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", "contextMenus"],
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",
53 "$ref": "contextMenus.ItemType",
55 "description": "The type of menu item. Defaults to 'normal' if not specified."
60 "description": "The unique ID to assign to this item. Cannot be the same as another ID for this webview."
65 "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\"."
70 "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."
75 // |launcher| isn't actually supported, this is listed here so that we can build |contexts| using the same code from chrome.contextMenus API.
76 "$ref": "contextMenus.ContextType"
80 "description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified."
85 "description": "A function that will be called back when the menu item is clicked.",
89 "$ref": "contextMenusInternal.OnClickData",
90 "description": "Information about the item clicked and the context where the click happened."
96 { "type": "integer" },
100 "description": "The ID of a parent menu item; this makes the item a child of a previously added item."
102 "documentUrlPatterns": {
104 "items": {"type": "string"},
106 "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>."
108 "targetUrlPatterns": {
110 "items": {"type": "string"},
112 "description": "Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of anchor tags."
117 "description": "Whether this context menu item is enabled or disabled. Defaults to true."
125 "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.",
131 "name": "contextMenusUpdate",
133 "description": "Updates a previously created context menu item.",
137 "name": "instanceId",
142 { "type": "integer" },
146 "description": "The ID of the item to update."
149 "name": "updateProperties",
150 "description": "The properties to update. Accepts the same values as the create function.",
153 "$ref": "contextMenus.ItemType",
167 // |launcher| isn't actually supported, this is listed here so that we can build |contexts| using the same code from chrome.contextMenus API.
168 "$ref": "contextMenus.ContextType"
172 "description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified."
180 { "type": "integer" },
184 "description": "Note: You cannot change an item to be a child of one of its own descendants."
186 "documentUrlPatterns": {
188 "items": {"type": "string"},
191 "targetUrlPatterns": {
193 "items": {"type": "string"},
207 "description": "Called when the context menu has been updated."
212 "name": "contextMenusRemove",
214 "description": "Removes a context menu item.",
218 "name": "instanceId",
223 { "type": "integer" },
226 "name": "menuItemId",
227 "description": "The ID of the context menu item to remove."
234 "description": "Called when the context menu has been removed."
239 "name": "contextMenusRemoveAll",
241 "description": "Removes all context menu items added by this webview.",
245 "name": "instanceId",
253 "description": "Called when removal is complete."
258 "name": "showContextMenu",
263 "name": "instanceId",
264 "description": "The instance ID of the guest <webview> process. This not exposed to developers through the API."
269 "description": "The strictly increasing request counter that serves as ID for the context menu. This not exposed to developers through the API."
273 "name": "itemsToShow",
274 "items": {"$ref": "ContextMenuItem"},
275 "description": "Items to be shown in the context menu. These are top level items as opposed to children items.",
286 "$ref": "contextMenusInternal.onClicked"
291 "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.",