diff options
Diffstat (limited to 'chromium/chrome/common/extensions/api/webview.json')
-rw-r--r-- | chromium/chrome/common/extensions/api/webview.json | 476 |
1 files changed, 463 insertions, 13 deletions
diff --git a/chromium/chrome/common/extensions/api/webview.json b/chromium/chrome/common/extensions/api/webview.json index fbb467ff145..63278aebc8d 100644 --- a/chromium/chrome/common/extensions/api/webview.json +++ b/chromium/chrome/common/extensions/api/webview.json @@ -6,6 +6,7 @@ { "namespace": "webview", "description": "none", + "dependencies": ["contextMenusInternal"], "types": [ { "id": "DataTypeSet", @@ -45,6 +46,22 @@ } }, { + "id": "ContextMenuItem", + "type": "object", + "description": "An item in the context menu.", + "properties": { + "label": { + "type": "string", + "description": "label of the item", + "optional": true + }, + "commandId": { + "type": "integer", + "description": "id of the input item" + } + } + }, + { "id": "RemovalOptions", "type": "object", "description": "Options that determine exactly what data will be removed.", @@ -59,6 +76,235 @@ ], "functions": [ { + "name": "contextMenusCreate", + "type": "function", + "returns": { + "choices": [ + { "type": "integer" }, + { "type": "string" } + ], + "description": "The ID of the newly created item." + }, + "parameters": [ + { + "type": "integer", + "name": "instanceId", + "nodoc": true + }, + { + "type": "object", + "name": "createProperties", + "properties": { + "type": { + "type": "string", + "enum": ["normal", "checkbox", "radio", "separator"], + "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. Cannot be the same as another ID for this webview." + }, + "title": { + "type": "string", + "optional": true, + "description": "The text to be displayed in the item; this is <em>required</em> unless <em>type</em> 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": { + "type": "string", + // |launcher| isn't actually supported, this is listed here so that we can build |contexts| using the same code from chrome.contextMenus API. + "enum": ["all", "page", "frame", "selection", "link", "editable", "image", "video", "audio", "launcher"] + }, + "minItems": 1, + "optional": true, + "description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified. Specifying ['all'] is equivalent to the combination of all other contexts except for 'launcher'. The 'launcher' context is not supported for <webview>." + }, + "onclick": { + "type": "function", + "optional": true, + "description": "A function that will be called back when the menu item is clicked.", + "parameters": [ + { + "name": "info", + "$ref": "contextMenusInternal.OnClickData", + "description": "Information about the item clicked and the context where the click happened." + } + ] + }, + "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 <a href='match_patterns'>Match Patterns</a>." + }, + "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 chrome.runtime.lastError.", + "parameters": [] + } + ] + }, + { + "name": "contextMenusUpdate", + "type": "function", + "description": "Updates a previously created context menu item.", + "parameters": [ + { + "type": "integer", + "name": "instanceId", + "nodoc": true + }, + { + "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": { + "type": "string", + "enum": ["normal", "checkbox", "radio", "separator"], + "optional": true + }, + "title": { + "type": "string", + "optional": true + }, + "checked": { + "type": "boolean", + "optional": true + }, + "contexts": { + "type": "array", + "items": { + "type": "string", + // |launcher| isn't actually supported, this is listed here so that we can build |contexts| using the same code from chrome.contextMenus API. + "enum": ["all", "page", "frame", "selection", "link", "editable", "image", "video", "audio", "launcher"] + }, + "minItems": 1, + "optional": true, + "description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified. Specifying ['all'] is equivalent to the combination of all other contexts except for 'launcher'. The 'launcher' context is not supported for <webview>." + }, + "onclick": { + "type": "function", + "optional": true + }, + "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": "contextMenusRemove", + "type": "function", + "description": "Removes a context menu item.", + "parameters": [ + { + "type": "integer", + "name": "instanceId", + "nodoc": true + }, + { + "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": "contextMenusRemoveAll", + "type": "function", + "description": "Removes all context menu items added by this webview.", + "parameters": [ + { + "type": "integer", + "name": "instanceId", + "nodoc": true + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [], + "description": "Called when removal is complete." + } + ] + }, + { "name": "clearData", "type": "function", "description": "Clears various types of browsing data stored in a storage partition of a <webview>.", @@ -97,6 +343,11 @@ "description": "The instance ID of the guest <webview> process." }, { + "type": "string", + "name": "src", + "description": "The src of the guest <webview> tag." + }, + { "$ref": "tabs.InjectDetails", "name": "details", "description": "Details of the script to run." @@ -121,7 +372,7 @@ { "name": "insertCSS", "type": "function", - "description": "Injects JavaScript code into a <webview> page.", + "description": "Injects CSS into a <webview> page. For details, see the <a href='/extensions/content_scripts#pi'>programmatic injection</a> section of the content scripts doc.", "parameters": [ { "type": "integer", @@ -129,24 +380,21 @@ "description": "The instance ID of the guest <webview> process." }, { + "type": "string", + "name": "src", + "description": "The src of the guest <webview> tag." + }, + { "$ref": "tabs.InjectDetails", "name": "details", - "description": "Details of the script to run." + "description": "Details of the CSS text to insert." }, { "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", "minimum": 0}, - "description": "The result of the script in every injected frame." - } - ] + "description": "Called when all the CSS has been inserted.", + "parameters": [] } ] }, @@ -173,6 +421,150 @@ ] }, { + "name": "setZoom", + "type": "function", + "parameters": [ + { + "type": "integer", + "name": "instanceId", + "description": "The instance ID of the guest <webview> process." + }, + { + "type": "number", + "name": "zoomFactor", + "description" : "The new zoom factor." + }, + { + "type": "function", + "name": "callback", + "description": "Called after the zoom message has been sent to the guest process.", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "getZoom", + "type": "function", + "parameters": [ + { + "type": "integer", + "name": "instanceId", + "description": "The instance ID of the guest <webview> process." + }, + { + "type": "function", + "name": "callback", + "description": "Called after the current zoom factor is retreived.", + "parameters": [ + { + "type": "number", + "name": "zoomFactor", + "description": "The current zoom factor." + } + ] + } + ] + }, + { + "name": "find", + "type": "function", + "description": "Initiates a find-in-page request.", + "parameters": [ + { + "type": "integer", + "name": "instanceId", + "description": "The instance ID of the guest <webview> process." + }, + { + "type": "string", + "name": "searchText", + "description": "The string to find in the page." + }, + { + "type": "object", + "name": "options", + "optional": true, + "properties": { + "backward": { + "type": "boolean", + "description": "Flag to find matches in reverse order.", + "optional": true + }, + "matchCase": { + "type": "boolean", + "description": "Flag to match |searchText| with case-sensitivity.", + "optional": true + } + } + }, + { + "type": "function", + "name": "callback", + "description": "Called after all find results have been returned for this find request.", + "optional": true, + "parameters": [ + { + "type": "object", + "name": "results", + "optional": true, + "properties": { + "numberOfMatches": { + "type": "integer", + "description": "The number of times |searchText| was matched on the page." + }, + "activeMatchOrdinal": { + "type": "integer", + "description": "The ordinal number of the current match." + }, + "selectionRect": { + "type": "object", + "description": "Describes a rectangle around the active match.", + "properties": { + "left": { + "type": "integer" + }, + "top": { + "type": "integer" + }, + "width": { + "type": "integer" + }, + "height": { + "type": "integer" + } + } + }, + "canceled": { + "type": "boolean", + "description": "Indicates whether this find request was canceled." + } + } + } + ] + } + ] + }, + { + "name": "stopFinding", + "type": "function", + "description": "Ends the current find session (clearing all highlighting) and cancels all find requests in progress.", + "parameters": [ + { + "type": "integer", + "name": "instanceId", + "description": "The instance ID of the guest <webview> process." + }, + { + "type": "string", + "name": "action", + "description": "Determines what to do with the active match after the find session has ended. 'clear' will clear the highlighting over the active match; 'keep' will keep the active match highlighted; 'activate' will keep the active match highlighted and simulate a user click on that match.", + "optional": true, + "enum": ["clear", "keep", "activate"] + } + ] + }, + { "name": "go", "type": "function", "parameters": [ @@ -211,6 +603,20 @@ ] }, { + "name": "setName", + "type": "function", + "parameters": [ + { + "type": "integer", + "name": "instanceId" + }, + { + "type": "string", + "name": "frameName" + } + ] + }, + { "name": "setPermission", "type": "function", "parameters": [ @@ -246,6 +652,43 @@ ] }, { + "name": "navigate", + "type": "function", + "parameters": [ + { + "type": "integer", + "name": "instanceId" + }, + { + "type": "string", + "name": "src" + } + ] + }, + { + "name": "showContextMenu", + "type": "function", + "parameters": [ + { + "type": "integer", + "name": "instanceId", + "description": "The instance ID of the guest <webview> process. This not exposed to developers through the API." + }, + { + "type": "integer", + "name": "requestId", + "description": "The strictly increasing request counter that serves as ID for the context menu. This not exposed to developers through the API." + }, + { + "type": "array", + "name": "itemsToShow", + "items": {"$ref": "ContextMenuItem"}, + "description": "Items to be shown in the context menu. These are top level items as opposed to children items.", + "optional": true + } + ] + }, + { "name": "stop", "type": "function", "parameters": [ @@ -265,7 +708,14 @@ } ] } + ], + "events": [ + { + "name": "onClicked", + "type": "function", + "nodoc": true, + "$ref": "contextMenusInternal.onClicked" + } ] } ] - |