OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 [ | 5 [ |
6 { | 6 { |
7 "namespace": "webview", | 7 "namespace": "webview", |
8 "nodoc": true, | 8 "nodoc": true, |
9 "types": [ | |
10 // TODO(fsamuel): We should be usng tabs.InjectDetails. However, due to a | |
11 // bug in the JSON compiler, we are currently copying-and-pasting this | |
12 // type: https://crbug.com/171726. | |
13 { | |
14 "id": "InjectDetails", | |
15 "type": "object", | |
16 "description": "Details of the script or CSS to inject. Either the code
or the file property must be set, but both may not be set at the same time.", | |
17 "properties": { | |
18 "code": {"type": "string", "optional": true, "description": "JavaScrip
t or CSS code to inject."}, | |
19 "file": {"type": "string", "optional": true, "description": "JavaScrip
t or CSS file to inject."}, | |
20 "allFrames": {"type": "boolean", "optional": true, "description": "If
allFrames is <code>true</code>, implies that the JavaScript or CSS should be inj
ected into all frames of current page. By default, it's <code>false</code> and w
ill only be injected into the top frame."}, | |
21 "runAt": { | |
22 "type": "string", | |
23 "optional": true, | |
24 "enum": ["document_start", "document_end", "document_idle"], | |
25 "description": "The soonest that the JavaScript or CSS will be injec
ted into the tab. Defaults to \"document_idle\"." | |
26 } | |
27 } | |
28 } | |
29 ], | |
30 "functions": [ | 9 "functions": [ |
31 { | 10 { |
32 "name": "executeScript", | 11 "name": "executeScript", |
33 "type": "function", | 12 "type": "function", |
34 "description": "Injects JavaScript code into a <webview> page.", | 13 "description": "Injects JavaScript code into a <webview> page.", |
35 "parameters": [ | 14 "parameters": [ |
36 { | 15 { |
37 "type": "integer", | 16 "type": "integer", |
38 "name": "processId", | 17 "name": "processId", |
39 "description": "The process ID of the guest <webview> process." | 18 "description": "The process ID of the guest <webview> process." |
40 }, | 19 }, |
41 { | 20 { |
42 "type": "integer", | 21 "type": "integer", |
43 "name": "routeId", | 22 "name": "routeId", |
44 "description": "The route ID of the guest <webview> renderer." | 23 "description": "The route ID of the guest <webview> renderer." |
45 }, | 24 }, |
46 { | 25 { |
47 "$ref": "webview.InjectDetails", | 26 "$ref": "tabs.InjectDetails", |
48 "name": "details", | 27 "name": "details", |
49 "description": "Details of the script to run." | 28 "description": "Details of the script to run." |
50 }, | 29 }, |
51 { | 30 { |
52 "type": "function", | 31 "type": "function", |
53 "name": "callback", | 32 "name": "callback", |
54 "optional": true, | 33 "optional": true, |
55 "description": "Called after all the JavaScript has been executed.", | 34 "description": "Called after all the JavaScript has been executed.", |
56 "parameters": [ | 35 "parameters": [ |
57 { | 36 { |
58 "name": "result", | 37 "name": "result", |
59 "optional": true, | 38 "optional": true, |
60 "type": "array", | 39 "type": "array", |
61 "items": {"type": "any", "minimum": 0}, | 40 "items": {"type": "any", "minimum": 0}, |
62 "description": "The result of the script in every injected frame
." | 41 "description": "The result of the script in every injected frame
." |
63 } | 42 } |
64 ] | 43 ] |
65 } | 44 } |
66 ] | 45 ] |
67 } | 46 } |
68 ] | 47 ] |
69 } | 48 } |
70 ] | 49 ] |
71 | 50 |
OLD | NEW |