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.",
13 "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).",
16 { "type": "integer" },
19 "description": "The ID of the newly created item."
24 "name": "createProperties",
28 "enum": ["normal", "checkbox", "radio", "separator"],
30 "description": "The type of menu item. Defaults to 'normal' if not specified."
35 "description": "The unique ID to assign to this item. Mandatory for event pages. Cannot be the same as another ID for this extension."
40 "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\"."
45 "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."
51 "enum": ["all", "page", "frame", "selection", "link", "editable", "image", "video", "audio", "launcher"]
55 "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 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."
60 "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.",
64 "$ref": "contextMenusInternal.OnClickData",
65 "description": "Information about the item clicked and the context where the click happened."
70 "description": "The details of the tab where the click took place."
76 { "type": "integer" },
80 "description": "The ID of a parent menu item; this makes the item a child of a previously added item."
82 "documentUrlPatterns": {
84 "items": {"type": "string"},
86 "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.html'>Match Patterns</a>."
88 "targetUrlPatterns": {
90 "items": {"type": "string"},
92 "description": "Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of anchor tags."
97 "description": "Whether this context menu item is enabled or disabled. Defaults to true."
105 "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.",
113 "description": "Updates a previously created context menu item.",
117 { "type": "integer" },
121 "description": "The ID of the item to update."
125 "name": "updateProperties",
126 "description": "The properties to update. Accepts the same values as the create function.",
130 "enum": ["normal", "checkbox", "radio", "separator"],
145 "enum": ["all", "page", "frame", "selection", "link", "editable", "image", "video", "audio", "launcher"]
156 { "type": "integer" },
160 "description": "Note: You cannot change an item to be a child of one of its own descendants."
162 "documentUrlPatterns": {
164 "items": {"type": "string"},
167 "targetUrlPatterns": {
169 "items": {"type": "string"},
183 "description": "Called when the context menu has been updated."
190 "description": "Removes a context menu item.",
194 { "type": "integer" },
197 "name": "menuItemId",
198 "description": "The ID of the context menu item to remove."
205 "description": "Called when the context menu has been removed."
212 "description": "Removes all context menu items added by this extension.",
219 "description": "Called when removal is complete."
228 "$ref": "contextMenusInternal.onClicked"