Index: components/plugins/renderer/mobile_youtube_plugin.cc |
diff --git a/components/plugins/renderer/mobile_youtube_plugin.cc b/components/plugins/renderer/mobile_youtube_plugin.cc |
index 6db102af72166d28d1a4031d8a160511f6d187ef..9745a0a138e37371b137f3d8f14b42199e3fba15 100644 |
--- a/components/plugins/renderer/mobile_youtube_plugin.cc |
+++ b/components/plugins/renderer/mobile_youtube_plugin.cc |
@@ -11,10 +11,8 @@ |
#include "base/values.h" |
#include "content/public/common/content_constants.h" |
#include "content/public/renderer/render_frame.h" |
-#include "gin/handle.h" |
#include "gin/object_template_builder.h" |
#include "third_party/WebKit/public/web/WebFrame.h" |
-#include "third_party/WebKit/public/web/WebKit.h" |
#include "ui/base/webui/jstemplate_builder.h" |
using blink::WebFrame; |
@@ -73,16 +71,17 @@ bool IsValidYouTubeVideo(const std::string& path) { |
namespace plugins { |
+gin::WrapperInfo MobileYouTubePlugin::kWrapperInfo = {gin::kEmbedderNativeGin}; |
+ |
MobileYouTubePlugin::MobileYouTubePlugin(content::RenderFrame* render_frame, |
blink::WebLocalFrame* frame, |
const blink::WebPluginParams& params, |
- base::StringPiece& template_html, |
- GURL placeholderDataUrl) |
- : PluginPlaceholder(render_frame, |
- frame, |
- params, |
- HtmlData(params, template_html), |
- placeholderDataUrl) {} |
+ base::StringPiece& template_html) |
+ : PluginPlaceholderBase(render_frame, |
+ frame, |
+ params, |
+ HtmlData(params, template_html)) { |
+} |
MobileYouTubePlugin::~MobileYouTubePlugin() {} |
@@ -108,22 +107,15 @@ void MobileYouTubePlugin::OpenYoutubeUrlCallback() { |
GetFrame(), request, blink::WebNavigationPolicyNewForegroundTab); |
} |
-void MobileYouTubePlugin::BindWebFrame(WebFrame* frame) { |
- v8::Isolate* isolate = blink::mainThreadIsolate(); |
- v8::HandleScope handle_scope(isolate); |
- v8::Local<v8::Context> context = frame->mainWorldScriptContext(); |
- DCHECK(!context.IsEmpty()); |
- |
- v8::Context::Scope context_scope(context); |
- v8::Local<v8::Object> global = context->Global(); |
- global->Set(gin::StringToV8(isolate, "plugin"), |
- gin::CreateHandle(isolate, this).ToV8()); |
+v8::Local<v8::Value> MobileYouTubePlugin::GetV8Handle(v8::Isolate* isolate) { |
+ return gin::CreateHandle(isolate, this).ToV8(); |
} |
gin::ObjectTemplateBuilder MobileYouTubePlugin::GetObjectTemplateBuilder( |
v8::Isolate* isolate) { |
- return PluginPlaceholder::GetObjectTemplateBuilder(isolate) |
- .SetMethod("openYoutubeURL", &MobileYouTubePlugin::OpenYoutubeUrlCallback); |
+ return gin::Wrappable<MobileYouTubePlugin>::GetObjectTemplateBuilder(isolate) |
+ .SetMethod("openYoutubeURL", |
+ &MobileYouTubePlugin::OpenYoutubeUrlCallback); |
} |
} // namespace plugins |