blob: de404476af0b263067c1f53202ff80d777e1003c [file] [log] [blame]
// 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": "chromeWebViewInternal",
"description": "none",
"compiler_options": {
"implemented_in": "chrome/browser/extensions/api/web_view/chrome_web_view_internal_api.h"
},
"dependencies": ["contextMenusInternal", "contextMenus"],
"types": [
{
"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"
}
}
}
],
"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": {
"$ref": "contextMenus.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. 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": {
// |launcher| isn't actually supported, this is listed here so that we can build |contexts| using the same code from chrome.contextMenus API.
"$ref": "contextMenus.ContextType"
},
"minItems": 1,
"optional": true,
"description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified."
},
"visible": {
"type": "boolean",
"optional": true,
"description": "Whether the item is visible in the menu."
},
"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": {
"$ref": "contextMenus.ItemType",
"optional": true
},
"title": {
"type": "string",
"optional": true
},
"checked": {
"type": "boolean",
"optional": true
},
"contexts": {
"type": "array",
"items": {
// |launcher| isn't actually supported, this is listed here so that we can build |contexts| using the same code from chrome.contextMenus API.
"$ref": "contextMenus.ContextType"
},
"minItems": 1,
"optional": true,
"description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified."
},
"visible": {
"type": "boolean",
"optional": true,
"description": "Whether the item is visible in the menu."
},
"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": "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
}
]
}
],
"events": [
{
"name": "onClicked",
"type": "function",
"nodoc": true,
"$ref": "contextMenusInternal.onClicked"
},
{
"name": "onShow",
"type": "function",
"description": "Fired when context menu is about to be shown. Provides the ability to cancel the context menu by calling <code>event.preventDefault()</code> from this handler.",
"nodoc": true,
"parameters": [
{
"name": "event",
"type": "object",
"properties": {
"preventDefault": {
"type": "function",
"parameters": [
]
}
}
}
]
}
]
}
]