Chromium Code Reviews| Index: chrome/browser/extensions/extension_service.cc |
| diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc |
| index a1ad7e239ee5f6acd846acbfee09f857fbf12cb0..cb1d6f2d6ad330987ee626947b901dbdd031c78f 100644 |
| --- a/chrome/browser/extensions/extension_service.cc |
| +++ b/chrome/browser/extensions/extension_service.cc |
| @@ -129,6 +129,7 @@ using extensions::ExtensionIdSet; |
| using extensions::ExtensionInfo; |
| using extensions::FeatureSwitch; |
| using extensions::Manifest; |
| +using extensions::NaClModuleInfo; |
| using extensions::PermissionMessage; |
| using extensions::PermissionMessages; |
| using extensions::PermissionSet; |
| @@ -178,12 +179,6 @@ ExtensionService::ExtensionRuntimeData::ExtensionRuntimeData() |
| ExtensionService::ExtensionRuntimeData::~ExtensionRuntimeData() { |
| } |
| -ExtensionService::NaClModuleInfo::NaClModuleInfo() { |
| -} |
| - |
| -ExtensionService::NaClModuleInfo::~NaClModuleInfo() { |
| -} |
| - |
| // ExtensionService. |
| const char ExtensionService::kLocalAppSettingsDirectoryName[] = |
| @@ -1093,12 +1088,12 @@ void ExtensionService::NotifyExtensionLoaded(const Extension* extension) { |
| #if defined(ENABLE_PLUGINS) |
| // TODO(mpcomplete): This ends up affecting all profiles. See crbug.com/80757. |
| - bool plugins_changed = false; |
| + bool plugins_or_nacl_changed = false; |
|
not at google - send to devlin
2013/05/29 16:29:21
Without picking through the source code of all of
not at google - send to devlin
2013/05/29 16:32:09
s/ExtensionSystem/a PKS/g
Yoyo Zhou
2013/05/29 22:27:47
Yeah, it's definitely possible; it was all dumped
|
| if (extensions::PluginInfo::HasPlugins(extension)) { |
| const extensions::PluginInfo::PluginVector* plugins = |
| extensions::PluginInfo::GetPlugins(extension); |
| CHECK(plugins); |
| - plugins_changed = true; |
| + plugins_or_nacl_changed = true; |
| for (extensions::PluginInfo::PluginVector::const_iterator plugin = |
| plugins->begin(); |
| plugin != plugins->end(); ++plugin) { |
| @@ -1116,17 +1111,18 @@ void ExtensionService::NotifyExtensionLoaded(const Extension* extension) { |
| } |
| } |
| - bool nacl_modules_changed = false; |
| - for (size_t i = 0; i < extension->nacl_modules().size(); ++i) { |
| - const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; |
| - RegisterNaClModule(module.url, module.mime_type); |
| - nacl_modules_changed = true; |
| - } |
| - |
| - if (nacl_modules_changed) |
| + const NaClModuleInfo::List* nacl_modules = |
| + NaClModuleInfo::GetNaClModules(extension); |
| + if (nacl_modules) { |
| + plugins_or_nacl_changed = true; |
| + for (NaClModuleInfo::List::const_iterator module = nacl_modules->begin(); |
| + module != nacl_modules->end(); ++module) { |
| + RegisterNaClModule(*module); |
| + } |
| UpdatePluginListWithNaClModules(); |
| + } |
| - if (plugins_changed || nacl_modules_changed) |
| + if (plugins_or_nacl_changed) |
| PluginService::GetInstance()->PurgePluginListCache(profile_, false); |
| #endif // defined(ENABLE_PLUGINS) |
| } |
| @@ -1182,11 +1178,11 @@ void ExtensionService::NotifyExtensionUnloaded( |
| UpdateActiveExtensionsInCrashReporter(); |
| #if defined(ENABLE_PLUGINS) |
| - bool plugins_changed = false; |
| + bool plugins_or_nacl_changed = false; |
| if (extensions::PluginInfo::HasPlugins(extension)) { |
| const extensions::PluginInfo::PluginVector* plugins = |
| extensions::PluginInfo::GetPlugins(extension); |
| - plugins_changed = true; |
| + plugins_or_nacl_changed = true; |
| for (extensions::PluginInfo::PluginVector::const_iterator plugin = |
| plugins->begin(); |
| plugin != plugins->end(); ++plugin) { |
| @@ -1197,17 +1193,18 @@ void ExtensionService::NotifyExtensionUnloaded( |
| } |
| } |
| - bool nacl_modules_changed = false; |
| - for (size_t i = 0; i < extension->nacl_modules().size(); ++i) { |
| - const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; |
| - UnregisterNaClModule(module.url); |
| - nacl_modules_changed = true; |
| - } |
| - |
| - if (nacl_modules_changed) |
| + const NaClModuleInfo::List* nacl_modules = |
| + NaClModuleInfo::GetNaClModules(extension); |
| + if (nacl_modules) { |
| + plugins_or_nacl_changed = true; |
| + for (NaClModuleInfo::List::const_iterator module = nacl_modules->begin(); |
| + module != nacl_modules->end(); ++module) { |
| + UnregisterNaClModule(*module); |
| + } |
| UpdatePluginListWithNaClModules(); |
| + } |
| - if (plugins_changed || nacl_modules_changed) |
| + if (plugins_or_nacl_changed) |
| PluginService::GetInstance()->PurgePluginListCache(profile_, false); |
| #endif // defined(ENABLE_PLUGINS) |
| } |
| @@ -2820,18 +2817,13 @@ void ExtensionService::SetHasUsedWebRequest(const Extension* extension, |
| extension_runtime_data_[extension->id()].has_used_webrequest = value; |
| } |
| -void ExtensionService::RegisterNaClModule(const GURL& url, |
| - const std::string& mime_type) { |
| - NaClModuleInfo info; |
| - info.url = url; |
| - info.mime_type = mime_type; |
| - |
| - DCHECK(FindNaClModule(url) == nacl_module_list_.end()); |
| +void ExtensionService::RegisterNaClModule(const NaClModuleInfo& info) { |
| + DCHECK(FindNaClModule(info.url) == nacl_module_list_.end()); |
| nacl_module_list_.push_front(info); |
| } |
| -void ExtensionService::UnregisterNaClModule(const GURL& url) { |
| - NaClModuleInfoList::iterator iter = FindNaClModule(url); |
| +void ExtensionService::UnregisterNaClModule(const NaClModuleInfo& info) { |
| + NaClModuleInfo::List::iterator iter = FindNaClModule(info.url); |
| DCHECK(iter != nacl_module_list_.end()); |
| nacl_module_list_.erase(iter); |
| } |
| @@ -2861,9 +2853,9 @@ void ExtensionService::UpdatePluginListWithNaClModules() { |
| webkit::WebPluginInfo info = pepper_info->ToWebPluginInfo(); |
| - for (ExtensionService::NaClModuleInfoList::const_iterator iter = |
| - nacl_module_list_.begin(); |
| - iter != nacl_module_list_.end(); ++iter) { |
| + for (NaClModuleInfo::List::const_iterator iter = |
| + nacl_module_list_.begin(); |
| + iter != nacl_module_list_.end(); ++iter) { |
| // Add the MIME type specified in the extension to this NaCl plugin, |
| // With an extra "nacl" argument to specify the location of the NaCl |
| // manifest file. |
| @@ -2884,9 +2876,9 @@ void ExtensionService::UpdatePluginListWithNaClModules() { |
| } |
| } |
| -ExtensionService::NaClModuleInfoList::iterator |
| - ExtensionService::FindNaClModule(const GURL& url) { |
| - for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); |
| +NaClModuleInfo::List::iterator |
| +ExtensionService::FindNaClModule(const GURL& url) { |
| + for (NaClModuleInfo::List::iterator iter = nacl_module_list_.begin(); |
| iter != nacl_module_list_.end(); ++iter) { |
| if (iter->url == url) |
| return iter; |