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

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

Issue 1174343003: blink:bindings: Passes the global context instead of |this| in JS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/media_galleries_custom_bindings.cc
diff --git a/chrome/renderer/extensions/media_galleries_custom_bindings.cc b/chrome/renderer/extensions/media_galleries_custom_bindings.cc
index 1a08e30ecab73a4be0a4cb1050c579e6d26649f3..16d0b4aee15381e42d9aa0781b0a1a56af784779 100644
--- a/chrome/renderer/extensions/media_galleries_custom_bindings.cc
+++ b/chrome/renderer/extensions/media_galleries_custom_bindings.cc
@@ -15,11 +15,19 @@
namespace extensions {
-namespace {
+MediaGalleriesCustomBindings::MediaGalleriesCustomBindings(
+ ScriptContext* context)
+ : ObjectBackedNativeHandler(context) {
+ RouteFunction(
+ "GetMediaFileSystemObject",
+ base::Bind(&MediaGalleriesCustomBindings::GetMediaFileSystemObject,
+ base::Unretained(this)));
+}
// FileSystemObject GetMediaFileSystem(string file_system_url): construct
// a file system object from a file system url.
-void GetMediaFileSystemObject(const v8::FunctionCallbackInfo<v8::Value>& args) {
+void MediaGalleriesCustomBindings::GetMediaFileSystemObject(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK_EQ(1, args.Length());
CHECK(args[0]->IsString());
@@ -40,16 +48,7 @@ void GetMediaFileSystemObject(const v8::FunctionCallbackInfo<v8::Value>& args) {
blink::WebFileSystemTypeExternal,
blink::WebString::fromUTF8(fs_name),
root_url)
- .toV8Value(args.Holder(), args.GetIsolate()));
-}
-
-} // namespace
-
-MediaGalleriesCustomBindings::MediaGalleriesCustomBindings(
- ScriptContext* context)
- : ObjectBackedNativeHandler(context) {
- RouteFunction("GetMediaFileSystemObject",
- base::Bind(&GetMediaFileSystemObject));
+ .toV8Value(context()->v8_context()->Global(), args.GetIsolate()));
}
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698