OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 // 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. |
| 8 |
| 9 /** @type {Object} */ |
| 10 chrome.cast = {}; |
| 11 |
| 12 /** @constructor */ |
| 13 chrome.cast.AutoJoinPolicy = function() {}; |
| 14 |
| 15 /** @type {chrome.cast.AutoJoinPolicy} */ |
| 16 chrome.cast.AutoJoinPolicy.PAGE_SCOPED; |
| 17 |
| 18 /** @type {chrome.cast.AutoJoinPolicy} */ |
| 19 chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED; |
| 20 |
| 21 /** @type {chrome.cast.AutoJoinPolicy} */ |
| 22 chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED; |
| 23 |
| 24 /** @constructor */ |
| 25 chrome.cast.DefaultActionPolicy = function() {}; |
| 26 |
| 27 /** @type {chrome.cast.DefaultActionPolicy} */ |
| 28 chrome.cast.DefaultActionPolicy.CAST_THIS_TAB; |
| 29 |
| 30 /** @type {chrome.cast.DefaultActionPolicy} */ |
| 31 chrome.cast.DefaultActionPolicy.CREATE_SESSION; |
| 32 |
| 33 /** @constructor */ |
| 34 chrome.cast.Error = function() {}; |
| 35 |
| 36 /** @constructor */ |
| 37 chrome.cast.ReceiverAvailability = function() {}; |
| 38 |
| 39 /** @type {chrome.cast.ReceiverAvailability} */ |
| 40 chrome.cast.ReceiverAvailability.AVAILABLE; |
| 41 |
| 42 /** @type {chrome.cast.ReceiverAvailability} */ |
| 43 chrome.cast.ReceiverAvailability.UNAVAILABLE; |
| 44 |
| 45 /** @type {Object} */ |
| 46 chrome.cast.media = {}; |
| 47 |
| 48 /** @constructor */ |
| 49 chrome.cast.media.Media = function() { |
| 50 /** @type {number} */ |
| 51 this.mediaSessionId = 0; |
| 52 }; |
| 53 |
| 54 /** @constructor */ |
| 55 chrome.cast.Session = function() { |
| 56 /** @type {Array<chrome.cast.media.Media>} */ |
| 57 this.media = []; |
| 58 |
| 59 /** @type {string} */ |
| 60 this.sessionId = ''; |
| 61 }; |
| 62 |
| 63 /** |
| 64 * @param {string} namespace |
| 65 * @param {Object} message |
| 66 * @param {function():void} successCallback |
| 67 * @param {function(chrome.cast.Error):void} errorCallback |
| 68 */ |
| 69 chrome.cast.Session.prototype.sendMessage = |
| 70 function(namespace, message, successCallback, errorCallback) {}; |
| 71 |
| 72 /** |
| 73 * @param {function(chrome.cast.media.Media):void} listener |
| 74 */ |
| 75 chrome.cast.Session.prototype.addMediaListener = function(listener) {}; |
| 76 |
| 77 /** |
| 78 * @param {function(boolean):void} listener |
| 79 */ |
| 80 chrome.cast.Session.prototype.addUpdateListener = function(listener) {}; |
| 81 |
| 82 /** |
| 83 * @param {string} namespace |
| 84 * @param {function(string, string):void} listener |
| 85 */ |
| 86 chrome.cast.Session.prototype.addMessageListener = |
| 87 function(namespace, listener){}; |
| 88 |
| 89 /** |
| 90 * @param {function():void} successCallback |
| 91 * @param {function(chrome.cast.Error):void} errorCallback |
| 92 */ |
| 93 chrome.cast.Session.prototype.stop = |
| 94 function(successCallback, errorCallback) {}; |
| 95 |
| 96 /** |
| 97 * @constructor |
| 98 * @param {string} applicationID |
| 99 */ |
| 100 chrome.cast.SessionRequest = function(applicationID) {}; |
| 101 |
| 102 /** |
| 103 * @constructor |
| 104 * @param {chrome.cast.SessionRequest} sessionRequest |
| 105 * @param {function(chrome.cast.Session):void} sessionListener |
| 106 * @param {function(chrome.cast.ReceiverAvailability):void} receiverListener |
| 107 * @param {chrome.cast.AutoJoinPolicy=} opt_autoJoinPolicy |
| 108 * @param {chrome.cast.DefaultActionPolicy=} opt_defaultActionPolicy |
| 109 */ |
| 110 chrome.cast.ApiConfig = function(sessionRequest, |
| 111 sessionListener, |
| 112 receiverListener, |
| 113 opt_autoJoinPolicy, |
| 114 opt_defaultActionPolicy) {}; |
| 115 |
| 116 /** |
| 117 * @param {chrome.cast.ApiConfig} apiConfig |
| 118 * @param {function():void} onInitSuccess |
| 119 * @param {function(chrome.cast.Error):void} onInitError |
| 120 */ |
| 121 chrome.cast.initialize = |
| 122 function(apiConfig, onInitSuccess, onInitError) {}; |
| 123 |
| 124 /** |
| 125 * @param {function(chrome.cast.Session):void} successCallback |
| 126 * @param {function(chrome.cast.Error):void} errorCallback |
| 127 */ |
| 128 chrome.cast.requestSession = |
| 129 function(successCallback, errorCallback) {}; |
OLD | NEW |