Index: components/plugins/renderer/plugin_placeholder.cc |
diff --git a/components/plugins/renderer/plugin_placeholder.cc b/components/plugins/renderer/plugin_placeholder.cc |
index df85dd562bd181041fd12c095143e0a83406458a..20d4e664bc3e4f42bcac8c93047e83ceb2e8059c 100644 |
--- a/components/plugins/renderer/plugin_placeholder.cc |
+++ b/components/plugins/renderer/plugin_placeholder.cc |
@@ -15,6 +15,7 @@ |
#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 "third_party/WebKit/public/web/WebDocument.h" |
#include "third_party/WebKit/public/web/WebElement.h" |
#include "third_party/WebKit/public/web/WebFrame.h" |
@@ -35,8 +36,6 @@ using blink::WebPluginContainer; |
using blink::WebPluginParams; |
using blink::WebScriptSource; |
using blink::WebURLRequest; |
-using webkit_glue::CppArgumentList; |
-using webkit_glue::CppVariant; |
namespace plugins { |
@@ -59,17 +58,16 @@ PluginPlaceholder::PluginPlaceholder(content::RenderFrame* render_frame, |
PluginPlaceholder::~PluginPlaceholder() {} |
-void PluginPlaceholder::BindWebFrame(WebFrame* frame) { |
- BindToJavascript(frame, "plugin"); |
- BindCallback( |
- "load", |
- base::Bind(&PluginPlaceholder::LoadCallback, base::Unretained(this))); |
- BindCallback( |
- "hide", |
- base::Bind(&PluginPlaceholder::HideCallback, base::Unretained(this))); |
- BindCallback("didFinishLoading", |
- base::Bind(&PluginPlaceholder::DidFinishLoadingCallback, |
- base::Unretained(this))); |
+// static |
+gin::WrapperInfo PluginPlaceholder::kWrapperInfo = {gin::kEmbedderNativeGin}; |
+ |
+gin::ObjectTemplateBuilder PluginPlaceholder::GetObjectTemplateBuilder( |
+ v8::Isolate* isolate) { |
+ return gin::Wrappable<PluginPlaceholder>::GetObjectTemplateBuilder(isolate) |
+ .SetMethod("load", &PluginPlaceholder::LoadCallback) |
+ .SetMethod("hide", &PluginPlaceholder::HideCallback) |
+ .SetMethod("didFinishLoading", |
+ &PluginPlaceholder::DidFinishLoadingCallback); |
} |
void PluginPlaceholder::ReplacePlugin(WebPlugin* new_plugin) { |
@@ -152,8 +150,6 @@ void PluginPlaceholder::HidePlugin() { |
} |
} |
-void PluginPlaceholder::WillDestroyPlugin() { delete this; } |
- |
void PluginPlaceholder::SetMessage(const base::string16& message) { |
message_ = message; |
if (finished_loading_) |
@@ -207,20 +203,17 @@ void PluginPlaceholder::LoadPlugin() { |
ReplacePlugin(plugin); |
} |
-void PluginPlaceholder::LoadCallback(const CppArgumentList& args, |
- CppVariant* result) { |
+void PluginPlaceholder::LoadCallback() { |
RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Load_Click")); |
LoadPlugin(); |
} |
-void PluginPlaceholder::HideCallback(const CppArgumentList& args, |
- CppVariant* result) { |
+void PluginPlaceholder::HideCallback() { |
RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Hide_Click")); |
HidePlugin(); |
} |
-void PluginPlaceholder::DidFinishLoadingCallback(const CppArgumentList& args, |
- CppVariant* result) { |
+void PluginPlaceholder::DidFinishLoadingCallback() { |
finished_loading_ = true; |
if (message_.length() > 0) |
UpdateMessage(); |