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

Unified Diff: components/plugins/renderer/mobile_youtube_plugin.cc

Issue 1161923004: Reland: Plugin Placeholders: Refactor for platforms that don't support plugins (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove some enable_plugins that are no longer needed 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: 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
« no previous file with comments | « components/plugins/renderer/mobile_youtube_plugin.h ('k') | components/plugins/renderer/plugin_placeholder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698