summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormtomasz <mtomasz@chromium.org>2015-07-17 00:48:52 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-17 07:49:37 +0000
commit8316e51650ca1632c82460b4247f53c8b8106229 (patch)
tree698a51559d7fdfa3082a4da5aa838221340be815
parent10dd1c0953df66761e407ba7f6e9c0fe2ddeb198 (diff)
downloadchromium_src-8316e51650ca1632c82460b4247f53c8b8106229.zip
chromium_src-8316e51650ca1632c82460b4247f53c8b8106229.tar.gz
chromium_src-8316e51650ca1632c82460b4247f53c8b8106229.tar.bz2
Update some chrome.fileManagerPrivate APIs to accept entries, not URLs.
NOPRESUBMIT=true TEST=All current tests pass. Closure compiler compiles. BUG=507210 Review URL: https://codereview.chromium.org/1224303006 Cr-Commit-Position: refs/heads/master@{#339227}
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc50
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_drive.h26
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc22
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_file_system.h13
-rw-r--r--chrome/common/extensions/api/file_manager_private.idl20
-rw-r--r--chrome/common/extensions/api/file_manager_private_internal.idl11
-rw-r--r--chrome/renderer/resources/extensions/file_manager_private_custom_bindings.js23
-rw-r--r--extensions/browser/extension_function_histogram_value.h8
-rw-r--r--third_party/closure_compiler/externs/file_manager_private.js25
-rw-r--r--tools/metrics/histograms/histograms.xml8
-rw-r--r--ui/file_manager/file_manager/background/js/media_import_handler.js2
-rw-r--r--ui/file_manager/file_manager/background/js/media_import_handler_unittest.js8
-rw-r--r--ui/file_manager/file_manager/foreground/js/file_transfer_controller.js2
-rw-r--r--ui/file_manager/file_manager/foreground/js/ui/share_dialog.js2
-rw-r--r--ui/file_manager/video_player/js/cast/media_manager.js6
15 files changed, 132 insertions, 94 deletions
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
index e4e8294..cd25169 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
@@ -921,8 +921,8 @@ void FileManagerPrivateRequestAccessTokenFunction::OnAccessTokenFetched(
SendResponse(true);
}
-bool FileManagerPrivateGetShareUrlFunction::RunAsync() {
- using extensions::api::file_manager_private::GetShareUrl::Params;
+bool FileManagerPrivateInternalGetShareUrlFunction::RunAsync() {
+ using extensions::api::file_manager_private_internal::GetShareUrl::Params;
const scoped_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -942,11 +942,12 @@ bool FileManagerPrivateGetShareUrlFunction::RunAsync() {
file_system->GetShareUrl(
drive_path,
GURL("chrome-extension://" + extension_id()), // embed origin
- base::Bind(&FileManagerPrivateGetShareUrlFunction::OnGetShareUrl, this));
+ base::Bind(&FileManagerPrivateInternalGetShareUrlFunction::OnGetShareUrl,
+ this));
return true;
}
-void FileManagerPrivateGetShareUrlFunction::OnGetShareUrl(
+void FileManagerPrivateInternalGetShareUrlFunction::OnGetShareUrl(
drive::FileError error,
const GURL& share_url) {
if (error != drive::FILE_ERROR_OK) {
@@ -959,8 +960,9 @@ void FileManagerPrivateGetShareUrlFunction::OnGetShareUrl(
SendResponse(true);
}
-bool FileManagerPrivateRequestDriveShareFunction::RunAsync() {
- using extensions::api::file_manager_private::RequestDriveShare::Params;
+bool FileManagerPrivateInternalRequestDriveShareFunction::RunAsync() {
+ using extensions::api::file_manager_private_internal::RequestDriveShare::
+ Params;
const scoped_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -1001,29 +1003,26 @@ bool FileManagerPrivateRequestDriveShareFunction::RunAsync() {
// Share |drive_path| in |owner_file_system| to |user->email()|.
owner_file_system->AddPermission(
- drive_path,
- user->email(),
- role,
- base::Bind(&FileManagerPrivateRequestDriveShareFunction::OnAddPermission,
- this));
+ drive_path, user->email(), role,
+ base::Bind(
+ &FileManagerPrivateInternalRequestDriveShareFunction::OnAddPermission,
+ this));
return true;
}
-void FileManagerPrivateRequestDriveShareFunction::OnAddPermission(
+void FileManagerPrivateInternalRequestDriveShareFunction::OnAddPermission(
drive::FileError error) {
SendResponse(error == drive::FILE_ERROR_OK);
}
-FileManagerPrivateGetDownloadUrlFunction::
- FileManagerPrivateGetDownloadUrlFunction() {
-}
+FileManagerPrivateInternalGetDownloadUrlFunction::
+ FileManagerPrivateInternalGetDownloadUrlFunction() {}
-FileManagerPrivateGetDownloadUrlFunction::
- ~FileManagerPrivateGetDownloadUrlFunction() {
-}
+FileManagerPrivateInternalGetDownloadUrlFunction::
+ ~FileManagerPrivateInternalGetDownloadUrlFunction() {}
-bool FileManagerPrivateGetDownloadUrlFunction::RunAsync() {
- using extensions::api::file_manager_private::GetShareUrl::Params;
+bool FileManagerPrivateInternalGetDownloadUrlFunction::RunAsync() {
+ using extensions::api::file_manager_private_internal::GetShareUrl::Params;
const scoped_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
@@ -1048,12 +1047,13 @@ bool FileManagerPrivateGetDownloadUrlFunction::RunAsync() {
file_system->GetResourceEntry(
file_path,
- base::Bind(&FileManagerPrivateGetDownloadUrlFunction::OnGetResourceEntry,
- this));
+ base::Bind(
+ &FileManagerPrivateInternalGetDownloadUrlFunction::OnGetResourceEntry,
+ this));
return true;
}
-void FileManagerPrivateGetDownloadUrlFunction::OnGetResourceEntry(
+void FileManagerPrivateInternalGetDownloadUrlFunction::OnGetResourceEntry(
drive::FileError error,
scoped_ptr<drive::ResourceEntry> entry) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -1084,10 +1084,10 @@ void FileManagerPrivateGetDownloadUrlFunction::OnGetResourceEntry(
GetProfile()->GetRequestContext(),
scopes));
auth_service_->StartAuthentication(base::Bind(
- &FileManagerPrivateGetDownloadUrlFunction::OnTokenFetched, this));
+ &FileManagerPrivateInternalGetDownloadUrlFunction::OnTokenFetched, this));
}
-void FileManagerPrivateGetDownloadUrlFunction::OnTokenFetched(
+void FileManagerPrivateInternalGetDownloadUrlFunction::OnTokenFetched(
google_apis::DriveApiErrorCode code,
const std::string& access_token) {
if (code != google_apis::HTTP_SUCCESS) {
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.h b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.h
index f36800f..cb1cd1d 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.h
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.h
@@ -197,14 +197,14 @@ class FileManagerPrivateRequestAccessTokenFunction
};
// Implements the chrome.fileManagerPrivate.getShareUrl method.
-class FileManagerPrivateGetShareUrlFunction
+class FileManagerPrivateInternalGetShareUrlFunction
: public LoggedAsyncExtensionFunction {
public:
- DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getShareUrl",
- FILEMANAGERPRIVATE_GETSHAREURL)
+ DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.getShareUrl",
+ FILEMANAGERPRIVATEINTERNAL_GETSHAREURL)
protected:
- ~FileManagerPrivateGetShareUrlFunction() override {}
+ ~FileManagerPrivateInternalGetShareUrlFunction() override {}
// AsyncExtensionFunction overrides.
bool RunAsync() override;
@@ -215,14 +215,14 @@ class FileManagerPrivateGetShareUrlFunction
};
// Implements the chrome.fileManagerPrivate.requestDriveShare method.
-class FileManagerPrivateRequestDriveShareFunction
+class FileManagerPrivateInternalRequestDriveShareFunction
: public LoggedAsyncExtensionFunction {
public:
- DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.requestDriveShare",
- FILEMANAGERPRIVATE_REQUESTDRIVESHARE);
+ DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.requestDriveShare",
+ FILEMANAGERPRIVATEINTERNAL_REQUESTDRIVESHARE);
protected:
- ~FileManagerPrivateRequestDriveShareFunction() override {}
+ ~FileManagerPrivateInternalRequestDriveShareFunction() override {}
bool RunAsync() override;
private:
@@ -231,16 +231,16 @@ class FileManagerPrivateRequestDriveShareFunction
};
// Implements the chrome.fileManagerPrivate.getDownloadUrl method.
-class FileManagerPrivateGetDownloadUrlFunction
+class FileManagerPrivateInternalGetDownloadUrlFunction
: public LoggedAsyncExtensionFunction {
public:
- FileManagerPrivateGetDownloadUrlFunction();
+ FileManagerPrivateInternalGetDownloadUrlFunction();
- DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getDownloadUrl",
- FILEMANAGERPRIVATE_GETDOWNLOADURL)
+ DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.getDownloadUrl",
+ FILEMANAGERPRIVATEINTERNAL_GETDOWNLOADURL)
protected:
- ~FileManagerPrivateGetDownloadUrlFunction() override;
+ ~FileManagerPrivateInternalGetDownloadUrlFunction() override;
// AsyncExtensionFunction overrides.
bool RunAsync() override;
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
index 129fc1b..43f3921 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
@@ -898,18 +898,18 @@ FileManagerPrivateIsUMAEnabledFunction::Run() {
ChromeMetricsServiceAccessor::IsMetricsReportingEnabled())));
}
-FileManagerPrivateSetEntryTagFunction::FileManagerPrivateSetEntryTagFunction()
- : chrome_details_(this) {
-}
+FileManagerPrivateInternalSetEntryTagFunction::
+ FileManagerPrivateInternalSetEntryTagFunction()
+ : chrome_details_(this) {}
-ExtensionFunction::ResponseAction FileManagerPrivateSetEntryTagFunction::Run() {
- using extensions::api::file_manager_private::SetEntryTag::Params;
+ExtensionFunction::ResponseAction
+FileManagerPrivateInternalSetEntryTagFunction::Run() {
+ using extensions::api::file_manager_private_internal::SetEntryTag::Params;
const scoped_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
const base::FilePath local_path = file_manager::util::GetLocalPathFromURL(
- render_frame_host(), chrome_details_.GetProfile(),
- GURL(params->entry_url));
+ render_frame_host(), chrome_details_.GetProfile(), GURL(params->url));
const base::FilePath drive_path = drive::util::ExtractDrivePath(local_path);
if (drive_path.empty())
return RespondNow(Error("Only Drive files and directories are supported."));
@@ -936,13 +936,13 @@ ExtensionFunction::ResponseAction FileManagerPrivateSetEntryTagFunction::Run() {
file_system->SetProperty(
drive_path, visibility, params->key, params->value,
- base::Bind(
- &FileManagerPrivateSetEntryTagFunction::OnSetEntryPropertyCompleted,
- this));
+ base::Bind(&FileManagerPrivateInternalSetEntryTagFunction::
+ OnSetEntryPropertyCompleted,
+ this));
return RespondLater();
}
-void FileManagerPrivateSetEntryTagFunction::OnSetEntryPropertyCompleted(
+void FileManagerPrivateInternalSetEntryTagFunction::OnSetEntryPropertyCompleted(
drive::FileError result) {
Respond(result == drive::FILE_ERROR_OK ? NoArguments()
: Error("Failed to set a tag."));
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.h b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.h
index 3463212..feee389 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.h
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.h
@@ -311,13 +311,14 @@ class FileManagerPrivateIsUMAEnabledFunction
};
// Implements the chrome.fileManagerPrivate.setEntryTag method.
-class FileManagerPrivateSetEntryTagFunction : public UIThreadExtensionFunction {
+class FileManagerPrivateInternalSetEntryTagFunction
+ : public UIThreadExtensionFunction {
public:
- FileManagerPrivateSetEntryTagFunction();
- DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.setEntryTag",
- FILEMANAGERPRIVATE_SETENTRYTAG)
+ FileManagerPrivateInternalSetEntryTagFunction();
+ DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.setEntryTag",
+ FILEMANAGERPRIVATEINTERNAL_SETENTRYTAG)
protected:
- ~FileManagerPrivateSetEntryTagFunction() override {}
+ ~FileManagerPrivateInternalSetEntryTagFunction() override {}
private:
const ChromeExtensionFunctionDetails chrome_details_;
@@ -326,7 +327,7 @@ class FileManagerPrivateSetEntryTagFunction : public UIThreadExtensionFunction {
void OnSetEntryPropertyCompleted(drive::FileError result);
ExtensionFunction::ResponseAction Run() override;
- DISALLOW_COPY_AND_ASSIGN(FileManagerPrivateSetEntryTagFunction);
+ DISALLOW_COPY_AND_ASSIGN(FileManagerPrivateInternalSetEntryTagFunction);
};
} // namespace extensions
diff --git a/chrome/common/extensions/api/file_manager_private.idl b/chrome/common/extensions/api/file_manager_private.idl
index 5709a7d..85ddde1 100644
--- a/chrome/common/extensions/api/file_manager_private.idl
+++ b/chrome/common/extensions/api/file_manager_private.idl
@@ -874,19 +874,24 @@ interface Functions {
RequestWebStoreAccessTokenCallback callback);
// Requests a share dialog url for the specified file.
- // |url| Url for the file.
+ // |entry| The entry to share.
// |callback|
- static void getShareUrl(DOMString url, GetUrlCallback callback);
+ [nocompile]
+ static void getShareUrl([instanceof=Entry] object entry,
+ GetUrlCallback callback);
// Requests a download url to download the file contents.
- // |url| Url for the file.
+ // |entry| The entry to download.
// |callback|
- static void getDownloadUrl(DOMString url, GetUrlCallback callback);
+ [nocompile]
+ static void getDownloadUrl([instanceof=Entry] object entry,
+ GetUrlCallback callback);
// Requests to share drive files.
- // |url| URL of a file to be shared.
+ // |entry| Entry to be shared.
// |shareType| Type of access that is getting granted.
- static void requestDriveShare(DOMString url,
+ [nocompile]
+ static void requestDriveShare([instanceof=Entry] object entry,
DriveShareType shareType,
SimpleCallback callback);
@@ -908,7 +913,8 @@ interface Functions {
static void isUMAEnabled(BooleanCallback callback);
// Sets a tag on a file or a directory. Only Drive files are supported.
- static void setEntryTag(DOMString entryURL,
+ [nocompile]
+ static void setEntryTag([instanceof=Entry] object entry,
EntryTagVisibility visibility,
DOMString key,
DOMString value,
diff --git a/chrome/common/extensions/api/file_manager_private_internal.idl b/chrome/common/extensions/api/file_manager_private_internal.idl
index 7c6a98c..4ca4afe 100644
--- a/chrome/common/extensions/api/file_manager_private_internal.idl
+++ b/chrome/common/extensions/api/file_manager_private_internal.idl
@@ -25,6 +25,7 @@ namespace fileManagerPrivateInternal {
callback GetMimeTypeCallback = void(DOMString result);
callback ExecuteTaskCallback = void(fileManagerPrivate.TaskResult result);
callback GetFileTasksCallback = void(fileManagerPrivate.FileTask[] tasks);
+ callback GetUrlCallback = void(DOMString url);
interface Functions {
static void resolveIsolatedEntries(DOMString[] urls,
@@ -60,5 +61,15 @@ namespace fileManagerPrivateInternal {
SimpleCallback callback);
static void getFileTasks(DOMString[] urls,
GetFileTasksCallback callback);
+ static void getShareUrl(DOMString url, GetUrlCallback callback);
+ static void getDownloadUrl(DOMString url, GetUrlCallback callback);
+ static void requestDriveShare(DOMString url,
+ fileManagerPrivate.DriveShareType shareType,
+ SimpleCallback callback);
+ static void setEntryTag(DOMString url,
+ fileManagerPrivate.EntryTagVisibility visibility,
+ DOMString key,
+ DOMString value,
+ SimpleCallback callback);
};
};
diff --git a/chrome/renderer/resources/extensions/file_manager_private_custom_bindings.js b/chrome/renderer/resources/extensions/file_manager_private_custom_bindings.js
index 7bfa6ca..90644fc 100644
--- a/chrome/renderer/resources/extensions/file_manager_private_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/file_manager_private_custom_bindings.js
@@ -136,6 +136,29 @@ binding.registerCustomHook(function(bindingsAPI) {
});
fileManagerPrivateInternal.getFileTasks(urls, callback);
});
+
+ apiFunctions.setHandleRequest('getShareUrl', function(entry, callback) {
+ var url = fileBrowserHandlerNatives.GetEntryURL(entry);
+ fileManagerPrivateInternal.getShareUrl(url, callback);
+ });
+
+ apiFunctions.setHandleRequest('getDownloadUrl', function(entry, callback) {
+ var url = fileBrowserHandlerNatives.GetEntryURL(entry);
+ fileManagerPrivateInternal.getDownloadUrl(url, callback);
+ });
+
+ apiFunctions.setHandleRequest('requestDriveShare', function(
+ entry, shareType, callback) {
+ var url = fileBrowserHandlerNatives.GetEntryURL(entry);
+ fileManagerPrivateInternal.requestDriveShare(url, shareType, callback);
+ });
+
+ apiFunctions.setHandleRequest('setEntryTag', function(
+ entry, visibility, key, value, callback) {
+ var url = fileBrowserHandlerNatives.GetEntryURL(entry);
+ fileManagerPrivateInternal.setEntryTag(
+ url, visibility, key, value, callback);
+ });
});
eventBindings.registerArgumentMassager(
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h
index c0cec6d..f039163 100644
--- a/extensions/browser/extension_function_histogram_value.h
+++ b/extensions/browser/extension_function_histogram_value.h
@@ -570,7 +570,7 @@ enum HistogramValue {
SYSTEM_DISPLAY_GETINFO,
SYSTEM_DISPLAY_SETDISPLAYPROPERTIES,
SYSTEM_MEMORY_GETINFO,
- FILEMANAGERPRIVATE_GETSHAREURL,
+ FILEMANAGERPRIVATEINTERNAL_GETSHAREURL,
SYSTEM_STORAGE_GETINFO,
SYSTEM_STORAGE_EJECTDEVICE,
DELETED_SYSTEM_STORAGE_ADDAVAILABLECAPACITYWATCH,
@@ -761,7 +761,7 @@ enum HistogramValue {
APP_CURRENTWINDOWINTERNAL_SETSIZECONSTRAINTS,
BLUETOOTH_GETDEVICE,
GCM_UNREGISTER,
- FILEMANAGERPRIVATE_REQUESTDRIVESHARE,
+ FILEMANAGERPRIVATEINTERNAL_REQUESTDRIVESHARE,
METRICSPRIVATE_RECORDSPARSEVALUE,
HOTWORDPRIVATE_SETAUDIOLOGGINGENABLED,
BLUETOOTHPRIVATE_SETADAPTERSTATE,
@@ -899,7 +899,7 @@ enum HistogramValue {
GCDPRIVATE_GETCOMMANDSLIST,
APPVIEWINTERNAL_ATTACHFRAME,
APPVIEWINTERNAL_DENYREQUEST,
- FILEMANAGERPRIVATE_GETDOWNLOADURL,
+ FILEMANAGERPRIVATEINTERNAL_GETDOWNLOADURL,
EASYUNLOCKPRIVATE_PERFORMECDHKEYAGREEMENT,
EASYUNLOCKPRIVATE_GENERATEECP256KEYPAIR,
EASYUNLOCKPRIVATE_CREATESECUREMESSAGE,
@@ -1028,7 +1028,7 @@ enum HistogramValue {
AUDIOMODEM_STOPRECEIVE,
WEBRTCLOGGINGPRIVATE_STORE,
WEBRTCLOGGINGPRIVATE_UPLOADSTORED,
- FILEMANAGERPRIVATE_SETENTRYTAG,
+ FILEMANAGERPRIVATEINTERNAL_SETENTRYTAG,
INPUTMETHODPRIVATE_FETCHALLDICTIONARYWORDS,
INPUTMETHODPRIVATE_ADDWORDTODICTIONARY,
WEBSTOREPRIVATE_SHOWPERMISSIONPROMPTFORDELEGATEDINSTALL,
diff --git a/third_party/closure_compiler/externs/file_manager_private.js b/third_party/closure_compiler/externs/file_manager_private.js
index 427b433..c14569f 100644
--- a/third_party/closure_compiler/externs/file_manager_private.js
+++ b/third_party/closure_compiler/externs/file_manager_private.js
@@ -530,29 +530,26 @@ chrome.fileManagerPrivate.requestAccessToken = function(refresh, callback) {};
chrome.fileManagerPrivate.requestWebStoreAccessToken = function(callback) {};
/**
- * Requests a share dialog url for the specified file. |url| Url for the file.
- * |callback|
- * @param {string} url
+ * Requests a share dialog url for the specified file.
+ * @param {!Entry} entry
* @param {function((string|undefined))} callback Callback with the result url.
*/
-chrome.fileManagerPrivate.getShareUrl = function(url, callback) {};
+chrome.fileManagerPrivate.getShareUrl = function(entry, callback) {};
/**
- * Requests a download url to download the file contents. |url| Url for the
- * file. |callback|
- * @param {string} url
+ * Requests a download url to download the file contents.
+ * @param {!Entry} entry
* @param {function((string|undefined))} callback Callback with the result url.
*/
-chrome.fileManagerPrivate.getDownloadUrl = function(url, callback) {};
+chrome.fileManagerPrivate.getDownloadUrl = function(entry, callback) {};
/**
- * Requests to share drive files. |url| URL of a file to be shared. |shareType|
- * Type of access that is getting granted.
- * @param {string} url
+ * Requests to share drive files.
+ * @param {!Entry} entry
* @param {string} shareType
* @param {function()} callback Callback that does not take arguments.
*/
-chrome.fileManagerPrivate.requestDriveShare = function(url, shareType,
+chrome.fileManagerPrivate.requestDriveShare = function(entry, shareType,
callback) {};
/**
@@ -605,13 +602,13 @@ chrome.fileManagerPrivate.isUMAEnabled = function(callback) {};
/**
* Sets a tag on a file or a directory. Only Drive files are supported.
- * @param {string} entryURL
+ * @param {!Entry} entry
* @param {string} visibility 'private' or 'public'
* @param {string} key
* @param {string} value
* @param {function()} callback
*/
-chrome.fileManagerPrivate.setEntryTag = function(entryURL, visibility, key,
+chrome.fileManagerPrivate.setEntryTag = function(entry, visibility, key,
value, callback) {};
/**
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 4f1afcd..0a86f51 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -55726,7 +55726,7 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
<int value="509" label="SYSTEM_DISPLAY_GETINFO"/>
<int value="510" label="SYSTEM_DISPLAY_SETDISPLAYPROPERTIES"/>
<int value="511" label="SYSTEM_MEMORY_GETINFO"/>
- <int value="512" label="FILEMANAGERPRIVATE_GETSHAREURL"/>
+ <int value="512" label="FILEMANAGERPRIVATEINTERNAL_GETSHAREURL"/>
<int value="513" label="SYSTEM_STORAGE_GETINFO"/>
<int value="514" label="SYSTEM_STORAGE_EJECTDEVICE"/>
<int value="515" label="DELETED_SYSTEM_STORAGE_ADDAVAILABLECAPACITYWATCH"/>
@@ -55920,7 +55920,7 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
<int value="700" label="APP_CURRENTWINDOWINTERNAL_SETSIZECONSTRAINTS"/>
<int value="701" label="BLUETOOTH_GETDEVICE"/>
<int value="702" label="GCM_UNREGISTER"/>
- <int value="703" label="FILEMANAGERPRIVATE_REQUESTDRIVESHARE"/>
+ <int value="703" label="FILEMANAGERPRIVATEINTERNAL_REQUESTDRIVESHARE"/>
<int value="704" label="METRICSPRIVATE_RECORDSPARSEVALUE"/>
<int value="705" label="HOTWORDPRIVATE_SETAUDIOLOGGINGENABLED"/>
<int value="706" label="BLUETOOTHPRIVATE_SETADAPTERSTATE"/>
@@ -56070,7 +56070,7 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
<int value="838" label="GCDPRIVATE_GETCOMMANDSLIST"/>
<int value="839" label="APPVIEWINTERNAL_ATTACHFRAME"/>
<int value="840" label="APPVIEWINTERNAL_DENYREQUEST"/>
- <int value="841" label="FILEMANAGERPRIVATE_GETDOWNLOADURL"/>
+ <int value="841" label="FILEMANAGERPRIVATEINTERNAL_GETDOWNLOADURL"/>
<int value="842" label="EASYUNLOCKPRIVATE_PERFORMECDHKEYAGREEMENT"/>
<int value="843" label="EASYUNLOCKPRIVATE_GENERATEECP256KEYPAIR"/>
<int value="844" label="EASYUNLOCKPRIVATE_CREATESECUREMESSAGE"/>
@@ -56200,7 +56200,7 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
<int value="967" label="AUDIOMODEM_STOPRECEIVE"/>
<int value="968" label="WEBRTCLOGGINGPRIVATE_STORE"/>
<int value="969" label="WEBRTCLOGGINGPRIVATE_UPLOADSTORED"/>
- <int value="970" label="FILEMANAGERPRIVATE_SETENTRYTAG"/>
+ <int value="970" label="FILEMANAGERPRIVATEINTERNAL_SETENTRYTAG"/>
<int value="971" label="INPUTMETHODPRIVATE_FETCHALLDICTIONARYWORDS"/>
<int value="972" label="INPUTMETHODPRIVATE_ADDWORDTODICTIONARY"/>
<int value="973"
diff --git a/ui/file_manager/file_manager/background/js/media_import_handler.js b/ui/file_manager/file_manager/background/js/media_import_handler.js
index 52cbbce..ba7fa01 100644
--- a/ui/file_manager/file_manager/background/js/media_import_handler.js
+++ b/ui/file_manager/file_manager/background/js/media_import_handler.js
@@ -166,7 +166,7 @@ importer.MediaImportHandler.prototype.onFileImported_ =
// Tag the import with a private drive property.
chrome.fileManagerPrivate.setEntryTag(
- info.destination.toURL(),
+ info.destination,
'private', // Scoped to just this app.
importer.MediaImportHandler.IMPORTS_TAG_KEY,
importer.MediaImportHandler.IMPORTS_TAG_VALUE,
diff --git a/ui/file_manager/file_manager/background/js/media_import_handler_unittest.js b/ui/file_manager/file_manager/background/js/media_import_handler_unittest.js
index 5df8602..b9659cd 100644
--- a/ui/file_manager/file_manager/background/js/media_import_handler_unittest.js
+++ b/ui/file_manager/file_manager/background/js/media_import_handler_unittest.js
@@ -359,16 +359,16 @@ function testTagsEntriesAfterImport(callback) {
});
});
- var taggedUrls = [];
+ var taggedEntries = [];
// Replace chrome.fileManagerPrivate.setEntryTag with a listener.
- chrome.fileManagerPrivate.setEntryTag = function(url) {
- taggedUrls.push(url);
+ chrome.fileManagerPrivate.setEntryTag = function(entry) {
+ taggedEntries.push(entry);
};
reportPromise(
whenImportDone.then(
function() {
- assertEquals(entries.length, taggedUrls.length);
+ assertEquals(entries.length, taggedEntries.length);
}),
callback);
diff --git a/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js b/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
index 4c7a39f..3062738 100644
--- a/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
+++ b/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
@@ -553,7 +553,7 @@ FileTransferController.prototype.paste =
return;
return new Promise(function(fulfill) {
chrome.fileManagerPrivate.requestDriveShare(
- shareEntries[index].toURL(),
+ shareEntries[index],
dialogResult,
function() {
// TODO(hirono): Check chrome.runtime.lastError
diff --git a/ui/file_manager/file_manager/foreground/js/ui/share_dialog.js b/ui/file_manager/file_manager/foreground/js/ui/share_dialog.js
index 71a9413..879bbeb 100644
--- a/ui/file_manager/file_manager/foreground/js/ui/share_dialog.js
+++ b/ui/file_manager/file_manager/foreground/js/ui/share_dialog.js
@@ -302,7 +302,7 @@ ShareDialog.prototype.showEntry = function(entry, callback) {
// Fetches an url to the sharing dialog.
group.add(function(inCallback) {
chrome.fileManagerPrivate.getShareUrl(
- entry.toURL(),
+ entry,
function(inShareUrl) {
if (!chrome.runtime.lastError)
shareUrl = inShareUrl;
diff --git a/ui/file_manager/video_player/js/cast/media_manager.js b/ui/file_manager/video_player/js/cast/media_manager.js
index 2083477..8a32389 100644
--- a/ui/file_manager/video_player/js/cast/media_manager.js
+++ b/ui/file_manager/video_player/js/cast/media_manager.js
@@ -5,7 +5,7 @@
/**
* Media manager class.
* This class supports the information for the media file.
- * @param {FileEntry} entry Entry of media file. This must be a external entry.
+ * @param {!FileEntry} entry Entry of media file. This must be a external entry.
* @constructor
*/
function MediaManager(entry) {
@@ -50,7 +50,7 @@ MediaManager.prototype.getToken = function(refresh) {
return new Promise(function(fulfill, reject) {
// TODO(yoshiki): Creates the method to get a token and use it.
- chrome.fileManagerPrivate.getDownloadUrl(this.entry_.toURL(), fulfill);
+ chrome.fileManagerPrivate.getDownloadUrl(this.entry_, fulfill);
}.bind(this)).then(function(url) {
if (chrome.runtime.lastError) {
return Promise.reject(
@@ -83,7 +83,7 @@ MediaManager.prototype.getUrl = function() {
return new Promise(function(fulfill, reject) {
// TODO(yoshiki): Creates the method to get a url and use it.
- chrome.fileManagerPrivate.getDownloadUrl(this.entry_.toURL(), fulfill);
+ chrome.fileManagerPrivate.getDownloadUrl(this.entry_, fulfill);
}.bind(this)).then(function(url) {
if (chrome.runtime.lastError) {
return Promise.reject(