Commit b5ed0496 authored by yoshiki@chromium.org's avatar yoshiki@chromium.org

Video Player: Disables cast feature by default

The feature will work only when the flag is on.

BUG=305511
TEST=Confirms the cast icon doesn't appear when the flag is off.

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

Cr-Commit-Position: refs/heads/master@{#289621}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289621 0039d316-1c4b-4281-b951-d872f2087c98
parent 68397dbd
......@@ -902,6 +902,15 @@ FileBrowserPrivateGetDownloadUrlFunction::
}
bool FileBrowserPrivateGetDownloadUrlFunction::RunAsync() {
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(
chromeos::switches::kEnableVideoPlayerChromecastSupport)) {
SetError("Cast support is disabled.");
SetResult(new base::StringValue("")); // Intentionally returns a blank.
return false;
}
using extensions::api::file_browser_private::GetShareUrl::Params;
const scoped_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
......
......@@ -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.
......
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