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

Unified Diff: content/renderer/browser_plugin/browser_plugin.cc

Issue 15007012: Track NPObject ownership by the originating plugins' NPP identifier. [2/3] (Chrome) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing includes. Created 7 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
Index: content/renderer/browser_plugin/browser_plugin.cc
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index d3aa325a9fb4c9f1de03e0419ba32f783f8684da..9e383a94268626deb362eb489ea3b05278824f2f 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -1137,6 +1137,9 @@ bool BrowserPlugin::initialize(WebPluginContainer* container) {
if (!GetContentClient()->renderer()->AllowBrowserPlugin(container))
return false;
+ // Tell |container| to allow this plugin to use script objects.
Fady Samuel 2013/05/15 23:21:15 Does webview.contentWindow work without this worka
Wez 2013/05/16 18:27:16 It will do once patch [3/3] has landed in Blink, y
+ container->allowScriptObjects();
+
bindings_.reset(new BrowserPluginBindings(this));
container_ = container;
container_->setWantsWheelEvents(true);
@@ -1180,6 +1183,9 @@ void BrowserPlugin::EnableCompositing(bool enable) {
}
void BrowserPlugin::destroy() {
+ // Tell |container_| to clear references to this plugin's script objects.
+ container_->clearScriptObjects();
+
// The BrowserPlugin's WebPluginContainer is deleted immediately after this
// call returns, so let's not keep a reference to it around.
g_plugin_container_map.Get().erase(container_);
@@ -1202,6 +1208,13 @@ NPObject* BrowserPlugin::scriptableObject() {
return browser_plugin_np_object;
}
+NPP BrowserPlugin::pluginNPP() {
+ // We must return the same pointer that the NPP parameter to NPObject binding
+ // calls will contain. WebKit will treat it as opaque, though, so it needn't
+ // be an actual NPP_t instance.
+ return reinterpret_cast<NPP>(this);
+}
+
bool BrowserPlugin::supportsKeyboardFocus() const {
return true;
}

Powered by Google App Engine
This is Rietveld 408576698