summaryrefslogtreecommitdiffstats
path: root/o3d/plugin/npapi_host_control
diff options
context:
space:
mode:
authortschmelcher@chromium.org <tschmelcher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 22:01:54 +0000
committertschmelcher@chromium.org <tschmelcher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 22:01:54 +0000
commit78c7977d2fc51cb7b24f1eb69e1bce64b71cb51a (patch)
tree6175aad4900e5d8cecff970711c5c58dd436e44a /o3d/plugin/npapi_host_control
parentf6ee0a018e7b1f4ff5e63da7e8c388041acad2c3 (diff)
downloadchromium_src-78c7977d2fc51cb7b24f1eb69e1bce64b71cb51a.zip
chromium_src-78c7977d2fc51cb7b24f1eb69e1bce64b71cb51a.tar.gz
chromium_src-78c7977d2fc51cb7b24f1eb69e1bce64b71cb51a.tar.bz2
Introduce two new GYP variables:
1) plugin_domain_whitelist, which sets an optional domain whitelist. If specified, websites not in the list can't use the plugin. 2) plugin_enable_fullscreen_msg, which can be optionally unset to disable the Win/Mac fullscreen message. Also fix a bug in NPPluginProxy that this uncovered. TEST=built on Windows with a whitelist and without fullscreen message and verified correct behaviour in both IE and FF. Also, the whitelist logic comes almost verbatim from another Google product where it is already well-tested BUG=none Review URL: http://codereview.chromium.org/668078 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40786 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/plugin/npapi_host_control')
-rw-r--r--o3d/plugin/npapi_host_control/win/np_plugin_proxy.cc16
-rw-r--r--o3d/plugin/npapi_host_control/win/np_plugin_proxy.h3
2 files changed, 14 insertions, 5 deletions
diff --git a/o3d/plugin/npapi_host_control/win/np_plugin_proxy.cc b/o3d/plugin/npapi_host_control/win/np_plugin_proxy.cc
index afc97d1..5404c5f 100644
--- a/o3d/plugin/npapi_host_control/win/np_plugin_proxy.cc
+++ b/o3d/plugin/npapi_host_control/win/np_plugin_proxy.cc
@@ -166,7 +166,8 @@ NPPluginProxy::NPPluginProxy()
NP_Initialize_(NULL),
NP_GetEntryPoints_(NULL),
NP_Shutdown_(NULL),
- plugin_module_(0) {
+ plugin_module_(0),
+ initialized_(false) {
npp_data_.ndata = npp_data_.pdata = NULL;
memset(&plugin_funcs_, NULL, sizeof(plugin_funcs_));
}
@@ -228,6 +229,7 @@ bool NPPluginProxy::Init(NPBrowserProxy* browser_proxy,
ATLASSERT(plugin_module_ &&
"Plugin module not loaded before initialization.");
ATLASSERT(browser_proxy && "Browser environment required for plugin init.");
+ ATLASSERT(!initialized_ && "Duplicate initialization");
browser_proxy_ = browser_proxy;
// Store a pointer to the browser proxy instance in the netscape data
@@ -254,7 +256,6 @@ bool NPPluginProxy::Init(NPBrowserProxy* browser_proxy,
reinterpret_cast<char**>(argn.get()),
reinterpret_cast<char**>(argv.get()),
NULL)) {
- NP_Shutdown_();
ATLASSERT(false && "Unknown failure creating NPAPI plugin instance.");
return false;
}
@@ -263,7 +264,6 @@ bool NPPluginProxy::Init(NPBrowserProxy* browser_proxy,
GetNPP(),
const_cast<NPWindow*>(&window))) {
plugin_funcs_.destroy(GetNPP(), NULL);
- NP_Shutdown_();
ATLASSERT(false && "Unknown failure binding plugin window.");
return false;
}
@@ -276,7 +276,6 @@ bool NPPluginProxy::Init(NPBrowserProxy* browser_proxy,
NPPVpluginScriptableNPObject,
static_cast<void*>(&np_object))) {
plugin_funcs_.destroy(GetNPP(), NULL);
- NP_Shutdown_();
ATLASSERT(false && "Unable to initialize NPAPI scripting interface.");
return false;
}
@@ -286,16 +285,21 @@ bool NPPluginProxy::Init(NPBrowserProxy* browser_proxy,
NPBrowserProxy::GetBrowserFunctions()->releaseobject(np_object);
+ initialized_ = true;
+
return true;
}
bool NPPluginProxy::SetWindow(const NPWindow& window) {
+ // The ATLASSERT() upon failed NPP_New() can generate a reentrant
+ // SetWindow() call, which we must be prepared to ignore.
+ if (!initialized_) return false;
+
if (plugin_funcs_.setwindow != NULL &&
NPERR_NO_ERROR != plugin_funcs_.setwindow(
GetNPP(),
const_cast<NPWindow*>(&window))) {
plugin_funcs_.destroy(GetNPP(), NULL);
- NP_Shutdown_();
ATLASSERT(false && "Unknown failure re-setting plugin window.");
return false;
}
@@ -359,6 +363,8 @@ void NPPluginProxy::TearDown() {
scriptable_object_ = NULL;
plugin_funcs_.destroy(GetNPP(), NULL);
}
+
+ initialized_ = false;
}
void NPPluginProxy::RegisterStreamOperation(StreamOperation* stream_op) {
diff --git a/o3d/plugin/npapi_host_control/win/np_plugin_proxy.h b/o3d/plugin/npapi_host_control/win/np_plugin_proxy.h
index f693bf2..58509db 100644
--- a/o3d/plugin/npapi_host_control/win/np_plugin_proxy.h
+++ b/o3d/plugin/npapi_host_control/win/np_plugin_proxy.h
@@ -147,6 +147,9 @@ class NPPluginProxy {
// by the plugin.
StreamOpArray active_stream_ops_;
+ // Whether this plugin instance is in an initialized state.
+ bool initialized_;
+
// Global count of the number of currently live plugin instances. Used
// to ensure that NP_Initialize and NP_Shutdown are called only once
// per loading of the plugin module.