Commit ac340a28 authored by yawano's avatar yawano Committed by Commit bot

Add type annotations to caster.js.

BUG=444485
TEST=GYP_GENERATORS=ninja tools/gyp/gyp --depth . ui/file_manager/video_player/js/compiled_resources.gyp && ninja -C out/Default | grep "caster.js"

Review URL: https://codereview.chromium.org/823583005

Cr-Commit-Position: refs/heads/master@{#309623}
parent bf057ae7
......@@ -334,7 +334,8 @@ chrome.cast.Volume.prototype.muted;
/**
* @param {!chrome.cast.SessionRequest} sessionRequest
* @param {function(!chrome.cast.Session)} sessionListener
* @param {function(!chrome.cast.ReceiverAvailability)} receiverListener
* @param {function(!chrome.cast.ReceiverAvailability,Array.<Object>)}
* receiverListener
* @param {chrome.cast.AutoJoinPolicy=} opt_autoJoinPolicy
* @param {chrome.cast.DefaultActionPolicy=} opt_defaultActionPolicy
* @constructor
......
......@@ -8,6 +8,10 @@
// cast extension. This line prevents an exception on using localStorage.
window.__defineGetter__('localStorage', function() { return {}; });
/**
* @type {string}
* @const
*/
var APPLICATION_ID = '4CCB98DA';
util.addPageLoadHandler(function() {
......@@ -42,7 +46,7 @@ function initialize() {
* in background before load. The cast API will load the cast SDK automatically.
* The given callback is executes after the cast SDK extension is initialized.
*
* @param {function} callback Callback (executed asynchronously).
* @param {function()} callback Callback (executed asynchronously).
* @param {boolean=} opt_secondTry Specify true if it's the second call after
* installation of Cast API extension.
*/
......@@ -79,7 +83,7 @@ function loadCastAPI(callback, opt_secondTry) {
console.info('Google Cast API extension installed.');
// Loads API again.
setTimeout(loadCastAPI.bind(null, callback, true));
setTimeout(loadCastAPI.bind(null, callback, true), 0);
}.wrap());
}.wrap();
......@@ -107,7 +111,7 @@ function onLoadCastExtension(callback, opt_installationOccured) {
metrics.CAST_API_EXTENSION_STATUS.LOADED);
}
setTimeout(callback); // Runs asynchronously.
setTimeout(callback, 0); // Runs asynchronously.
};
if(!chrome.cast || !chrome.cast.isAvailable) {
......@@ -164,6 +168,9 @@ function initializeApi() {
}
/**
* Called when receiver availability is changed. This method is also called when
* initialization is completed.
*
* @param {chrome.cast.ReceiverAvailability} availability Availability of casts.
* @param {Array.<Object>} receivers List of casts.
*/
......
......@@ -19,15 +19,14 @@ window.onerror = function() { window.JSErrorCount++; };
* - Capture the stack trace in case of error.
* - Bind this object
*
* @param {Object} thisObject Object to be used as this.
* @param {Object=} opt_thisObject Object to be used as this.
* @param {...} var_args Arguments to be bound with the wrapped function.
* @return {function} Wrapped function.
*/
Function.prototype.wrap = function(thisObject, var_args) {
Function.prototype.wrap = function(opt_thisObject, var_args) {
var func = this;
var liveStack = (new Error('Stack trace before async call')).stack;
if (thisObject === undefined)
thisObject = null;
var thisObject = opt_thisObject || null;
var boundArguments = Array.prototype.slice.call(arguments, 1);
return function wrappedCallback(var_args) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment