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. 4 5 [ 6 { 7 "namespace": "contextMenusInternal", 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 "types": [ 10 { 11 "id": "OnClickData", 12 "type": "object", 13 "description": "Information sent when a context menu item is clicked.", 14 "properties": { 15 "menuItemId": { 16 "choices": [ 17 { "type": "integer" }, 18 { "type": "string" } 19 ], 20 "description": "The ID of the menu item that was clicked." 21 }, 22 "parentMenuItemId": { 23 "choices": [ 24 { "type": "integer" }, 25 { "type": "string" } 26 ], 27 "optional": true, 28 "description": "The parent ID, if any, for the item clicked." 29 }, 30 "mediaType": { 31 "type": "string", 32 "optional": true, 33 "description": "One of 'image', 'video', or 'audio' if the context menu was activated on one of these types of elements." 34 }, 35 "linkUrl": { 36 "type": "string", 37 "optional": true, 38 "description": "If the element is a link, the URL it points to." 39 }, 40 "srcUrl": { 41 "type": "string", 42 "optional": true, 43 "description": "Will be present for elements with a 'src' URL." 44 }, 45 "pageUrl": { 46 "type": "string", 47 "optional": true, 48 "description": "The URL of the page where the menu item was clicked. This property is not set if the click occured in a context where there is no current page, such as in a launcher context menu." 49 }, 50 "frameUrl": { 51 "type": "string", 52 "optional": true, 53 "description": " The URL of the frame of the element where the context menu was clicked, if it was in a frame." 54 }, 55 "selectionText": { 56 "type": "string", 57 "optional": true, 58 "description": "The text for the context selection, if any." 59 }, 60 "editable": { 61 "type": "boolean", 62 "description": "A flag indicating whether the element is editable (text input, textarea, etc.)." 63 }, 64 "wasChecked": { 65 "type": "boolean", 66 "optional": true, 67 "description": "A flag indicating the state of a checkbox or radio item before it was clicked." 68 }, 69 "checked": { 70 "type": "boolean", 71 "optional": true, 72 "description": "A flag indicating the state of a checkbox or radio item after it is clicked." 73 } 74 } 75 } 76 ], 77 "events": [ 78 { 79 "name": "onClicked", 80 "type": "function", 81 "description": "Fired when a context menu item is clicked.", 82 "parameters": [ 83 { 84 "name": "info", 85 "$ref": "OnClickData", 86 "description": "Information about the item clicked and the context where the click happened." 87 }, 88 { 89 "name": "tab", 90 "$ref": "tabs.Tab", 91 "description": "The details of the tab where the click took place. If the click did not take place in a tab, this parameter will be missing.", 92 "optional": true 93 } 94 ] 95 } 96 ] 97 } 98 ] 99