blob: 63278aebc8d607e605a801f2b1b2489e2e60763f [file] [log] [blame]
// Copyright (c) 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": "webview",
"description": "none",
"dependencies": ["contextMenusInternal"],
"types": [
{
"id": "DataTypeSet",
"type": "object",
"description": "A set of data types. Missing data types are interpreted as <code>false</code>.",
"properties": {
"appcache": {
"type": "boolean",
"optional": true,
"description": "Websites' appcaches."
},
"cookies": {
"type": "boolean",
"optional": true,
"description": "The browser's cookies."
},
"fileSystems": {
"type": "boolean",
"optional": true,
"description": "Websites' file systems."
},
"indexedDB": {
"type": "boolean",
"optional": true,
"description": "Websites' IndexedDB data."
},
"localStorage": {
"type": "boolean",
"optional": true,
"description": "Websites' local storage data."
},
"webSQL": {
"type": "boolean",
"optional": true,
"description": "Websites' WebSQL data."
}
}
},
{
"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.",
"properties": {
"since": {
"type": "number",
"optional": true,
"description": "Remove data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the <code>getTime</code> method of the JavaScript <code>Date</code> object). If absent, defaults to 0 (which would remove all browsing data)."
}
}
}
],
"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>.",
"parameters": [
{
"type": "integer",
"name": "instanceId",
"description": "The instance ID of the guest <webview> process."
},
{
"$ref": "RemovalOptions",
"name": "options"
},
{
"name": "dataToRemove",
"$ref": "DataTypeSet",
"description": "The set of data types to remove."
},
{
"name": "callback",
"type": "function",
"description": "Called when deletion has completed.",
"optional": true,
"parameters": []
}
]
},
{
"name": "executeScript",
"type": "function",
"description": "Injects JavaScript code into a <webview> page.",
"parameters": [
{
"type": "integer",
"name": "instanceId",
"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."
},
{
"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."
}
]
}
]
},
{
"name": "insertCSS",
"type": "function",
"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",
"name": "instanceId",
"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 CSS text to insert."
},
{
"type": "function",
"name": "callback",
"optional": true,
"description": "Called when all the CSS has been inserted.",
"parameters": []
}
]
},
{
"name": "captureVisibleRegion",
"type": "function",
"description": "Captures the visible area of the currently loaded page inside <webview>.",
"parameters": [
{
"type": "integer",
"name": "instanceId",
"description": "The instance ID of the guest <webview> process."
},
{
"$ref": "types.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": "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": [
{
"type": "integer",
"name": "instanceId"
},
{
"type": "integer",
"name": "relativeIndex"
}
]
},
{
"name": "overrideUserAgent",
"type": "function",
"parameters": [
{
"type": "integer",
"name": "instanceId"
},
{
"type": "string",
"name": "userAgentOverride"
}
]
},
{
"name": "reload",
"type": "function",
"parameters": [
{
"type": "integer",
"name": "instanceId"
}
]
},
{
"name": "setName",
"type": "function",
"parameters": [
{
"type": "integer",
"name": "instanceId"
},
{
"type": "string",
"name": "frameName"
}
]
},
{
"name": "setPermission",
"type": "function",
"parameters": [
{
"type": "integer",
"name": "instanceId"
},
{
"type": "integer",
"name": "requestId"
},
{
"type": "string",
"name": "action",
"enum": ["allow", "deny", "default"]
},
{
"type": "string",
"name": "userInput",
"optional": true
},
{
"type": "function",
"name": "callback",
"optional": true,
"parameters": [
{
"name": "allowed",
"type": "boolean"
}
]
}
]
},
{
"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 &lt;webview&gt; 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": [
{
"type": "integer",
"name": "instanceId"
}
]
},
{
"name": "terminate",
"type": "function",
"parameters": [
{
"type": "integer",
"name": "instanceId"
}
]
}
],
"events": [
{
"name": "onClicked",
"type": "function",
"nodoc": true,
"$ref": "contextMenusInternal.onClicked"
}
]
}
]