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.
5 // This file contains various hacks needed to inform JSCompiler of various
6 // WebKit- and Chrome-specific properties and methods. It is used only with
7 // JSCompiler to verify the type-correctness of our code.
13 chrome
.app
.runtime
= {
14 /** @type {chrome.Event} */
22 * @param {string} name
23 * @param {Object} parameters
24 * @param {function(AppWindow)=} opt_callback
26 create: function(name
, parameters
, opt_callback
) {},
30 current: function() {},
37 * @return {Array<AppWindow>}
52 /** @return {{name: string, version: string, app: {background: Object}}} */
53 getManifest: function() {},
54 /** @param {function(Window):void} callback */
55 getBackgroundPage: function(callback
) {},
56 /** @type {chrome.Event} */
58 /** @type {chrome.Event} */
59 onSuspendCanceled
: null,
60 /** @type {chrome.Event} */
62 /** @type {chrome.Event} */
63 onConnectExternal
: null,
64 /** @type {chrome.Event} */
66 /** @type {chrome.Event} */
67 onMessageExternal
: null
71 * @type {?function(string):chrome.runtime.Port}
73 chrome
.runtime
.connectNative = function(name
) {};
76 * @param {{ name: string}} config
77 * @return {chrome.runtime.Port}
79 chrome
.runtime
.connect = function(config
) {};
82 * @param {string?} extensionId
84 * @param {Object=} opt_options
85 * @param {function(*)=} opt_callback
87 chrome
.runtime
.sendMessage = function(
88 extensionId
, message
, opt_options
, opt_callback
) {};
91 chrome
.runtime
.MessageSender = function(){
92 /** @type {chrome.Tab} */
101 chrome
.runtime
.Port = function() {
102 this.onMessage
= new chrome
.Event();
103 this.onDisconnect
= new chrome
.Event();
105 /** @type {string} */
108 /** @type {chrome.runtime.MessageSender} */
112 /** @type {chrome.Event} */
113 chrome
.runtime
.Port
.prototype.onMessage
= null;
115 /** @type {chrome.Event} */
116 chrome
.runtime
.Port
.prototype.onDisconnect
= null;
118 chrome
.runtime
.Port
.prototype.disconnect = function() {};
121 * @param {Object} message
123 chrome
.runtime
.Port
.prototype.postMessage = function(message
) {};
126 /** @type {Object} */
127 chrome
.extension
= {};
131 * @param {function(*)=} opt_callback
133 chrome
.extension
.sendMessage = function(message
, opt_callback
) {};
135 /** @type {chrome.Event} */
136 chrome
.extension
.onMessage
;
139 /** @type {Object} */
143 * @param {string} messageName
144 * @param {(string|Array<string>)=} opt_args
147 chrome
.i18n
.getMessage = function(messageName
, opt_args
) {};
152 chrome
.i18n
.getUILanguage = function() {};
155 /** @type {Object} */
158 /** @type {chrome.Storage} */
159 chrome
.storage
.local
;
161 /** @type {chrome.Storage} */
165 chrome
.Storage = function() {};
168 * @param {string|Array<string>|Object<string>} items
169 * @param {function(Object<string>):void} callback
172 chrome
.Storage
.prototype.get = function(items
, callback
) {};
175 * @param {Object<string>} items
176 * @param {function():void=} opt_callback
179 chrome
.Storage
.prototype.set = function(items
, opt_callback
) {};
182 * @param {string|Array<string>} items
183 * @param {function():void=} opt_callback
186 chrome
.Storage
.prototype.remove = function(items
, opt_callback
) {};
189 * @param {function():void=} opt_callback
192 chrome
.Storage
.prototype.clear = function(opt_callback
) {};
197 * src/chrome/common/extensions/api/context_menus.json
199 chrome
.contextMenus
= {};
200 /** @type {chrome.Event} */
201 chrome
.contextMenus
.onClicked
;
203 * @param {!Object} createProperties
204 * @param {function()=} opt_callback
206 chrome
.contextMenus
.create = function(createProperties
, opt_callback
) {};
208 * @param {string|number} id
209 * @param {!Object} updateProperties
210 * @param {function()=} opt_callback
212 chrome
.contextMenus
.update = function(id
, updateProperties
, opt_callback
) {};
214 * @param {string|number} menuItemId
215 * @param {function()=} opt_callback
217 chrome
.contextMenus
.remove = function(menuItemId
, opt_callback
) {};
219 * @param {function()=} opt_callback
221 chrome
.contextMenus
.removeAll = function(opt_callback
) {};
224 function OnClickData() {};
225 /** @type {string|number} */
226 OnClickData
.prototype.menuItemId
;
227 /** @type {string|number} */
228 OnClickData
.prototype.parentMenuItemId
;
229 /** @type {string} */
230 OnClickData
.prototype.mediaType
;
231 /** @type {string} */
232 OnClickData
.prototype.linkUrl
;
233 /** @type {string} */
234 OnClickData
.prototype.srcUrl
;
235 /** @type {string} */
236 OnClickData
.prototype.pageUrl
;
237 /** @type {string} */
238 OnClickData
.prototype.frameUrl
;
239 /** @type {string} */
240 OnClickData
.prototype.selectionText
;
241 /** @type {boolean} */
242 OnClickData
.prototype.editable
;
243 /** @type {boolean} */
244 OnClickData
.prototype.wasChecked
;
245 /** @type {boolean} */
246 OnClickData
.prototype.checked
;
249 /** @type {Object} */
250 chrome
.fileSystem
= {
252 * @param {Object<string>?} options
253 * @param {function(Entry, Array<FileEntry>):void} callback
255 chooseEntry: function(options
, callback
) {},
257 * @param {Entry} entry
258 * @param {function(string):void} callback
260 getDisplayPath: function(entry
, callback
) {}
263 /** @param {function(FileWriter):void} callback */
264 Entry
.prototype.createWriter = function(callback
) {};
266 /** @type {Object} */
269 * @param {Object<string>} parameters
270 * @param {function(string):void} callback
272 getAuthToken: function(parameters
, callback
) {},
274 * @param {Object<string>} parameters
275 * @param {function():void} callback
277 removeCachedAuthToken: function(parameters
, callback
) {},
279 * @param {Object<string>} parameters
280 * @param {function(string):void} callback
282 launchWebAuthFlow: function(parameters
, callback
) {}
286 /** @type {Object} */
287 chrome
.permissions
= {
289 * @param {Object<string>} permissions
290 * @param {function(boolean):void} callback
292 contains: function(permissions
, callback
) {},
294 * @param {Object<string>} permissions
295 * @param {function(boolean):void} callback
297 request: function(permissions
, callback
) {}
301 /** @type {Object} */
304 /** @param {function(chrome.Tab):void} callback */
305 chrome
.tabs
.getCurrent = function(callback
) {};
308 * @param {Object?} options
309 * @param {function(chrome.Tab)=} opt_callback
311 chrome
.tabs
.create = function(options
, opt_callback
) {};
315 * @param {function(chrome.Tab)} callback
317 chrome
.tabs
.get = function(id
, callback
) {};
321 * @param {function(*=):void=} opt_callback
323 chrome
.tabs
.remove = function(id
, opt_callback
) {};
327 chrome
.Tab = function() {
328 /** @type {boolean} */
330 /** @type {number} */
332 /** @type {string} */
337 /** @type {Object} */
340 /** @param {number} id
341 * @param {Object?} getInfo
342 * @param {function(chrome.Window):void} callback */
343 chrome
.windows
.get = function(id
, getInfo
, callback
) {};
346 chrome
.Window = function() {
347 /** @type {string} */
349 /** @type {string} */
354 var AppWindow = function() {
355 /** @type {Window} */
356 this.contentWindow
= null;
357 /** @type {chrome.Event} */
358 this.onClosed
= null;
359 /** @type {chrome.Event} */
360 this.onRestored
= null;
361 /** @type {chrome.Event} */
362 this.onMaximized
= null;
363 /** @type {chrome.Event} */
364 this.onMinimized
= null;
365 /** @type {chrome.Event} */
366 this.onFullscreened
= null;
367 /** @type {string} */
369 /** @type {Bounds} */
370 this.outerBounds
= null;
371 /** @type {Bounds} */
372 this.innerBounds
= null;
375 AppWindow
.prototype.close = function() {};
376 AppWindow
.prototype.drawAttention = function() {};
377 AppWindow
.prototype.focus = function() {};
378 AppWindow
.prototype.maximize = function() {};
379 AppWindow
.prototype.minimize = function() {};
381 * @param {number} left
382 * @param {number} top
384 AppWindow
.prototype.moveTo = function(left
, top
) {};
386 * @param {number} width
387 * @param {number} height
389 AppWindow
.prototype.resizeTo = function(width
, height
) {};
391 AppWindow
.prototype.restore = function() {};
392 AppWindow
.prototype.show = function() {};
393 /** @return {boolean} */
394 AppWindow
.prototype.isMinimized = function() {};
395 AppWindow
.prototype.fullscreen = function() {};
396 /** @return {boolean} */
397 AppWindow
.prototype.isFullscreen = function() {};
398 /** @return {boolean} */
399 AppWindow
.prototype.isMaximized = function() {};
402 * @param {{rects: Array<ClientRect>}} rects
404 AppWindow
.prototype.setShape = function(rects
) {};
407 * @param {{rects: Array<ClientRect>}} rects
409 AppWindow
.prototype.setInputRegion = function(rects
) {};
412 var LaunchData = function() {
413 /** @type {string} */
415 /** @type {Array<{type: string, entry: FileEntry}>} */
421 /** @type {number} */
423 /** @type {number} */
425 /** @type {number} */
427 /** @type {number} */
431 /** @type {Object} */
434 /** @type {Object} */
435 chrome
.sockets
.tcp
= {};
438 chrome
.sockets
.tcp
.CreateInfo = function() {
439 /** @type {number} */
444 * @param {Object} properties
445 * @param {function(chrome.sockets.tcp.CreateInfo):void} callback
447 chrome
.sockets
.tcp
.create = function(properties
, callback
) {};
451 chrome
.sockets
.tcp
.ConnectInfo = function() {
452 /** @type {number} */
457 * @param {number} socketId
458 * @param {string} peerAddress
459 * @param {number} peerPort
460 * @param {function(chrome.sockets.tcp.ConnectInfo):void} callback
462 chrome
.sockets
.tcp
.connect
=
463 function(socketId
, peerAddress
, peerPort
, callback
) {};
467 chrome
.sockets
.tcp
.SendInfo = function() {
468 /** @type {number} */
471 /** @type {number} */
476 * @param {number} socketId
477 * @param {ArrayBuffer} data
478 * @param {function(chrome.sockets.tcp.SendInfo):void} callback
480 chrome
.sockets
.tcp
.send = function(socketId
, data
, callback
) {};
484 * @param {number} socketId
486 chrome
.sockets
.tcp
.close = function(socketId
) {};
489 * @param {number} socketId
490 * @param {Object} options
491 * @param {function(number):void} callback
493 chrome
.sockets
.tcp
.secure = function(socketId
, options
, callback
) {};
496 chrome
.sockets
.tcp
.ReceiveInfo = function() {
497 /** @type {number} */
500 /** @type {ArrayBuffer} */
504 /** @type {chrome.Event} */
505 chrome
.sockets
.tcp
.onReceive
= null;
508 chrome
.sockets
.tcp
.ReceiveErrorInfo = function() {
509 /** @type {number} */
512 /** @type {number} */
516 /** @type {chrome.Event} */
517 chrome
.sockets
.tcp
.onReceiveError
= null;
519 /** @type {Object} */
523 chrome
.socket
.CreateInfo = function() {
524 /** @type {number} */
529 * @param {string} socketType
530 * @param {Object} options
531 * @param {function(chrome.socket.CreateInfo):void} callback
533 chrome
.socket
.create = function(socketType
, options
, callback
) {};
536 * @param {number} socketId
537 * @param {string} hostname
538 * @param {number} port
539 * @param {function(number):void} callback
541 chrome
.socket
.connect
=
542 function(socketId
, hostname
, port
, callback
) {};
545 chrome
.socket
.WriteInfo = function() {
546 /** @type {number} */
547 this.bytesWritten
= 0;
551 * @param {number} socketId
552 * @param {ArrayBuffer} data
553 * @param {function(chrome.socket.WriteInfo):void} callback
555 chrome
.socket
.write = function(socketId
, data
, callback
) {};
558 chrome
.socket
.ReadInfo = function() {
559 /** @type {number} */
562 /** @type {ArrayBuffer} */
567 * @param {number} socketId
568 * @param {function(chrome.socket.ReadInfo):void} callback
570 chrome
.socket
.read = function(socketId
, callback
) {};
573 * @param {number} socketId
575 chrome
.socket
.destroy = function(socketId
) {};
578 * @param {number} socketId
579 * @param {Object} options
580 * @param {function(number):void} callback
582 chrome
.socket
.secure = function(socketId
, options
, callback
) {};