| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/lazy_instance.h" | 6 #include "base/lazy_instance.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/extensions/plugin_manager.h" | 10 #include "chrome/browser/extensions/plugin_manager.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 using content::PluginService; | 22 using content::PluginService; |
| 23 | 23 |
| 24 static const char* kNaClPluginMimeType = "application/x-nacl"; | 24 static const char* kNaClPluginMimeType = "application/x-nacl"; |
| 25 | 25 |
| 26 namespace extensions { | 26 namespace extensions { |
| 27 | 27 |
| 28 PluginManager::PluginManager(content::BrowserContext* context) | 28 PluginManager::PluginManager(content::BrowserContext* context) |
| 29 : profile_(Profile::FromBrowserContext(context)) { | 29 : profile_(Profile::FromBrowserContext(context)) { |
| 30 registrar_.Add(this, | 30 registrar_.Add(this, |
| 31 chrome::NOTIFICATION_EXTENSION_LOADED, | 31 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 32 content::Source<Profile>(profile_)); | 32 content::Source<Profile>(profile_)); |
| 33 registrar_.Add(this, | 33 registrar_.Add(this, |
| 34 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 34 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 35 content::Source<Profile>(profile_)); | 35 content::Source<Profile>(profile_)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 PluginManager::~PluginManager() { | 38 PluginManager::~PluginManager() { |
| 39 } | 39 } |
| 40 | 40 |
| 41 static base::LazyInstance<BrowserContextKeyedAPIFactory<PluginManager> > | 41 static base::LazyInstance<BrowserContextKeyedAPIFactory<PluginManager> > |
| 42 g_factory = LAZY_INSTANCE_INITIALIZER; | 42 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 43 | 43 |
| 44 // static | 44 // static |
| 45 BrowserContextKeyedAPIFactory<PluginManager>* | 45 BrowserContextKeyedAPIFactory<PluginManager>* |
| 46 PluginManager::GetFactoryInstance() { | 46 PluginManager::GetFactoryInstance() { |
| 47 return g_factory.Pointer(); | 47 return g_factory.Pointer(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void PluginManager::Observe(int type, | 50 void PluginManager::Observe(int type, |
| 51 const content::NotificationSource& source, | 51 const content::NotificationSource& source, |
| 52 const content::NotificationDetails& details) { | 52 const content::NotificationDetails& details) { |
| 53 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { | 53 if (type == chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED) { |
| 54 const Extension* extension = | 54 const Extension* extension = |
| 55 content::Details<const Extension>(details).ptr(); | 55 content::Details<const Extension>(details).ptr(); |
| 56 | 56 |
| 57 bool plugins_or_nacl_changed = false; | 57 bool plugins_or_nacl_changed = false; |
| 58 if (PluginInfo::HasPlugins(extension)) { | 58 if (PluginInfo::HasPlugins(extension)) { |
| 59 const PluginInfo::PluginVector* plugins = | 59 const PluginInfo::PluginVector* plugins = |
| 60 PluginInfo::GetPlugins(extension); | 60 PluginInfo::GetPlugins(extension); |
| 61 CHECK(plugins); | 61 CHECK(plugins); |
| 62 plugins_or_nacl_changed = true; | 62 plugins_or_nacl_changed = true; |
| 63 for (PluginInfo::PluginVector::const_iterator plugin = plugins->begin(); | 63 for (PluginInfo::PluginVector::const_iterator plugin = plugins->begin(); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 NaClModuleInfo::List::iterator PluginManager::FindNaClModule(const GURL& url) { | 190 NaClModuleInfo::List::iterator PluginManager::FindNaClModule(const GURL& url) { |
| 191 for (NaClModuleInfo::List::iterator iter = nacl_module_list_.begin(); | 191 for (NaClModuleInfo::List::iterator iter = nacl_module_list_.begin(); |
| 192 iter != nacl_module_list_.end(); ++iter) { | 192 iter != nacl_module_list_.end(); ++iter) { |
| 193 if (iter->url == url) | 193 if (iter->url == url) |
| 194 return iter; | 194 return iter; |
| 195 } | 195 } |
| 196 return nacl_module_list_.end(); | 196 return nacl_module_list_.end(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 } // namespace extensions | 199 } // namespace extensions |
| OLD | NEW |