Revert of Enabling audio quality test on mac. (patchset #1 id:1 of https://codereview...
[chromium-blink-merge.git] / remoting / webapp / js_proto / chrome_proto.js
blob359b997abf9f04aeeb0374d70ec9b579d4f8ad20
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.
9 /** @type {Object} */
10 var chrome = {};
12 /** @constructor */
13 chrome.Event = function() {};
15 /** @param {Function} callback */
16 chrome.Event.prototype.addListener = function(callback) {};
18 /** @param {Function} callback */
19 chrome.Event.prototype.removeListener = function(callback) {};
21 /** @type {Object} */
22 chrome.app = {};
24 /** @type {Object} */
25 chrome.app.runtime = {
26 /** @type {chrome.Event} */
27 onLaunched: null
31 /** @type {Object} */
32 chrome.app.window = {
33 /**
34 * @param {string} name
35 * @param {Object} parameters
36 * @param {function()=} opt_callback
38 create: function(name, parameters, opt_callback) {},
39 /**
40 * @return {AppWindow}
42 current: function() {},
43 /**
44 * @param {string} id
45 * @param {function()=} opt_callback
47 get: function(id, opt_callback) {}
51 /** @type {Object} */
52 chrome.runtime = {
53 /** @type {Object} */
54 lastError: {
55 /** @type {string} */
56 message: ''
58 /** @return {{version: string, app: {background: Object}}} */
59 getManifest: function() {},
60 /** @type {chrome.Event} */
61 onSuspend: null,
62 /** @type {chrome.Event} */
63 onSuspendCanceled: null,
64 /** @type {chrome.Event} */
65 onConnect: null,
66 /** @type {chrome.Event} */
67 onConnectExternal: null,
68 /** @type {chrome.Event} */
69 onMessage: null,
70 /** @type {chrome.Event} */
71 onMessageExternal: null
74 /**
75 * @type {?function(string):chrome.runtime.Port}
77 chrome.runtime.connectNative = function(name) {};
79 /**
80 * @param {{ name: string}} config
81 * @return {chrome.runtime.Port}
83 chrome.runtime.connect = function(config) {};
85 /**
86 * @param {string} extensionId
87 * @param {*} message
88 * @param {Object=} opt_options
89 * @param {function(*)=} opt_callback
91 chrome.runtime.sendMessage = function(
92 extensionId, message, opt_options, opt_callback) {};
94 /** @constructor */
95 chrome.runtime.MessageSender = function(){
96 /** @type {chrome.Tab} */
97 this.tab = null;
100 /** @constructor */
101 chrome.runtime.Port = function() {
102 this.onMessage = new chrome.Event();
103 this.onDisconnect = new chrome.Event();
105 /** @type {string} */
106 this.name = '';
108 /** @type {chrome.runtime.MessageSender} */
109 this.sender = null;
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 = {};
130 * @param {*} message
132 chrome.extension.sendMessage = function(message) {}
134 /** @type {chrome.Event} */
135 chrome.extension.onMessage;
138 /** @type {Object} */
139 chrome.i18n = {};
142 * @param {string} messageName
143 * @param {(string|Array.<string>)=} opt_args
144 * @return {string}
146 chrome.i18n.getMessage = function(messageName, opt_args) {};
149 /** @type {Object} */
150 chrome.storage = {};
152 /** @type {chrome.Storage} */
153 chrome.storage.local;
155 /** @type {chrome.Storage} */
156 chrome.storage.sync;
158 /** @constructor */
159 chrome.Storage = function() {};
162 * @param {string|Array.<string>|Object.<string>} items
163 * @param {function(Object.<string>):void} callback
164 * @return {void}
166 chrome.Storage.prototype.get = function(items, callback) {};
169 * @param {Object.<string>} items
170 * @param {function():void=} opt_callback
171 * @return {void}
173 chrome.Storage.prototype.set = function(items, opt_callback) {};
176 * @param {string|Array.<string>} items
177 * @param {function():void=} opt_callback
178 * @return {void}
180 chrome.Storage.prototype.remove = function(items, opt_callback) {};
183 * @param {function():void=} opt_callback
184 * @return {void}
186 chrome.Storage.prototype.clear = function(opt_callback) {};
190 * @type {Object}
191 * src/chrome/common/extensions/api/context_menus.json
193 chrome.contextMenus = {};
194 /** @type {chrome.Event} */
195 chrome.contextMenus.onClicked;
197 * @param {!Object} createProperties
198 * @param {function()=} opt_callback
200 chrome.contextMenus.create = function(createProperties, opt_callback) {};
202 * @param {string|number} id
203 * @param {!Object} updateProperties
204 * @param {function()=} opt_callback
206 chrome.contextMenus.update = function(id, updateProperties, opt_callback) {};
208 * @param {string|number} menuItemId
209 * @param {function()=} opt_callback
211 chrome.contextMenus.remove = function(menuItemId, opt_callback) {};
213 * @param {function()=} opt_callback
215 chrome.contextMenus.removeAll = function(opt_callback) {};
217 /** @constructor */
218 function OnClickData() {}
219 /** @type {string|number} */
220 OnClickData.prototype.menuItemId;
221 /** @type {string|number} */
222 OnClickData.prototype.parentMenuItemId;
223 /** @type {string} */
224 OnClickData.prototype.mediaType;
225 /** @type {string} */
226 OnClickData.prototype.linkUrl;
227 /** @type {string} */
228 OnClickData.prototype.srcUrl;
229 /** @type {string} */
230 OnClickData.prototype.pageUrl;
231 /** @type {string} */
232 OnClickData.prototype.frameUrl;
233 /** @type {string} */
234 OnClickData.prototype.selectionText;
235 /** @type {boolean} */
236 OnClickData.prototype.editable;
237 /** @type {boolean} */
238 OnClickData.prototype.wasChecked;
239 /** @type {boolean} */
240 OnClickData.prototype.checked;
243 /** @type {Object} */
244 chrome.fileSystem = {
246 * @param {Object.<string>?} options
247 * @param {function(Entry, Array.<FileEntry>):void} callback
249 chooseEntry: function(options, callback) {},
251 * @param {FileEntry} fileEntry
252 * @param {function(string):void} callback
254 getDisplayPath: function(fileEntry, callback) {}
257 /** @type {Object} */
258 chrome.identity = {
260 * @param {Object.<string>} parameters
261 * @param {function(string):void} callback
263 getAuthToken: function(parameters, callback) {},
265 * @param {Object.<string>} parameters
266 * @param {function():void} callback
268 removeCachedAuthToken: function(parameters, callback) {},
270 * @param {Object.<string>} parameters
271 * @param {function(string):void} callback
273 launchWebAuthFlow: function(parameters, callback) {}
277 /** @type {Object} */
278 chrome.permissions = {
280 * @param {Object.<string>} permissions
281 * @param {function(boolean):void} callback
283 contains: function(permissions, callback) {},
285 * @param {Object.<string>} permissions
286 * @param {function(boolean):void} callback
288 request: function(permissions, callback) {}
292 /** @type {Object} */
293 chrome.tabs = {};
295 /** @param {function(chrome.Tab):void} callback */
296 chrome.tabs.getCurrent = function(callback) {};
299 * @param {Object?} options
300 * @param {function(chrome.Tab)=} opt_callback
302 chrome.tabs.create = function(options, opt_callback) {};
305 * @param {string} id
306 * @param {function(chrome.Tab)} callback
308 chrome.tabs.get = function(id, callback) {};
311 * @param {string} id
312 * @param {function()=} opt_callback
314 chrome.tabs.remove = function(id, opt_callback) {};
317 /** @constructor */
318 chrome.Tab = function() {
319 /** @type {boolean} */
320 this.pinned = false;
321 /** @type {number} */
322 this.windowId = 0;
323 /** @type {string} */
324 this.id = '';
328 /** @type {Object} */
329 chrome.windows = {};
331 /** @param {number} id
332 * @param {Object?} getInfo
333 * @param {function(chrome.Window):void} callback */
334 chrome.windows.get = function(id, getInfo, callback) {};
336 /** @constructor */
337 chrome.Window = function() {
338 /** @type {string} */
339 this.state = '';
340 /** @type {string} */
341 this.type = '';
344 /** @constructor */
345 var AppWindow = function() {
346 /** @type {Window} */
347 this.contentWindow = null;
348 /** @type {chrome.Event} */
349 this.onClosed = null;
350 /** @type {chrome.Event} */
351 this.onRestored = null;
352 /** @type {chrome.Event} */
353 this.onMaximized = null;
354 /** @type {chrome.Event} */
355 this.onFullscreened = null;
356 /** @type {string} */
357 this.id = '';
360 AppWindow.prototype.close = function() {};
361 AppWindow.prototype.drawAttention = function() {};
362 AppWindow.prototype.maximize = function() {};
363 AppWindow.prototype.minimize = function() {};
364 AppWindow.prototype.restore = function() {};
365 AppWindow.prototype.show = function() {};
366 AppWindow.prototype.fullscreen = function() {};
367 /** @return {boolean} */
368 AppWindow.prototype.isFullscreen = function() {};
369 /** @return {boolean} */
370 AppWindow.prototype.isMaximized = function() {};
373 * @param {{rects: Array.<ClientRect>}} rects
375 AppWindow.prototype.setShape = function(rects) {};
378 * @param {{rects: Array.<ClientRect>}} rects
380 AppWindow.prototype.setInputRegion = function(rects) {};
382 /** @constructor */
383 var LaunchData = function() {
384 /** @type {string} */
385 this.id = '';
386 /** @type {Array.<{type: string, entry: FileEntry}>} */
387 this.items = [];
390 /** @constructor */
391 function ClientRect() {
392 /** @type {number} */
393 this.width = 0;
394 /** @type {number} */
395 this.height = 0;
396 /** @type {number} */
397 this.top = 0;
398 /** @type {number} */
399 this.bottom = 0;
400 /** @type {number} */
401 this.left = 0;
402 /** @type {number} */
403 this.right = 0;
406 /** @type {Object} */
407 chrome.cast = {};
409 /** @constructor */
410 chrome.cast.AutoJoinPolicy = function() {};
412 /** @type {chrome.cast.AutoJoinPolicy} */
413 chrome.cast.AutoJoinPolicy.PAGE_SCOPED;
415 /** @type {chrome.cast.AutoJoinPolicy} */
416 chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;
418 /** @type {chrome.cast.AutoJoinPolicy} */
419 chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED;
421 /** @constructor */
422 chrome.cast.DefaultActionPolicy = function() {};
424 /** @type {chrome.cast.DefaultActionPolicy} */
425 chrome.cast.DefaultActionPolicy.CAST_THIS_TAB;
427 /** @type {chrome.cast.DefaultActionPolicy} */
428 chrome.cast.DefaultActionPolicy.CREATE_SESSION;
430 /** @constructor */
431 chrome.cast.Error = function() {};
433 /** @constructor */
434 chrome.cast.ReceiverAvailability = function() {};
436 /** @type {chrome.cast.ReceiverAvailability} */
437 chrome.cast.ReceiverAvailability.AVAILABLE;
439 /** @type {chrome.cast.ReceiverAvailability} */
440 chrome.cast.ReceiverAvailability.UNAVAILABLE;
442 /** @type {Object} */
443 chrome.cast.media = {};
445 /** @constructor */
446 chrome.cast.media.Media = function() {
447 /** @type {number} */
448 this.mediaSessionId = 0;
451 /** @constructor */
452 chrome.cast.Session = function() {
453 /** @type {Array.<chrome.cast.media.Media>} */
454 this.media = [];
456 /** @type {string} */
457 this.sessionId = '';
461 * @param {string} namespace
462 * @param {Object} message
463 * @param {function():void} successCallback
464 * @param {function(chrome.cast.Error):void} errorCallback
466 chrome.cast.Session.prototype.sendMessage =
467 function(namespace, message, successCallback, errorCallback) {};
470 * @param {function(chrome.cast.media.Media):void} listener
472 chrome.cast.Session.prototype.addMediaListener = function(listener) {};
475 * @param {function(boolean):void} listener
477 chrome.cast.Session.prototype.addUpdateListener = function(listener) {};
480 * @param {string} namespace
481 * @param {function(chrome.cast.media.Media):void} listener
483 chrome.cast.Session.prototype.addMessageListener =
484 function(namespace, listener){};
487 * @param {function():void} successCallback
488 * @param {function(chrome.cast.Error):void} errorCallback
490 chrome.cast.Session.prototype.stop =
491 function(successCallback, errorCallback) {};
494 * @constructor
495 * @param {string} applicationID
497 chrome.cast.SessionRequest = function(applicationID) {};
500 * @constructor
501 * @param {chrome.cast.SessionRequest} sessionRequest
502 * @param {function(chrome.cast.Session):void} sessionListener
503 * @param {function(chrome.cast.ReceiverAvailability):void} receiverListener
504 * @param {chrome.cast.AutoJoinPolicy=} opt_autoJoinPolicy
505 * @param {chrome.cast.DefaultActionPolicy=} opt_defaultActionPolicy
507 chrome.cast.ApiConfig = function(sessionRequest,
508 sessionListener,
509 receiverListener,
510 opt_autoJoinPolicy,
511 opt_defaultActionPolicy) {};
514 * @param {chrome.cast.ApiConfig} apiConfig
515 * @param {function():void} onInitSuccess
516 * @param {function(chrome.cast.Error):void} onInitError
518 chrome.cast.initialize =
519 function(apiConfig, onInitSuccess, onInitError) {};
522 * @param {function(chrome.cast.Session):void} successCallback
523 * @param {function(chrome.cast.Error):void} errorCallback
525 chrome.cast.requestSession =
526 function(successCallback, errorCallback) {};
528 /** @type {Object} */
529 chrome.sockets = {};
531 /** @type {Object} */
532 chrome.sockets.tcp = {};
534 /** @constructor */
535 chrome.sockets.tcp.CreateInfo = function() {
536 /** @type {number} */
537 this.socketId = 0;
541 * @param {Object} properties
542 * @param {function(chrome.sockets.tcp.CreateInfo):void} callback
544 chrome.sockets.tcp.create = function(properties, callback) {};
547 /** @constructor */
548 chrome.sockets.tcp.ConnectInfo = function() {
549 /** @type {number} */
550 this.result = 0;
554 * @param {number} socketId
555 * @param {string} peerAddress
556 * @param {number} peerPort
557 * @param {function(chrome.sockets.tcp.ConnectInfo):void} callback
559 chrome.sockets.tcp.connect =
560 function(socketId, peerAddress, peerPort, callback) {};
563 /** @constructor */
564 chrome.sockets.tcp.SendInfo = function() {
565 /** @type {number} */
566 this.resultCode = 0;
568 /** @type {number} */
569 this.bytesSent = 0;
573 * @param {number} socketId
574 * @param {ArrayBuffer} data
575 * @param {function(chrome.sockets.tcp.SendInfo):void} callback
577 chrome.sockets.tcp.send = function(socketId, data, callback) {};
581 * @param {number} socketId
583 chrome.sockets.tcp.close = function(socketId) {};
586 * @param {number} socketId
587 * @param {Object} options
588 * @param {function(number):void} callback
590 chrome.sockets.tcp.secure = function(socketId, options, callback) {};
592 /** @constructor */
593 chrome.sockets.tcp.ReceiveInfo = function() {
594 /** @type {number} */
595 this.socketId = 0;
597 /** @type {ArrayBuffer} */
598 this.data = null;
601 /** @type {chrome.Event} */
602 chrome.sockets.tcp.onReceive = null;
604 /** @constructor */
605 chrome.sockets.tcp.ReceiveErrorInfo = function() {
606 /** @type {number} */
607 this.socketId = 0;
609 /** @type {number} */
610 this.resultCode = 0;
613 /** @type {chrome.Event} */
614 chrome.sockets.tcp.onReceiveError = null;
616 /** @type {Object} */
617 chrome.socket = {};
619 /** @constructor */
620 chrome.socket.CreateInfo = function() {
621 /** @type {number} */
622 this.socketId = 0;
626 * @param {string} socketType
627 * @param {Object} options
628 * @param {function(chrome.socket.CreateInfo):void} callback
630 chrome.socket.create = function(socketType, options, callback) {};
633 * @param {number} socketId
634 * @param {string} hostname
635 * @param {number} port
636 * @param {function(number):void} callback
638 chrome.socket.connect =
639 function(socketId, hostname, port, callback) {};
641 /** @constructor */
642 chrome.socket.WriteInfo = function() {
643 /** @type {number} */
644 this.bytesWritten = 0;
648 * @param {number} socketId
649 * @param {ArrayBuffer} data
650 * @param {function(chrome.socket.WriteInfo):void} callback
652 chrome.socket.write = function(socketId, data, callback) {};
654 /** @constructor */
655 chrome.socket.ReadInfo = function() {
656 /** @type {number} */
657 this.resultCode = 0;
659 /** @type {ArrayBuffer} */
660 this.data = null;
664 * @param {number} socketId
665 * @param {function(chrome.socket.ReadInfo):void} callback
667 chrome.socket.read = function(socketId, callback) {};
670 * @param {number} socketId
672 chrome.socket.destroy = function(socketId) {};
675 * @param {number} socketId
676 * @param {Object} options
677 * @param {function(number):void} callback
679 chrome.socket.secure = function(socketId, options, callback) {};