Index: content/browser/plugin_service.cc |
diff --git a/content/browser/plugin_service.cc b/content/browser/plugin_service.cc |
index 5e0e910656076fa2394cec4f57f871b1f52a079b..31df32e406dbae15563f6836f70a265c488909ff 100644 |
--- a/content/browser/plugin_service.cc |
+++ b/content/browser/plugin_service.cc |
@@ -76,6 +76,14 @@ void WillLoadPluginsCallback() { |
} // namespace |
+// Custom Singleton traits to inject the PluginList. |
+struct PluginServiceSingletonTraits : |
+ public DefaultSingletonTraits<PluginService> { |
+ static PluginService* New() { |
+ return new PluginService(webkit::npapi::PluginList::Singleton()); |
Bernhard Bauer
2011/11/08 17:03:23
If you set the WillLoadPluginsCallback here, you d
Robert Sesek
2011/11/08 17:21:00
Good idea. Done.
|
+ } |
+}; |
+ |
#if defined(OS_MACOSX) |
static void NotifyPluginsOfActivation() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
@@ -109,11 +117,12 @@ class PluginDirWatcherDelegate : public FilePathWatcher::Delegate { |
// static |
PluginService* PluginService::GetInstance() { |
- return Singleton<PluginService>::get(); |
+ return Singleton<PluginService, PluginServiceSingletonTraits>::get(); |
} |
-PluginService::PluginService() |
- : ui_locale_( |
+PluginService::PluginService(webkit::npapi::PluginList* a_plugin_list) |
+ : plugin_list_(a_plugin_list), |
+ ui_locale_( |
content::GetContentClient()->browser()->GetApplicationLocale()), |
filter_(NULL) { |
plugin_list()->set_will_load_plugins_callback( |