OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 } | 1099 } |
1100 #endif | 1100 #endif |
1101 | 1101 |
1102 // Same for chrome://thumb/ resources. | 1102 // Same for chrome://thumb/ resources. |
1103 if (extension->HasHostPermission(GURL(chrome::kChromeUIThumbnailURL))) { | 1103 if (extension->HasHostPermission(GURL(chrome::kChromeUIThumbnailURL))) { |
1104 ThumbnailSource* thumbnail_source = new ThumbnailSource(profile_); | 1104 ThumbnailSource* thumbnail_source = new ThumbnailSource(profile_); |
1105 ChromeURLDataManagerFactory::GetForProfile(profile_)-> | 1105 ChromeURLDataManagerFactory::GetForProfile(profile_)-> |
1106 AddDataSource(thumbnail_source); | 1106 AddDataSource(thumbnail_source); |
1107 } | 1107 } |
1108 | 1108 |
| 1109 #if defined(ENABLE_PLUGINS) |
1109 // TODO(mpcomplete): This ends up affecting all profiles. See crbug.com/80757. | 1110 // TODO(mpcomplete): This ends up affecting all profiles. See crbug.com/80757. |
1110 bool plugins_changed = false; | 1111 bool plugins_changed = false; |
1111 for (size_t i = 0; i < extension->plugins().size(); ++i) { | 1112 for (size_t i = 0; i < extension->plugins().size(); ++i) { |
1112 const Extension::PluginInfo& plugin = extension->plugins()[i]; | 1113 const Extension::PluginInfo& plugin = extension->plugins()[i]; |
1113 PluginService::GetInstance()->RefreshPlugins(); | 1114 PluginService::GetInstance()->RefreshPlugins(); |
1114 PluginService::GetInstance()->AddExtraPluginPath(plugin.path); | 1115 PluginService::GetInstance()->AddExtraPluginPath(plugin.path); |
1115 plugins_changed = true; | 1116 plugins_changed = true; |
1116 ChromePluginServiceFilter* filter = | 1117 ChromePluginServiceFilter* filter = |
1117 ChromePluginServiceFilter::GetInstance(); | 1118 ChromePluginServiceFilter::GetInstance(); |
1118 if (plugin.is_public) { | 1119 if (plugin.is_public) { |
(...skipping 10 matching lines...) Expand all Loading... |
1129 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; | 1130 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; |
1130 RegisterNaClModule(module.url, module.mime_type); | 1131 RegisterNaClModule(module.url, module.mime_type); |
1131 nacl_modules_changed = true; | 1132 nacl_modules_changed = true; |
1132 } | 1133 } |
1133 | 1134 |
1134 if (nacl_modules_changed) | 1135 if (nacl_modules_changed) |
1135 UpdatePluginListWithNaClModules(); | 1136 UpdatePluginListWithNaClModules(); |
1136 | 1137 |
1137 if (plugins_changed || nacl_modules_changed) | 1138 if (plugins_changed || nacl_modules_changed) |
1138 PluginService::GetInstance()->PurgePluginListCache(profile_, false); | 1139 PluginService::GetInstance()->PurgePluginListCache(profile_, false); |
| 1140 #endif // defined(ENABLE_PLUGINS) |
1139 } | 1141 } |
1140 | 1142 |
1141 void ExtensionService::NotifyExtensionUnloaded( | 1143 void ExtensionService::NotifyExtensionUnloaded( |
1142 const Extension* extension, | 1144 const Extension* extension, |
1143 extension_misc::UnloadedExtensionReason reason) { | 1145 extension_misc::UnloadedExtensionReason reason) { |
1144 UnloadedExtensionInfo details(extension, reason); | 1146 UnloadedExtensionInfo details(extension, reason); |
1145 content::NotificationService::current()->Notify( | 1147 content::NotificationService::current()->Notify( |
1146 chrome::NOTIFICATION_EXTENSION_UNLOADED, | 1148 chrome::NOTIFICATION_EXTENSION_UNLOADED, |
1147 content::Source<Profile>(profile_), | 1149 content::Source<Profile>(profile_), |
1148 content::Details<UnloadedExtensionInfo>(&details)); | 1150 content::Details<UnloadedExtensionInfo>(&details)); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 BrowserContext::GetDefaultStoragePartition(profile_)-> | 1182 BrowserContext::GetDefaultStoragePartition(profile_)-> |
1181 GetFileSystemContext(); | 1183 GetFileSystemContext(); |
1182 if (filesystem_context && filesystem_context->external_provider()) { | 1184 if (filesystem_context && filesystem_context->external_provider()) { |
1183 filesystem_context->external_provider()-> | 1185 filesystem_context->external_provider()-> |
1184 RevokeAccessForExtension(extension->id()); | 1186 RevokeAccessForExtension(extension->id()); |
1185 } | 1187 } |
1186 #endif | 1188 #endif |
1187 | 1189 |
1188 UpdateActiveExtensionsInCrashReporter(); | 1190 UpdateActiveExtensionsInCrashReporter(); |
1189 | 1191 |
| 1192 #if defined(ENABLE_PLUGINS) |
1190 bool plugins_changed = false; | 1193 bool plugins_changed = false; |
1191 for (size_t i = 0; i < extension->plugins().size(); ++i) { | 1194 for (size_t i = 0; i < extension->plugins().size(); ++i) { |
1192 const Extension::PluginInfo& plugin = extension->plugins()[i]; | 1195 const Extension::PluginInfo& plugin = extension->plugins()[i]; |
1193 PluginService::GetInstance()->ForcePluginShutdown(plugin.path); | 1196 PluginService::GetInstance()->ForcePluginShutdown(plugin.path); |
1194 PluginService::GetInstance()->RefreshPlugins(); | 1197 PluginService::GetInstance()->RefreshPlugins(); |
1195 PluginService::GetInstance()->RemoveExtraPluginPath(plugin.path); | 1198 PluginService::GetInstance()->RemoveExtraPluginPath(plugin.path); |
1196 plugins_changed = true; | 1199 plugins_changed = true; |
1197 ChromePluginServiceFilter::GetInstance()->UnrestrictPlugin(plugin.path); | 1200 ChromePluginServiceFilter::GetInstance()->UnrestrictPlugin(plugin.path); |
1198 } | 1201 } |
1199 | 1202 |
1200 bool nacl_modules_changed = false; | 1203 bool nacl_modules_changed = false; |
1201 for (size_t i = 0; i < extension->nacl_modules().size(); ++i) { | 1204 for (size_t i = 0; i < extension->nacl_modules().size(); ++i) { |
1202 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; | 1205 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; |
1203 UnregisterNaClModule(module.url); | 1206 UnregisterNaClModule(module.url); |
1204 nacl_modules_changed = true; | 1207 nacl_modules_changed = true; |
1205 } | 1208 } |
1206 | 1209 |
1207 if (nacl_modules_changed) | 1210 if (nacl_modules_changed) |
1208 UpdatePluginListWithNaClModules(); | 1211 UpdatePluginListWithNaClModules(); |
1209 | 1212 |
1210 if (plugins_changed || nacl_modules_changed) | 1213 if (plugins_changed || nacl_modules_changed) |
1211 PluginService::GetInstance()->PurgePluginListCache(profile_, false); | 1214 PluginService::GetInstance()->PurgePluginListCache(profile_, false); |
| 1215 #endif // defined(ENABLE_PLUGINS) |
1212 } | 1216 } |
1213 | 1217 |
1214 Profile* ExtensionService::profile() { | 1218 Profile* ExtensionService::profile() { |
1215 return profile_; | 1219 return profile_; |
1216 } | 1220 } |
1217 | 1221 |
1218 extensions::ExtensionPrefs* ExtensionService::extension_prefs() { | 1222 extensions::ExtensionPrefs* ExtensionService::extension_prefs() { |
1219 return extension_prefs_; | 1223 return extension_prefs_; |
1220 } | 1224 } |
1221 | 1225 |
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3130 scoped_refptr<const Extension> extension = GetInstalledExtension(*it); | 3134 scoped_refptr<const Extension> extension = GetInstalledExtension(*it); |
3131 DCHECK(extension); | 3135 DCHECK(extension); |
3132 if (!extension) | 3136 if (!extension) |
3133 continue; | 3137 continue; |
3134 blacklisted_extensions_.Insert(extension); | 3138 blacklisted_extensions_.Insert(extension); |
3135 UnloadExtension(*it, extension_misc::UNLOAD_REASON_BLACKLIST); | 3139 UnloadExtension(*it, extension_misc::UNLOAD_REASON_BLACKLIST); |
3136 } | 3140 } |
3137 | 3141 |
3138 IdentifyAlertableExtensions(); | 3142 IdentifyAlertableExtensions(); |
3139 } | 3143 } |
OLD | NEW |