summaryrefslogtreecommitdiffstats
path: root/chrome/browser/plugin_service.cc
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-23 23:16:27 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-23 23:16:27 +0000
commitb547fd44ca39e90e6416da8a5ffc040fa9d2446c (patch)
treee99a4dd4e1d05e0d8ceb2c1db2f8c45ba4b2bc2a /chrome/browser/plugin_service.cc
parentb2225f18acfce00b1a8a9f25a7ad2ef8450bb6a9 (diff)
downloadchromium_src-b547fd44ca39e90e6416da8a5ffc040fa9d2446c.zip
chromium_src-b547fd44ca39e90e6416da8a5ffc040fa9d2446c.tar.gz
chromium_src-b547fd44ca39e90e6416da8a5ffc040fa9d2446c.tar.bz2
Allow Flash (and other plugins) to be installed without restarting the browser. This works by monitoring the MozillaPlugins registry key and reloading the plugin list afterwards.
Note: I'll commit the WebKit change separately, but putting it in this change right now so everything can be reviewed together. BUG=10574 Review URL: http://codereview.chromium.org/88020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14377 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_service.cc')
-rw-r--r--chrome/browser/plugin_service.cc45
1 files changed, 44 insertions, 1 deletions
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc
index d46a1d5..eb8ec2a 100644
--- a/chrome/browser/plugin_service.cc
+++ b/chrome/browser/plugin_service.cc
@@ -8,15 +8,17 @@
#include "base/command_line.h"
#include "base/thread.h"
+#include "base/waitable_event.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_plugin_host.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/plugin_process_host.h"
#include "chrome/browser/renderer_host/render_process_host.h"
-#include "chrome/browser/renderer_host/resource_message_filter.h"
#include "chrome/common/chrome_plugin_lib.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/logging_chrome.h"
+#include "chrome/common/render_messages.h"
+#include "webkit/glue/plugins/plugin_constants_win.h"
#include "webkit/glue/plugins/plugin_list.h"
// static
@@ -35,9 +37,32 @@ PluginService::PluginService()
std::wstring path = command_line->GetSwitchValue(switches::kLoadPlugin);
if (!path.empty())
NPAPI::PluginList::AddExtraPluginPath(FilePath::FromWStringHack(path));
+
+#if defined(OS_WIN)
+ hkcu_key_.Create(
+ HKEY_CURRENT_USER, kRegistryMozillaPlugins, KEY_NOTIFY);
+ hklm_key_.Create(
+ HKEY_LOCAL_MACHINE, kRegistryMozillaPlugins, KEY_NOTIFY);
+ if (hkcu_key_.StartWatching()) {
+ hkcu_event_.reset(new base::WaitableEvent(hkcu_key_.watch_event()));
+ hkcu_watcher_.StartWatching(hkcu_event_.get(), this);
+ }
+
+ if (hklm_key_.StartWatching()) {
+ hklm_event_.reset(new base::WaitableEvent(hklm_key_.watch_event()));
+ hklm_watcher_.StartWatching(hklm_event_.get(), this);
+ }
+#endif
}
PluginService::~PluginService() {
+#if defined(OS_WIN)
+ // Release the events since they're owned by RegKey, not WaitableEvent.
+ hkcu_watcher_.StopWatching();
+ hklm_watcher_.StopWatching();
+ hkcu_event_->Release();
+ hklm_event_->Release();
+#endif
}
void PluginService::GetPlugins(bool refresh,
@@ -171,3 +196,21 @@ bool PluginService::HavePluginFor(const std::string& mime_type,
allow_wildcard, &info,
NULL);
}
+
+void PluginService::OnWaitableEventSignaled(base::WaitableEvent* waitable_event) {
+#if defined(OS_WIN)
+ if (waitable_event == hkcu_event_.get()) {
+ hkcu_key_.StartWatching();
+ } else {
+ hklm_key_.StartWatching();
+ }
+
+ AutoLock lock(lock_);
+ NPAPI::PluginList::ResetPluginsLoaded();
+
+ for (RenderProcessHost::iterator it = RenderProcessHost::begin();
+ it != RenderProcessHost::end(); ++it) {
+ it->second->Send(new ViewMsg_PurgePluginListCache());
+ }
+#endif
+}