Upstream version 10.38.222.0
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / api / web_view_internal.json
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": "webViewInternal",
8     "description": "none",
9     "compiler_options": {
10       "implemented_in": "chrome/browser/extensions/api/web_view/web_view_internal_api.h"
11     },
12     "dependencies": ["contextMenusInternal"],
13     "types": [
14       {
15         "id": "DataTypeSet",
16         "type": "object",
17         "description": "A set of data types. Missing data types are interpreted as <code>false</code>.",
18         "properties": {
19           "appcache": {
20             "type": "boolean",
21             "optional": true,
22             "description": "Websites' appcaches."
23           },
24           "cookies": {
25             "type": "boolean",
26             "optional": true,
27             "description": "The browser's cookies."
28           },
29           "fileSystems": {
30             "type": "boolean",
31             "optional": true,
32             "description": "Websites' file systems."
33           },
34           "indexedDB": {
35             "type": "boolean",
36             "optional": true,
37             "description": "Websites' IndexedDB data."
38           },
39           "localStorage": {
40             "type": "boolean",
41             "optional": true,
42             "description": "Websites' local storage data."
43           },
44           "webSQL": {
45             "type": "boolean",
46             "optional": true,
47             "description": "Websites' WebSQL data."
48           }
49         }
50       },
51       {
52         "id": "ContextMenuItem",
53         "type": "object",
54         "description": "An item in the context menu.",
55         "properties": {
56           "label": {
57             "type": "string",
58             "description": "label of the item",
59             "optional": true
60           },
61           "commandId": {
62             "type": "integer",
63             "description": "id of the input item"
64           }
65         }
66       },
67       {
68         "id": "RemovalOptions",
69         "type": "object",
70         "description": "Options that determine exactly what data will be removed.",
71         "properties": {
72           "since": {
73             "type": "number",
74             "optional": true,
75             "description": "Remove data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the <code>getTime</code> method of the JavaScript <code>Date</code> object). If absent, defaults to 0 (which would remove all browsing data)."
76           }
77         }
78       }
79     ],
80     "functions": [
81       {
82         "name": "contextMenusCreate",
83         "type": "function",
84         "returns": {
85           "choices": [
86             { "type": "integer" },
87             { "type": "string" }
88           ],
89           "description": "The ID of the newly created item."
90         },
91         "parameters": [
92           {
93             "type": "integer",
94             "name": "instanceId",
95             "nodoc": true
96           },
97           {
98             "type": "object",
99             "name": "createProperties",
100             "properties": {
101               "type": {
102                 "type": "string",
103                 "enum": ["normal", "checkbox", "radio", "separator"],
104                 "optional": true,
105                 "description": "The type of menu item. Defaults to 'normal' if not specified."
106               },
107               "id": {
108                 "type": "string",
109                 "optional": true,
110                 "description": "The unique ID to assign to this item. Cannot be the same as another ID for this webview."
111               },
112               "title": {
113                 "type": "string",
114                 "optional": true,
115                 "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\"."
116               },
117               "checked": {
118                 "type": "boolean",
119                 "optional": true,
120                 "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."
121               },
122               "contexts": {
123                 "type": "array",
124                 "items": {
125                   "type": "string",
126                   // |launcher| isn't actually supported, this is listed here so that we can build |contexts| using the same code from chrome.contextMenus API.
127                   "enum": ["all", "page", "frame", "selection", "link", "editable", "image", "video", "audio", "launcher", "browser_action", "page_action"]
128                 },
129                 "minItems": 1,
130                 "optional": true,
131                 "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 not supported for <webview>."
132               },
133               "onclick": {
134                 "type": "function",
135                 "optional": true,
136                 "description": "A function that will be called back when the menu item is clicked.",
137                 "parameters": [
138                   {
139                     "name": "info",
140                     "$ref": "contextMenusInternal.OnClickData",
141                     "description": "Information about the item clicked and the context where the click happened."
142                   }
143                 ]
144               },
145               "parentId": {
146                 "choices": [
147                   { "type": "integer" },
148                   { "type": "string" }
149                 ],
150                 "optional": true,
151                 "description": "The ID of a parent menu item; this makes the item a child of a previously added item."
152               },
153               "documentUrlPatterns": {
154                 "type": "array",
155                 "items": {"type": "string"},
156                 "optional": true,
157                 "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>."
158               },
159               "targetUrlPatterns": {
160                 "type": "array",
161                 "items": {"type": "string"},
162                 "optional": true,
163                 "description": "Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of anchor tags."
164               },
165               "enabled": {
166                 "type": "boolean",
167                 "optional": true,
168                 "description": "Whether this context menu item is enabled or disabled. Defaults to true."
169               }
170             }
171           },
172           {
173             "type": "function",
174             "name": "callback",
175             "optional": true,
176             "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.",
177             "parameters": []
178           }
179         ]
180       },
181       {
182         "name": "contextMenusUpdate",
183         "type": "function",
184         "description": "Updates a previously created context menu item.",
185         "parameters": [
186           {
187             "type": "integer",
188             "name": "instanceId",
189             "nodoc": true
190           },
191           {
192             "choices": [
193               { "type": "integer" },
194               { "type": "string" }
195             ],
196             "name": "id",
197             "description": "The ID of the item to update."
198           },
199           { "type": "object",
200             "name": "updateProperties",
201             "description": "The properties to update. Accepts the same values as the create function.",
202             "properties": {
203               "type": {
204                 "type": "string",
205                 "enum": ["normal", "checkbox", "radio", "separator"],
206                 "optional": true
207               },
208               "title": {
209                 "type": "string",
210                 "optional": true
211               },
212               "checked": {
213                 "type": "boolean",
214                 "optional": true
215               },
216               "contexts": {
217                 "type": "array",
218                 "items": {
219                   "type": "string",
220                   // |launcher| isn't actually supported, this is listed here so that we can build |contexts| using the same code from chrome.contextMenus API.
221                   "enum": ["all", "page", "frame", "selection", "link", "editable", "image", "video", "audio", "launcher", "browser_action", "page_action"]
222                 },
223                 "minItems": 1,
224                 "optional": true,
225                 "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 not supported for <webview>."
226               },
227               "onclick": {
228                 "type": "function",
229                 "optional": true
230               },
231               "parentId": {
232                 "choices": [
233                   { "type": "integer" },
234                   { "type": "string" }
235                 ],
236                 "optional": true,
237                 "description": "Note: You cannot change an item to be a child of one of its own descendants."
238               },
239               "documentUrlPatterns": {
240                 "type": "array",
241                 "items": {"type": "string"},
242                 "optional": true
243               },
244               "targetUrlPatterns": {
245                 "type": "array",
246                 "items": {"type": "string"},
247                 "optional": true
248               },
249               "enabled": {
250                 "type": "boolean",
251                 "optional": true
252               }
253             }
254           },
255           {
256             "type": "function",
257             "name": "callback",
258             "optional": true,
259             "parameters": [],
260             "description": "Called when the context menu has been updated."
261           }
262         ]
263       },
264       {
265         "name": "contextMenusRemove",
266         "type": "function",
267         "description": "Removes a context menu item.",
268         "parameters": [
269           {
270             "type": "integer",
271             "name": "instanceId",
272             "nodoc": true
273           },
274           {
275             "choices": [
276               { "type": "integer" },
277               { "type": "string" }
278             ],
279             "name": "menuItemId",
280             "description": "The ID of the context menu item to remove."
281           },
282           {
283             "type": "function",
284             "name": "callback",
285             "optional": true,
286             "parameters": [],
287             "description": "Called when the context menu has been removed."
288           }
289         ]
290       },
291       {
292         "name": "contextMenusRemoveAll",
293         "type": "function",
294         "description": "Removes all context menu items added by this webview.",
295         "parameters": [
296           {
297             "type": "integer",
298             "name": "instanceId",
299             "nodoc": true
300           },
301           {
302             "type": "function",
303             "name": "callback",
304             "optional": true,
305             "parameters": [],
306             "description": "Called when removal is complete."
307           }
308         ]
309       },
310       {
311         "name": "clearData",
312         "type": "function",
313         "description": "Clears various types of browsing data stored in a storage partition of a <webview>.",
314         "parameters": [
315           {
316             "type": "integer",
317             "name": "instanceId",
318             "description": "The instance ID of the guest <webview> process."
319           },
320           {
321             "$ref": "RemovalOptions",
322             "name": "options"
323           },
324           {
325             "name": "dataToRemove",
326             "$ref": "DataTypeSet",
327             "description": "The set of data types to remove."
328           },
329           {
330             "name": "callback",
331             "type": "function",
332             "description": "Called when deletion has completed.",
333             "optional": true,
334             "parameters": []
335           }
336         ]
337       },
338       {
339         "name": "executeScript",
340         "type": "function",
341         "description": "Injects JavaScript code into a <webview> page.",
342         "parameters": [
343           {
344             "type": "integer",
345             "name": "instanceId",
346             "description": "The instance ID of the guest <webview> process."
347           },
348           {
349             "type": "string",
350             "name": "src",
351             "description": "The src of the guest <webview> tag."
352           },
353           {
354             "$ref": "tabs.InjectDetails",
355             "name": "details",
356             "description": "Details of the script to run."
357           },
358           {
359             "type": "function",
360             "name": "callback",
361             "optional": true,
362             "description": "Called after all the JavaScript has been executed.",
363             "parameters": [
364               {
365                 "name": "result",
366                 "optional": true,
367                 "type": "array",
368                 "items": {"type": "any", "minimum": 0},
369                 "description": "The result of the script in every injected frame."
370               }
371             ]
372           }
373         ]
374       },
375       {
376         "name": "insertCSS",
377         "type": "function",
378         "description": "Injects CSS into a <webview> page. For details, see the <a href='/extensions/content_scripts#pi'>programmatic injection</a> section of the content scripts doc.",
379         "parameters": [
380           {
381             "type": "integer",
382             "name": "instanceId",
383             "description": "The instance ID of the guest <webview> process."
384           },
385           {
386             "type": "string",
387             "name": "src",
388             "description": "The src of the guest <webview> tag."
389           },
390           {
391             "$ref": "tabs.InjectDetails",
392             "name": "details",
393             "description": "Details of the CSS text to insert."
394           },
395           {
396             "type": "function",
397             "name": "callback",
398             "optional": true,
399             "description": "Called when all the CSS has been inserted.",
400             "parameters": []
401           }
402         ]
403       },
404       {
405         "name": "captureVisibleRegion",
406         "type": "function",
407         "description": "Captures the visible area of the currently loaded page inside <webview>.",
408         "parameters": [
409           {
410             "type": "integer",
411             "name": "instanceId",
412             "description": "The instance ID of the guest <webview> process."
413           },
414           {
415             "$ref": "types.ImageDetails",
416             "name": "options",
417             "optional": true
418           },
419           {
420             "type": "function", "name": "callback", "parameters": [
421               {"type": "string", "name": "dataUrl", "description": "A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display."}
422             ]
423           }
424         ]
425       },
426       {
427         "name": "setZoom",
428         "type": "function",
429         "parameters": [
430           {
431             "type": "integer",
432             "name": "instanceId",
433             "description": "The instance ID of the guest <webview> process."
434           },
435           {
436             "type": "number",
437             "name": "zoomFactor",
438             "description" : "The new zoom factor."
439           },
440           {
441             "type": "function",
442             "name": "callback",
443             "description": "Called after the zoom message has been sent to the guest process.",
444             "optional": true,
445             "parameters": []
446           }
447         ]
448       },
449       {
450         "name": "getZoom",
451         "type": "function",
452         "parameters": [
453           {
454             "type": "integer",
455             "name": "instanceId",
456             "description": "The instance ID of the guest <webview> process."
457           },
458           {
459             "type": "function",
460             "name": "callback",
461             "description": "Called after the current zoom factor is retreived.",
462             "parameters": [
463               {
464                 "type": "number",
465                 "name": "zoomFactor",
466                 "description": "The current zoom factor."
467               }
468             ]
469           }
470         ]
471       },
472       {
473         "name": "find",
474         "type": "function",
475         "description": "Initiates a find-in-page request.",
476         "parameters": [
477           {
478             "type": "integer",
479             "name": "instanceId",
480             "description": "The instance ID of the guest <webview> process."
481           },
482           {
483             "type": "string",
484             "name": "searchText",
485             "description": "The string to find in the page."
486           },
487           {
488             "type": "object",
489             "name": "options",
490             "optional": true,
491             "properties": {
492               "backward": {
493                 "type": "boolean",
494                 "description": "Flag to find matches in reverse order.",
495                 "optional": true
496               },
497               "matchCase": {
498                 "type": "boolean",
499                 "description": "Flag to match |searchText| with case-sensitivity.",
500                 "optional": true
501               }
502             }
503           },
504           {
505             "type": "function",
506             "name": "callback",
507             "description": "Called after all find results have been returned for this find request.",
508             "optional": true,
509             "parameters": [
510               {
511                 "type": "object",
512                 "name": "results",
513                 "optional": true,
514                 "properties": {
515                   "numberOfMatches": {
516                     "type": "integer",
517                     "description": "The number of times |searchText| was matched on the page."
518                   },
519                   "activeMatchOrdinal": {
520                     "type": "integer",
521                     "description": "The ordinal number of the current match."
522                   },
523                   "selectionRect": {
524                     "type": "object",
525                     "description": "Describes a rectangle around the active match.",
526                     "properties": {
527                       "left": {
528                         "type": "integer"
529                       },
530                       "top": {
531                         "type": "integer"
532                       },
533                       "width": {
534                         "type": "integer"
535                       },
536                       "height": {
537                         "type": "integer"
538                       }
539                     }
540                   },
541                   "canceled": {
542                     "type": "boolean",
543                     "description": "Indicates whether this find request was canceled."
544                   }
545                 }
546               }
547             ]
548           }
549         ]
550       },
551       {
552         "name": "stopFinding",
553         "type": "function",
554         "description": "Ends the current find session (clearing all highlighting) and cancels all find requests in progress.",
555         "parameters": [
556           {
557             "type": "integer",
558             "name": "instanceId",
559             "description": "The instance ID of the guest <webview> process."
560           },
561           {
562             "type": "string",
563             "name": "action",
564             "description": "Determines what to do with the active match after the find session has ended. 'clear' will clear the highlighting over the active match; 'keep' will keep the active match highlighted; 'activate' will keep the active match highlighted and simulate a user click on that match.",
565             "optional": true,
566             "enum": ["clear", "keep", "activate"]
567           }
568         ]
569       },
570       {
571         "name": "go",
572         "type": "function",
573         "parameters": [
574           {
575             "type": "integer",
576             "name": "instanceId"
577           },
578           {
579             "type": "integer",
580             "name": "relativeIndex"
581           }
582         ]
583       },
584       {
585         "name": "overrideUserAgent",
586         "type": "function",
587         "parameters": [
588           {
589             "type": "integer",
590             "name": "instanceId"
591           },
592           {
593             "type": "string",
594             "name": "userAgentOverride"
595           }
596         ]
597       },
598       {
599         "name": "reload",
600         "type": "function",
601         "parameters": [
602           {
603             "type": "integer",
604             "name": "instanceId"
605           }
606         ]
607       },
608       {
609         "name": "setName",
610         "type": "function",
611         "parameters": [
612           {
613             "type": "integer",
614             "name": "instanceId"
615           },
616           {
617             "type": "string",
618             "name": "frameName"
619           }
620         ]
621       },
622       {
623         "name": "setPermission",
624         "type": "function",
625         "parameters": [
626           {
627             "type": "integer",
628             "name": "instanceId"
629           },
630           {
631             "type": "integer",
632             "name": "requestId"
633           },
634           {
635             "type": "string",
636             "name": "action",
637             "enum": ["allow", "deny", "default"]
638           },
639           {
640             "type": "string",
641             "name": "userInput",
642             "optional": true
643           },
644           {
645             "type": "function",
646             "name": "callback",
647             "optional": true,
648             "parameters": [
649               {
650                 "name": "allowed",
651                 "type": "boolean"
652               }
653             ]
654           }
655         ]
656       },
657       {
658         "name": "navigate",
659         "type": "function",
660         "parameters": [
661           {
662             "type": "integer",
663             "name": "instanceId"
664           },
665           {
666             "type": "string",
667             "name": "src"
668           }
669         ]
670       },
671       {
672         "name": "showContextMenu",
673         "type": "function",
674         "parameters": [
675           {
676             "type": "integer",
677             "name": "instanceId",
678             "description": "The instance ID of the guest &lt;webview&gt; process. This not exposed to developers through the API."
679           },
680           {
681             "type": "integer",
682             "name": "requestId",
683             "description": "The strictly increasing request counter that serves as ID for the context menu. This not exposed to developers through the API."
684           },
685           {
686             "type": "array",
687             "name": "itemsToShow",
688             "items": {"$ref": "ContextMenuItem"},
689             "description": "Items to be shown in the context menu. These are top level items as opposed to children items.",
690             "optional": true
691           }
692         ]
693       },
694       {
695         "name": "stop",
696         "type": "function",
697         "parameters": [
698           {
699             "type": "integer",
700             "name": "instanceId"
701           }
702         ]
703       },
704       {
705         "name": "terminate",
706         "type": "function",
707         "parameters": [
708           {
709             "type": "integer",
710             "name": "instanceId"
711           }
712         ]
713       }
714     ],
715     "events": [
716       {
717         "name": "onClicked",
718         "type": "function",
719         "nodoc": true,
720         "$ref": "contextMenusInternal.onClicked"
721       }
722     ]
723   }
724 ]