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": "extensions/browser/api/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        }
49      },
50      {
51        "id": "RemovalOptions",
52        "type": "object",
53        "description": "Options that determine exactly what data will be removed.",
54        "properties": {
55          "since": {
56            "type": "number",
57            "optional": true,
58            "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)."
59          }
60        }
61      }
62    ],
63    "functions": [
64      {
65        "name": "executeScript",
66        "type": "function",
67        "description": "Injects JavaScript code into a <webview> page.",
68        "parameters": [
69          {
70            "type": "integer",
71            "name": "instanceId",
72            "description": "The instance ID of the guest <webview> process."
73          },
74          {
75            "type": "string",
76            "name": "src",
77            "description": "The src of the guest <webview> tag."
78          },
79          {
80            "$ref": "extensionTypes.InjectDetails",
81            "name": "details",
82            "description": "Details of the script to run."
83          },
84          {
85            "type": "function",
86            "name": "callback",
87            "optional": true,
88            "description": "Called after all the JavaScript has been executed.",
89            "parameters": [
90              {
91                "name": "result",
92                "optional": true,
93                "type": "array",
94                "items": {"type": "any", "minimum": 0},
95                "description": "The result of the script in every injected frame."
96              }
97            ]
98          }
99        ]
100      },
101      {
102        "name": "insertCSS",
103        "type": "function",
104        "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.",
105        "parameters": [
106          {
107            "type": "integer",
108            "name": "instanceId",
109            "description": "The instance ID of the guest <webview> process."
110          },
111          {
112            "type": "string",
113            "name": "src",
114            "description": "The src of the guest <webview> tag."
115          },
116          {
117            "$ref": "extensionTypes.InjectDetails",
118            "name": "details",
119            "description": "Details of the CSS text to insert."
120          },
121          {
122            "type": "function",
123            "name": "callback",
124            "optional": true,
125            "description": "Called when all the CSS has been inserted.",
126            "parameters": []
127          }
128        ]
129      },
130      {
131        "name": "captureVisibleRegion",
132        "type": "function",
133        "description": "Captures the visible area of the currently loaded page inside <webview>.",
134        "parameters": [
135          {
136            "type": "integer",
137            "name": "instanceId",
138            "description": "The instance ID of the guest <webview> process."
139          },
140          {
141            "$ref": "extensionTypes.ImageDetails",
142            "name": "options",
143            "optional": true
144          },
145          {
146            "type": "function", "name": "callback", "parameters": [
147              {"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."}
148            ]
149          }
150        ]
151      },
152      {
153        "name": "setZoom",
154        "type": "function",
155        "parameters": [
156          {
157            "type": "integer",
158            "name": "instanceId",
159            "description": "The instance ID of the guest <webview> process."
160          },
161          {
162            "type": "number",
163            "name": "zoomFactor",
164            "description" : "The new zoom factor."
165          },
166          {
167            "type": "function",
168            "name": "callback",
169            "description": "Called after the zoom message has been sent to the guest process.",
170            "optional": true,
171            "parameters": []
172          }
173        ]
174      },
175      {
176        "name": "getZoom",
177        "type": "function",
178        "parameters": [
179          {
180            "type": "integer",
181            "name": "instanceId",
182            "description": "The instance ID of the guest <webview> process."
183          },
184          {
185            "type": "function",
186            "name": "callback",
187            "description": "Called after the current zoom factor is retreived.",
188            "parameters": [
189              {
190                "type": "number",
191                "name": "zoomFactor",
192                "description": "The current zoom factor."
193              }
194            ]
195          }
196        ]
197      },
198      {
199        "name": "find",
200        "type": "function",
201        "description": "Initiates a find-in-page request.",
202        "parameters": [
203          {
204            "type": "integer",
205            "name": "instanceId",
206            "description": "The instance ID of the guest <webview> process."
207          },
208          {
209            "type": "string",
210            "name": "searchText",
211            "description": "The string to find in the page."
212          },
213          {
214            "type": "object",
215            "name": "options",
216            "optional": true,
217            "properties": {
218              "backward": {
219                "type": "boolean",
220                "description": "Flag to find matches in reverse order.",
221                "optional": true
222              },
223              "matchCase": {
224                "type": "boolean",
225                "description": "Flag to match |searchText| with case-sensitivity.",
226                "optional": true
227              }
228            }
229          },
230          {
231            "type": "function",
232            "name": "callback",
233            "description": "Called after all find results have been returned for this find request.",
234            "optional": true,
235            "parameters": [
236              {
237                "type": "object",
238                "name": "results",
239                "optional": true,
240                "properties": {
241                  "numberOfMatches": {
242                    "type": "integer",
243                    "description": "The number of times |searchText| was matched on the page."
244                  },
245                  "activeMatchOrdinal": {
246                    "type": "integer",
247                    "description": "The ordinal number of the current match."
248                  },
249                  "selectionRect": {
250                    "type": "object",
251                    "description": "Describes a rectangle around the active match.",
252                    "properties": {
253                      "left": {
254                        "type": "integer"
255                      },
256                      "top": {
257                        "type": "integer"
258                      },
259                      "width": {
260                        "type": "integer"
261                      },
262                      "height": {
263                        "type": "integer"
264                      }
265                    }
266                  },
267                  "canceled": {
268                    "type": "boolean",
269                    "description": "Indicates whether this find request was canceled."
270                  }
271                }
272              }
273            ]
274          }
275        ]
276      },
277      {
278        "name": "stopFinding",
279        "type": "function",
280        "description": "Ends the current find session (clearing all highlighting) and cancels all find requests in progress.",
281        "parameters": [
282          {
283            "type": "integer",
284            "name": "instanceId",
285            "description": "The instance ID of the guest <webview> process."
286          },
287          {
288            "type": "string",
289            "name": "action",
290            "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.",
291            "optional": true,
292            "enum": ["clear", "keep", "activate"]
293          }
294        ]
295      },
296      {
297        "name": "go",
298        "type": "function",
299        "parameters": [
300          {
301            "type": "integer",
302            "name": "instanceId"
303          },
304          {
305            "type": "integer",
306            "name": "relativeIndex"
307          }
308        ]
309      },
310      {
311        "name": "overrideUserAgent",
312        "type": "function",
313        "parameters": [
314          {
315            "type": "integer",
316            "name": "instanceId"
317          },
318          {
319            "type": "string",
320            "name": "userAgentOverride"
321          }
322        ]
323      },
324      {
325        "name": "reload",
326        "type": "function",
327        "parameters": [
328          {
329            "type": "integer",
330            "name": "instanceId"
331          }
332        ]
333      },
334      {
335        "name": "setAllowTransparency",
336        "type": "function",
337        "parameters": [
338          {
339            "type": "integer",
340            "name": "instanceId"
341          },
342          {
343            "type": "boolean",
344            "name": "allow"
345          }
346        ]
347      },
348      {
349        "name": "setName",
350        "type": "function",
351        "parameters": [
352          {
353            "type": "integer",
354            "name": "instanceId"
355          },
356          {
357            "type": "string",
358            "name": "frameName"
359          }
360        ]
361      },
362      {
363        "name": "setPermission",
364        "type": "function",
365        "parameters": [
366          {
367            "type": "integer",
368            "name": "instanceId"
369          },
370          {
371            "type": "integer",
372            "name": "requestId"
373          },
374          {
375            "type": "string",
376            "name": "action",
377            "enum": ["allow", "deny", "default"]
378          },
379          {
380            "type": "string",
381            "name": "userInput",
382            "optional": true
383          },
384          {
385            "type": "function",
386            "name": "callback",
387            "optional": true,
388            "parameters": [
389              {
390                "name": "allowed",
391                "type": "boolean"
392              }
393            ]
394          }
395        ]
396      },
397      {
398        "name": "navigate",
399        "type": "function",
400        "parameters": [
401          {
402            "type": "integer",
403            "name": "instanceId"
404          },
405          {
406            "type": "string",
407            "name": "src"
408          }
409        ]
410      },
411      {
412        "name": "stop",
413        "type": "function",
414        "parameters": [
415          {
416            "type": "integer",
417            "name": "instanceId"
418          }
419        ]
420      },
421      {
422        "name": "terminate",
423        "type": "function",
424        "parameters": [
425          {
426            "type": "integer",
427            "name": "instanceId"
428          }
429        ]
430      },
431      {
432        "name": "clearData",
433        "type": "function",
434        "description": "Clears various types of browsing data stored in a storage partition of a <webview>.",
435        "parameters": [
436          {
437            "type": "integer",
438            "name": "instanceId",
439            "description": "The instance ID of the guest <webview> process."
440          },
441          {
442            "$ref": "RemovalOptions",
443            "name": "options"
444          },
445          {
446            "name": "dataToRemove",
447            "$ref": "DataTypeSet",
448            "description": "The set of data types to remove."
449          },
450          {
451            "name": "callback",
452            "type": "function",
453            "description": "Called when deletion has completed.",
454            "optional": true,
455            "parameters": []
456          }
457        ]
458      }
459    ]
460  }
461]
462