| 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 13 matching lines...) Expand all Loading... |
| 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, |
| 32 content::Source<Profile>(profile_)); | 32 content::Source<Profile>(profile_)); |
| 33 registrar_.Add(this, | 33 registrar_.Add(this, |
| 34 chrome::NOTIFICATION_EXTENSION_UNLOADED, | 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 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 for (NaClModuleInfo::List::const_iterator module = nacl_modules->begin(); | 83 for (NaClModuleInfo::List::const_iterator module = nacl_modules->begin(); |
| 84 module != nacl_modules->end(); ++module) { | 84 module != nacl_modules->end(); ++module) { |
| 85 RegisterNaClModule(*module); | 85 RegisterNaClModule(*module); |
| 86 } | 86 } |
| 87 UpdatePluginListWithNaClModules(); | 87 UpdatePluginListWithNaClModules(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 if (plugins_or_nacl_changed) | 90 if (plugins_or_nacl_changed) |
| 91 PluginService::GetInstance()->PurgePluginListCache(profile_, false); | 91 PluginService::GetInstance()->PurgePluginListCache(profile_, false); |
| 92 | 92 |
| 93 } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { | 93 } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) { |
| 94 const Extension* extension = | 94 const Extension* extension = |
| 95 content::Details<UnloadedExtensionInfo>(details)->extension; | 95 content::Details<UnloadedExtensionInfo>(details)->extension; |
| 96 | 96 |
| 97 bool plugins_or_nacl_changed = false; | 97 bool plugins_or_nacl_changed = false; |
| 98 if (PluginInfo::HasPlugins(extension)) { | 98 if (PluginInfo::HasPlugins(extension)) { |
| 99 const PluginInfo::PluginVector* plugins = | 99 const PluginInfo::PluginVector* plugins = |
| 100 PluginInfo::GetPlugins(extension); | 100 PluginInfo::GetPlugins(extension); |
| 101 plugins_or_nacl_changed = true; | 101 plugins_or_nacl_changed = true; |
| 102 for (PluginInfo::PluginVector::const_iterator plugin = plugins->begin(); | 102 for (PluginInfo::PluginVector::const_iterator plugin = plugins->begin(); |
| 103 plugin != plugins->end(); ++plugin) { | 103 plugin != plugins->end(); ++plugin) { |
| (...skipping 86 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 |