Commit 2e3086bc authored by yoshiki@chromium.org's avatar yoshiki@chromium.org

Video Player: Fix the private API error in Debug build

BUG=400892
TEST=manually tested

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

Cr-Commit-Position: refs/heads/master@{#288321}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288321 0039d316-1c4b-4281-b951-d872f2087c98
parent b13b58c7
......@@ -918,7 +918,11 @@ bool FileBrowserPrivateGetDownloadUrlFunction::RunAsync() {
const base::FilePath path = file_manager::util::GetLocalPathFromURL(
render_view_host(), GetProfile(), GURL(params->url));
DCHECK(drive::util::IsUnderDriveMountPoint(path));
if (!drive::util::IsUnderDriveMountPoint(path)) {
SetError("The given file is not in Drive.");
SetResult(new base::StringValue("")); // Intentionally returns a blank.
return false;
}
base::FilePath file_path = drive::util::ExtractDrivePath(path);
file_system->GetResourceEntry(
......
......@@ -51,6 +51,10 @@ MediaManager.prototype.getToken = function(refresh) {
// TODO(yoshiki): Creates the method to get a token and use it.
chrome.fileBrowserPrivate.getDownloadUrl(this.entry_.toURL(), fulfill);
}.bind(this)).then(function(url) {
if (chrome.runtime.lastError) {
return Promise.reject(
'Token fetch failed: ' + chrome.runtime.lastError.message);
}
if (!url)
return Promise.reject('Token fetch failed.');
var token = url.substring(url.indexOf('access_token=') + 13);
......@@ -76,6 +80,10 @@ MediaManager.prototype.getUrl = function() {
// TODO(yoshiki): Creates the method to get a url and use it.
chrome.fileBrowserPrivate.getDownloadUrl(this.entry_.toURL(), fulfill);
}.bind(this)).then(function(url) {
if (chrome.runtime.lastError) {
return Promise.reject(
'URL fetch failed: ' + chrome.runtime.lastError.message);
}
if (!url)
return Promise.reject('URL fetch failed.');
var access_token_index = url.indexOf('access_token=');
......
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