1 // Copyright (c) 2012 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": "contextMenus",
8 "description": "Use the <code>chrome.contextMenus</code> API to add items to Google Chrome's context menu. You can choose what types of objects your context menu additions apply to, such as images, hyperlinks, and pages.",
10 "ACTION_MENU_TOP_LEVEL_LIMIT": {
12 "description": "The maximum number of top level extension items that can be added to an extension action context menu. Any items beyond this limit will be ignored."
19 "enum": ["all", "page", "frame", "selection", "link", "editable", "image", "video", "audio", "launcher", "browser_action", "page_action"],
20 "description": "The different contexts a menu can appear in. Specifying ['all'] is equivalent to the combination of all other contexts except for 'launcher'. The 'launcher' context is only supported by apps and is used to add menu items to the context menu that appears when clicking on the app icon in the launcher/taskbar/dock/etc. Different platforms might put limitations on what is actually supported in a launcher context menu."
25 "enum": ["normal", "checkbox", "radio", "separator"],
26 "description": "The type of menu item."
33 "description": "Creates a new context menu item. Note that if an error occurs during creation, you may not find out until the creation callback fires (the details will be in chrome.runtime.lastError).",
36 { "type": "integer" },
39 "description": "The ID of the newly created item."
44 "name": "createProperties",
49 "description": "The type of menu item. Defaults to 'normal' if not specified."
54 "description": "The unique ID to assign to this item. Mandatory for event pages. Cannot be the same as another ID for this extension."
59 "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\"."
64 "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."
73 "description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified."
78 "description": "A function that will be called back when the menu item is clicked. Event pages cannot use this; instead, they should register a listener for chrome.contextMenus.onClicked.",
82 "$ref": "contextMenusInternal.OnClickData",
83 "description": "Information about the item clicked and the context where the click happened."
88 "description": "The details of the tab where the click took place.",
89 "extension_types": ["extension", "legacy_packaged_app"]
95 { "type": "integer" },
99 "description": "The ID of a parent menu item; this makes the item a child of a previously added item."
101 "documentUrlPatterns": {
103 "items": {"type": "string"},
105 "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>."
107 "targetUrlPatterns": {
109 "items": {"type": "string"},
111 "description": "Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of anchor tags."
116 "description": "Whether this context menu item is enabled or disabled. Defaults to true."
124 "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.",
132 "description": "Updates a previously created context menu item.",
136 { "type": "integer" },
140 "description": "The ID of the item to update."
144 "name": "updateProperties",
145 "description": "The properties to update. Accepts the same values as the create function.",
162 "$ref": "ContextType"
173 { "type": "integer" },
177 "description": "Note: You cannot change an item to be a child of one of its own descendants."
179 "documentUrlPatterns": {
181 "items": {"type": "string"},
184 "targetUrlPatterns": {
186 "items": {"type": "string"},
200 "description": "Called when the context menu has been updated."
207 "description": "Removes a context menu item.",
211 { "type": "integer" },
214 "name": "menuItemId",
215 "description": "The ID of the context menu item to remove."
222 "description": "Called when the context menu has been removed."
229 "description": "Removes all context menu items added by this extension.",
236 "description": "Called when removal is complete."
245 "$ref": "contextMenusInternal.onClicked"