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 |