summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/extensions/extension_process_bindings.cc17
-rw-r--r--chrome/renderer/resources/extension_process_bindings.js12
-rw-r--r--chrome/renderer/resources/renderer_extension_bindings.js2
3 files changed, 31 insertions, 0 deletions
diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc
index 1a1d7e5..bca44b1 100644
--- a/chrome/renderer/extensions/extension_process_bindings.cc
+++ b/chrome/renderer/extensions/extension_process_bindings.cc
@@ -234,6 +234,8 @@ class ExtensionImpl : public ExtensionBase {
return v8::FunctionTemplate::New(IsIncognitoProcess);
} else if (name->Equals(v8::String::New("GetUniqueSubEventName"))) {
return v8::FunctionTemplate::New(GetUniqueSubEventName);
+ } else if (name->Equals(v8::String::New("GetLocalFileSystem"))) {
+ return v8::FunctionTemplate::New(GetLocalFileSystem);
}
return ExtensionBase::GetNativeFunction(name);
@@ -301,6 +303,21 @@ class ExtensionImpl : public ExtensionBase {
return v8::String::New(unique_event_name.c_str());
}
+ // Attach an event name to an object.
+ static v8::Handle<v8::Value> GetLocalFileSystem(
+ const v8::Arguments& args) {
+ DCHECK(args.Length() == 2);
+ DCHECK(args[0]->IsString());
+ DCHECK(args[1]->IsString());
+ std::string name(*v8::String::Utf8Value(args[0]));
+ std::string path(*v8::String::Utf8Value(args[1]));
+
+ WebFrame* webframe = WebFrame::frameForCurrentContext();
+ return webframe->createFileSystem(fileapi::kFileSystemTypeLocal,
+ WebKit::WebString::fromUTF8(name.c_str()),
+ WebKit::WebString::fromUTF8(path.c_str()));
+ }
+
// Creates a new messaging channel to the tab with the given ID.
static v8::Handle<v8::Value> OpenChannelToTab(const v8::Arguments& args) {
// Get the current RenderView so that we can send a routed IPC message from
diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js
index 6565f6f..d8c2648 100644
--- a/chrome/renderer/resources/extension_process_bindings.js
+++ b/chrome/renderer/resources/extension_process_bindings.js
@@ -19,6 +19,7 @@ var chrome = chrome || {};
native function IsExtensionProcess();
native function IsIncognitoProcess();
native function GetUniqueSubEventName(eventName);
+ native function GetLocalFileSystem(name, path);
var chromeHidden = GetChromeHidden();
@@ -658,6 +659,17 @@ var chrome = chrome || {};
});
};
+ apiFunctions["fileBrowserPrivate.requestLocalFileSystem"].customCallback =
+ function(name, request, response) {
+ var resp = response ? [chromeHidden.JSON.parse(response)] : [];
+ var fs = null;
+ if (!resp[0].error)
+ fs = GetLocalFileSystem(resp[0].name, resp[0].path);
+ if (request.callback)
+ request.callback(fs);
+ request.callback = null;
+ };
+
apiFunctions["extension.getViews"].handleRequest = function(properties) {
var windowId = -1;
var type = "ALL";
diff --git a/chrome/renderer/resources/renderer_extension_bindings.js b/chrome/renderer/resources/renderer_extension_bindings.js
index afcd00d..aac3db9 100644
--- a/chrome/renderer/resources/renderer_extension_bindings.js
+++ b/chrome/renderer/resources/renderer_extension_bindings.js
@@ -318,6 +318,8 @@ var chrome = chrome || {};
"experimental.webRequest",
"history",
"idle",
+ "fileBrowserPrivate",
+ "fileSystem",
"management",
"omnibox",
"pageAction",