Chromium Code Reviews| Index: content/browser/plugin_service.cc |
| diff --git a/content/browser/plugin_service.cc b/content/browser/plugin_service.cc |
| index 5e0e910656076fa2394cec4f57f871b1f52a079b..62992456588fde20f40e263b956e7fc5dc33b96c 100644 |
| --- a/content/browser/plugin_service.cc |
| +++ b/content/browser/plugin_service.cc |
| @@ -113,9 +113,33 @@ PluginService* PluginService::GetInstance() { |
| } |
| PluginService::PluginService() |
| - : ui_locale_( |
| + : did_init_(false), |
| + plugin_list_(NULL), |
| + ui_locale_( |
| content::GetContentClient()->browser()->GetApplicationLocale()), |
| filter_(NULL) { |
| +} |
| + |
| +PluginService::~PluginService() { |
| +#if defined(OS_WIN) |
| + // Release the events since they're owned by RegKey, not WaitableEvent. |
| + hkcu_watcher_.StopWatching(); |
| + hklm_watcher_.StopWatching(); |
| + if (hkcu_event_.get()) |
| + hkcu_event_->Release(); |
| + if (hklm_event_.get()) |
| + hklm_event_->Release(); |
| +#endif |
| + // Make sure no plugin channel requests have been leaked. |
| + DCHECK(pending_plugin_clients_.empty()); |
| +} |
| + |
| +void PluginService::Init() { |
| + DCHECK(!did_init_); |
|
jam
2011/11/10 21:53:54
nit: is this member variable really needed now?
Robert Sesek
2011/11/10 22:04:32
Doesn't have to be. Removed.
|
| + |
| + if (!plugin_list_) |
| + plugin_list_ = webkit::npapi::PluginList::Singleton(); |
| + |
| plugin_list()->set_will_load_plugins_callback( |
| base::Bind(&WillLoadPluginsCallback)); |
| @@ -138,20 +162,8 @@ PluginService::PluginService() |
| registrar_.Add(this, content::NOTIFICATION_APP_ACTIVATED, |
| content::NotificationService::AllSources()); |
| #endif |
| -} |
| -PluginService::~PluginService() { |
| -#if defined(OS_WIN) |
| - // Release the events since they're owned by RegKey, not WaitableEvent. |
| - hkcu_watcher_.StopWatching(); |
| - hklm_watcher_.StopWatching(); |
| - if (hkcu_event_.get()) |
| - hkcu_event_->Release(); |
| - if (hklm_event_.get()) |
| - hklm_event_->Release(); |
| -#endif |
| - // Make sure no plugin channel requests have been leaked. |
| - DCHECK(pending_plugin_clients_.empty()); |
| + did_init_ = true; |
| } |
| void PluginService::StartWatchingPlugins() { |
| @@ -640,6 +652,11 @@ webkit::npapi::PluginList* PluginService::plugin_list() { |
| return webkit::npapi::PluginList::Singleton(); |
| } |
| +void PluginService::SetPluginListForTesting( |
| + webkit::npapi::PluginList* plugin_list) { |
| + plugin_list_ = plugin_list; |
| +} |
| + |
| void PluginService::RegisterInternalPlugin(const webkit::WebPluginInfo& info) { |
| plugin_list()->RegisterInternalPlugin(info); |
| } |