Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: ui/file_manager/video_player/js/cast/caster.js

Issue 471903002: Video Player: Disables cast feature by default (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed the comment Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 'use strict'; 5 'use strict';
6 6
7 // This hack prevents a bug on the cast extension. 7 // This hack prevents a bug on the cast extension.
8 // TODO(yoshiki): Remove this once the cast extension supports Chrome apps. 8 // TODO(yoshiki): Remove this once the cast extension supports Chrome apps.
9 // Although localStorage in Chrome app is not supported, but it's used in the 9 // Although localStorage in Chrome app is not supported, but it's used in the
10 // cast extension. This line prevents an exception on using localStorage. 10 // cast extension. This line prevents an exception on using localStorage.
11 window.__defineGetter__('localStorage', function() { return {}; }); 11 window.__defineGetter__('localStorage', function() { return {}; });
12 12
13 /**
14 * @type {string}
15 * @const
16 */
17 var CAST_COMMAND_LINE_FLAG = 'enable-video-player-chromecast-support';
18
13 // THIS IS A TEST APP. 19 // THIS IS A TEST APP.
14 // TODO(yoshiki): Fix this before launch. 20 // TODO(yoshiki): Fix this before launch.
15 var APPLICATION_ID = '214CC863'; 21 var APPLICATION_ID = '214CC863';
16 22
17 util.addPageLoadHandler(function() { 23 util.addPageLoadHandler(function() {
24 chrome.commandLinePrivate.hasSwitch(CAST_COMMAND_LINE_FLAG, function(result) {
25 if (result)
26 initialize();
27 }.wrap());
28 }.wrap());
29
30 /**
31 * Starts initialization of cast-related feature.
32 */
33 function initialize() {
18 CastExtensionDiscoverer.findInstalledExtension(function(foundId) { 34 CastExtensionDiscoverer.findInstalledExtension(function(foundId) {
19 if (foundId) 35 if (foundId)
20 loadCastAPI(initializeApi); 36 loadCastAPI(initializeApi);
21 else 37 else
22 console.info('No Google Cast extension is installed.'); 38 console.info('No Google Cast extension is installed.');
23 }); 39 }.wrap());
24 }); 40 }
25 41
26 /** 42 /**
27 * Executes the given callback after the cast extension is initialized. 43 * Executes the given callback after the cast extension is initialized.
28 * @param {function} callback Callback (executed asynchronously). 44 * @param {function} callback Callback (executed asynchronously).
29 * @param {boolean=} opt_secondTry Spericy try if it's second call after 45 * @param {boolean=} opt_secondTry Spericy try if it's second call after
30 * installation of Cast API extension. 46 * installation of Cast API extension.
31 */ 47 */
32 function loadCastAPI(callback, opt_secondTry) { 48 function loadCastAPI(callback, opt_secondTry) {
33 var script = document.createElement('script'); 49 var script = document.createElement('script');
34 50
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 139 }
124 140
125 player.setCastList(receivers); 141 player.setCastList(receivers);
126 } else if (availability == chrome.cast.ReceiverAvailability.UNAVAILABLE) { 142 } else if (availability == chrome.cast.ReceiverAvailability.UNAVAILABLE) {
127 player.setCastList([]); 143 player.setCastList([]);
128 } else { 144 } else {
129 console.error('Unexpected response in onReceiver.', arguments); 145 console.error('Unexpected response in onReceiver.', arguments);
130 player.setCastList([]); 146 player.setCastList([]);
131 } 147 }
132 } 148 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698