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

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

Issue 1148223004: Plugin Placeholders: Factor out common BindWebFrame method into base class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « components/plugins/renderer/plugin_placeholder.h ('k') | components/plugins/renderer/webview_plugin.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/plugins/renderer/plugin_placeholder.cc
diff --git a/components/plugins/renderer/plugin_placeholder.cc b/components/plugins/renderer/plugin_placeholder.cc
index 8bbe491c405cded2a3c55e8613179f48ee962fb1..328e381ada063df65cee7800c61f535342f1658a 100644
--- a/components/plugins/renderer/plugin_placeholder.cc
+++ b/components/plugins/renderer/plugin_placeholder.cc
@@ -5,6 +5,8 @@
#include "components/plugins/renderer/plugin_placeholder.h"
#include "content/public/renderer/render_frame.h"
+#include "gin/handle.h"
+#include "third_party/WebKit/public/web/WebKit.h"
namespace plugins {
@@ -32,6 +34,18 @@ const blink::WebPluginParams& PluginPlaceholder::GetPluginParams() const {
return plugin_params_;
}
+void PluginPlaceholder::BindWebFrame(blink::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());
+}
+
void PluginPlaceholder::ShowContextMenu(const blink::WebMouseEvent& event) {
// Does nothing by default. Will be overridden if a specific browser wants
// a context menu.
« no previous file with comments | « components/plugins/renderer/plugin_placeholder.h ('k') | components/plugins/renderer/webview_plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698