summaryrefslogtreecommitdiffstats
path: root/chrome/browser/plugin_service.cc
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-06 20:51:16 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-06 20:51:16 +0000
commit4e59e814cc1264300b597c3d62a8ccb4da264889 (patch)
tree3da745987d40a5ff16cade564043ea701af3f239 /chrome/browser/plugin_service.cc
parent718b1465c8916ac5b912ee57d6448ff8d772e414 (diff)
downloadchromium_src-4e59e814cc1264300b597c3d62a8ccb4da264889.zip
chromium_src-4e59e814cc1264300b597c3d62a8ccb4da264889.tar.gz
chromium_src-4e59e814cc1264300b597c3d62a8ccb4da264889.tar.bz2
Fix problems with unloading/reloading/updating extensions that contain NPAPI
plugins, by ensuring that an extension's plugins are shut down and unloaded when the extension unloads. BUG=34670 BUG=32806 Review URL: http://codereview.chromium.org/1596009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43756 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_service.cc')
-rw-r--r--chrome/browser/plugin_service.cc21
1 files changed, 14 insertions, 7 deletions
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc
index 535ab31..f16108d 100644
--- a/chrome/browser/plugin_service.cc
+++ b/chrome/browser/plugin_service.cc
@@ -28,6 +28,7 @@
#include "chrome/common/logging_chrome.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/notification_service.h"
+#include "chrome/common/plugin_messages.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
#ifndef DISABLE_NACL
@@ -288,25 +289,28 @@ void PluginService::OnWaitableEventSignaled(
hklm_key_.StartWatching();
}
- NPAPI::PluginList::Singleton()->ResetPluginsLoaded();
+ NPAPI::PluginList::Singleton()->RefreshPlugins();
PurgePluginListCache(true);
#endif // defined(OS_WIN)
}
+static void ForceShutdownPlugin(const FilePath& plugin_path) {
+ PluginProcessHost* plugin =
+ PluginService::GetInstance()->FindPluginProcess(plugin_path);
+ if (plugin)
+ plugin->ForceShutdown();
+}
+
void PluginService::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
switch (type.value) {
case NotificationType::EXTENSION_LOADED: {
- // TODO(mpcomplete): We also need to force a renderer to refresh its
- // cache of the plugin list when we inject user scripts, since it could
- // have a stale version by the time extensions are loaded.
- // See: http://code.google.com/p/chromium/issues/detail?id=12306
Extension* extension = Details<Extension>(details).ptr();
bool plugins_changed = false;
for (size_t i = 0; i < extension->plugins().size(); ++i) {
const Extension::PluginInfo& plugin = extension->plugins()[i];
- NPAPI::PluginList::Singleton()->ResetPluginsLoaded();
+ NPAPI::PluginList::Singleton()->RefreshPlugins();
NPAPI::PluginList::Singleton()->AddExtraPluginPath(plugin.path);
plugins_changed = true;
if (!plugin.is_public)
@@ -322,7 +326,10 @@ void PluginService::Observe(NotificationType type,
bool plugins_changed = false;
for (size_t i = 0; i < extension->plugins().size(); ++i) {
const Extension::PluginInfo& plugin = extension->plugins()[i];
- NPAPI::PluginList::Singleton()->ResetPluginsLoaded();
+ ChromeThread::PostTask(ChromeThread::IO, FROM_HERE,
+ NewRunnableFunction(&ForceShutdownPlugin,
+ plugin.path));
+ NPAPI::PluginList::Singleton()->RefreshPlugins();
NPAPI::PluginList::Singleton()->RemoveExtraPluginPath(plugin.path);
plugins_changed = true;
if (!plugin.is_public)