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

Unified Diff: chrome/renderer/extensions/file_system_natives.cc

Issue 50703013: fileSystemProvider: First cut at implementing fileSystemProvider API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 7 years, 1 month 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/renderer/extensions/file_system_natives.cc
diff --git a/chrome/renderer/extensions/file_system_natives.cc b/chrome/renderer/extensions/file_system_natives.cc
index 522d1ca97b5e541539f051167bdaa962e542de3b..e7943ca72681f71af2cce0edf6782ae42f119844 100644
--- a/chrome/renderer/extensions/file_system_natives.cc
+++ b/chrome/renderer/extensions/file_system_natives.cc
@@ -16,6 +16,7 @@
#include "third_party/WebKit/public/platform/WebFileSystem.h"
#include "third_party/WebKit/public/platform/WebFileSystemType.h"
#include "third_party/WebKit/public/platform/WebString.h"
+#include "third_party/WebKit/public/web/WebDOMError.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "webkit/common/fileapi/file_system_types.h"
#include "webkit/common/fileapi/file_system_util.h"
@@ -32,6 +33,9 @@ FileSystemNatives::FileSystemNatives(ChromeV8Context* context)
RouteFunction("CrackIsolatedFileSystemName",
base::Bind(&FileSystemNatives::CrackIsolatedFileSystemName,
base::Unretained(this)));
+ RouteFunction("GetDOMError",
+ base::Bind(&FileSystemNatives::GetDOMError,
+ base::Unretained(this)));
}
void FileSystemNatives::GetIsolatedFileSystem(
@@ -117,4 +121,33 @@ void FileSystemNatives::CrackIsolatedFileSystemName(
v8::String::New(filesystem_id.c_str(), filesystem_id.size()));
}
+void FileSystemNatives::GetDOMError(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ if (args.Length() != 2) {
+ NOTREACHED();
+ return;
+ }
+ if (!args[0]->IsString()) {
+ NOTREACHED();
+ return;
+ }
+ if (!args[1]->IsString()) {
+ NOTREACHED();
+ return;
+ }
+
+ std::string name(*v8::String::Utf8Value(args[0]));
+ if (name.empty()) {
+ NOTREACHED();
+ return;
+ }
+ std::string message(*v8::String::Utf8Value(args[1]));
+ // message is optional hence empty is fine.
+
+ blink::WebDOMError dom_error = blink::WebDOMError::create(
+ blink::WebString::fromUTF8(name),
+ blink::WebString::fromUTF8(message));
+ args.GetReturnValue().Set(dom_error.toV8Value());
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698