OLD | NEW |
---|---|
(Empty) | |
1 { | |
Aaron Boodman
2011/12/07 23:30:35
How about just calling this file "extension.json"
koz (OOO until 15th September)
2011/12/09 19:24:18
Done.
| |
2 "namespace": "extension", | |
3 "types": [ | |
4 { | |
5 "id": "MessageSender", | |
6 "type": "object", | |
7 "description": "An object containing information about the script context that sent a message or request.", | |
8 "properties": { | |
9 "tab": {"$ref": "Tab", "optional": true, "description":"This property wi ll <b>only</b> be present when the connection was opened from a tab or content s cript."}, | |
10 "id": {"type": "string", "description": "The extension ID of the extensi on that opened the connection."} | |
11 } | |
12 }, | |
13 { | |
14 "id": "Event", | |
15 "type": "object", | |
16 "description": "An object which allows the addition and removal of listene rs for a Chrome event.", | |
17 "properties": { | |
18 "addListener": {"type": "function"}, | |
19 "removeListener": {"type": "function"}, | |
20 "hasListener": {"type": "function"}, | |
21 "hasListeners": {"type": "function"} | |
22 }, | |
23 "additionalProperties": { "type": "any"} | |
24 }, | |
25 { | |
26 "id": "Port", | |
27 "type": "object", | |
28 "description": "An object which allows two way communication with other pa ges.", | |
29 "properties": { | |
30 "name": {"type": "string"}, | |
31 "onDisconnect": { "$ref": "Event" }, | |
32 "onMessage": { "$ref": "Event" }, | |
33 "postMessage": {"type": "function"}, | |
34 "sender": { | |
35 "$ref": "MessageSender", | |
36 "optional": true, | |
37 "description": "This property will <b>only</b> be present on ports pas sed to onConnect/onConnectExternal listeners." | |
38 } | |
39 }, | |
40 "additionalProperties": { "type": "any"} | |
41 } | |
42 ], | |
43 "properties": { | |
44 "lastError": { | |
45 "type": "object", | |
46 "optional": true, | |
47 "unprivileged": true, | |
48 "description": "Set for the lifetime of a callback if an ansychronous exte nsion api has resulted in an error. If no error has occured lastError will be <v ar>undefined</var>.", | |
49 "properties": { | |
50 "message": { "type": "string", "description": "Description of the error that has taken place." } | |
51 } | |
52 }, | |
53 "inIncognitoContext": { | |
54 "type": "boolean", | |
55 "optional": true, | |
56 "unprivileged": true, | |
57 "description": "True for content scripts running inside incognito tabs, an d for extension pages running inside an incognito process. The latter only appli es to extensions with 'split' incognito_behavior." | |
58 } | |
59 }, | |
60 "functions": [ | |
61 { | |
62 "name": "connect", | |
63 "type": "function", | |
64 "unprivileged": true, | |
65 "description": "Attempts to connect to other listeners within the extensio n (such as the extension's background page). This is primarily useful for conten t scripts connecting to their extension processes. Extensions may connect to con tent scripts embedded in tabs via <a href='tabs.html#method-connect'><code>chrom e.tabs.connect()</code></a>.", | |
66 "parameters": [ | |
67 {"type": "string", "name": "extensionId", "optional": true, "description ": "The extension ID of the extension you want to connect to. If omitted, defaul t is your own extension."}, | |
68 { | |
69 "type": "object", | |
70 "name": "connectInfo", | |
71 "properties": { | |
72 "name": { "type": "string", "optional": true, "description": "Will b e passed into onConnect for extension processes that are listening for the conne ction event." } | |
73 }, | |
74 "optional": true | |
75 } | |
76 ], | |
77 "returns": { | |
78 "$ref": "Port", | |
79 "description": "Port through which messages can be sent and received wit h the extension. The port's <a href='extension.html#type-Port'>onDisconnect</a> event is fired if extension does not exist. " | |
80 } | |
81 }, | |
82 { | |
83 "name": "sendRequest", | |
84 "type": "function", | |
85 "unprivileged": true, | |
86 "description": "Sends a single request to other listeners within the exten sion. Similar to chrome.extension.connect, but only sends a single request with an optional response. The <a href='extension.html#event-onRequest'>chrome.extens ion.onRequest</a> event is fired in each page of the extension.", | |
87 "parameters": [ | |
88 {"type": "string", "name": "extensionId", "optional": true, "description ": "The extension ID of the extension you want to connect to. If omitted, defaul t is your own extension."}, | |
89 { "type": "any", "name": "request" }, | |
90 { | |
91 "type": "function", | |
92 "name": "responseCallback", | |
93 "optional": true, | |
94 "parameters": [ | |
95 { | |
96 "name": "response", | |
97 "type": "any", | |
98 "description": "The JSON response object sent by the handler of th e request. If an error occurs while connecting to the extension, the callback wi ll be called with no arguments and <a href='extension.html#property-lastError'>c hrome.extension.lastError</a> will be set to the error message." | |
99 } | |
100 ] | |
101 } | |
102 ] | |
103 }, | |
104 { | |
105 "name": "getURL", | |
106 "type": "function", | |
107 "unprivileged": true, | |
108 "description": "Converts a relative path within an extension install direc tory to a fully-qualified URL.", | |
109 "parameters": [ | |
110 { | |
111 "type": "string", | |
112 "name": "path", | |
113 "description": "A path to a resource within an extension expressed rel ative to its install directory." | |
114 } | |
115 ], | |
116 "returns": { | |
117 "type": "string", | |
118 "description": "The fully-qualified URL to the resource." | |
119 } | |
120 }, | |
121 { | |
122 "name": "getViews", | |
123 "type": "function", | |
124 "description": "Returns an array of the JavaScript 'window' objects for ea ch of the pages running inside the current extension.", | |
125 "parameters": [ | |
126 { | |
127 "type": "object", | |
128 "name": "fetchProperties", | |
129 "optional": true, | |
130 "properties": { | |
131 "type": { | |
132 "type": "string", | |
133 "enum": ["tab", "infobar", "notification", "popup"], | |
134 "optional": true, | |
135 "description": "The type of view to get. If omitted, returns all v iews (including background pages and tabs). Valid values: 'tab', 'infobar', 'not ification', 'popup'." | |
136 }, | |
137 "windowId": { | |
138 "type": "integer", | |
139 "optional": true, | |
140 "description": "The window to restrict the search to. If omitted, returns all views." | |
141 } | |
142 } | |
143 } | |
144 ], | |
145 "returns": { | |
146 "type": "array", | |
147 "description": "Array of global objects", | |
148 "items": { "type": "object", "isInstanceOf": "DOMWindow", "properties": {}, "additionalProperties": { "type": "any" } } | |
149 } | |
150 }, | |
151 { | |
152 "name": "getBackgroundPage", | |
153 "type": "function", | |
154 "description": "Returns the JavaScript 'window' object for the background page running inside the current extension. Returns null if the extension has no background page.", | |
155 "parameters": [], | |
156 "returns": { | |
157 "type": "object", "isInstanceOf": "DOMWindow", "properties": {}, "additi onalProperties": { "type": "any" } | |
158 } | |
159 }, | |
160 { | |
161 "name": "getExtensionTabs", | |
162 "nodoc": true, | |
163 "type": "function", | |
164 "description": "Deprecated. Please use getViews({type: 'TAB'}). Returns an array of the JavaScript 'window' objects for each of the tabs running inside th e current extension. If windowId is specified, returns only the 'window' objects of tabs attached to the specified window.", | |
165 "parameters": [ | |
166 {"type": "integer", "name": "windowId", "optional": true} | |
167 ], | |
168 "returns": { | |
169 "type": "array", | |
170 "description": "Array of global window objects", | |
171 "items": { "type": "object", "isInstanceOf": "DOMWindow", "properties": {}, "additionalProperties": { "type": "any" } } | |
172 } | |
173 }, | |
174 { | |
175 "name": "isAllowedIncognitoAccess", | |
176 "type": "function", | |
177 "description": "Retrieves the state of the extension's access to Incognito -mode (as determined by the user-controlled 'Allowed in Incognito' checkbox.", | |
178 "min_version": "12.0.706.0", | |
179 "parameters": [ | |
180 { | |
181 "type": "function", | |
182 "name": "callback", | |
183 "parameters": [ | |
184 { | |
185 "name": "isAllowedAccess", | |
186 "type": "boolean", | |
187 "description": "True if the extension has access to Incognito mode , false otherwise." | |
188 } | |
189 ] | |
190 } | |
191 ] | |
192 }, | |
193 { | |
194 "name": "isAllowedFileSchemeAccess", | |
195 "type": "function", | |
196 "description": "Retrieves the state of the extension's access to the 'file ://' scheme (as determined by the user-controlled 'Allow access to File URLs' ch eckbox.", | |
197 "min_version": "12.0.706.0", | |
198 "parameters": [ | |
199 { | |
200 "type": "function", | |
201 "name": "callback", | |
202 "parameters": [ | |
203 { | |
204 "name": "isAllowedAccess", | |
205 "type": "boolean", | |
206 "description": "True if the extension can access the 'file://' sch eme, false otherwise." | |
207 } | |
208 ] | |
209 } | |
210 ] | |
211 }, | |
212 { | |
213 "name": "setUpdateUrlData", | |
214 "type": "function", | |
215 "description": "Sets the value of the ap CGI parameter used in the extensi on's update URL. This value is ignored for extensions that are hosted in the Ch rome Extension Gallery.", | |
216 "parameters": [ | |
217 {"type": "string", "name": "data", "maxLength": 1024} | |
218 ] | |
219 } | |
220 ], | |
221 "events": [ | |
222 { | |
223 "name": "onConnect", | |
224 "type": "function", | |
225 "unprivileged": true, | |
226 "description": "Fired when a connection is made from either an extension p rocess or a content script.", | |
227 "parameters": [ | |
228 {"$ref": "Port", "name": "port"} | |
229 ] | |
230 }, | |
231 { | |
232 "name": "onConnectExternal", | |
233 "type": "function", | |
234 "description": "Fired when a connection is made from another extension.", | |
235 "parameters": [ | |
236 {"$ref": "Port", "name": "port"} | |
237 ] | |
238 }, | |
239 { | |
240 "name": "onRequest", | |
241 "type": "function", | |
242 "unprivileged": true, | |
243 "description": "Fired when a request is sent from either an extension proc ess or a content script.", | |
244 "parameters": [ | |
245 {"name": "request", "type": "any", "description": "The request sent by t he calling script."}, | |
246 {"name": "sender", "$ref": "MessageSender" }, | |
247 {"name": "sendResponse", "type": "function", "description": "Function to call (at most once) when you have a response. The argument should be any JSON-i fiable object, or undefined if there is no response. If you have more than one < code>onRequest</code> listener in the same document, then only one may send a re sponse." } | |
248 ] | |
249 }, | |
250 { | |
251 "name": "onRequestExternal", | |
252 "type": "function", | |
253 "description": "Fired when a request is sent from another extension.", | |
254 "parameters": [ | |
255 {"name": "request", "type": "any", "description": "The request sent by t he calling script."}, | |
256 {"name": "sender", "$ref": "MessageSender" }, | |
257 {"name": "sendResponse", "type": "function", "description": "Function to call when you have a response. The argument should be any JSON-ifiable object, or undefined if there is no response." } | |
258 ] | |
259 } | |
260 ] | |
261 } | |
OLD | NEW |