Index: ui/file_manager/video_player/js/cast/caster.js |
diff --git a/ui/file_manager/video_player/js/cast/caster.js b/ui/file_manager/video_player/js/cast/caster.js |
index 7373b066d0c43f314817205bc2d20c6aaed7fefb..ad704497ef039342e30afee962964e0db9bc2b2a 100644 |
--- a/ui/file_manager/video_player/js/cast/caster.js |
+++ b/ui/file_manager/video_player/js/cast/caster.js |
@@ -10,18 +10,34 @@ |
// cast extension. This line prevents an exception on using localStorage. |
window.__defineGetter__('localStorage', function() { return {}; }); |
+/** |
+ * @type {string} |
+ * @const |
+ */ |
+var CAST_COMMAND_LINE_FLAG = 'enable-video-player-chromecast-support'; |
+ |
// THIS IS A TEST APP. |
// TODO(yoshiki): Fix this before launch. |
var APPLICATION_ID = '214CC863'; |
util.addPageLoadHandler(function() { |
+ chrome.commandLinePrivate.hasSwitch(CAST_COMMAND_LINE_FLAG, function(result) { |
+ if (result) |
+ initialize(); |
+ }.wrap()); |
+}.wrap()); |
+ |
+/** |
+ * Starts initialization of cast-related feature. |
+ */ |
+function initialize() { |
CastExtensionDiscoverer.findInstalledExtension(function(foundId) { |
if (foundId) |
loadCastAPI(initializeApi); |
else |
console.info('No Google Cast extension is installed.'); |
- }); |
-}); |
+ }.wrap()); |
+} |
/** |
* Executes the given callback after the cast extension is initialized. |