diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-09 10:39:41 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-09 10:39:41 -0500 |
commit | 30de4018913f0cdaea19d1dd12ecd8209e2ed08e (patch) | |
tree | 6deebaede10def16e627d489455b4856c4f49386 /browser/components/webextensions/schemas | |
parent | ac46df8daea09899ce30dc8fd70986e258c746bf (diff) | |
download | UXP-30de4018913f0cdaea19d1dd12ecd8209e2ed08e.tar UXP-30de4018913f0cdaea19d1dd12ecd8209e2ed08e.tar.gz UXP-30de4018913f0cdaea19d1dd12ecd8209e2ed08e.tar.lz UXP-30de4018913f0cdaea19d1dd12ecd8209e2ed08e.tar.xz UXP-30de4018913f0cdaea19d1dd12ecd8209e2ed08e.zip |
Rename Basilisk's webextensions component directory to better reflect what it is. Also, add an Application level configure option to disable webextensions
Diffstat (limited to 'browser/components/webextensions/schemas')
-rw-r--r-- | browser/components/webextensions/schemas/LICENSE | 27 | ||||
-rw-r--r-- | browser/components/webextensions/schemas/bookmarks.json | 568 | ||||
-rw-r--r-- | browser/components/webextensions/schemas/browser_action.json | 430 | ||||
-rw-r--r-- | browser/components/webextensions/schemas/commands.json | 148 | ||||
-rw-r--r-- | browser/components/webextensions/schemas/context_menus.json | 424 | ||||
-rw-r--r-- | browser/components/webextensions/schemas/context_menus_internal.json | 78 | ||||
-rw-r--r-- | browser/components/webextensions/schemas/history.json | 316 | ||||
-rw-r--r-- | browser/components/webextensions/schemas/jar.mn | 16 | ||||
-rw-r--r-- | browser/components/webextensions/schemas/moz.build | 7 | ||||
-rw-r--r-- | browser/components/webextensions/schemas/omnibox.json | 248 | ||||
-rw-r--r-- | browser/components/webextensions/schemas/page_action.json | 235 | ||||
-rw-r--r-- | browser/components/webextensions/schemas/sessions.json | 146 | ||||
-rw-r--r-- | browser/components/webextensions/schemas/tabs.json | 1295 | ||||
-rw-r--r-- | browser/components/webextensions/schemas/windows.json | 508 |
14 files changed, 4446 insertions, 0 deletions
diff --git a/browser/components/webextensions/schemas/LICENSE b/browser/components/webextensions/schemas/LICENSE new file mode 100644 index 000000000..9314092fd --- /dev/null +++ b/browser/components/webextensions/schemas/LICENSE @@ -0,0 +1,27 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/browser/components/webextensions/schemas/bookmarks.json b/browser/components/webextensions/schemas/bookmarks.json new file mode 100644 index 000000000..fb74c633e --- /dev/null +++ b/browser/components/webextensions/schemas/bookmarks.json @@ -0,0 +1,568 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "Permission", + "choices": [{ + "type": "string", + "enum": [ + "bookmarks" + ] + }] + } + ] + }, + { + "namespace": "bookmarks", + "description": "Use the <code>browser.bookmarks</code> API to create, organize, and otherwise manipulate bookmarks. Also see $(topic:override)[Override Pages], which you can use to create a custom Bookmark Manager page.", + "permissions": ["bookmarks"], + "types": [ + { + "id": "BookmarkTreeNodeUnmodifiable", + "type": "string", + "enum": ["managed"], + "description": "Indicates the reason why this node is unmodifiable. The <var>managed</var> value indicates that this node was configured by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user and the extension (default)." + }, + { + "id": "BookmarkTreeNode", + "type": "object", + "description": "A node (either a bookmark or a folder) in the bookmark tree. Child nodes are ordered within their parent folder.", + "properties": { + "id": { + "type": "string", + "description": "The unique identifier for the node. IDs are unique within the current profile, and they remain valid even after the browser is restarted." + }, + "parentId": { + "type": "string", + "optional": true, + "description": "The <code>id</code> of the parent folder. Omitted for the root node." + }, + "index": { + "type": "integer", + "optional": true, + "description": "The 0-based position of this node within its parent folder." + }, + "url": { + "type": "string", + "optional": true, + "description": "The URL navigated to when a user clicks the bookmark. Omitted for folders." + }, + "title": { + "type": "string", + "description": "The text displayed for the node." + }, + "dateAdded": { + "type": "number", + "optional": true, + "description": "When this node was created, in milliseconds since the epoch (<code>new Date(dateAdded)</code>)." + }, + "dateGroupModified": { + "type": "number", + "optional": true, + "description": "When the contents of this folder last changed, in milliseconds since the epoch." + }, + "unmodifiable": { + "$ref": "BookmarkTreeNodeUnmodifiable", + "optional": true, + "description": "Indicates the reason why this node is unmodifiable. The <var>managed</var> value indicates that this node was configured by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user and the extension (default)." + }, + "children": { + "type": "array", + "optional": true, + "items": { "$ref": "BookmarkTreeNode" }, + "description": "An ordered list of children of this node." + } + } + }, + { + "id": "CreateDetails", + "description": "Object passed to the create() function.", + "type": "object", + "properties": { + "parentId": { + "type": "string", + "optional": true, + "description": "Defaults to the Other Bookmarks folder." + }, + "index": { + "type": "integer", + "minimum": 0, + "optional": true + }, + "title": { + "type": "string", + "optional": true + }, + "url": { + "type": "string", + "optional": true + } + } + } + ], + "functions": [ + { + "name": "get", + "type": "function", + "description": "Retrieves the specified BookmarkTreeNode(s).", + "async": "callback", + "parameters": [ + { + "name": "idOrIdList", + "description": "A single string-valued id, or an array of string-valued ids", + "choices": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1 + } + ] + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { "$ref": "BookmarkTreeNode" } + } + ] + } + ] + }, + { + "name": "getChildren", + "type": "function", + "description": "Retrieves the children of the specified BookmarkTreeNode id.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { "$ref": "BookmarkTreeNode"} + } + ] + } + ] + }, + { + "name": "getRecent", + "type": "function", + "description": "Retrieves the recently added bookmarks.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "minimum": 1, + "name": "numberOfItems", + "description": "The maximum number of items to return." + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { "$ref": "BookmarkTreeNode" } + } + ] + } + ] + }, + { + "name": "getTree", + "type": "function", + "description": "Retrieves the entire Bookmarks hierarchy.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { "$ref": "BookmarkTreeNode" } + } + ] + } + ] + }, + { + "name": "getSubTree", + "type": "function", + "description": "Retrieves part of the Bookmarks hierarchy, starting at the specified node.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "id", + "description": "The ID of the root of the subtree to retrieve." + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { "$ref": "BookmarkTreeNode" } + } + ] + } + ] + }, + { + "name": "search", + "type": "function", + "description": "Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties.", + "async": "callback", + "parameters": [ + { + "name": "query", + "description": "Either a string of words and quoted phrases that are matched against bookmark URLs and titles, or an object. If an object, the properties <code>query</code>, <code>url</code>, and <code>title</code> may be specified and bookmarks matching all specified properties will be produced.", + "choices": [ + { + "type": "string", + "description": "A string of words and quoted phrases that are matched against bookmark URLs and titles." + }, + { + "type": "object", + "description": "An object specifying properties and values to match when searching. Produces bookmarks matching all properties.", + "properties": { + "query": { + "type": "string", + "optional": true, + "description": "A string of words and quoted phrases that are matched against bookmark URLs and titles." + }, + "url": { + "type": "string", + "format": "url", + "optional": true, + "description": "The URL of the bookmark; matches verbatim. Note that folders have no URL." + }, + "title": { + "type": "string", + "optional": true, + "description": "The title of the bookmark; matches verbatim." + } + } + } + ] + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { "$ref": "BookmarkTreeNode" } + } + ] + } + ] + }, + { + "name": "create", + "type": "function", + "description": "Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder.", + "async": "callback", + "parameters": [ + { + "$ref": "CreateDetails", + "name": "bookmark" + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "result", + "$ref": "BookmarkTreeNode" + } + ] + } + ] + }, + { + "name": "move", + "type": "function", + "description": "Moves the specified BookmarkTreeNode to the provided location.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "object", + "name": "destination", + "properties": { + "parentId": { + "type": "string", + "optional": true + }, + "index": { + "type": "integer", + "minimum": 0, + "optional": true + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "result", + "$ref": "BookmarkTreeNode" + } + ] + } + ] + }, + { + "name": "update", + "type": "function", + "description": "Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified properties will be left unchanged. <b>Note:</b> Currently, only 'title' and 'url' are supported.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "object", + "name": "changes", + "properties": { + "title": { + "type": "string", + "optional": true + }, + "url": { + "type": "string", + "optional": true + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "result", + "$ref": "BookmarkTreeNode" + } + ] + } + ] + }, + { + "name": "remove", + "type": "function", + "description": "Removes a bookmark or an empty bookmark folder.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "removeTree", + "type": "function", + "description": "Recursively removes a bookmark folder.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "import", + "unsupported": true, + "type": "function", + "description": "Imports bookmarks from an html bookmark file", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "export", + "unsupported": true, + "type": "function", + "description": "Exports bookmarks to an html bookmark file", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + } + ], + "events": [ + { + "name": "onCreated", + "type": "function", + "description": "Fired when a bookmark or folder is created.", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "$ref": "BookmarkTreeNode", + "name": "bookmark" + } + ] + }, + { + "name": "onRemoved", + "type": "function", + "description": "Fired when a bookmark or folder is removed. When a folder is removed recursively, a single notification is fired for the folder, and none for its contents.", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "object", + "name": "removeInfo", + "properties": { + "parentId": { "type": "string" }, + "index": { "type": "integer" }, + "node": { "$ref": "BookmarkTreeNode" } + } + } + ] + }, + { + "name": "onChanged", + "type": "function", + "description": "Fired when a bookmark or folder changes. <b>Note:</b> Currently, only title and url changes trigger this.", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "object", + "name": "changeInfo", + "properties": { + "title": { "type": "string" }, + "url": { + "type": "string", + "optional": true + } + } + } + ] + }, + { + "name": "onMoved", + "type": "function", + "description": "Fired when a bookmark or folder is moved to a different parent folder.", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "object", + "name": "moveInfo", + "properties": { + "parentId": { "type": "string" }, + "index": { "type": "integer" }, + "oldParentId": { "type": "string" }, + "oldIndex": { "type": "integer" } + } + } + ] + }, + { + "name": "onChildrenReordered", + "unsupported": true, + "type": "function", + "description": "Fired when the children of a folder have changed their order due to the order being sorted in the UI. This is not called as a result of a move().", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "object", + "name": "reorderInfo", + "properties": { + "childIds": { + "type": "array", + "items": { "type": "string" } + } + } + } + ] + }, + { + "name": "onImportBegan", + "unsupported": true, + "type": "function", + "description": "Fired when a bookmark import session is begun. Expensive observers should ignore onCreated updates until onImportEnded is fired. Observers should still handle other notifications immediately.", + "parameters": [] + }, + { + "name": "onImportEnded", + "unsupported": true, + "type": "function", + "description": "Fired when a bookmark import session is ended.", + "parameters": [] + } + ] + } +] diff --git a/browser/components/webextensions/schemas/browser_action.json b/browser/components/webextensions/schemas/browser_action.json new file mode 100644 index 000000000..1a7da956a --- /dev/null +++ b/browser/components/webextensions/schemas/browser_action.json @@ -0,0 +1,430 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "WebExtensionManifest", + "properties": { + "browser_action": { + "type": "object", + "additionalProperties": { "$ref": "UnrecognizedProperty" }, + "properties": { + "default_title": { + "type": "string", + "optional": true, + "preprocess": "localize" + }, + "default_icon": { + "$ref": "IconPath", + "optional": true + }, + "default_popup": { + "type": "string", + "format": "relativeUrl", + "optional": true, + "preprocess": "localize" + }, + "browser_style": { + "type": "boolean", + "optional": true + } + }, + "optional": true + } + } + } + ] + }, + { + "namespace": "browserAction", + "description": "Use browser actions to put icons in the main browser toolbar, to the right of the address bar. In addition to its icon, a browser action can also have a tooltip, a badge, and a popup.", + "permissions": ["manifest:browser_action"], + "types": [ + { + "id": "ColorArray", + "type": "array", + "items": { + "type": "integer", + "minimum": 0, + "maximum": 255 + }, + "minItems": 4, + "maxItems": 4 + }, + { + "id": "ImageDataType", + "type": "object", + "isInstanceOf": "ImageData", + "additionalProperties": { "type": "any" }, + "postprocess": "convertImageDataToURL", + "description": "Pixel data for an image. Must be an ImageData object (for example, from a <code>canvas</code> element)." + } + ], + "functions": [ + { + "name": "setTitle", + "type": "function", + "description": "Sets the title of the browser action. This shows up in the tooltip.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "The string the browser action should display when moused over." + }, + "tabId": { + "type": "integer", + "optional": true, + "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "getTitle", + "type": "function", + "description": "Gets the title of the browser action.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": { + "type": "integer", + "optional": true, + "description": "Specify the tab to get the title from. If no tab is specified, the non-tab-specific title is returned." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "result", + "type": "string" + } + ] + } + ] + }, + { + "name": "setIcon", + "type": "function", + "description": "Sets the icon for the browser action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the <b>path</b> or the <b>imageData</b> property must be specified.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "imageData": { + "choices": [ + { "$ref": "ImageDataType" }, + { + "type": "object", + "additionalProperties": {"$ref": "ImageDataType"} + } + ], + "optional": true, + "description": "Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}'" + }, + "path": { + "choices": [ + { "type": "string" }, + { + "type": "object", + "additionalProperties": {"type": "string"} + } + ], + "optional": true, + "description": "Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}'" + }, + "tabId": { + "type": "integer", + "optional": true, + "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "setPopup", + "type": "function", + "description": "Sets the html document to be opened as a popup when the user clicks on the browser action's icon.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": { + "type": "integer", + "optional": true, + "minimum": 0, + "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed." + }, + "popup": { + "type": "string", + "description": "The html file to show in a popup. If set to the empty string (''), no popup is shown." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "getPopup", + "type": "function", + "description": "Gets the html document set as the popup for this browser action.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": { + "type": "integer", + "optional": true, + "description": "Specify the tab to get the popup from. If no tab is specified, the non-tab-specific popup is returned." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "result", + "type": "string" + } + ] + } + ] + }, + { + "name": "setBadgeText", + "type": "function", + "description": "Sets the badge text for the browser action. The badge is displayed on top of the icon.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "text": { + "type": "string", + "description": "Any number of characters can be passed, but only about four can fit in the space." + }, + "tabId": { + "type": "integer", + "optional": true, + "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "getBadgeText", + "type": "function", + "description": "Gets the badge text of the browser action. If no tab is specified, the non-tab-specific badge text is returned.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": { + "type": "integer", + "optional": true, + "description": "Specify the tab to get the badge text from. If no tab is specified, the non-tab-specific badge text is returned." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "result", + "type": "string" + } + ] + } + ] + }, + { + "name": "setBadgeBackgroundColor", + "type": "function", + "description": "Sets the background color for the badge.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "color": { + "description": "An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is <code>[255, 0, 0, 255]</code>. Can also be a string with a CSS value, with opaque red being <code>#FF0000</code> or <code>#F00</code>.", + "choices": [ + {"type": "string"}, + {"$ref": "ColorArray"} + ] + }, + "tabId": { + "type": "integer", + "optional": true, + "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "getBadgeBackgroundColor", + "type": "function", + "description": "Gets the background color of the browser action.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": { + "type": "integer", + "optional": true, + "description": "Specify the tab to get the badge background color from. If no tab is specified, the non-tab-specific badge background color is returned." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "result", + "$ref": "ColorArray" + } + ] + } + ] + }, + { + "name": "enable", + "type": "function", + "description": "Enables the browser action for a tab. By default, browser actions are enabled.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "optional": true, + "name": "tabId", + "minimum": 0, + "description": "The id of the tab for which you want to modify the browser action." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "disable", + "type": "function", + "description": "Disables the browser action for a tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "optional": true, + "name": "tabId", + "minimum": 0, + "description": "The id of the tab for which you want to modify the browser action." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "openPopup", + "type": "function", + "description": "Opens the extension popup window in the active window but does not grant tab permissions.", + "unsupported": true, + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "popupView", + "type": "object", + "optional": true, + "description": "JavaScript 'window' object for the popup window if it was succesfully opened.", + "additionalProperties": { "type": "any" } + } + ] + } + ] + } + ], + "events": [ + { + "name": "onClicked", + "type": "function", + "description": "Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup.", + "parameters": [ + { + "name": "tab", + "$ref": "tabs.Tab" + } + ] + } + ] + } +] diff --git a/browser/components/webextensions/schemas/commands.json b/browser/components/webextensions/schemas/commands.json new file mode 100644 index 000000000..a1632088e --- /dev/null +++ b/browser/components/webextensions/schemas/commands.json @@ -0,0 +1,148 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + { + "namespace": "manifest", + "types": [ + { + "id": "KeyName", + "choices": [ + { + "type": "string", + "pattern": "^\\s*(Alt|Ctrl|Command|MacCtrl)\\s*\\+\\s*(Shift\\s*\\+\\s*)?([A-Z0-9]|Comma|Period|Home|End|PageUp|PageDown|Space|Insert|Delete|Up|Down|Left|Right)\\s*$" + }, + { + "type": "string", + "pattern": "^(MediaNextTrack|MediaPlayPause|MediaPrevTrack|MediaStop)$" + } + ] + }, + { + "$extend": "WebExtensionManifest", + "properties": { + "commands": { + "type": "object", + "optional": true, + "additionalProperties": { + "type": "object", + "additionalProperties": { "$ref": "UnrecognizedProperty" }, + "properties": { + "suggested_key": { + "type": "object", + "optional": true, + "properties": { + "default": { + "$ref": "KeyName", + "optional": true + }, + "mac": { + "$ref": "KeyName", + "optional": true + }, + "linux": { + "$ref": "KeyName", + "optional": true + }, + "windows": { + "$ref": "KeyName", + "optional": true + }, + "chromeos": { + "type": "string", + "optional": true + }, + "android": { + "type": "string", + "optional": true + }, + "ios": { + "type": "string", + "optional": true + }, + "additionalProperties": { + "type": "string", + "deprecated": "Unknown platform name", + "optional": true + } + } + }, + "description": { + "type": "string", + "optional": true + } + } + } + } + } + } + ] + }, + { + "namespace": "commands", + "description": "Use the commands API to add keyboard shortcuts that trigger actions in your extension, for example, an action to open the browser action or send a command to the xtension.", + "permissions": ["manifest:commands"], + "types": [ + { + "id": "Command", + "type": "object", + "properties": { + "name": { + "type": "string", + "optional": true, + "description": "The name of the Extension Command" + }, + "description": { + "type": "string", + "optional": true, + "description": "The Extension Command description" + }, + "shortcut": { + "type": "string", + "optional": true, + "description": "The shortcut active for this command, or blank if not active." + } + } + } + ], + "events": [ + { + "name": "onCommand", + "description": "Fired when a registered command is activated using a keyboard shortcut.", + "type": "function", + "parameters": [ + { + "name": "command", + "type": "string" + } + ] + } + ], + "functions": [ + { + "name": "getAll", + "type": "function", + "async": "callback", + "description": "Returns all the registered extension commands for this extension and their shortcut (if active).", + "parameters": [ + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "commands", + "type": "array", + "items": { + "$ref": "Command" + } + } + ], + "description": "Called to return the registered commands." + } + ] + } + ] + } +] diff --git a/browser/components/webextensions/schemas/context_menus.json b/browser/components/webextensions/schemas/context_menus.json new file mode 100644 index 000000000..b31af51f3 --- /dev/null +++ b/browser/components/webextensions/schemas/context_menus.json @@ -0,0 +1,424 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "Permission", + "choices": [{ + "type": "string", + "enum": [ + "contextMenus" + ] + }] + } + ] + }, + { + "namespace": "contextMenus", + "description": "Use the <code>browser.contextMenus</code> API to add items to the browser's context menu. You can choose what types of objects your context menu additions apply to, such as images, hyperlinks, and pages.", + "permissions": ["contextMenus"], + "properties": { + "ACTION_MENU_TOP_LEVEL_LIMIT": { + "value": 6, + "description": "The maximum number of top level extension items that can be added to an extension action context menu. Any items beyond this limit will be ignored." + } + }, + "types": [ + { + "id": "ContextType", + "type": "string", + "enum": ["all", "page", "frame", "selection", "link", "editable", "image", "video", "audio", "launcher", "browser_action", "page_action"], + "description": "The different contexts a menu can appear in. Specifying 'all' is equivalent to the combination of all other contexts except for 'launcher'. The 'launcher' context is only supported by apps and is used to add menu items to the context menu that appears when clicking on the app icon in the launcher/taskbar/dock/etc. Different platforms might put limitations on what is actually supported in a launcher context menu." + }, + { + "id": "ItemType", + "type": "string", + "enum": ["normal", "checkbox", "radio", "separator"], + "description": "The type of menu item." + }, + { + "id": "OnClickData", + "type": "object", + "description": "Information sent when a context menu item is clicked.", + "properties": { + "menuItemId": { + "choices": [ + { "type": "integer" }, + { "type": "string" } + ], + "description": "The ID of the menu item that was clicked." + }, + "parentMenuItemId": { + "choices": [ + { "type": "integer" }, + { "type": "string" } + ], + "optional": true, + "description": "The parent ID, if any, for the item clicked." + }, + "mediaType": { + "type": "string", + "optional": true, + "description": "One of 'image', 'video', or 'audio' if the context menu was activated on one of these types of elements." + }, + "linkUrl": { + "type": "string", + "optional": true, + "description": "If the element is a link, the URL it points to." + }, + "srcUrl": { + "type": "string", + "optional": true, + "description": "Will be present for elements with a 'src' URL." + }, + "pageUrl": { + "type": "string", + "optional": true, + "description": "The URL of the page where the menu item was clicked. This property is not set if the click occured in a context where there is no current page, such as in a launcher context menu." + }, + "frameUrl": { + "type": "string", + "optional": true, + "description": " The URL of the frame of the element where the context menu was clicked, if it was in a frame." + }, + "selectionText": { + "type": "string", + "optional": true, + "description": "The text for the context selection, if any." + }, + "editable": { + "type": "boolean", + "description": "A flag indicating whether the element is editable (text input, textarea, etc.)." + }, + "wasChecked": { + "type": "boolean", + "optional": true, + "description": "A flag indicating the state of a checkbox or radio item before it was clicked." + }, + "checked": { + "type": "boolean", + "optional": true, + "description": "A flag indicating the state of a checkbox or radio item after it is clicked." + } + } + } + ], + "functions": [ + { + "name": "create", + "type": "function", + "description": "Creates a new context menu item. Note that if an error occurs during creation, you may not find out until the creation callback fires (the details will be in $(ref:runtime.lastError)).", + "returns": { + "choices": [ + { "type": "integer" }, + { "type": "string" } + ], + "description": "The ID of the newly created item." + }, + "parameters": [ + { + "type": "object", + "name": "createProperties", + "properties": { + "type": { + "$ref": "ItemType", + "optional": true, + "description": "The type of menu item. Defaults to 'normal' if not specified." + }, + "id": { + "type": "string", + "optional": true, + "description": "The unique ID to assign to this item. Mandatory for event pages. Cannot be the same as another ID for this extension." + }, + "title": { + "type": "string", + "optional": true, + "description": "The text to be displayed in the item; this is <em>required</em> unless <code>type</code> is 'separator'. When the context is 'selection', you can use <code>%s</code> within the string to show the selected text. For example, if this parameter's value is \"Translate '%s' to Pig Latin\" and the user selects the word \"cool\", the context menu item for the selection is \"Translate 'cool' to Pig Latin\"." + }, + "checked": { + "type": "boolean", + "optional": true, + "description": "The initial state of a checkbox or radio item: true for selected and false for unselected. Only one radio item can be selected at a time in a given group of radio items." + }, + "contexts": { + "type": "array", + "items": { + "$ref": "ContextType" + }, + "minItems": 1, + "optional": true, + "description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified." + }, + "onclick": { + "type": "function", + "optional": true, + "description": "A function that will be called back when the menu item is clicked. Event pages cannot use this; instead, they should register a listener for $(ref:contextMenus.onClicked).", + "parameters": [ + { + "name": "info", + "$ref": "contextMenusInternal.OnClickData", + "description": "Information about the item clicked and the context where the click happened." + }, + { + "name": "tab", + "$ref": "tabs.Tab", + "description": "The details of the tab where the click took place. Note: this parameter only present for extensions." + } + ] + }, + "parentId": { + "choices": [ + { "type": "integer" }, + { "type": "string" } + ], + "optional": true, + "description": "The ID of a parent menu item; this makes the item a child of a previously added item." + }, + "documentUrlPatterns": { + "type": "array", + "items": {"type": "string"}, + "optional": true, + "description": "Lets you restrict the item to apply only to documents whose URL matches one of the given patterns. (This applies to frames as well.) For details on the format of a pattern, see $(topic:match_patterns)[Match Patterns]." + }, + "targetUrlPatterns": { + "type": "array", + "items": {"type": "string"}, + "optional": true, + "description": "Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of anchor tags." + }, + "enabled": { + "type": "boolean", + "optional": true, + "description": "Whether this context menu item is enabled or disabled. Defaults to true." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "description": "Called when the item has been created in the browser. If there were any problems creating the item, details will be available in $(ref:runtime.lastError).", + "parameters": [] + } + ] + }, + { + "name": "createInternal", + "type": "function", + "allowedContexts": ["addon_parent_only"], + "async": "callback", + "description": "Identical to contextMenus.create, except: the 'id' field is required and allows an integer, 'onclick' is not allowed, and the method is async (and the return value is not a menu item ID).", + "parameters": [ + { + "type": "object", + "name": "createProperties", + "properties": { + "type": { + "$ref": "ItemType", + "optional": true + }, + "id": { + "choices": [ + { "type": "integer" }, + { "type": "string" } + ] + }, + "title": { + "type": "string", + "optional": true + }, + "checked": { + "type": "boolean", + "optional": true + }, + "contexts": { + "type": "array", + "items": { + "$ref": "ContextType" + }, + "minItems": 1, + "optional": true + }, + "parentId": { + "choices": [ + { "type": "integer" }, + { "type": "string" } + ], + "optional": true + }, + "documentUrlPatterns": { + "type": "array", + "items": {"type": "string"}, + "optional": true + }, + "targetUrlPatterns": { + "type": "array", + "items": {"type": "string"}, + "optional": true + }, + "enabled": { + "type": "boolean", + "optional": true + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "update", + "type": "function", + "description": "Updates a previously created context menu item.", + "async": "callback", + "parameters": [ + { + "choices": [ + { "type": "integer" }, + { "type": "string" } + ], + "name": "id", + "description": "The ID of the item to update." + }, + { + "type": "object", + "name": "updateProperties", + "description": "The properties to update. Accepts the same values as the create function.", + "properties": { + "type": { + "$ref": "ItemType", + "optional": true + }, + "title": { + "type": "string", + "optional": true + }, + "checked": { + "type": "boolean", + "optional": true + }, + "contexts": { + "type": "array", + "items": { + "$ref": "ContextType" + }, + "minItems": 1, + "optional": true + }, + "onclick": { + "type": "function", + "optional": "omit-key-if-missing", + "parameters": [ + { + "name": "info", + "$ref": "contextMenusInternal.OnClickData" + }, + { + "name": "tab", + "$ref": "tabs.Tab", + "description": "The details of the tab where the click took place. Note: this parameter only present for extensions." + } + ] + }, + "parentId": { + "choices": [ + { "type": "integer" }, + { "type": "string" } + ], + "optional": true, + "description": "Note: You cannot change an item to be a child of one of its own descendants." + }, + "documentUrlPatterns": { + "type": "array", + "items": {"type": "string"}, + "optional": true + }, + "targetUrlPatterns": { + "type": "array", + "items": {"type": "string"}, + "optional": true + }, + "enabled": { + "type": "boolean", + "optional": true + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [], + "description": "Called when the context menu has been updated." + } + ] + }, + { + "name": "remove", + "type": "function", + "description": "Removes a context menu item.", + "async": "callback", + "parameters": [ + { + "choices": [ + { "type": "integer" }, + { "type": "string" } + ], + "name": "menuItemId", + "description": "The ID of the context menu item to remove." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [], + "description": "Called when the context menu has been removed." + } + ] + }, + { + "name": "removeAll", + "type": "function", + "description": "Removes all context menu items added by this extension.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [], + "description": "Called when removal is complete." + } + ] + } + ], + "events": [ + { + "name": "onClicked", + "type": "function", + "description": "Fired when a context menu item is clicked.", + "parameters": [ + { + "name": "info", + "$ref": "OnClickData", + "description": "Information about the item clicked and the context where the click happened." + }, + { + "name": "tab", + "$ref": "tabs.Tab", + "description": "The details of the tab where the click took place. If the click did not take place in a tab, this parameter will be missing.", + "optional": true + } + ] + } + ] + } +] diff --git a/browser/components/webextensions/schemas/context_menus_internal.json b/browser/components/webextensions/schemas/context_menus_internal.json new file mode 100644 index 000000000..c3cb7aff0 --- /dev/null +++ b/browser/components/webextensions/schemas/context_menus_internal.json @@ -0,0 +1,78 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + { + "namespace": "contextMenusInternal", + "description": "Use the <code>browser.contextMenus</code> API to add items to the browser's context menu. You can choose what types of objects your context menu additions apply to, such as images, hyperlinks, and pages.", + "types": [ + { + "id": "OnClickData", + "type": "object", + "description": "Information sent when a context menu item is clicked.", + "properties": { + "menuItemId": { + "choices": [ + { "type": "integer" }, + { "type": "string" } + ], + "description": "The ID of the menu item that was clicked." + }, + "parentMenuItemId": { + "choices": [ + { "type": "integer" }, + { "type": "string" } + ], + "optional": true, + "description": "The parent ID, if any, for the item clicked." + }, + "mediaType": { + "type": "string", + "optional": true, + "description": "One of 'image', 'video', or 'audio' if the context menu was activated on one of these types of elements." + }, + "linkUrl": { + "type": "string", + "optional": true, + "description": "If the element is a link, the URL it points to." + }, + "srcUrl": { + "type": "string", + "optional": true, + "description": "Will be present for elements with a 'src' URL." + }, + "pageUrl": { + "type": "string", + "optional": true, + "description": "The URL of the page where the menu item was clicked. This property is not set if the click occured in a context where there is no current page, such as in a launcher context menu." + }, + "frameUrl": { + "type": "string", + "optional": true, + "description": " The URL of the frame of the element where the context menu was clicked, if it was in a frame." + }, + "selectionText": { + "type": "string", + "optional": true, + "description": "The text for the context selection, if any." + }, + "editable": { + "type": "boolean", + "description": "A flag indicating whether the element is editable (text input, textarea, etc.)." + }, + "wasChecked": { + "type": "boolean", + "optional": true, + "description": "A flag indicating the state of a checkbox or radio item before it was clicked." + }, + "checked": { + "type": "boolean", + "optional": true, + "description": "A flag indicating the state of a checkbox or radio item after it is clicked." + } + } + } + ] + } +] diff --git a/browser/components/webextensions/schemas/history.json b/browser/components/webextensions/schemas/history.json new file mode 100644 index 000000000..e05569e38 --- /dev/null +++ b/browser/components/webextensions/schemas/history.json @@ -0,0 +1,316 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "Permission", + "choices": [{ + "type": "string", + "enum": [ + "history" + ] + }] + } + ] + }, + { + "namespace": "history", + "description": "Use the <code>browser.history</code> API to interact with the browser's record of visited pages. You can add, remove, and query for URLs in the browser's history. To override the history page with your own version, see $(topic:override)[Override Pages].", + "permissions": ["history"], + "types": [ + { + "id": "TransitionType", + "type": "string", + "enum": ["link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "auto_toplevel", "form_submit", "reload", "keyword", "keyword_generated"], + "description": "The $(topic:transition-types)[transition type] for this visit from its referrer." + }, + { + "id": "HistoryItem", + "type": "object", + "description": "An object encapsulating one result of a history query.", + "properties": { + "id": { + "type": "string", + "description": "The unique identifier for the item." + }, + "url": { + "type": "string", + "optional": true, + "description": "The URL navigated to by a user." + }, + "title": { + "type": "string", + "optional": true, + "description": "The title of the page when it was last loaded." + }, + "lastVisitTime": { + "type": "number", + "optional": true, + "description": "When this page was last loaded, represented in milliseconds since the epoch." + }, + "visitCount": { + "type": "integer", + "optional": true, + "description": "The number of times the user has navigated to this page." + }, + "typedCount": { + "type": "integer", + "optional": true, + "description": "The number of times the user has navigated to this page by typing in the address." + } + } + }, + { + "id": "VisitItem", + "type": "object", + "description": "An object encapsulating one visit to a URL.", + "properties": { + "id": { + "type": "string", + "description": "The unique identifier for the item." + }, + "visitId": { + "type": "string", + "description": "The unique identifier for this visit." + }, + "visitTime": { + "type": "number", + "optional": true, + "description": "When this visit occurred, represented in milliseconds since the epoch." + }, + "referringVisitId": { + "type": "string", + "description": "The visit ID of the referrer." + }, + "transition": { + "$ref": "TransitionType", + "description": "The $(topic:transition-types)[transition type] for this visit from its referrer." + } + } + } + ], + "functions": [ + { + "name": "search", + "type": "function", + "description": "Searches the history for the last visit time of each page matching the query.", + "async": "callback", + "parameters": [ + { + "name": "query", + "type": "object", + "properties": { + "text": { + "type": "string", + "description": "A free-text query to the history service. Leave empty to retrieve all pages." + }, + "startTime": { + "$ref": "extensionTypes.Date", + "optional": true, + "description": "Limit results to those visited after this date. If not specified, this defaults to 24 hours in the past." + }, + "endTime": { + "$ref": "extensionTypes.Date", + "optional": true, + "description": "Limit results to those visited before this date." + }, + "maxResults": { + "type": "integer", + "optional": true, + "minimum": 1, + "description": "The maximum number of results to retrieve. Defaults to 100." + } + } + }, + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { + "$ref": "HistoryItem" + } + } + ] + } + ] + }, + { + "name": "getVisits", + "type": "function", + "description": "Retrieves information about visits to a URL.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "The URL for which to retrieve visit information. It must be in the format as returned from a call to history.search." + } + } + }, + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { + "$ref": "VisitItem" + } + } + ] + } + ] + }, + { + "name": "addUrl", + "type": "function", + "description": "Adds a URL to the history with a default visitTime of the current time and a default $(topic:transition-types)[transition type] of \"link\".", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "The URL to add. Must be a valid URL that can be added to history." + }, + "title": { + "type": "string", + "optional": true, + "description": "The title of the page." + }, + "transition": { + "$ref": "TransitionType", + "optional": true, + "description": "The $(topic:transition-types)[transition type] for this visit from its referrer." + }, + "visitTime": { + "$ref": "extensionTypes.Date", + "optional": true, + "description": "The date when this visit occurred." + } + } + }, + { + "name": "callback", + "type": "function", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "deleteUrl", + "type": "function", + "description": "Removes all occurrences of the given URL from the history.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "The URL to remove." + } + } + }, + { + "name": "callback", + "type": "function", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "deleteRange", + "type": "function", + "description": "Removes all items within the specified date range from the history. Pages will not be removed from the history unless all visits fall within the range.", + "async": "callback", + "parameters": [ + { + "name": "range", + "type": "object", + "properties": { + "startTime": { + "$ref": "extensionTypes.Date", + "description": "Items added to history after this date." + }, + "endTime": { + "$ref": "extensionTypes.Date", + "description": "Items added to history before this date." + } + } + }, + { + "name": "callback", + "type": "function", + "parameters": [] + } + ] + }, + { + "name": "deleteAll", + "type": "function", + "description": "Deletes all items from the history.", + "async": "callback", + "parameters": [ + { + "name": "callback", + "type": "function", + "parameters": [] + } + ] + } + ], + "events": [ + { + "name": "onVisited", + "type": "function", + "description": "Fired when a URL is visited, providing the HistoryItem data for that URL. This event fires before the page has loaded.", + "parameters": [ + { + "name": "result", + "$ref": "HistoryItem" + } + ] + }, + { + "name": "onVisitRemoved", + "type": "function", + "description": "Fired when one or more URLs are removed from the history service. When all visits have been removed the URL is purged from history.", + "parameters": [ + { + "name": "removed", + "type": "object", + "properties": { + "allHistory": { + "type": "boolean", + "description": "True if all history was removed. If true, then urls will be empty." + }, + "urls": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + ] + } + ] + } +] diff --git a/browser/components/webextensions/schemas/jar.mn b/browser/components/webextensions/schemas/jar.mn new file mode 100644 index 000000000..c9fc9a808 --- /dev/null +++ b/browser/components/webextensions/schemas/jar.mn @@ -0,0 +1,16 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +browser.jar: + content/browser/schemas/bookmarks.json + content/browser/schemas/browser_action.json + content/browser/schemas/commands.json + content/browser/schemas/context_menus.json + content/browser/schemas/context_menus_internal.json + content/browser/schemas/history.json + content/browser/schemas/omnibox.json + content/browser/schemas/page_action.json + content/browser/schemas/sessions.json + content/browser/schemas/tabs.json + content/browser/schemas/windows.json diff --git a/browser/components/webextensions/schemas/moz.build b/browser/components/webextensions/schemas/moz.build new file mode 100644 index 000000000..aac3a838c --- /dev/null +++ b/browser/components/webextensions/schemas/moz.build @@ -0,0 +1,7 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +JAR_MANIFESTS += ['jar.mn'] diff --git a/browser/components/webextensions/schemas/omnibox.json b/browser/components/webextensions/schemas/omnibox.json new file mode 100644 index 000000000..34428fab7 --- /dev/null +++ b/browser/components/webextensions/schemas/omnibox.json @@ -0,0 +1,248 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "WebExtensionManifest", + "properties": { + "omnibox": { + "type": "object", + "additionalProperties": { "$ref": "UnrecognizedProperty" }, + "properties": { + "keyword": { + "type": "string", + "pattern": "^[^?\\s:]([^\\s:]*[^/\\s:])?$" + } + }, + "optional": true + } + } + } + ] + }, + { + "namespace": "omnibox", + "description": "The omnibox API allows you to register a keyword with Firefox's address bar.", + "permissions": ["manifest:omnibox"], + "types": [ + { + "id": "DescriptionStyleType", + "type": "string", + "description": "The style type.", + "enum": ["url", "match", "dim"] + }, + { + "id": "OnInputEnteredDisposition", + "type": "string", + "enum": ["currentTab", "newForegroundTab", "newBackgroundTab"], + "description": "The window disposition for the omnibox query. This is the recommended context to display results. For example, if the omnibox command is to navigate to a certain URL, a disposition of 'newForegroundTab' means the navigation should take place in a new selected tab." + }, + { + "id": "SuggestResult", + "type": "object", + "description": "A suggest result.", + "properties": { + "content": { + "type": "string", + "minLength": 1, + "description": "The text that is put into the URL bar, and that is sent to the extension when the user chooses this entry." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "The text that is displayed in the URL dropdown. Can contain XML-style markup for styling. The supported tags are 'url' (for a literal URL), 'match' (for highlighting text that matched what the user's query), and 'dim' (for dim helper text). The styles can be nested, eg. <dim><match>dimmed match</match></dim>. You must escape the five predefined entities to display them as text: stackoverflow.com/a/1091953/89484 " + }, + "descriptionStyles": { + "optional": true, + "unsupported": true, + "type": "array", + "description": "An array of style ranges for the description, as provided by the extension.", + "items": { + "type": "object", + "description": "The style ranges for the description, as provided by the extension.", + "properties": { + "offset": { "type": "integer" }, + "type": { "description": "The style type", "$ref": "DescriptionStyleType"}, + "length": { "type": "integer", "optional": true } + } + } + }, + "descriptionStylesRaw": { + "optional": true, + "unsupported": true, + "type": "array", + "description": "An array of style ranges for the description, as provided by ToValue().", + "items": { + "type": "object", + "description": "The style ranges for the description, as provided by ToValue().", + "properties": { + "offset": { "type": "integer" }, + "type": { "type": "integer" } + } + } + } + } + }, + { + "id": "DefaultSuggestResult", + "type": "object", + "description": "A suggest result.", + "properties": { + "description": { + "type": "string", + "minLength": 1, + "description": "The text that is displayed in the URL dropdown." + }, + "descriptionStyles": { + "optional": true, + "unsupported": true, + "type": "array", + "description": "An array of style ranges for the description, as provided by the extension.", + "items": { + "type": "object", + "description": "The style ranges for the description, as provided by the extension.", + "properties": { + "offset": { "type": "integer" }, + "type": { "description": "The style type", "$ref": "DescriptionStyleType"}, + "length": { "type": "integer", "optional": true } + } + } + }, + "descriptionStylesRaw": { + "optional": true, + "unsupported": true, + "type": "array", + "description": "An array of style ranges for the description, as provided by ToValue().", + "items": { + "type": "object", + "description": "The style ranges for the description, as provided by ToValue().", + "properties": { + "offset": { "type": "integer" }, + "type": { "type": "integer" } + } + } + } + } + } + ], + "functions": [ + { + "name": "setDefaultSuggestion", + "type": "function", + "description": "Sets the description and styling for the default suggestion. The default suggestion is the text that is displayed in the first suggestion row underneath the URL bar.", + "parameters": [ + { + "name": "suggestion", + "$ref": "DefaultSuggestResult", + "description": "A partial SuggestResult object, without the 'content' parameter." + } + ] + } + ], + "events": [ + { + "name": "onInputStarted", + "type": "function", + "description": "User has started a keyword input session by typing the extension's keyword. This is guaranteed to be sent exactly once per input session, and before any onInputChanged events.", + "parameters": [] + }, + { + "name": "onInputChanged", + "type": "function", + "description": "User has changed what is typed into the omnibox.", + "parameters": [ + { + "type": "string", + "name": "text" + }, + { + "name": "suggest", + "type": "function", + "description": "A callback passed to the onInputChanged event used for sending suggestions back to the browser.", + "parameters": [ + { + "name": "suggestResults", + "type": "array", + "description": "Array of suggest results", + "items": { + "$ref": "SuggestResult" + } + } + ] + } + ] + }, + { + "name": "onInputEntered", + "type": "function", + "description": "User has accepted what is typed into the omnibox.", + "parameters": [ + { + "type": "string", + "name": "text" + }, + { + "name": "disposition", + "$ref": "OnInputEnteredDisposition" + } + ] + }, + { + "name": "onInputCancelled", + "type": "function", + "description": "User has ended the keyword input session without accepting the input.", + "parameters": [] + } + ] + }, + { + "namespace": "omnibox_internal", + "description": "The internal namespace used by the omnibox API.", + "defaultContexts": ["addon_parent_only"], + "functions": [ + { + "name": "addSuggestions", + "type": "function", + "async": "callback", + "description": "Internal function used by omnibox.onInputChanged for adding search suggestions", + "parameters": [ + { + "name": "id", + "type": "integer", + "description": "The ID of the callback received by onInputChangedInternal" + }, + { + "name": "suggestResults", + "type": "array", + "description": "Array of suggest results", + "items": { + "$ref": "omnibox.SuggestResult" + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + } + ], + "events": [ + { + "name": "onInputChanged", + "type": "function", + "description": "Identical to omnibox.onInputChanged except no 'suggest' callback is provided.", + "parameters": [ + { + "type": "string", + "name": "text" + } + ] + } + ] + } +]
\ No newline at end of file diff --git a/browser/components/webextensions/schemas/page_action.json b/browser/components/webextensions/schemas/page_action.json new file mode 100644 index 000000000..126378ca5 --- /dev/null +++ b/browser/components/webextensions/schemas/page_action.json @@ -0,0 +1,235 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "WebExtensionManifest", + "properties": { + "page_action": { + "type": "object", + "additionalProperties": { "$ref": "UnrecognizedProperty" }, + "properties": { + "default_title": { + "type": "string", + "optional": true, + "preprocess": "localize" + }, + "default_icon": { + "$ref": "IconPath", + "optional": true + }, + "default_popup": { + "type": "string", + "format": "relativeUrl", + "optional": true, + "preprocess": "localize" + }, + "browser_style": { + "type": "boolean", + "optional": true + } + }, + "optional": true + } + } + } + ] + }, + { + "namespace": "pageAction", + "description": "Use the <code>browser.pageAction</code> API to put icons inside the address bar. Page actions represent actions that can be taken on the current page, but that aren't applicable to all pages.", + "permissions": ["manifest:page_action"], + "types": [ + { + "id": "ImageDataType", + "type": "object", + "isInstanceOf": "ImageData", + "additionalProperties": { "type": "any" }, + "postprocess": "convertImageDataToURL", + "description": "Pixel data for an image. Must be an ImageData object (for example, from a <code>canvas</code> element)." + } + ], + "functions": [ + { + "name": "show", + "type": "function", + "async": "callback", + "description": "Shows the page action. The page action is shown whenever the tab is selected.", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0, "description": "The id of the tab for which you want to modify the page action."}, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "hide", + "type": "function", + "async": "callback", + "description": "Hides the page action.", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0, "description": "The id of the tab for which you want to modify the page action."}, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "setTitle", + "type": "function", + "description": "Sets the title of the page action. This is displayed in a tooltip over the page action.", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": {"type": "integer", "minimum": 0, "description": "The id of the tab for which you want to modify the page action."}, + "title": {"type": "string", "description": "The tooltip string."} + } + } + ] + }, + { + "name": "getTitle", + "type": "function", + "description": "Gets the title of the page action.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": { + "type": "integer", + "description": "Specify the tab to get the title from." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "result", + "type": "string" + } + ] + } + ] + }, + { + "name": "setIcon", + "type": "function", + "description": "Sets the icon for the page action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the <b>path</b> or the <b>imageData</b> property must be specified.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": {"type": "integer", "minimum": 0, "description": "The id of the tab for which you want to modify the page action."}, + "imageData": { + "choices": [ + { "$ref": "ImageDataType" }, + { + "type": "object", + "additionalProperties": {"$ref": "ImageDataType"} + } + ], + "optional": true, + "description": "Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}'" + }, + "path": { + "choices": [ + { "type": "string" }, + { + "type": "object", + "additionalProperties": {"type": "string"} + } + ], + "optional": true, + "description": "Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}'" + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "setPopup", + "type": "function", + "async": true, + "description": "Sets the html document to be opened as a popup when the user clicks on the page action's icon.", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": {"type": "integer", "minimum": 0, "description": "The id of the tab for which you want to modify the page action."}, + "popup": { + "type": "string", + "description": "The html file to show in a popup. If set to the empty string (''), no popup is shown." + } + } + } + ] + }, + { + "name": "getPopup", + "type": "function", + "description": "Gets the html document set as the popup for this page action.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": { + "type": "integer", + "description": "Specify the tab to get the popup from." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "result", + "type": "string" + } + ] + } + ] + } + ], + "events": [ + { + "name": "onClicked", + "type": "function", + "description": "Fired when a page action icon is clicked. This event will not fire if the page action has a popup.", + "parameters": [ + { + "name": "tab", + "$ref": "tabs.Tab" + } + ] + } + ] + } +] diff --git a/browser/components/webextensions/schemas/sessions.json b/browser/components/webextensions/schemas/sessions.json new file mode 100644 index 000000000..690bb8ebc --- /dev/null +++ b/browser/components/webextensions/schemas/sessions.json @@ -0,0 +1,146 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "Permission", + "choices": [{ + "type": "string", + "enum": [ + "sessions" + ] + }] + } + ] + }, + { + "namespace": "sessions", + "description": "Use the <code>chrome.sessions</code> API to query and restore tabs and windows from a browsing session.", + "permissions": ["sessions"], + "types": [ + { + "id": "Filter", + "type": "object", + "properties": { + "maxResults": { + "type": "integer", + "minimum": 0, + "maximum": 25, + "optional": true, + "description": "The maximum number of entries to be fetched in the requested list. Omit this parameter to fetch the maximum number of entries ($(ref:sessions.MAX_SESSION_RESULTS))." + } + } + }, + { + "id": "Session", + "type": "object", + "properties": { + "lastModified": {"type": "integer", "description": "The time when the window or tab was closed or modified, represented in milliseconds since the epoch."}, + "tab": {"$ref": "tabs.Tab", "optional": true, "description": "The $(ref:tabs.Tab), if this entry describes a tab. Either this or $(ref:sessions.Session.window) will be set."}, + "window": {"$ref": "windows.Window", "optional": true, "description": "The $(ref:windows.Window), if this entry describes a window. Either this or $(ref:sessions.Session.tab) will be set."} + } + }, + { + "id": "Device", + "type": "object", + "properties": { + "info": {"type": "string"}, + "deviceName": {"type": "string", "description": "The name of the foreign device."}, + "sessions": {"type": "array", "items": {"$ref": "Session"}, "description": "A list of open window sessions for the foreign device, sorted from most recently to least recently modified session."} + } + } + ], + "functions": [ + { + "name": "getRecentlyClosed", + "type": "function", + "description": "Gets the list of recently closed tabs and/or windows.", + "async": "callback", + "parameters": [ + { + "$ref": "Filter", + "name": "filter", + "optional": true, + "default": {} + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "sessions", "type": "array", "items": { "$ref": "Session" }, "description": "The list of closed entries in reverse order that they were closed (the most recently closed tab or window will be at index <code>0</code>). The entries may contain either tabs or windows." + } + ] + } + ] + }, + { + "name": "getDevices", + "unsupported": true, + "type": "function", + "description": "Retrieves all devices with synced sessions.", + "async": "callback", + "parameters": [ + { + "$ref": "Filter", + "name": "filter", + "optional": true + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "devices", "type": "array", "items": { "$ref": "Device" }, "description": "The list of $(ref:sessions.Device) objects for each synced session, sorted in order from device with most recently modified session to device with least recently modified session. $(ref:tabs.Tab) objects are sorted by recency in the $(ref:windows.Window) of the $(ref:sessions.Session) objects." + } + ] + } + ] + }, + { + "name": "restore", + "type": "function", + "description": "Reopens a $(ref:windows.Window) or $(ref:tabs.Tab), with an optional callback to run when the entry has been restored.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "sessionId", + "optional": true, + "description": "The $(ref:windows.Window.sessionId), or $(ref:tabs.Tab.sessionId) to restore. If this parameter is not specified, the most recently closed session is restored." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "$ref": "Session", + "name": "restoredSession", + "description": "A $(ref:sessions.Session) containing the restored $(ref:windows.Window) or $(ref:tabs.Tab) object." + } + ] + } + ] + } + ], + "events": [ + { + "name": "onChanged", + "unsupported": true, + "description": "Fired when recently closed tabs and/or windows are changed. This event does not monitor synced sessions changes.", + "type": "function" + } + ], + "properties": { + "MAX_SESSION_RESULTS": { + "value": 25, + "description": "The maximum number of $(ref:sessions.Session) that will be included in a requested list." + } + } + } +] diff --git a/browser/components/webextensions/schemas/tabs.json b/browser/components/webextensions/schemas/tabs.json new file mode 100644 index 000000000..23ce33a4b --- /dev/null +++ b/browser/components/webextensions/schemas/tabs.json @@ -0,0 +1,1295 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "Permission", + "choices": [{ + "type": "string", + "enum": [ + "activeTab", + "tabs" + ] + }] + } + ] + }, + { + "namespace": "tabs", + "description": "Use the <code>browser.tabs</code> API to interact with the browser's tab system. You can use this API to create, modify, and rearrange tabs in the browser.", + "types": [ + { "id": "MutedInfoReason", + "type": "string", + "description": "An event that caused a muted state change.", + "enum": [ + {"name": "user", "description": "A user input action has set/overridden the muted state."}, + {"name": "capture", "description": "Tab capture started, forcing a muted state change."}, + {"name": "extension", "description": "An extension, identified by the extensionId field, set the muted state."} + ] + }, + { + "id": "MutedInfo", + "type": "object", + "description": "Tab muted state and the reason for the last state change.", + "properties": { + "muted": { + "type": "boolean", + "description": "Whether the tab is prevented from playing sound (but hasn't necessarily recently produced sound). Equivalent to whether the muted audio indicator is showing." + }, + "reason": { + "$ref": "MutedInfoReason", + "optional": true, + "description": "The reason the tab was muted or unmuted. Not set if the tab's mute state has never been changed." + }, + "extensionId": { + "type": "string", + "optional": true, + "description": "The ID of the extension that changed the muted state. Not set if an extension was not the reason the muted state last changed." + } + } + }, + { + "id": "Tab", + "type": "object", + "properties": { + "id": {"type": "integer", "minimum": -1, "optional": true, "description": "The ID of the tab. Tab IDs are unique within a browser session. Under some circumstances a Tab may not be assigned an ID, for example when querying foreign tabs using the $(ref:sessions) API, in which case a session ID may be present. Tab ID can also be set to $(ref:tabs.TAB_ID_NONE) for apps and devtools windows."}, + "index": {"type": "integer", "minimum": -1, "description": "The zero-based index of the tab within its window."}, + "windowId": {"type": "integer", "minimum": 0, "description": "The ID of the window the tab is contained within."}, + "openerTabId": {"unsupported": true, "type": "integer", "minimum": 0, "optional": true, "description": "The ID of the tab that opened this tab, if any. This property is only present if the opener tab still exists."}, + "selected": {"type": "boolean", "description": "Whether the tab is selected.", "deprecated": "Please use $(ref:tabs.Tab.highlighted).", "unsupported": true}, + "highlighted": {"type": "boolean", "description": "Whether the tab is highlighted."}, + "active": {"type": "boolean", "description": "Whether the tab is active in its window. (Does not necessarily mean the window is focused.)"}, + "pinned": {"type": "boolean", "description": "Whether the tab is pinned."}, + "audible": {"type": "boolean", "optional": true, "description": "Whether the tab has produced sound over the past couple of seconds (but it might not be heard if also muted). Equivalent to whether the speaker audio indicator is showing."}, + "mutedInfo": {"$ref": "MutedInfo", "optional": true, "description": "Current tab muted state and the reason for the last state change."}, + "url": {"type": "string", "optional": true, "permissions": ["tabs"], "description": "The URL the tab is displaying. This property is only present if the extension's manifest includes the <code>\"tabs\"</code> permission."}, + "title": {"type": "string", "optional": true, "permissions": ["tabs"], "description": "The title of the tab. This property is only present if the extension's manifest includes the <code>\"tabs\"</code> permission."}, + "favIconUrl": {"type": "string", "optional": true, "permissions": ["tabs"], "description": "The URL of the tab's favicon. This property is only present if the extension's manifest includes the <code>\"tabs\"</code> permission. It may also be an empty string if the tab is loading."}, + "status": {"type": "string", "optional": true, "description": "Either <em>loading</em> or <em>complete</em>."}, + "incognito": {"type": "boolean", "description": "Whether the tab is in an incognito window."}, + "width": {"type": "integer", "optional": true, "description": "The width of the tab in pixels."}, + "height": {"type": "integer", "optional": true, "description": "The height of the tab in pixels."}, + "sessionId": {"unsupported": true, "type": "string", "optional": true, "description": "The session ID used to uniquely identify a Tab obtained from the $(ref:sessions) API."}, + "cookieStoreId": {"type": "string", "description": "The CookieStoreId used for the tab."} + } + }, + { + "id": "ZoomSettingsMode", + "type": "string", + "description": "Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to <code>automatic</code>.", + "enum": [ + { + "name": "automatic", + "description": "Zoom changes are handled automatically by the browser." + }, + { + "name": "manual", + "description": "Overrides the automatic handling of zoom changes. The <code>onZoomChange</code> event will still be dispatched, and it is the responsibility of the extension to listen for this event and manually scale the page. This mode does not support <code>per-origin</code> zooming, and will thus ignore the <code>scope</code> zoom setting and assume <code>per-tab</code>." + }, + { + "name": "disabled", + "description": "Disables all zooming in the tab. The tab will revert to the default zoom level, and all attempted zoom changes will be ignored." + } + ] + }, + { + "id": "ZoomSettingsScope", + "type": "string", + "description": "Defines whether zoom changes will persist for the page's origin, or only take effect in this tab; defaults to <code>per-origin</code> when in <code>automatic</code> mode, and <code>per-tab</code> otherwise.", + "enum": [ + { + "name": "per-origin", + "description": "Zoom changes will persist in the zoomed page's origin, i.e. all other tabs navigated to that same origin will be zoomed as well. Moreover, <code>per-origin</code> zoom changes are saved with the origin, meaning that when navigating to other pages in the same origin, they will all be zoomed to the same zoom factor. The <code>per-origin</code> scope is only available in the <code>automatic</code> mode." + }, + { + "name": "per-tab", + "description": "Zoom changes only take effect in this tab, and zoom changes in other tabs will not affect the zooming of this tab. Also, <code>per-tab</code> zoom changes are reset on navigation; navigating a tab will always load pages with their <code>per-origin</code> zoom factors." + } + ] + }, + { + "id": "ZoomSettings", + "type": "object", + "description": "Defines how zoom changes in a tab are handled and at what scope.", + "properties": { + "mode": { + "$ref": "ZoomSettingsMode", + "description": "Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to <code>automatic</code>.", + "optional": true + }, + "scope": { + "$ref": "ZoomSettingsScope", + "description": "Defines whether zoom changes will persist for the page's origin, or only take effect in this tab; defaults to <code>per-origin</code> when in <code>automatic</code> mode, and <code>per-tab</code> otherwise.", + "optional": true + }, + "defaultZoomFactor": { + "type": "number", + "optional": true, + "description": "Used to return the default zoom level for the current tab in calls to tabs.getZoomSettings." + } + } + }, + { + "id": "TabStatus", + "type": "string", + "enum": ["loading", "complete"], + "description": "Whether the tabs have completed loading." + }, + { + "id": "WindowType", + "type": "string", + "enum": ["normal", "popup", "panel", "app", "devtools"], + "description": "The type of window." + } + ], + "properties": { + "TAB_ID_NONE": { + "value": -1, + "description": "An ID which represents the absence of a browser tab." + } + }, + "functions": [ + { + "name": "get", + "type": "function", + "description": "Retrieves details about the specified tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0 + }, + { + "type": "function", + "name": "callback", + "parameters": [ + {"name": "tab", "$ref": "Tab"} + ] + } + ] + }, + { + "name": "getCurrent", + "type": "function", + "description": "Gets the tab that this script call is being made from. May be undefined if called from a non-tab context (for example: a background page or popup view).", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "tab", + "$ref": "Tab", + "optional": true + } + ] + } + ] + }, + { + "name": "connect", + "type": "function", + "description": "Connects to the content script(s) in the specified tab. The $(ref:runtime.onConnect) event is fired in each content script running in the specified tab for the current extension. For more details, see $(topic:messaging)[Content Script Messaging].", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0 + }, + { + "type": "object", + "name": "connectInfo", + "properties": { + "name": { "type": "string", "optional": true, "description": "Will be passed into onConnect for content scripts that are listening for the connection event." }, + "frameId": { + "type": "integer", + "optional": true, + "minimum": 0, + "description": "Open a port to a specific $(topic:frame_ids)[frame] identified by <code>frameId</code> instead of all frames in the tab." + } + }, + "optional": true + } + ], + "returns": { + "$ref": "runtime.Port", + "description": "A port that can be used to communicate with the content scripts running in the specified tab. The port's $(ref:runtime.Port) event is fired if the tab closes or does not exist. " + } + }, + { + "name": "sendRequest", + "deprecated": "Please use $(ref:runtime.sendMessage).", + "unsupported": true, + "type": "function", + "description": "Sends a single request to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The $(ref:extension.onRequest) event is fired in each content script running in the specified tab for the current extension.", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0 + }, + { + "type": "any", + "name": "request" + }, + { + "type": "function", + "name": "responseCallback", + "optional": true, + "parameters": [ + { + "name": "response", + "type": "any", + "description": "The JSON response object sent by the handler of the request. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and $(ref:runtime.lastError) will be set to the error message." + } + ] + } + ] + }, + { + "name": "sendMessage", + "type": "function", + "description": "Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The $(ref:runtime.onMessage) event is fired in each content script running in the specified tab for the current extension.", + "async": "responseCallback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0 + }, + { + "type": "any", + "name": "message" + }, + { + "type": "object", + "name": "options", + "properties": { + "frameId": { + "type": "integer", + "optional": true, + "minimum": 0, + "description": "Send a message to a specific $(topic:frame_ids)[frame] identified by <code>frameId</code> instead of all frames in the tab." + } + }, + "optional": true + }, + { + "type": "function", + "name": "responseCallback", + "optional": true, + "parameters": [ + { + "name": "response", + "type": "any", + "description": "The JSON response object sent by the handler of the message. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and $(ref:runtime.lastError) will be set to the error message." + } + ] + } + ] + }, + { + "name": "getSelected", + "deprecated": "Please use $(ref:tabs.query) <code>{active: true}</code>.", + "unsupported": true, + "type": "function", + "description": "Gets the tab that is selected in the specified window.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "windowId", + "minimum": -2, + "optional": true, + "description": "Defaults to the $(topic:current-window)[current window]." + }, + { + "type": "function", + "name": "callback", + "parameters": [ + {"name": "tab", "$ref": "Tab"} + ] + } + ] + }, + { + "name": "getAllInWindow", + "deprecated": "Please use $(ref:tabs.query) <code>{windowId: windowId}</code>.", + "unsupported": true, + "type": "function", + "description": "Gets details about all tabs in the specified window.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "windowId", + "minimum": -2, + "optional": true, + "description": "Defaults to the $(topic:current-window)[current window]." + }, + { + "type": "function", + "name": "callback", + "parameters": [ + {"name": "tabs", "type": "array", "items": { "$ref": "Tab" } } + ] + } + ] + }, + { + "name": "create", + "type": "function", + "description": "Creates a new tab.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "createProperties", + "properties": { + "windowId": { + "type": "integer", + "minimum": -2, + "optional": true, + "description": "The window to create the new tab in. Defaults to the $(topic:current-window)[current window]." + }, + "index": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The position the tab should take in the window. The provided value will be clamped to between zero and the number of tabs in the window." + }, + "url": { + "type": "string", + "optional": true, + "description": "The URL to navigate the tab to initially. Fully-qualified URLs must include a scheme (i.e. 'http://www.google.com', not 'www.google.com'). Relative URLs will be relative to the current page within the extension. Defaults to the New Tab Page." + }, + "active": { + "type": "boolean", + "optional": true, + "description": "Whether the tab should become the active tab in the window. Does not affect whether the window is focused (see $(ref:windows.update)). Defaults to <var>true</var>." + }, + "selected": { + "deprecated": "Please use <em>active</em>.", + "unsupported": true, + "type": "boolean", + "optional": true, + "description": "Whether the tab should become the selected tab in the window. Defaults to <var>true</var>" + }, + "pinned": { + "type": "boolean", + "optional": true, + "description": "Whether the tab should be pinned. Defaults to <var>false</var>" + }, + "openerTabId": { + "unsupported": true, + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as the newly created tab." + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The CookieStoreId for the tab that opened this tab." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "tab", + "$ref": "Tab", + "description": "Details about the created tab. Will contain the ID of the new tab." + } + ] + } + ] + }, + { + "name": "duplicate", + "type": "function", + "description": "Duplicates a tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "description": "The ID of the tab which is to be duplicated." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "tab", + "optional": true, + "description": "Details about the duplicated tab. The $(ref:tabs.Tab) object doesn't contain <code>url</code>, <code>title</code> and <code>favIconUrl</code> if the <code>\"tabs\"</code> permission has not been requested.", + "$ref": "Tab" + } + ] + } + ] + }, + { + "name": "query", + "type": "function", + "description": "Gets all tabs that have the specified properties, or all tabs if no properties are specified.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "queryInfo", + "properties": { + "active": { + "type": "boolean", + "optional": true, + "description": "Whether the tabs are active in their windows." + }, + "pinned": { + "type": "boolean", + "optional": true, + "description": "Whether the tabs are pinned." + }, + "audible": { + "type": "boolean", + "optional": true, + "description": "Whether the tabs are audible." + }, + "muted": { + "type": "boolean", + "optional": true, + "description": "Whether the tabs are muted." + }, + "highlighted": { + "type": "boolean", + "optional": true, + "description": "Whether the tabs are highlighted." + }, + "currentWindow": { + "type": "boolean", + "optional": true, + "description": "Whether the tabs are in the $(topic:current-window)[current window]." + }, + "lastFocusedWindow": { + "type": "boolean", + "optional": true, + "description": "Whether the tabs are in the last focused window." + }, + "status": { + "$ref": "TabStatus", + "optional": true, + "description": "Whether the tabs have completed loading." + }, + "title": { + "type": "string", + "optional": true, + "description": "Match page titles against a pattern." + }, + "url": { + "choices": [ + {"type": "string"}, + {"type": "array", "items": {"type": "string"}} + ], + "optional": true, + "description": "Match tabs against one or more $(topic:match_patterns)[URL patterns]. Note that fragment identifiers are not matched." + }, + "windowId": { + "type": "integer", + "optional": true, + "minimum": -2, + "description": "The ID of the parent window, or $(ref:windows.WINDOW_ID_CURRENT) for the $(topic:current-window)[current window]." + }, + "windowType": { + "$ref": "WindowType", + "optional": true, + "description": "The type of window the tabs are in." + }, + "index": { + "type": "integer", + "optional": true, + "minimum": 0, + "description": "The position of the tabs within their windows." + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The CookieStoreId used for the tab." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "result", + "type": "array", + "items": { + "$ref": "Tab" + } + } + ] + } + ] + }, + { + "name": "highlight", + "type": "function", + "description": "Highlights the given tabs.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "highlightInfo", + "properties": { + "windowId": { + "type": "integer", + "optional": true, + "description": "The window that contains the tabs.", + "minimum": -2 + }, + "tabs": { + "description": "One or more tab indices to highlight.", + "choices": [ + {"type": "array", "items": {"type": "integer", "minimum": 0}}, + {"type": "integer"} + ] + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "window", + "$ref": "windows.Window", + "description": "Contains details about the window whose tabs were highlighted." + } + ] + } + ] + }, + { + "name": "update", + "type": "function", + "description": "Modifies the properties of a tab. Properties that are not specified in <var>updateProperties</var> are not modified.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "Defaults to the selected tab of the $(topic:current-window)[current window]." + }, + { + "type": "object", + "name": "updateProperties", + "properties": { + "url": { + "type": "string", + "optional": true, + "description": "A URL to navigate the tab to." + }, + "active": { + "type": "boolean", + "optional": true, + "description": "Whether the tab should be active. Does not affect whether the window is focused (see $(ref:windows.update))." + }, + "highlighted": { + "unsupported": true, + "type": "boolean", + "optional": true, + "description": "Adds or removes the tab from the current selection." + }, + "selected": { + "unsupported": true, + "deprecated": "Please use <em>highlighted</em>.", + "type": "boolean", + "optional": true, + "description": "Whether the tab should be selected." + }, + "pinned": { + "type": "boolean", + "optional": true, + "description": "Whether the tab should be pinned." + }, + "muted": { + "type": "boolean", + "optional": true, + "description": "Whether the tab should be muted." + }, + "openerTabId": { + "unsupported": true, + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as this tab." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "tab", + "$ref": "Tab", + "optional": true, + "description": "Details about the updated tab. The $(ref:tabs.Tab) object doesn't contain <code>url</code>, <code>title</code> and <code>favIconUrl</code> if the <code>\"tabs\"</code> permission has not been requested." + } + ] + } + ] + }, + { + "name": "move", + "type": "function", + "description": "Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === \"normal\") windows.", + "async": "callback", + "parameters": [ + { + "name": "tabIds", + "description": "The tab or list of tabs to move.", + "choices": [ + {"type": "integer", "minimum": 0}, + {"type": "array", "items": {"type": "integer", "minimum": 0}} + ] + }, + { + "type": "object", + "name": "moveProperties", + "properties": { + "windowId": { + "type": "integer", + "minimum": -2, + "optional": true, + "description": "Defaults to the window the tab is currently in." + }, + "index": { + "type": "integer", + "minimum": -1, + "description": "The position to move the window to. -1 will place the tab at the end of the window." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "tabs", + "description": "Details about the moved tabs.", + "choices": [ + {"$ref": "Tab"}, + {"type": "array", "items": {"$ref": "Tab"}} + ] + } + ] + } + ] + }, + { + "name": "reload", + "type": "function", + "description": "Reload a tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "The ID of the tab to reload; defaults to the selected tab of the current window." + }, + { + "type": "object", + "name": "reloadProperties", + "optional": true, + "properties": { + "bypassCache": { + "type": "boolean", + "optional": true, + "description": "Whether using any local cache. Default is false." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "remove", + "type": "function", + "description": "Closes one or more tabs.", + "async": "callback", + "parameters": [ + { + "name": "tabIds", + "description": "The tab or list of tabs to close.", + "choices": [ + {"type": "integer", "minimum": 0}, + {"type": "array", "items": {"type": "integer", "minimum": 0}} + ] + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "detectLanguage", + "type": "function", + "description": "Detects the primary language of the content in a tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "Defaults to the active tab of the $(topic:current-window)[current window]." + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "type": "string", + "name": "language", + "description": "An ISO language code such as <code>en</code> or <code>fr</code>. For a complete list of languages supported by this method, see <a href='http://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languages/internal/languages.cc'>kLanguageInfoTable</a>. The 2nd to 4th columns will be checked and the first non-NULL value will be returned except for Simplified Chinese for which zh-CN will be returned. For an unknown language, <code>und</code> will be returned." + } + ] + } + ] + }, + { + "name": "captureVisibleTab", + "type": "function", + "description": "Captures the visible area of the currently active tab in the specified window. You must have $(topic:declare_permissions)[<all_urls>] permission to use this method.", + "permissions": ["<all_urls>"], + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "windowId", + "minimum": -2, + "optional": true, + "description": "The target window. Defaults to the $(topic:current-window)[current window]." + }, + { + "$ref": "extensionTypes.ImageDetails", + "name": "options", + "optional": true + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "type": "string", + "name": "dataUrl", + "description": "A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display." + } + ] + } + ] + }, + { + "name": "executeScript", + "type": "function", + "description": "Injects JavaScript code into a page. For details, see the $(topic:content_scripts)[programmatic injection] section of the content scripts doc.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "The ID of the tab in which to run the script; defaults to the active tab of the current window." + }, + { + "$ref": "extensionTypes.InjectDetails", + "name": "details", + "description": "Details of the script to run." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "description": "Called after all the JavaScript has been executed.", + "parameters": [ + { + "name": "result", + "optional": true, + "type": "array", + "items": {"type": "any"}, + "description": "The result of the script in every injected frame." + } + ] + } + ] + }, + { + "name": "insertCSS", + "type": "function", + "description": "Injects CSS into a page. For details, see the $(topic:content_scripts)[programmatic injection] section of the content scripts doc.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "The ID of the tab in which to insert the CSS; defaults to the active tab of the current window." + }, + { + "$ref": "extensionTypes.InjectDetails", + "name": "details", + "description": "Details of the CSS text to insert." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "description": "Called when all the CSS has been inserted.", + "parameters": [] + } + ] + }, + { + "name": "removeCSS", + "type": "function", + "description": "Removes injected CSS from a page. For details, see the $(topic:content_scripts)[programmatic injection] section of the content scripts doc.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "The ID of the tab from which to remove the injected CSS; defaults to the active tab of the current window." + }, + { + "$ref": "extensionTypes.InjectDetails", + "name": "details", + "description": "Details of the CSS text to remove." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "description": "Called when all the CSS has been removed.", + "parameters": [] + } + ] + }, + { + "name": "setZoom", + "type": "function", + "description": "Zooms a specified tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "The ID of the tab to zoom; defaults to the active tab of the current window." + }, + { + "type": "number", + "name": "zoomFactor", + "description": "The new zoom factor. Use a value of 0 here to set the tab to its current default zoom factor. Values greater than zero specify a (possibly non-default) zoom factor for the tab." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "description": "Called after the zoom factor has been changed.", + "parameters": [] + } + ] + }, + { + "name": "getZoom", + "type": "function", + "description": "Gets the current zoom factor of a specified tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "The ID of the tab to get the current zoom factor from; defaults to the active tab of the current window." + }, + { + "type": "function", + "name": "callback", + "description": "Called with the tab's current zoom factor after it has been fetched.", + "parameters": [ + { + "type": "number", + "name": "zoomFactor", + "description": "The tab's current zoom factor." + } + ] + } + ] + }, + { + "name": "setZoomSettings", + "type": "function", + "description": "Sets the zoom settings for a specified tab, which define how zoom changes are handled. These settings are reset to defaults upon navigating the tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "optional": true, + "minimum": 0, + "description": "The ID of the tab to change the zoom settings for; defaults to the active tab of the current window." + }, + { + "$ref": "ZoomSettings", + "name": "zoomSettings", + "description": "Defines how zoom changes are handled and at what scope." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "description": "Called after the zoom settings have been changed.", + "parameters": [] + } + ] + }, + { + "name": "getZoomSettings", + "type": "function", + "description": "Gets the current zoom settings of a specified tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "optional": true, + "minimum": 0, + "description": "The ID of the tab to get the current zoom settings from; defaults to the active tab of the current window." + }, + { + "type": "function", + "name": "callback", + "description": "Called with the tab's current zoom settings.", + "parameters": [ + { + "$ref": "ZoomSettings", + "name": "zoomSettings", + "description": "The tab's current zoom settings." + } + ] + } + ] + } + ], + "events": [ + { + "name": "onCreated", + "type": "function", + "description": "Fired when a tab is created. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set.", + "parameters": [ + { + "$ref": "Tab", + "name": "tab", + "description": "Details of the tab that was created." + } + ] + }, + { + "name": "onUpdated", + "type": "function", + "description": "Fired when a tab is updated.", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0}, + { + "type": "object", + "name": "changeInfo", + "description": "Lists the changes to the state of the tab that was updated.", + "properties": { + "status": { + "type": "string", + "optional": true, + "description": "The status of the tab. Can be either <em>loading</em> or <em>complete</em>." + }, + "url": { + "type": "string", + "optional": true, + "description": "The tab's URL if it has changed." + }, + "pinned": { + "type": "boolean", + "optional": true, + "description": "The tab's new pinned state." + }, + "audible": { + "type": "boolean", + "optional": true, + "description": "The tab's new audible state." + }, + "mutedInfo": { + "$ref": "MutedInfo", + "optional": true, + "description": "The tab's new muted state and the reason for the change." + }, + "favIconUrl": { + "type": "string", + "optional": true, + "description": "The tab's new favicon URL." + } + } + }, + { + "$ref": "Tab", + "name": "tab", + "description": "Gives the state of the tab that was updated." + } + ] + }, + { + "name": "onMoved", + "type": "function", + "description": "Fired when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved. Move events are not fired for the other tabs that must move in response. This event is not fired when a tab is moved between windows. For that, see $(ref:tabs.onDetached).", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0}, + { + "type": "object", + "name": "moveInfo", + "properties": { + "windowId": {"type": "integer", "minimum": 0}, + "fromIndex": {"type": "integer", "minimum": 0}, + "toIndex": {"type": "integer", "minimum": 0} + } + } + ] + }, + { + "name": "onSelectionChanged", + "deprecated": "Please use $(ref:tabs.onActivated).", + "unsupported": true, + "type": "function", + "description": "Fires when the selected tab in a window changes.", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "description": "The ID of the tab that has become active." + }, + { + "type": "object", + "name": "selectInfo", + "properties": { + "windowId": { + "type": "integer", + "minimum": 0, + "description": "The ID of the window the selected tab changed inside of." + } + } + } + ] + }, + { + "name": "onActiveChanged", + "deprecated": "Please use $(ref:tabs.onActivated).", + "unsupported": true, + "type": "function", + "description": "Fires when the selected tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to $(ref:tabs.onUpdated) events to be notified when a URL is set.", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "description": "The ID of the tab that has become active." + }, + { + "type": "object", + "name": "selectInfo", + "properties": { + "windowId": { + "type": "integer", + "minimum": 0, + "description": "The ID of the window the selected tab changed inside of." + } + } + } + ] + }, + { + "name": "onActivated", + "type": "function", + "description": "Fires when the active tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set.", + "parameters": [ + { + "type": "object", + "name": "activeInfo", + "properties": { + "tabId": { + "type": "integer", + "minimum": 0, + "description": "The ID of the tab that has become active." + }, + "windowId": { + "type": "integer", + "minimum": 0, + "description": "The ID of the window the active tab changed inside of." + } + } + } + ] + }, + { + "name": "onHighlightChanged", + "deprecated": "Please use $(ref:tabs.onHighlighted).", + "unsupported": true, + "type": "function", + "description": "Fired when the highlighted or selected tabs in a window changes.", + "parameters": [ + { + "type": "object", + "name": "selectInfo", + "properties": { + "windowId": { + "type": "integer", + "minimum": 0, + "description": "The window whose tabs changed." + }, + "tabIds": { + "type": "array", + "items": {"type": "integer", "minimum": 0}, + "description": "All highlighted tabs in the window." + } + } + } + ] + }, + { + "name": "onHighlighted", + "type": "function", + "description": "Fired when the highlighted or selected tabs in a window changes.", + "parameters": [ + { + "type": "object", + "name": "highlightInfo", + "properties": { + "windowId": { + "type": "integer", + "minimum": 0, + "description": "The window whose tabs changed." + }, + "tabIds": { + "type": "array", + "items": {"type": "integer", "minimum": 0}, + "description": "All highlighted tabs in the window." + } + } + } + ] + }, + { + "name": "onDetached", + "type": "function", + "description": "Fired when a tab is detached from a window, for example because it is being moved between windows.", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0}, + { + "type": "object", + "name": "detachInfo", + "properties": { + "oldWindowId": {"type": "integer", "minimum": 0}, + "oldPosition": {"type": "integer", "minimum": 0} + } + } + ] + }, + { + "name": "onAttached", + "type": "function", + "description": "Fired when a tab is attached to a window, for example because it was moved between windows.", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0}, + { + "type": "object", + "name": "attachInfo", + "properties": { + "newWindowId": {"type": "integer", "minimum": 0}, + "newPosition": {"type": "integer", "minimum": 0} + } + } + ] + }, + { + "name": "onRemoved", + "type": "function", + "description": "Fired when a tab is closed.", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0}, + { + "type": "object", + "name": "removeInfo", + "properties": { + "windowId": {"type": "integer", "minimum": 0, "description": "The window whose tab is closed." }, + "isWindowClosing": {"type": "boolean", "description": "True when the tab is being closed because its window is being closed." } + } + } + ] + }, + { + "name": "onReplaced", + "type": "function", + "description": "Fired when a tab is replaced with another tab due to prerendering or instant.", + "parameters": [ + {"type": "integer", "name": "addedTabId", "minimum": 0}, + {"type": "integer", "name": "removedTabId", "minimum": 0} + ] + }, + { + "name": "onZoomChange", + "type": "function", + "description": "Fired when a tab is zoomed.", + "parameters": [{ + "type": "object", + "name": "ZoomChangeInfo", + "properties": { + "tabId": {"type": "integer", "minimum": 0}, + "oldZoomFactor": {"type": "number"}, + "newZoomFactor": {"type": "number"}, + "zoomSettings": {"$ref": "ZoomSettings"} + } + }] + } + ] + } +] diff --git a/browser/components/webextensions/schemas/windows.json b/browser/components/webextensions/schemas/windows.json new file mode 100644 index 000000000..8453358b5 --- /dev/null +++ b/browser/components/webextensions/schemas/windows.json @@ -0,0 +1,508 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + { + "namespace": "windows", + "description": "Use the <code>browser.windows</code> API to interact with browser windows. You can use this API to create, modify, and rearrange windows in the browser.", + "types": [ + { + "id": "WindowType", + "type": "string", + "description": "The type of browser window this is. Under some circumstances a Window may not be assigned type property, for example when querying closed windows from the $(ref:sessions) API.", + "enum": ["normal", "popup", "panel", "app", "devtools"] + }, + { + "id": "WindowState", + "type": "string", + "description": "The state of this browser window. Under some circumstances a Window may not be assigned state property, for example when querying closed windows from the $(ref:sessions) API.", + "enum": ["normal", "minimized", "maximized", "fullscreen", "docked"] + }, + { + "id": "Window", + "type": "object", + "properties": { + "id": { + "type": "integer", + "optional": true, + "minimum": 0, + "description": "The ID of the window. Window IDs are unique within a browser session. Under some circumstances a Window may not be assigned an ID, for example when querying windows using the $(ref:sessions) API, in which case a session ID may be present." + }, + "focused": { + "type": "boolean", + "description": "Whether the window is currently the focused window." + }, + "top": { + "type": "integer", + "optional": true, + "description": "The offset of the window from the top edge of the screen in pixels. Under some circumstances a Window may not be assigned top property, for example when querying closed windows from the $(ref:sessions) API." + }, + "left": { + "type": "integer", + "optional": true, + "description": "The offset of the window from the left edge of the screen in pixels. Under some circumstances a Window may not be assigned left property, for example when querying closed windows from the $(ref:sessions) API." + }, + "width": { + "type": "integer", + "optional": true, + "description": "The width of the window, including the frame, in pixels. Under some circumstances a Window may not be assigned width property, for example when querying closed windows from the $(ref:sessions) API." + }, + "height": { + "type": "integer", + "optional": true, + "description": "The height of the window, including the frame, in pixels. Under some circumstances a Window may not be assigned height property, for example when querying closed windows from the $(ref:sessions) API." + }, + "tabs": { + "type": "array", + "items": { "$ref": "tabs.Tab" }, + "optional": true, + "description": "Array of $(ref:tabs.Tab) objects representing the current tabs in the window." + }, + "incognito": { + "type": "boolean", + "description": "Whether the window is incognito." + }, + "type": { + "$ref": "WindowType", + "optional": true, + "description": "The type of browser window this is." + }, + "state": { + "$ref": "WindowState", + "optional": true, + "description": "The state of this browser window." + }, + "alwaysOnTop": { + "type": "boolean", + "description": "Whether the window is set to be always on top." + }, + "sessionId": { + "type": "string", + "optional": true, + "description": "The session ID used to uniquely identify a Window obtained from the $(ref:sessions) API." + } + } + }, + { + "id": "CreateType", + "type": "string", + "description": "Specifies what type of browser window to create. The 'panel' and 'detached_panel' types create a popup unless the '--enable-panels' flag is set.", + "enum": ["normal", "popup", "panel", "detached_panel"] + } + ], + "properties": { + "WINDOW_ID_NONE": { + "value": -1, + "description": "The windowId value that represents the absence of a browser window." + }, + "WINDOW_ID_CURRENT": { + "value": -2, + "description": "The windowId value that represents the $(topic:current-window)[current window]." + } + }, + "functions": [ + { + "name": "get", + "type": "function", + "description": "Gets details about a window.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "windowId", + "minimum": -2 + }, + { + "type": "object", + "name": "getInfo", + "optional": true, + "description": "", + "properties": { + "populate": { + "type": "boolean", + "optional": true, + "description": "If true, the $(ref:windows.Window) object will have a <var>tabs</var> property that contains a list of the $(ref:tabs.Tab) objects. The <code>Tab</code> objects only contain the <code>url</code>, <code>title</code> and <code>favIconUrl</code> properties if the extension's manifest file includes the <code>\"tabs\"</code> permission." + }, + "windowTypes": { + "type": "array", + "items": { + "$ref": "WindowType" + }, + "optional": true, + "description": "If set, the $(ref:windows.Window) returned will be filtered based on its type. If unset the default filter is set to <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "window", + "$ref": "Window" + } + ] + } + ] + }, + { + "name": "getCurrent", + "type": "function", + "description": "Gets the $(topic:current-window)[current window].", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "getInfo", + "optional": true, + "description": "", + "properties": { + "populate": { + "type": "boolean", + "optional": true, + "description": "If true, the $(ref:windows.Window) object will have a <var>tabs</var> property that contains a list of the $(ref:tabs.Tab) objects. The <code>Tab</code> objects only contain the <code>url</code>, <code>title</code> and <code>favIconUrl</code> properties if the extension's manifest file includes the <code>\"tabs\"</code> permission." + }, + "windowTypes": { + "type": "array", + "items": { "$ref": "WindowType" }, + "optional": true, + "description": "If set, the $(ref:windows.Window) returned will be filtered based on its type. If unset the default filter is set to <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "window", + "$ref": "Window" + } + ] + } + ] + }, + { + "name": "getLastFocused", + "type": "function", + "description": "Gets the window that was most recently focused — typically the window 'on top'.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "getInfo", + "optional": true, + "description": "", + "properties": { + "populate": { + "type": "boolean", + "optional": true, + "description": "If true, the $(ref:windows.Window) object will have a <var>tabs</var> property that contains a list of the $(ref:tabs.Tab) objects. The <code>Tab</code> objects only contain the <code>url</code>, <code>title</code> and <code>favIconUrl</code> properties if the extension's manifest file includes the <code>\"tabs\"</code> permission." + }, + "windowTypes": { + "type": "array", + "items": { "$ref": "WindowType" }, + "optional": true, + "description": "If set, the $(ref:windows.Window) returned will be filtered based on its type. If unset the default filter is set to <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "window", + "$ref": "Window" + } + ] + } + ] + }, + { + "name": "getAll", + "type": "function", + "description": "Gets all windows.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "getInfo", + "optional": true, + "description": "", + "properties": { + "populate": { + "type": "boolean", + "optional": true, + "description": "If true, each $(ref:windows.Window) object will have a <var>tabs</var> property that contains a list of the $(ref:tabs.Tab) objects for that window. The <code>Tab</code> objects only contain the <code>url</code>, <code>title</code> and <code>favIconUrl</code> properties if the extension's manifest file includes the <code>\"tabs\"</code> permission." + }, + "windowTypes": { + "type": "array", + "items": { "$ref": "WindowType" }, + "optional": true, + "description": "If set, the $(ref:windows.Window) returned will be filtered based on its type. If unset the default filter is set to <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "windows", + "type": "array", + "items": { "$ref": "Window" } + } + ] + } + ] + }, + { + "name": "create", + "type": "function", + "description": "Creates (opens) a new browser with any optional sizing, position or default URL provided.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "createData", + "optional": true, + "default": {}, + "properties": { + "url": { + "description": "A URL or array of URLs to open as tabs in the window. Fully-qualified URLs must include a scheme (i.e. 'http://www.google.com', not 'www.google.com'). Relative URLs will be relative to the current page within the extension. Defaults to the New Tab Page.", + "optional": true, + "choices": [ + { "type": "string", "format": "relativeUrl" }, + { + "type": "array", + "items": { "type": "string", "format": "relativeUrl" } + } + ] + }, + "tabId": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The id of the tab for which you want to adopt to the new window." + }, + "left": { + "type": "integer", + "optional": true, + "description": "The number of pixels to position the new window from the left edge of the screen. If not specified, the new window is offset naturally from the last focused window. This value is ignored for panels." + }, + "top": { + "type": "integer", + "optional": true, + "description": "The number of pixels to position the new window from the top edge of the screen. If not specified, the new window is offset naturally from the last focused window. This value is ignored for panels." + }, + "width": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The width in pixels of the new window, including the frame. If not specified defaults to a natural width." + }, + "height": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The height in pixels of the new window, including the frame. If not specified defaults to a natural height." + }, + "focused": { + "unsupported": true, + "type": "boolean", + "optional": true, + "description": "If true, opens an active window. If false, opens an inactive window." + }, + "incognito": { + "type": "boolean", + "optional": true, + "description": "Whether the new window should be an incognito window." + }, + "type": { + "$ref": "CreateType", + "optional": true, + "description": "Specifies what type of browser window to create. The 'panel' and 'detached_panel' types create a popup unless the '--enable-panels' flag is set." + }, + "state": { + "$ref": "WindowState", + "optional": true, + "description": "The initial state of the window. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'." + }, + "allowScriptsToClose": { + "type": "boolean", + "optional": true, + "description": "Allow scripts to close the window." + } + }, + "optional": true + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "window", + "$ref": "Window", + "description": "Contains details about the created window.", + "optional": true + } + ] + } + ] + }, + { + "name": "update", + "type": "function", + "description": "Updates the properties of a window. Specify only the properties that you want to change; unspecified properties will be left unchanged.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "windowId", + "minimum": -2 + }, + { + "type": "object", + "name": "updateInfo", + "properties": { + "left": { + "type": "integer", + "optional": true, + "description": "The offset from the left edge of the screen to move the window to in pixels. This value is ignored for panels." + }, + "top": { + "type": "integer", + "optional": true, + "description": "The offset from the top edge of the screen to move the window to in pixels. This value is ignored for panels." + }, + "width": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The width to resize the window to in pixels. This value is ignored for panels." + }, + "height": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The height to resize the window to in pixels. This value is ignored for panels." + }, + "focused": { + "type": "boolean", + "optional": true, + "description": "If true, brings the window to the front. If false, brings the next window in the z-order to the front." + }, + "drawAttention": { + "type": "boolean", + "optional": true, + "description": "If true, causes the window to be displayed in a manner that draws the user's attention to the window, without changing the focused window. The effect lasts until the user changes focus to the window. This option has no effect if the window already has focus. Set to false to cancel a previous draw attention request." + }, + "state": { + "$ref": "WindowState", + "optional": true, + "description": "The new state of the window. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "window", + "$ref": "Window" + } + ] + } + ] + }, + { + "name": "remove", + "type": "function", + "description": "Removes (closes) a window, and all the tabs inside it.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "windowId", + "minimum": 0 + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + } + ], + "events": [ + { + "name": "onCreated", + "type": "function", + "description": "Fired when a window is created.", + "filters": [ + { + "name": "windowTypes", + "type": "array", + "items": { "$ref": "WindowType" }, + "description": "Conditions that the window's type being created must satisfy. By default it will satisfy <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows." + } + ], + "parameters": [ + { + "$ref": "Window", + "name": "window", + "description": "Details of the window that was created." + } + ] + }, + { + "name": "onRemoved", + "type": "function", + "description": "Fired when a window is removed (closed).", + "filters": [ + { + "name": "windowTypes", + "type": "array", + "items": { "$ref": "WindowType" }, + "description": "Conditions that the window's type being removed must satisfy. By default it will satisfy <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows." + } + ], + "parameters": [ + { + "type": "integer", + "name": "windowId", + "minimum": 0, + "description": "ID of the removed window." + } + ] + }, + { + "name": "onFocusChanged", + "type": "function", + "description": "Fired when the currently focused window changes. Will be $(ref:windows.WINDOW_ID_NONE) if all browser windows have lost focus. Note: On some Linux window managers, WINDOW_ID_NONE will always be sent immediately preceding a switch from one browser window to another.", + "filters": [ + { + "name": "windowTypes", + "type": "array", + "items": { "$ref": "WindowType" }, + "description": "Conditions that the window's type being removed must satisfy. By default it will satisfy <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows." + } + ], + "parameters": [ + { + "type": "integer", + "name": "windowId", + "minimum": -1, + "description": "ID of the newly focused window." + } + ] + } + ] + } +] |