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

Unified Diff: chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc

Issue 294073007: [fsp] Let extensions decide about the file system id. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc
diff --git a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc
index c615cae6200820e6df720d5385ff24be350f9afd..bdc2dc9093826ab9452df80b876ed70b1fff85cd 100644
--- a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc
+++ b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc
@@ -26,10 +26,17 @@ bool FileSystemProviderMountFunction::RunSync() {
const scoped_ptr<Params> params(Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
+ // It's an error if the file system Id is empty.
+ if (params->file_system_id.empty()) {
+ base::ListValue* result = new base::ListValue();
+ result->Append(CreateError(kSecurityErrorName, kEmptyIdErrorMessage));
+ SetResult(result);
+ return true;
+ }
+
// It's an error if the display name is empty.
if (params->display_name.empty()) {
base::ListValue* result = new base::ListValue();
- result->Append(new base::StringValue(""));
result->Append(CreateError(kSecurityErrorName,
kEmptyNameErrorMessage));
SetResult(result);
@@ -41,24 +48,16 @@ bool FileSystemProviderMountFunction::RunSync() {
if (!service)
return false;
- int file_system_id =
- service->MountFileSystem(extension_id(), params->display_name);
-
- // If the |file_system_id| is zero, then it means that registering the file
- // system failed.
// TODO(mtomasz): Pass more detailed errors, rather than just a bool.
- if (!file_system_id) {
+ if (!service->MountFileSystem(
+ extension_id(), params->file_system_id, params->display_name)) {
base::ListValue* result = new base::ListValue();
- result->Append(new base::FundamentalValue(0));
result->Append(CreateError(kSecurityErrorName, kMountFailedErrorMessage));
SetResult(result);
return true;
}
base::ListValue* result = new base::ListValue();
- result->Append(new base::FundamentalValue(file_system_id));
- // Don't append an error on success.
-
SetResult(result);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698