OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 // This file contains various hacks needed to inform JSCompiler of various | 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 | 6 // WebKit- and Chrome-specific properties and methods. It is used only with |
7 // JSCompiler to verify the type-correctness of our code. | 7 // JSCompiler to verify the type-correctness of our code. |
8 | 8 |
9 /** @type {Object} */ | |
10 var chrome = {}; | |
11 | |
12 /** @constructor */ | 9 /** @constructor */ |
13 chrome.Event = function() {}; | 10 chrome.Event = function() {}; |
14 | 11 |
15 /** @param {Function} callback */ | 12 /** @param {Function} callback */ |
16 chrome.Event.prototype.addListener = function(callback) {}; | 13 chrome.Event.prototype.addListener = function(callback) {}; |
17 | 14 |
18 /** @param {Function} callback */ | 15 /** @param {Function} callback */ |
19 chrome.Event.prototype.removeListener = function(callback) {}; | 16 chrome.Event.prototype.removeListener = function(callback) {}; |
20 | 17 |
21 /** @type {Object} */ | 18 /** @type {Object} */ |
22 chrome.app = {}; | 19 chrome.app = {}; |
23 | 20 |
24 /** @type {Object} */ | 21 /** @type {Object} */ |
25 chrome.app.runtime = { | 22 chrome.app.runtime = { |
26 /** @type {chrome.Event} */ | 23 /** @type {chrome.Event} */ |
27 onLaunched: null | 24 onLaunched: null |
28 }; | 25 }; |
29 | 26 |
30 | 27 |
31 /** @type {Object} */ | 28 /** @type {Object} */ |
32 chrome.app.window = { | 29 chrome.app.window = { |
33 /** | 30 /** |
34 * @param {string} name | 31 * @param {string} name |
35 * @param {Object} parameters | 32 * @param {Object} parameters |
36 * @param {function()=} opt_callback | 33 * @param {function(AppWindow)=} opt_callback |
37 */ | 34 */ |
38 create: function(name, parameters, opt_callback) {}, | 35 create: function(name, parameters, opt_callback) {}, |
39 /** | 36 /** |
40 * @return {AppWindow} | 37 * @return {AppWindow} |
41 */ | 38 */ |
42 current: function() {}, | 39 current: function() {}, |
43 /** | 40 /** |
44 * @param {string} id | 41 * @param {string} id |
45 * @param {function()=} opt_callback | 42 * @param {function()=} opt_callback |
46 */ | 43 */ |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 248 |
252 | 249 |
253 /** @type {Object} */ | 250 /** @type {Object} */ |
254 chrome.fileSystem = { | 251 chrome.fileSystem = { |
255 /** | 252 /** |
256 * @param {Object.<string>?} options | 253 * @param {Object.<string>?} options |
257 * @param {function(Entry, Array.<FileEntry>):void} callback | 254 * @param {function(Entry, Array.<FileEntry>):void} callback |
258 */ | 255 */ |
259 chooseEntry: function(options, callback) {}, | 256 chooseEntry: function(options, callback) {}, |
260 /** | 257 /** |
261 * @param {FileEntry} fileEntry | 258 * @param {Entry} entry |
262 * @param {function(string):void} callback | 259 * @param {function(string):void} callback |
263 */ | 260 */ |
264 getDisplayPath: function(fileEntry, callback) {} | 261 getDisplayPath: function(entry, callback) {} |
265 }; | 262 }; |
266 | 263 |
| 264 /** @param {function(FileWriter):void} callback */ |
| 265 Entry.prototype.createWriter = function(callback) {}; |
| 266 |
267 /** @type {Object} */ | 267 /** @type {Object} */ |
268 chrome.identity = { | 268 chrome.identity = { |
269 /** | 269 /** |
270 * @param {Object.<string>} parameters | 270 * @param {Object.<string>} parameters |
271 * @param {function(string):void} callback | 271 * @param {function(string):void} callback |
272 */ | 272 */ |
273 getAuthToken: function(parameters, callback) {}, | 273 getAuthToken: function(parameters, callback) {}, |
274 /** | 274 /** |
275 * @param {Object.<string>} parameters | 275 * @param {Object.<string>} parameters |
276 * @param {function():void} callback | 276 * @param {function():void} callback |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 chrome.tabs.create = function(options, opt_callback) {}; | 312 chrome.tabs.create = function(options, opt_callback) {}; |
313 | 313 |
314 /** | 314 /** |
315 * @param {string} id | 315 * @param {string} id |
316 * @param {function(chrome.Tab)} callback | 316 * @param {function(chrome.Tab)} callback |
317 */ | 317 */ |
318 chrome.tabs.get = function(id, callback) {}; | 318 chrome.tabs.get = function(id, callback) {}; |
319 | 319 |
320 /** | 320 /** |
321 * @param {string} id | 321 * @param {string} id |
322 * @param {function()=} opt_callback | 322 * @param {function(*=):void=} opt_callback |
323 */ | 323 */ |
324 chrome.tabs.remove = function(id, opt_callback) {}; | 324 chrome.tabs.remove = function(id, opt_callback) {}; |
325 | 325 |
326 | 326 |
327 /** @constructor */ | 327 /** @constructor */ |
328 chrome.Tab = function() { | 328 chrome.Tab = function() { |
329 /** @type {boolean} */ | 329 /** @type {boolean} */ |
330 this.pinned = false; | 330 this.pinned = false; |
331 /** @type {number} */ | 331 /** @type {number} */ |
332 this.windowId = 0; | 332 this.windowId = 0; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 /** @type {number} */ | 409 /** @type {number} */ |
410 this.left = 0; | 410 this.left = 0; |
411 /** @type {number} */ | 411 /** @type {number} */ |
412 this.top = 0; | 412 this.top = 0; |
413 /** @type {number} */ | 413 /** @type {number} */ |
414 this.width = 0; | 414 this.width = 0; |
415 /** @type {number} */ | 415 /** @type {number} */ |
416 this.height = 0; | 416 this.height = 0; |
417 }; | 417 }; |
418 | 418 |
419 /** @constructor */ | |
420 function ClientRect() { | |
421 /** @type {number} */ | |
422 this.width = 0; | |
423 /** @type {number} */ | |
424 this.height = 0; | |
425 /** @type {number} */ | |
426 this.top = 0; | |
427 /** @type {number} */ | |
428 this.bottom = 0; | |
429 /** @type {number} */ | |
430 this.left = 0; | |
431 /** @type {number} */ | |
432 this.right = 0; | |
433 }; | |
434 | |
435 /** @type {Object} */ | 419 /** @type {Object} */ |
436 chrome.cast = {}; | 420 chrome.cast = {}; |
437 | 421 |
438 /** @constructor */ | 422 /** @constructor */ |
439 chrome.cast.AutoJoinPolicy = function() {}; | 423 chrome.cast.AutoJoinPolicy = function() {}; |
440 | 424 |
441 /** @type {chrome.cast.AutoJoinPolicy} */ | 425 /** @type {chrome.cast.AutoJoinPolicy} */ |
442 chrome.cast.AutoJoinPolicy.PAGE_SCOPED; | 426 chrome.cast.AutoJoinPolicy.PAGE_SCOPED; |
443 | 427 |
444 /** @type {chrome.cast.AutoJoinPolicy} */ | 428 /** @type {chrome.cast.AutoJoinPolicy} */ |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 */ | 484 */ |
501 chrome.cast.Session.prototype.addMediaListener = function(listener) {}; | 485 chrome.cast.Session.prototype.addMediaListener = function(listener) {}; |
502 | 486 |
503 /** | 487 /** |
504 * @param {function(boolean):void} listener | 488 * @param {function(boolean):void} listener |
505 */ | 489 */ |
506 chrome.cast.Session.prototype.addUpdateListener = function(listener) {}; | 490 chrome.cast.Session.prototype.addUpdateListener = function(listener) {}; |
507 | 491 |
508 /** | 492 /** |
509 * @param {string} namespace | 493 * @param {string} namespace |
510 * @param {function(chrome.cast.media.Media):void} listener | 494 * @param {function(string, string):void} listener |
511 */ | 495 */ |
512 chrome.cast.Session.prototype.addMessageListener = | 496 chrome.cast.Session.prototype.addMessageListener = |
513 function(namespace, listener){}; | 497 function(namespace, listener){}; |
514 | 498 |
515 /** | 499 /** |
516 * @param {function():void} successCallback | 500 * @param {function():void} successCallback |
517 * @param {function(chrome.cast.Error):void} errorCallback | 501 * @param {function(chrome.cast.Error):void} errorCallback |
518 */ | 502 */ |
519 chrome.cast.Session.prototype.stop = | 503 chrome.cast.Session.prototype.stop = |
520 function(successCallback, errorCallback) {}; | 504 function(successCallback, errorCallback) {}; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 * @param {number} socketId | 683 * @param {number} socketId |
700 */ | 684 */ |
701 chrome.socket.destroy = function(socketId) {}; | 685 chrome.socket.destroy = function(socketId) {}; |
702 | 686 |
703 /** | 687 /** |
704 * @param {number} socketId | 688 * @param {number} socketId |
705 * @param {Object} options | 689 * @param {Object} options |
706 * @param {function(number):void} callback | 690 * @param {function(number):void} callback |
707 */ | 691 */ |
708 chrome.socket.secure = function(socketId, options, callback) {}; | 692 chrome.socket.secure = function(socketId, options, callback) {}; |
OLD | NEW |