| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 [ | 5 [ |
| 6 { | 6 { |
| 7 "namespace": "contextMenus", | 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.", | 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.", |
| 9 "properties": { | 9 "properties": { |
| 10 "ACTION_MENU_TOP_LEVEL_LIMIT": { | 10 "ACTION_MENU_TOP_LEVEL_LIMIT": { |
| 11 "value": 6, | 11 "value": 6, |
| 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." | 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." |
| 13 } | 13 } |
| 14 }, | 14 }, |
| 15 "types": [ |
| 16 { |
| 17 "id": "ContextType", |
| 18 "type": "string", |
| 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 'launc
her'. The 'launcher' context is only supported by apps and is used to add menu i
tems to the context menu that appears when clicking on the app icon in the launc
her/taskbar/dock/etc. Different platforms might put limitations on what is actua
lly supported in a launcher context menu." |
| 21 }, |
| 22 { |
| 23 "id": "ItemType", |
| 24 "type": "string", |
| 25 "enum": ["normal", "checkbox", "radio", "separator"], |
| 26 "description": "The type of menu item." |
| 27 } |
| 28 ], |
| 15 "functions": [ | 29 "functions": [ |
| 16 { | 30 { |
| 17 "name": "create", | 31 "name": "create", |
| 18 "type": "function", | 32 "type": "function", |
| 19 "description": "Creates a new context menu item. Note that if an error o
ccurs during creation, you may not find out until the creation callback fires (t
he details will be in chrome.runtime.lastError).", | 33 "description": "Creates a new context menu item. Note that if an error o
ccurs during creation, you may not find out until the creation callback fires (t
he details will be in chrome.runtime.lastError).", |
| 20 "returns": { | 34 "returns": { |
| 21 "choices": [ | 35 "choices": [ |
| 22 { "type": "integer" }, | 36 { "type": "integer" }, |
| 23 { "type": "string" } | 37 { "type": "string" } |
| 24 ], | 38 ], |
| 25 "description": "The ID of the newly created item." | 39 "description": "The ID of the newly created item." |
| 26 }, | 40 }, |
| 27 "parameters": [ | 41 "parameters": [ |
| 28 { | 42 { |
| 29 "type": "object", | 43 "type": "object", |
| 30 "name": "createProperties", | 44 "name": "createProperties", |
| 31 "properties": { | 45 "properties": { |
| 32 "type": { | 46 "type": { |
| 33 "type": "string", | 47 "$ref": "ItemType", |
| 34 "enum": ["normal", "checkbox", "radio", "separator"], | |
| 35 "optional": true, | 48 "optional": true, |
| 36 "description": "The type of menu item. Defaults to 'normal' if n
ot specified." | 49 "description": "The type of menu item. Defaults to 'normal' if n
ot specified." |
| 37 }, | 50 }, |
| 38 "id": { | 51 "id": { |
| 39 "type": "string", | 52 "type": "string", |
| 40 "optional": true, | 53 "optional": true, |
| 41 "description": "The unique ID to assign to this item. Mandatory
for event pages. Cannot be the same as another ID for this extension." | 54 "description": "The unique ID to assign to this item. Mandatory
for event pages. Cannot be the same as another ID for this extension." |
| 42 }, | 55 }, |
| 43 "title": { | 56 "title": { |
| 44 "type": "string", | 57 "type": "string", |
| 45 "optional": true, | 58 "optional": true, |
| 46 "description": "The text to be displayed in the item; this is <e
m>required</em> unless <em>type</em> is 'separator'. When the context is 'select
ion', you can use <code>%s</code> within the string to show the selected text. F
or 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 \"Tr
anslate 'cool' to Pig Latin\"." | 59 "description": "The text to be displayed in the item; this is <e
m>required</em> unless <em>type</em> is 'separator'. When the context is 'select
ion', you can use <code>%s</code> within the string to show the selected text. F
or 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 \"Tr
anslate 'cool' to Pig Latin\"." |
| 47 }, | 60 }, |
| 48 "checked": { | 61 "checked": { |
| 49 "type": "boolean", | 62 "type": "boolean", |
| 50 "optional": true, | 63 "optional": true, |
| 51 "description": "The initial state of a checkbox or radio item: t
rue for selected and false for unselected. Only one radio item can be selected a
t a time in a given group of radio items." | 64 "description": "The initial state of a checkbox or radio item: t
rue for selected and false for unselected. Only one radio item can be selected a
t a time in a given group of radio items." |
| 52 }, | 65 }, |
| 53 "contexts": { | 66 "contexts": { |
| 54 "type": "array", | 67 "type": "array", |
| 55 "items": { | 68 "items": { |
| 56 "type": "string", | 69 "$ref": "ContextType" |
| 57 "enum": ["all", "page", "frame", "selection", "link", "editabl
e", "image", "video", "audio", "launcher", "browser_action", "page_action"] | |
| 58 }, | 70 }, |
| 59 "minItems": 1, | 71 "minItems": 1, |
| 60 "optional": true, | 72 "optional": true, |
| 61 "description": "List of contexts this menu item will appear in.
Defaults to ['page'] if not specified. Specifying ['all'] is equivalent to the c
ombination of all other contexts except for 'launcher'. The 'launcher' context i
s 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. Differen
t platforms might put limitations on what is actually supported in a launcher co
ntext menu." | 73 "description": "List of contexts this menu item will appear in.
Defaults to ['page'] if not specified." |
| 62 }, | 74 }, |
| 63 "onclick": { | 75 "onclick": { |
| 64 "type": "function", | 76 "type": "function", |
| 65 "optional": true, | 77 "optional": true, |
| 66 "description": "A function that will be called back when the men
u item is clicked. Event pages cannot use this; instead, they should register a
listener for chrome.contextMenus.onClicked.", | 78 "description": "A function that will be called back when the men
u item is clicked. Event pages cannot use this; instead, they should register a
listener for chrome.contextMenus.onClicked.", |
| 67 "parameters": [ | 79 "parameters": [ |
| 68 { | 80 { |
| 69 "name": "info", | 81 "name": "info", |
| 70 "$ref": "contextMenusInternal.OnClickData", | 82 "$ref": "contextMenusInternal.OnClickData", |
| 71 "description": "Information about the item clicked and the c
ontext where the click happened." | 83 "description": "Information about the item clicked and the c
ontext where the click happened." |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 ], | 138 ], |
| 127 "name": "id", | 139 "name": "id", |
| 128 "description": "The ID of the item to update." | 140 "description": "The ID of the item to update." |
| 129 }, | 141 }, |
| 130 { | 142 { |
| 131 "type": "object", | 143 "type": "object", |
| 132 "name": "updateProperties", | 144 "name": "updateProperties", |
| 133 "description": "The properties to update. Accepts the same values as
the create function.", | 145 "description": "The properties to update. Accepts the same values as
the create function.", |
| 134 "properties": { | 146 "properties": { |
| 135 "type": { | 147 "type": { |
| 136 "type": "string", | 148 "$ref": "ItemType", |
| 137 "enum": ["normal", "checkbox", "radio", "separator"], | |
| 138 "optional": true | 149 "optional": true |
| 139 }, | 150 }, |
| 140 "title": { | 151 "title": { |
| 141 "type": "string", | 152 "type": "string", |
| 142 "optional": true | 153 "optional": true |
| 143 }, | 154 }, |
| 144 "checked": { | 155 "checked": { |
| 145 "type": "boolean", | 156 "type": "boolean", |
| 146 "optional": true | 157 "optional": true |
| 147 }, | 158 }, |
| 148 "contexts": { | 159 "contexts": { |
| 149 "type": "array", | 160 "type": "array", |
| 150 "items": { | 161 "items": { |
| 151 "type": "string", | 162 "$ref": "ContextType" |
| 152 "enum": ["all", "page", "frame", "selection", "link", "editabl
e", "image", "video", "audio", "launcher", "browser_action", "page_action"] | |
| 153 }, | 163 }, |
| 154 "minItems": 1, | 164 "minItems": 1, |
| 155 "optional": true | 165 "optional": true |
| 156 }, | 166 }, |
| 157 "onclick": { | 167 "onclick": { |
| 158 "type": "function", | 168 "type": "function", |
| 159 "optional": true | 169 "optional": true |
| 160 }, | 170 }, |
| 161 "parentId": { | 171 "parentId": { |
| 162 "choices": [ | 172 "choices": [ |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 ], | 240 ], |
| 231 "events": [ | 241 "events": [ |
| 232 { | 242 { |
| 233 "name": "onClicked", | 243 "name": "onClicked", |
| 234 "type": "function", | 244 "type": "function", |
| 235 "$ref": "contextMenusInternal.onClicked" | 245 "$ref": "contextMenusInternal.onClicked" |
| 236 } | 246 } |
| 237 ] | 247 ] |
| 238 } | 248 } |
| 239 ] | 249 ] |
| OLD | NEW |