Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / common / api / web_view_internal.json
bloba33f500d22142a7e2e673e35b5131783ac1d7a02
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": "webViewInternal",
8     "description": "none",
9     "compiler_options": {
10       "implemented_in": "extensions/browser/api/guest_view/web_view/web_view_internal_api.h"
11     },
12     "types": [
13       {
14         "id": "DataTypeSet",
15         "type": "object",
16         "description": "A set of data types. Missing data types are interpreted as <code>false</code>.",
17         "properties": {
18           "appcache": {
19             "type": "boolean",
20             "optional": true,
21             "description": "Websites' appcaches."
22           },
23           "cookies": {
24             "type": "boolean",
25             "optional": true,
26             "description": "The browser's cookies."
27           },
28           "fileSystems": {
29             "type": "boolean",
30             "optional": true,
31             "description": "Websites' file systems."
32           },
33           "indexedDB": {
34             "type": "boolean",
35             "optional": true,
36             "description": "Websites' IndexedDB data."
37           },
38           "localStorage": {
39             "type": "boolean",
40             "optional": true,
41             "description": "Websites' local storage data."
42           },
43           "webSQL": {
44             "type": "boolean",
45             "optional": true,
46             "description": "Websites' WebSQL data."
47           },
48           "cache": {
49             "type": "boolean",
50             "optional": true,
51             "description": "The Websites' cache data. Note: when removing data, this clears the <em>entire</em> cache: it is not limited to the range you specify."
52           }
53         }
54       },
55       {
56         "id": "RemovalOptions",
57         "type": "object",
58         "description": "Options that determine exactly what data will be removed.",
59         "properties": {
60           "since": {
61             "type": "number",
62             "optional": true,
63             "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)."
64           }
65         }
66       },
67       {
68         "id": "ZoomMode",
69         "type": "string",
70         "description": "Defines the how zooming is handled in the webview.",
71         "enum": [
72           {
73             "name": "per-origin",
74             "description": "Zoom changes will persist in the zoomed page's origin, i.e. all other webviews in the same partition that are navigated to that same origin will be zoomed as well. Moreover, <code>per-origin</code> zoom changes are saved with the origin, meaning that when navigating to other pages in the same origin, they will all be zoomed to the same zoom factor."
75           },
76           {
77             "name": "per-view",
78             "description": "Zoom changes only take effect in this webview, and zoom changes in other webviews will not affect the zooming of this webview. Also, <code>per-view</code> zoom changes are reset on navigation; navigating a webview will always load pages with their per-origin zoom factors (within the scope of the partition)."
79           },
80           {
81             "name": "disabled",
82             "description": "Disables all zooming in the webview. The content will revert to the default zoom level, and all attempted zoom changes will be ignored."
83           }
84         ]
85       },
86       {
87         "id": "StopFindingAction",
88         "type": "string",
89         "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.",
90         "enum": ["clear", "keep", "activate"]
91       },
92       {
93         "id": "SetPermissionAction",
94         "type": "string",
95         "enum": ["allow", "deny", "default"]
96       },
97       {
98         "id": "InjectionItems",
99         "type": "object",
100         "description": "The type of injection item: code or a set of files.",
101         "properties": {
102           "code": {
103             "type": "string",
104             "optional": true,
105             "description": "JavaScript code or CSS to be injected into matching pages."
106           },
107           "files": {
108             "type": "array",
109             "items": { "type": "string"},
110             "optional": true,
111             "description": "The list of JavaScript or CSS files to be injected into matching pages. These are injected in the order they appear in this array."
112           }
113         }
114       },
115       {
116         "id": "ContentScriptDetails",
117         "type": "object",
118         "description": "Details of the content script to inject.",
119         "properties": {
120           "name": {
121             "type": "string",
122             "description": "The name of the content script to inject."
123           },
124           "matches": {
125             "type": "array",
126             "items": { "type": "string"},
127             "description": "Specifies which pages this content script will be injected into."
128           },
129           "exclude_matches": {
130             "type": "array",
131             "items": { "type": "string"},
132             "optional": true,
133             "description": "Excludes pages that this content script would otherwise be injected into."
134           },
135           "match_about_blank": {
136             "type": "boolean",
137             "optional": true,
138             "description": "Whether to insert the content script on about:blank and about:srcdoc. Content scripts will only be injected on pages when their inherit URL is matched by one of the declared patterns in the matches field. The inherit URL is the URL of the document that created the frame or window. Content scripts cannot be inserted in sandboxed frames."
139           },
140           "css": {
141             "$ref": "InjectionItems",
142             "optional": true,
143             "description": "The CSS code or a list of CSS files to be injected into matching pages. These are injected in the order they appear, before any DOM is constructed or displayed for the page."
144           },
145           "js": {
146             "$ref": "InjectionItems",
147             "optional": true,
148             "description": "The JavaScript code or a list of JavaScript files to be injected into matching pages. These are injected in the order they appear."
149           },
150           "run_at": {
151             "$ref": "extensionTypes.RunAt",
152             "optional": true,
153             "description": "The soonest that the JavaScript or CSS will be injected into the tab. Defaults to \"document_idle\"."
154           },
155           "all_frames": {
156             "type": "boolean",
157             "optional": true,
158             "description": "If allFrames is <code>true</code>, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's <code>false</code> and is only injected into the top frame."
159           },
160           "include_globs": {
161             "type": "array",
162             "items": { "type": "string"},
163             "optional": true,
164             "description": "Applied after matches to include only those URLs that also match this glob. Intended to emulate the @include Greasemonkey keyword."
165           },
166           "exclude_globs": {
167             "type": "array",
168             "items": { "type": "string"},
169             "optional": true,
170             "description": "Applied after matches to exclude URLs that match this glob. Intended to emulate the @exclude Greasemonkey keyword."
171           }
172         },
173         "required": ["name", "matches"]
174       }
175     ],
176     "functions": [
177       {
178         "name": "executeScript",
179         "type": "function",
180         "description": "Injects JavaScript code into a <webview> page.",
181         "parameters": [
182           {
183             "type": "integer",
184             "name": "instanceId",
185             "description": "The instance ID of the guest <webview> process."
186           },
187           {
188             "type": "string",
189             "name": "src",
190             "description": "The src of the guest <webview> tag."
191           },
192           {
193             "$ref": "extensionTypes.InjectDetails",
194             "name": "details",
195             "description": "Details of the script to run."
196           },
197           {
198             "type": "function",
199             "name": "callback",
200             "optional": true,
201             "description": "Called after all the JavaScript has been executed.",
202             "parameters": [
203               {
204                 "name": "result",
205                 "optional": true,
206                 "type": "array",
207                 "items": {"type": "any", "minimum": 0},
208                 "description": "The result of the script in every injected frame."
209               }
210             ]
211           }
212         ]
213       },
214       {
215         "name": "insertCSS",
216         "type": "function",
217         "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.",
218         "parameters": [
219           {
220             "type": "integer",
221             "name": "instanceId",
222             "description": "The instance ID of the guest <webview> process."
223           },
224           {
225             "type": "string",
226             "name": "src",
227             "description": "The src of the guest <webview> tag."
228           },
229           {
230             "$ref": "extensionTypes.InjectDetails",
231             "name": "details",
232             "description": "Details of the CSS text to insert."
233           },
234           {
235             "type": "function",
236             "name": "callback",
237             "optional": true,
238             "description": "Called when all the CSS has been inserted.",
239             "parameters": []
240           }
241         ]
242       },
243       {
244         "name": "addContentScripts",
245         "type": "function",
246         "description": "Adds content scripts into a <webview> page. For details, see the <a href='/extensions/content_scripts#pi'>programmatic injection</a> section of the content scripts doc.",
247         "parameters": [
248           {
249             "type": "integer",
250             "name": "instanceId",
251             "description": "The instance ID of the guest <webview> process."
252           },
253           {
254             "type": "array",
255             "name": "contentScriptList",
256             "items": {
257               "$ref": "ContentScriptDetails",
258               "name": "contentScriptDetails"
259             },
260             "description": "Details of the content scripts to add.",
261             "minItems": 1
262           }
263         ]
264       },
265       {
266         "name": "removeContentScripts",
267         "type": "function",
268         "description": "Removes specified content scripts from a <webview> page. For details, see the <a href='/extensions/content_scripts#pi'>programmatic injection</a> section of the content scripts doc.",
269         "parameters": [
270           {
271             "type": "integer",
272             "name": "instanceId",
273             "description": "The instance ID of the guest <webview> process."
274           },
275           {
276             "type": "array",
277             "name": "scriptNameList",
278             "items": {
279               "type": "string",
280               "description": "The name of a content script that will be removed."
281             },
282             "optional": true,
283             "description": "A list of names of content scripts that will be removed. If the list is empty, all the content scripts added to the <webview> page will be removed."
284           }
285         ]
286       },
287       {
288         "name": "setZoom",
289         "type": "function",
290         "parameters": [
291           {
292             "type": "integer",
293             "name": "instanceId",
294             "description": "The instance ID of the guest <webview> process."
295           },
296           {
297             "type": "number",
298             "name": "zoomFactor",
299             "description" : "The new zoom factor."
300           },
301           {
302             "type": "function",
303             "name": "callback",
304             "description": "Called after the zoom message has been sent to the guest process.",
305             "optional": true,
306             "parameters": []
307           }
308         ]
309       },
310       {
311         "name": "getZoom",
312         "type": "function",
313         "parameters": [
314           {
315             "type": "integer",
316             "name": "instanceId",
317             "description": "The instance ID of the guest <webview> process."
318           },
319           {
320             "type": "function",
321             "name": "callback",
322             "description": "Called after the current zoom factor is retrieved.",
323             "parameters": [
324               {
325                 "type": "number",
326                 "name": "zoomFactor",
327                 "description": "The current zoom factor."
328               }
329             ]
330           }
331         ]
332       },
333       {
334         "name": "setZoomMode",
335         "type": "function",
336         "description": "Sets the zoom mode of the webview.",
337         "parameters": [
338           {
339             "type": "integer",
340             "name": "instanceId",
341             "description": "The instance ID of the guest <webview> process."
342           },
343           {
344             "$ref": "ZoomMode",
345             "name": "ZoomMode",
346             "description": "Defines how zooming is handled in the webview."
347           },
348           {
349             "type": "function",
350             "name": "callback",
351             "description": "Called after the zoom mode has been changed.",
352             "optional": true,
353             "parameters": []
354           }
355         ]
356       },
357       {
358         "name": "getZoomMode",
359         "type": "function",
360         "description": "Gets the current zoom mode.",
361         "parameters": [
362           {
363             "type": "integer",
364             "name": "instanceId",
365             "description": "The instance ID of the guest <webview> process."
366           },
367           {
368             "type": "function",
369             "name": "callback",
370             "description": "Called with the webview's current zoom mode.",
371             "parameters": [
372               {
373                 "$ref": "ZoomMode",
374                 "name": "ZoomMode",
375                 "description": "The webview's current zoom mode."
376               }
377             ]
378           }
379         ]
380       },
381       {
382         "name": "find",
383         "type": "function",
384         "description": "Initiates a find-in-page request.",
385         "parameters": [
386           {
387             "type": "integer",
388             "name": "instanceId",
389             "description": "The instance ID of the guest <webview> process."
390           },
391           {
392             "type": "string",
393             "name": "searchText",
394             "description": "The string to find in the page."
395           },
396           {
397             "type": "object",
398             "name": "options",
399             "optional": true,
400             "properties": {
401               "backward": {
402                 "type": "boolean",
403                 "description": "Flag to find matches in reverse order.",
404                 "optional": true
405               },
406               "matchCase": {
407                 "type": "boolean",
408                 "description": "Flag to match |searchText| with case-sensitivity.",
409                 "optional": true
410               }
411             }
412           },
413           {
414             "type": "function",
415             "name": "callback",
416             "description": "Called after all find results have been returned for this find request.",
417             "optional": true,
418             "parameters": [
419               {
420                 "type": "object",
421                 "name": "results",
422                 "optional": true,
423                 "properties": {
424                   "numberOfMatches": {
425                     "type": "integer",
426                     "description": "The number of times |searchText| was matched on the page."
427                   },
428                   "activeMatchOrdinal": {
429                     "type": "integer",
430                     "description": "The ordinal number of the current match."
431                   },
432                   "selectionRect": {
433                     "type": "object",
434                     "description": "Describes a rectangle around the active match.",
435                     "properties": {
436                       "left": {
437                         "type": "integer"
438                       },
439                       "top": {
440                         "type": "integer"
441                       },
442                       "width": {
443                         "type": "integer"
444                       },
445                       "height": {
446                         "type": "integer"
447                       }
448                     }
449                   },
450                   "canceled": {
451                     "type": "boolean",
452                     "description": "Indicates whether this find request was canceled."
453                   }
454                 }
455               }
456             ]
457           }
458         ]
459       },
460       {
461         "name": "stopFinding",
462         "type": "function",
463         "description": "Ends the current find session (clearing all highlighting) and cancels all find requests in progress.",
464         "parameters": [
465           {
466             "type": "integer",
467             "name": "instanceId",
468             "description": "The instance ID of the guest <webview> process."
469           },
470           {
471             "$ref": "StopFindingAction",
472             "name": "action",
473             "description": "Determines what to do with the active match after the find session has ended.",
474             "optional": true
475           }
476         ]
477       },
478       {
479         "name": "loadDataWithBaseUrl",
480         "type": "function",
481         "description": "Loads a data URL with a specified base URL used for relative links. Optionally, a virtual URL can be provided to be shown to the user instead of the data URL.",
482         "parameters": [
483           {
484             "type": "integer",
485             "name": "instanceId",
486             "description": "The instance ID of the guest <webview> process."
487           },
488           {
489             "type": "string",
490             "name": "dataUrl",
491             "description" : "The data URL to load."
492           },
493           {
494             "type": "string",
495             "name": "baseUrl",
496             "description": "The base URL that will be used for relative links."
497           },
498           {
499             "type": "string",
500             "name": "virtualUrl",
501             "description": "The URL that will be displayed to the user.",
502             "optional": true
503           },
504           {
505             "type": "function",
506             "name": "callback",
507             "description": "Called internally for the purpose of reporting errors to console.error().",
508             "parameters": []
509           }
510         ]
511       },
512       {
513         "name": "go",
514         "type": "function",
515         "parameters": [
516           {
517             "type": "integer",
518             "name": "instanceId"
519           },
520           {
521             "type": "integer",
522             "name": "relativeIndex"
523           },
524           {
525             "type": "function",
526             "name": "callback",
527             "optional": true,
528             "parameters": [
529               {
530                 "name": "success",
531                 "type": "boolean",
532                 "description": "Indicates whether the navigation was successful."
533               }
534             ]
535           }
536         ]
537       },
538       {
539         "name": "overrideUserAgent",
540         "type": "function",
541         "parameters": [
542           {
543             "type": "integer",
544             "name": "instanceId"
545           },
546           {
547             "type": "string",
548             "name": "userAgentOverride"
549           }
550         ]
551       },
552       {
553         "name": "reload",
554         "type": "function",
555         "parameters": [
556           {
557             "type": "integer",
558             "name": "instanceId"
559           }
560         ]
561       },
562       {
563         "name": "setAllowTransparency",
564         "type": "function",
565         "parameters": [
566           {
567             "type": "integer",
568             "name": "instanceId"
569           },
570           {
571             "type": "boolean",
572             "name": "allow"
573           }
574         ]
575       },
576       {
577         "name": "setAllowScaling",
578         "type": "function",
579         "parameters": [
580           {
581             "type": "integer",
582             "name": "instanceId"
583           },
584           {
585             "type": "boolean",
586             "name": "allow"
587           }
588         ]
589       },
590       {
591         "name": "setName",
592         "type": "function",
593         "parameters": [
594           {
595             "type": "integer",
596             "name": "instanceId"
597           },
598           {
599             "type": "string",
600             "name": "frameName"
601           }
602         ]
603       },
604       {
605         "name": "setPermission",
606         "type": "function",
607         "parameters": [
608           {
609             "type": "integer",
610             "name": "instanceId"
611           },
612           {
613             "type": "integer",
614             "name": "requestId"
615           },
616           {
617             "$ref": "SetPermissionAction",
618             "name": "action"
619           },
620           {
621             "type": "string",
622             "name": "userInput",
623             "optional": true
624           },
625           {
626             "type": "function",
627             "name": "callback",
628             "optional": true,
629             "parameters": [
630               {
631                 "name": "allowed",
632                 "type": "boolean"
633               }
634             ]
635           }
636         ]
637       },
638       {
639         "name": "navigate",
640         "type": "function",
641         "parameters": [
642           {
643             "type": "integer",
644             "name": "instanceId"
645           },
646           {
647             "type": "string",
648             "name": "src"
649           }
650         ]
651       },
652       {
653         "name": "stop",
654         "type": "function",
655         "parameters": [
656           {
657             "type": "integer",
658             "name": "instanceId"
659           }
660         ]
661       },
662       {
663         "name": "terminate",
664         "type": "function",
665         "parameters": [
666           {
667             "type": "integer",
668             "name": "instanceId"
669           }
670         ]
671       },
672       {
673         "name": "clearData",
674         "type": "function",
675         "description": "Clears various types of browsing data stored in a storage partition of a <webview>.",
676         "parameters": [
677           {
678             "type": "integer",
679             "name": "instanceId",
680             "description": "The instance ID of the guest <webview> process."
681           },
682           {
683             "$ref": "RemovalOptions",
684             "name": "options"
685           },
686           {
687             "name": "dataToRemove",
688             "$ref": "DataTypeSet",
689             "description": "The set of data types to remove."
690           },
691           {
692             "name": "callback",
693             "type": "function",
694             "description": "Called when deletion has completed.",
695             "optional": true,
696             "parameters": []
697           }
698         ]
699       }
700     ]
701   }