- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / api / devtools / inspected_window.json
1 // Copyright (c) 2012 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": "devtools.inspectedWindow",
8     "description": "Use the <code>chrome.devtools.inspectedWindow</code> API to interact with the inspected window: obtain the tab ID for the inspected page, evaluate the code in the context of the inspected window, reload the page, or obtain the list of resources within the page.",
9     "nocompile": true,
10     "types": [
11       {
12         "id": "Resource",
13         "type": "object",
14         "description": "A resource within the inspected page, such as a document, a script, or an image.",
15         "properties": {
16           "url": {
17             "type": "string",
18             "description": "The URL of the resource."
19           }
20         },
21         "functions": [
22           {
23             "name": "getContent",
24             "type": "function",
25             "description": "Gets the content of the resource.",
26             "parameters": [
27               {
28                 "name": "callback",
29                 "type": "function",
30                 "description": "A function that receives resource content when the request completes.",
31                 "parameters": [
32                   {
33                     "name": "content",
34                     "type": "string",
35                     "description": "Content of the resource (potentially encoded)."
36                   },
37                   {
38                     "name": "encoding",
39                     "type": "string",
40                     "description": "Empty if content is not encoded, encoding name otherwise. Currently, only base64 is supported."
41                   }
42                 ]
43               }
44             ]
45           },
46           {
47             "name": "setContent",
48             "type": "function",
49             "description": "Sets the content of the resource.",
50             "parameters": [
51               {
52                 "name": "content",
53                 "type": "string",
54                 "description": "New content of the resource. Only resources with the text type are currently supported."
55               },
56               {
57                 "name": "commit",
58                 "type": "boolean",
59                 "description": "True if the user has finished editing the resource, and the new content of the resource should be persisted; false if this is a minor change sent in progress of the user editing the resource."
60               },
61               {
62                 "name": "callback",
63                 "type": "function",
64                 "description": "A function called upon request completion.",
65                 "optional": true,
66                 "parameters": [
67                   {
68                     "name": "error",
69                     "type": "object",
70                     "additionalProperties": {"type": "any"},
71                     "optional": true,
72                     "description": "Set to undefined if the resource content was set successfully; describes error otherwise."
73                   }
74                 ]
75               }
76             ]
77           }
78         ]
79       }
80     ],
81     "properties": {
82       "tabId": {
83         "description": "The ID of the tab being inspected. This ID may be used with chrome.tabs.* API.",
84         "type": "integer"
85       }
86     },
87     "functions": [
88       {
89         "name": "eval",
90         "type": "function",
91         "description": "Evaluates a JavaScript expression in the context of the main frame of the inspected page. The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown.",
92         "parameters": [
93           {
94             "name": "expression",
95             "type": "string",
96             "description": "An expression to evaluate."
97           },
98           {
99             "name": "callback",
100             "type": "function",
101             "description": "A function called when evaluation completes.",
102             "optional": true,
103             "parameters": [
104               {
105                 "name": "result",
106                 "type": "object",
107                 "additionalProperties": {"type": "any"},
108                 "description": "The result of evaluation."
109               },
110               {
111                 "name": "isException",
112                 "type": "boolean",
113                 "description": "Set if an exception was caught while evaluating the expression."
114               }
115             ]
116           }
117         ]
118       },
119       {
120         "name": "reload",
121         "type": "function",
122         "description": "Reloads the inspected page.",
123         "parameters": [
124           {
125             "type": "object",
126             "name": "reloadOptions",
127             "optional": true,
128             "properties": {
129               "ignoreCache": {
130                 "type": "boolean",
131                 "optional": true,
132                 "description": "When true, the loader will ignore the cache for all inspected page resources loaded before the <code>load</code> event is fired. The effect is similar to pressing Ctrl+Shift+R in the inspected window or within the Developer Tools window."
133               },
134               "userAgent": {
135                 "type": "string",
136                 "optional": true,
137                 "description": "If specified, the string will override the value of the <code>User-Agent</code> HTTP header that's sent while loading the resources of the inspected page. The string will also override the value of the <code>navigator.userAgent</code> property that's returned to any scripts that are running within the inspected page."
138               },
139               "injectedScript": {
140                 "type": "string",
141                 "optional": true,
142                 "description": "If specified, the script will be injected into every frame of the inspected page immediately upon load, before any of the frame's scripts. The script will not be injected after subsequent reloads&mdash;for example, if the user presses Ctrl+R."
143               }
144             }
145           }
146         ]
147       },
148       {
149         "name": "getResources",
150         "type": "function",
151         "description": "Retrieves the list of resources from the inspected page.",
152         "parameters": [
153           {
154             "name": "callback",
155             "type": "function",
156             "description": "A function that receives the list of resources when the request completes.",
157             "parameters": [
158               {
159                 "name": "resources",
160                 "type": "array",
161                 "items": { "$ref": "Resource" },
162                 "description": "The resources within the page."
163               }
164             ]
165           }
166         ]
167       }
168     ],
169     "events": [
170       {
171         "name": "onResourceAdded",
172         "description": "Fired when a new resource is added to the inspected page.",
173         "parameters": [
174           {
175             "name": "resource",
176             "$ref": "Resource"
177           }
178         ]
179       },
180       {
181         "name": "onResourceContentCommitted",
182         "description": "Fired when a new revision of the resource is committed (e.g. user saves an edited version of the resource in the Developer Tools).",
183         "parameters": [
184           {
185             "name": "resource",
186             "$ref": "Resource"
187           },
188           {
189             "name": "content",
190             "type": "string",
191             "description": "New content of the resource."
192           }
193         ]
194       }
195     ]
196   }
197 ]