Index: chrome/renderer/plugins/chrome_plugin_placeholder.cc |
diff --git a/chrome/renderer/plugins/chrome_plugin_placeholder.cc b/chrome/renderer/plugins/chrome_plugin_placeholder.cc |
index 182071fa4ee82e25390f11cd7584a5025dedfe66..7ddf63e7ac974158f26d26df95abff73ba1f82ca 100644 |
--- a/chrome/renderer/plugins/chrome_plugin_placeholder.cc |
+++ b/chrome/renderer/plugins/chrome_plugin_placeholder.cc |
@@ -14,12 +14,14 @@ |
#include "content/public/common/context_menu_params.h" |
#include "content/public/renderer/render_frame.h" |
#include "content/public/renderer/render_thread.h" |
+#include "gin/object_template_builder.h" |
#include "grit/generated_resources.h" |
#include "grit/renderer_resources.h" |
#include "grit/webkit_strings.h" |
#include "third_party/WebKit/public/web/WebDocument.h" |
#include "third_party/WebKit/public/web/WebFrame.h" |
#include "third_party/WebKit/public/web/WebInputEvent.h" |
+#include "third_party/WebKit/public/web/WebKit.h" |
#include "third_party/WebKit/public/web/WebScriptSource.h" |
#include "ui/base/l10n/l10n_util.h" |
#include "ui/base/resource/resource_bundle.h" |
@@ -36,8 +38,6 @@ using blink::WebNode; |
using blink::WebPlugin; |
using blink::WebPluginContainer; |
using blink::WebPluginParams; |
-using webkit_glue::CppArgumentList; |
-using webkit_glue::CppVariant; |
namespace { |
const plugins::PluginPlaceholder* g_last_active_menu = NULL; |
@@ -46,6 +46,13 @@ const plugins::PluginPlaceholder* g_last_active_menu = NULL; |
const char ChromePluginPlaceholder::kPluginPlaceholderDataURL[] = |
"chrome://pluginplaceholderdata/"; |
+gin::ObjectTemplateBuilder ChromePluginPlaceholder::GetObjectTemplateBuilder( |
+ v8::Isolate* isolate) { |
+ return plugins::PluginPlaceholder::GetObjectTemplateBuilder(isolate) |
+ .SetMethod("openAboutPlugins", |
+ &ChromePluginPlaceholder::OpenAboutPluginsCallback); |
+} |
+ |
ChromePluginPlaceholder::ChromePluginPlaceholder( |
content::RenderFrame* render_frame, |
blink::WebFrame* frame, |
@@ -218,9 +225,7 @@ void ChromePluginPlaceholder::OnLoadBlockedPlugins( |
plugins::PluginPlaceholder::OnLoadBlockedPlugins(identifier); |
} |
-void ChromePluginPlaceholder::OpenAboutPluginsCallback( |
- const CppArgumentList& args, |
- CppVariant* result) { |
+void ChromePluginPlaceholder::OpenAboutPluginsCallback() { |
RenderThread::Get()->Send( |
new ChromeViewHostMsg_OpenAboutPlugins(routing_id())); |
} |
@@ -354,8 +359,13 @@ void ChromePluginPlaceholder::ShowContextMenu(const WebMouseEvent& event) { |
} |
void ChromePluginPlaceholder::BindWebFrame(blink::WebFrame* frame) { |
- plugins::PluginPlaceholder::BindWebFrame(frame); |
- BindCallback("openAboutPlugins", |
- base::Bind(&ChromePluginPlaceholder::OpenAboutPluginsCallback, |
- base::Unretained(this))); |
+ v8::Isolate* isolate = blink::mainThreadIsolate(); |
+ v8::HandleScope handle_scope(isolate); |
+ v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); |
+ DCHECK(!context.IsEmpty()); |
+ |
+ v8::Context::Scope context_scope(context); |
+ v8::Handle<v8::Object> global = context->Global(); |
+ global->Set(gin::StringToV8(isolate, "plugin"), |
+ gin::CreateHandle(isolate, this).ToV8()); |
} |