1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 "namespace": "chromeWebViewInternal",
10 "implemented_in": "chrome/browser/extensions/api/web_view/chrome_web_view_internal_api.h"
12 "dependencies": ["contextMenusInternal"],
15 "id": "ContextMenuItem",
17 "description": "An item in the context menu.",
21 "description": "label of the item",
26 "description": "id of the input item"
33 "name": "contextMenusCreate",
37 { "type": "integer" },
40 "description": "The ID of the newly created item."
50 "name": "createProperties",
54 "enum": ["normal", "checkbox", "radio", "separator"],
56 "description": "The type of menu item. Defaults to 'normal' if not specified."
61 "description": "The unique ID to assign to this item. Cannot be the same as another ID for this webview."
66 "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\"."
71 "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."
77 // |launcher| isn't actually supported, this is listed here so that we can build |contexts| using the same code from chrome.contextMenus API.
78 "enum": ["all", "page", "frame", "selection", "link", "editable", "image", "video", "audio", "launcher", "browser_action", "page_action"]
82 "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>."
87 "description": "A function that will be called back when the menu item is clicked.",
91 "$ref": "contextMenusInternal.OnClickData",
92 "description": "Information about the item clicked and the context where the click happened."
98 { "type": "integer" },
102 "description": "The ID of a parent menu item; this makes the item a child of a previously added item."
104 "documentUrlPatterns": {
106 "items": {"type": "string"},
108 "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>."
110 "targetUrlPatterns": {
112 "items": {"type": "string"},
114 "description": "Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of anchor tags."
119 "description": "Whether this context menu item is enabled or disabled. Defaults to true."
127 "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.",
133 "name": "contextMenusUpdate",
135 "description": "Updates a previously created context menu item.",
139 "name": "instanceId",
144 { "type": "integer" },
148 "description": "The ID of the item to update."
151 "name": "updateProperties",
152 "description": "The properties to update. Accepts the same values as the create function.",
156 "enum": ["normal", "checkbox", "radio", "separator"],
171 // |launcher| isn't actually supported, this is listed here so that we can build |contexts| using the same code from chrome.contextMenus API.
172 "enum": ["all", "page", "frame", "selection", "link", "editable", "image", "video", "audio", "launcher", "browser_action", "page_action"]
176 "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>."
184 { "type": "integer" },
188 "description": "Note: You cannot change an item to be a child of one of its own descendants."
190 "documentUrlPatterns": {
192 "items": {"type": "string"},
195 "targetUrlPatterns": {
197 "items": {"type": "string"},
211 "description": "Called when the context menu has been updated."
216 "name": "contextMenusRemove",
218 "description": "Removes a context menu item.",
222 "name": "instanceId",
227 { "type": "integer" },
230 "name": "menuItemId",
231 "description": "The ID of the context menu item to remove."
238 "description": "Called when the context menu has been removed."
243 "name": "contextMenusRemoveAll",
245 "description": "Removes all context menu items added by this webview.",
249 "name": "instanceId",
257 "description": "Called when removal is complete."
262 "name": "showContextMenu",
267 "name": "instanceId",
268 "description": "The instance ID of the guest <webview> process. This not exposed to developers through the API."
273 "description": "The strictly increasing request counter that serves as ID for the context menu. This not exposed to developers through the API."
277 "name": "itemsToShow",
278 "items": {"$ref": "ContextMenuItem"},
279 "description": "Items to be shown in the context menu. These are top level items as opposed to children items.",
290 "$ref": "contextMenusInternal.onClicked"