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

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

Issue 50703013: fileSystemProvider: First cut at implementing fileSystemProvider API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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/extensions/api/file_system_provider/file_system_provider_api.cc
diff --git a/chrome/browser/extensions/api/file_system_provider/file_system_provider_api.cc b/chrome/browser/extensions/api/file_system_provider/file_system_provider_api.cc
new file mode 100644
index 0000000000000000000000000000000000000000..10db4ee4fd5dd1f43cf39241899f03a4b96a0fcd
--- /dev/null
+++ b/chrome/browser/extensions/api/file_system_provider/file_system_provider_api.cc
@@ -0,0 +1,57 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/api/file_system_provider/file_system_provider_api.h"
+
+#include "chrome/common/extensions/api/file_system_provider.h"
+
+namespace extensions {
+
+namespace {
+
+const char kOK[] = "OK";
+
+// Names come from http://www.w3.org/TR/file-system-api/#errors-and-exceptions
+// TODO(satorux): Switch to DOMError once crbug.com/313131 is fixed.
+const char kEncodingError[] = "EncodingError";
+const char kInvalidModificationError[] = "InvalidModificationError";
+const char kInvalidStateError[] = "InvalidStateError";
+const char kNotFoundError[] = "NotFoundError";
+const char kNotReadableErr[] = "NotReadableErr";
+const char kNoModificationAllowedError[] = "NoModificationAllowedError";
+const char kPathExistsError[] = "PathExistsError";
+const char kQuotaExceededError[] = "QuotaExceededError";
+const char kSecurityError[] = "SecurityError";
+const char kTypeMismatchError[] = "TypeMismatchError";
+
+} // namespace
+
+bool FileSystemProviderMountFunction::RunImpl() {
+ using extensions::api::file_system_provider::Mount::Params;
+ const scoped_ptr<Params> params(Params::Create(*args_));
+ EXTENSION_FUNCTION_VALIDATE(params);
+
+ // It's an error if the display name is empty.
+ if (params->display_name.empty()) {
+ extensions::api::file_system_provider::Error error;
+ error.name = kSecurityError;
kinuko 2013/10/30 10:45:05 nit: should we give some descriptive message in er
satorux1 2013/10/31 01:51:26 Done.
+
+ results_ = extensions::api::file_system_provider::Mount::Results::Create(
+ error, "");
+ SendResponse(true);
+ return true;
+ }
+
+ extensions::api::file_system_provider::Error error;
+ error.name = kOK;
+ // TODO(satorux): Implement the real logic.
+ const std::string file_system_id = params->display_name;
+ results_ = extensions::api::file_system_provider::Mount::Results::Create(
+ error, file_system_id);
+ SendResponse(true);
+
+ return true;
+}
+
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698