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

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

Issue 11571014: Lazy load chrome.* APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: windows interactive_ui_tests fix Created 7 years, 10 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/renderer/extensions/file_browser_private_custom_bindings.cc
diff --git a/chrome/renderer/extensions/file_browser_private_custom_bindings.cc b/chrome/renderer/extensions/file_browser_private_custom_bindings.cc
index 355e838316042ab28dbc8197a294e50de92630aa..364dfa444638ce1bfb02a4449d1e1ebe0aea0477 100644
--- a/chrome/renderer/extensions/file_browser_private_custom_bindings.cc
+++ b/chrome/renderer/extensions/file_browser_private_custom_bindings.cc
@@ -13,9 +13,18 @@
#include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
-namespace {
+namespace extensions {
+
+FileBrowserPrivateCustomBindings::FileBrowserPrivateCustomBindings(
+ v8::Handle<v8::Context> context)
+ : ChromeV8Extension(NULL, context) {
+ RouteFunction(
+ "GetLocalFileSystem",
+ base::Bind(&FileBrowserPrivateCustomBindings::GetLocalFileSystem,
+ base::Unretained(this)));
+}
-static v8::Handle<v8::Value> GetLocalFileSystem(
+v8::Handle<v8::Value> FileBrowserPrivateCustomBindings::GetLocalFileSystem(
const v8::Arguments& args) {
DCHECK(args.Length() == 2);
DCHECK(args[0]->IsString());
@@ -23,7 +32,7 @@ static v8::Handle<v8::Value> GetLocalFileSystem(
std::string name(*v8::String::Utf8Value(args[0]));
std::string path(*v8::String::Utf8Value(args[1]));
- WebKit::WebFrame* webframe = WebKit::WebFrame::frameForCurrentContext();
+ WebKit::WebFrame* webframe = WebKit::WebFrame::frameForContext(v8_context());
DCHECK(webframe);
return webframe->createFileSystem(
WebKit::WebFileSystem::TypeExternal,
@@ -31,13 +40,4 @@ static v8::Handle<v8::Value> GetLocalFileSystem(
WebKit::WebString::fromUTF8(path.c_str()));
}
-} // namespace
-
-namespace extensions {
-
-FileBrowserPrivateCustomBindings::FileBrowserPrivateCustomBindings()
- : ChromeV8Extension(NULL) {
- RouteStaticFunction("GetLocalFileSystem", &GetLocalFileSystem);
-}
-
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698