diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-21 22:05:45 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-21 22:05:45 +0000 |
commit | b78e168b1640e456e1fc5a1ca8956a4a50c7df94 (patch) | |
tree | cbadab016871c254617ec26ab2d4c6987033b1c4 /chrome/browser/plugin_service.cc | |
parent | a66e24c34a22a4a183b91ad80d74e896a4f4db5f (diff) | |
download | chromium_src-b78e168b1640e456e1fc5a1ca8956a4a50c7df94.zip chromium_src-b78e168b1640e456e1fc5a1ca8956a4a50c7df94.tar.gz chromium_src-b78e168b1640e456e1fc5a1ca8956a4a50c7df94.tar.bz2 |
Update renderer plugin cache when we load/unload extensions with plugins.
BUG=12306
TEST=Load and unload extensions that contain plugins and visit pages that use them. Also covered by tests.
Review URL: http://codereview.chromium.org/201111
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26748 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_service.cc')
-rw-r--r-- | chrome/browser/plugin_service.cc | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc index 1d767bd..42a67e9 100644 --- a/chrome/browser/plugin_service.cc +++ b/chrome/browser/plugin_service.cc @@ -178,6 +178,13 @@ FilePath PluginService::GetPluginPath(const GURL& url, return FilePath(); } +static void PurgePluginListCache(bool reload_pages) { + for (RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); + !it.IsAtEnd(); it.Advance()) { + it.GetCurrentValue()->Send(new ViewMsg_PurgePluginListCache(reload_pages)); + } +} + void PluginService::OnWaitableEventSignaled( base::WaitableEvent* waitable_event) { #if defined(OS_WIN) @@ -188,11 +195,7 @@ void PluginService::OnWaitableEventSignaled( } NPAPI::PluginList::Singleton()->ResetPluginsLoaded(); - - for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); - !it.IsAtEnd(); it.Advance()) { - it.GetCurrentValue()->Send(new ViewMsg_PurgePluginListCache()); - } + PurgePluginListCache(true); #endif // defined(OS_WIN) } @@ -206,20 +209,33 @@ void PluginService::Observe(NotificationType type, // 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()->AddExtraPluginPath(plugin.path); + plugins_changed = true; if (!plugin.is_public) private_plugins_[plugin.path] = extension->url(); } + if (plugins_changed) + PurgePluginListCache(false); break; } case NotificationType::EXTENSION_UNLOADED: { - // TODO(aa): Implement this. Also, will it be possible to delete the - // extension folder if this isn't unloaded? - // 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()->RemoveExtraPluginPath(plugin.path); + plugins_changed = true; + if (!plugin.is_public) + private_plugins_.erase(plugin.path); + } + if (plugins_changed) + PurgePluginListCache(false); break; } |