Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / common / extensions / api / chrome_web_view_internal.json
blob0797d47eca429946d4eac55d0932851413efc0f1
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.
6   {
7     "namespace": "chromeWebViewInternal",
8     "description": "none",
9     "compiler_options": {
10       "implemented_in": "chrome/browser/extensions/api/web_view/chrome_web_view_internal_api.h"
11     },
12     "dependencies": ["contextMenusInternal", "contextMenus"],
13     "types": [
14       {
15         "id": "ContextMenuItem",
16         "type": "object",
17         "description": "An item in the context menu.",
18         "properties": {
19           "label": {
20             "type": "string",
21             "description": "label of the item",
22             "optional": true
23           },
24           "commandId": {
25             "type": "integer",
26             "description": "id of the input item"
27           }
28         }
29       }
30     ],
31     "functions": [
32       {
33         "name": "contextMenusCreate",
34         "type": "function",
35         "returns": {
36           "choices": [
37             { "type": "integer" },
38             { "type": "string" }
39           ],
40           "description": "The ID of the newly created item."
41         },
42         "parameters": [
43           {
44             "type": "integer",
45             "name": "instanceId",
46             "nodoc": true
47           },
48           {
49             "type": "object",
50             "name": "createProperties",
51             "properties": {
52               "type": {
53                 "$ref": "contextMenus.ItemType",
54                 "optional": true,
55                 "description": "The type of menu item. Defaults to 'normal' if not specified."
56               },
57               "id": {
58                 "type": "string",
59                 "optional": true,
60                 "description": "The unique ID to assign to this item. Cannot be the same as another ID for this webview."
61               },
62               "title": {
63                 "type": "string",
64                 "optional": true,
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\"."
66               },
67               "checked": {
68                 "type": "boolean",
69                 "optional": true,
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."
71               },
72               "contexts": {
73                 "type": "array",
74                 "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"
77                 },
78                 "minItems": 1,
79                 "optional": true,
80                 "description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified."
81               },
82               "onclick": {
83                 "type": "function",
84                 "optional": true,
85                 "description": "A function that will be called back when the menu item is clicked.",
86                 "parameters": [
87                   {
88                     "name": "info",
89                     "$ref": "contextMenusInternal.OnClickData",
90                     "description": "Information about the item clicked and the context where the click happened."
91                   }
92                 ]
93               },
94               "parentId": {
95                 "choices": [
96                   { "type": "integer" },
97                   { "type": "string" }
98                 ],
99                 "optional": true,
100                 "description": "The ID of a parent menu item; this makes the item a child of a previously added item."
101               },
102               "documentUrlPatterns": {
103                 "type": "array",
104                 "items": {"type": "string"},
105                 "optional": true,
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>."
107               },
108               "targetUrlPatterns": {
109                 "type": "array",
110                 "items": {"type": "string"},
111                 "optional": true,
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."
113               },
114               "enabled": {
115                 "type": "boolean",
116                 "optional": true,
117                 "description": "Whether this context menu item is enabled or disabled. Defaults to true."
118               }
119             }
120           },
121           {
122             "type": "function",
123             "name": "callback",
124             "optional": 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.",
126             "parameters": []
127           }
128         ]
129       },
130       {
131         "name": "contextMenusUpdate",
132         "type": "function",
133         "description": "Updates a previously created context menu item.",
134         "parameters": [
135           {
136             "type": "integer",
137             "name": "instanceId",
138             "nodoc": true
139           },
140           {
141             "choices": [
142               { "type": "integer" },
143               { "type": "string" }
144             ],
145             "name": "id",
146             "description": "The ID of the item to update."
147           },
148           { "type": "object",
149             "name": "updateProperties",
150             "description": "The properties to update. Accepts the same values as the create function.",
151             "properties": {
152               "type": {
153                 "$ref": "contextMenus.ItemType",
154                 "optional": true
155               },
156               "title": {
157                 "type": "string",
158                 "optional": true
159               },
160               "checked": {
161                 "type": "boolean",
162                 "optional": true
163               },
164               "contexts": {
165                 "type": "array",
166                 "items": {
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"
169                 },
170                 "minItems": 1,
171                 "optional": true,
172                 "description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified."
173               },
174               "onclick": {
175                 "type": "function",
176                 "optional": true
177               },
178               "parentId": {
179                 "choices": [
180                   { "type": "integer" },
181                   { "type": "string" }
182                 ],
183                 "optional": true,
184                 "description": "Note: You cannot change an item to be a child of one of its own descendants."
185               },
186               "documentUrlPatterns": {
187                 "type": "array",
188                 "items": {"type": "string"},
189                 "optional": true
190               },
191               "targetUrlPatterns": {
192                 "type": "array",
193                 "items": {"type": "string"},
194                 "optional": true
195               },
196               "enabled": {
197                 "type": "boolean",
198                 "optional": true
199               }
200             }
201           },
202           {
203             "type": "function",
204             "name": "callback",
205             "optional": true,
206             "parameters": [],
207             "description": "Called when the context menu has been updated."
208           }
209         ]
210       },
211       {
212         "name": "contextMenusRemove",
213         "type": "function",
214         "description": "Removes a context menu item.",
215         "parameters": [
216           {
217             "type": "integer",
218             "name": "instanceId",
219             "nodoc": true
220           },
221           {
222             "choices": [
223               { "type": "integer" },
224               { "type": "string" }
225             ],
226             "name": "menuItemId",
227             "description": "The ID of the context menu item to remove."
228           },
229           {
230             "type": "function",
231             "name": "callback",
232             "optional": true,
233             "parameters": [],
234             "description": "Called when the context menu has been removed."
235           }
236         ]
237       },
238       {
239         "name": "contextMenusRemoveAll",
240         "type": "function",
241         "description": "Removes all context menu items added by this webview.",
242         "parameters": [
243           {
244             "type": "integer",
245             "name": "instanceId",
246             "nodoc": true
247           },
248           {
249             "type": "function",
250             "name": "callback",
251             "optional": true,
252             "parameters": [],
253             "description": "Called when removal is complete."
254           }
255         ]
256       },
257       {
258         "name": "showContextMenu",
259         "type": "function",
260         "parameters": [
261           {
262             "type": "integer",
263             "name": "instanceId",
264             "description": "The instance ID of the guest &lt;webview&gt; process. This not exposed to developers through the API."
265           },
266           {
267             "type": "integer",
268             "name": "requestId",
269             "description": "The strictly increasing request counter that serves as ID for the context menu. This not exposed to developers through the API."
270           },
271           {
272             "type": "array",
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.",
276             "optional": true
277           }
278         ]
279       }
280     ],
281     "events": [
282       {
283         "name": "onClicked",
284         "type": "function",
285         "nodoc": true,
286         "$ref": "contextMenusInternal.onClicked"
287       },
288       {
289         "name": "onShow",
290         "type": "function",
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.",
292         "nodoc": true,
293         "parameters": [
294           {
295             "name": "event",
296             "type": "object",
297             "properties": {
298               "preventDefault": {
299                 "type": "function",
300                 "parameters": [
301                 ]
302               }
303             }
304           }
305         ]
306       }
307     ]
308   }