Index: chrome/browser/extensions/extension_service.cc |
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc |
index 3c0eb11ebdafe8e34e40c44a8687572f08a06ca9..b2d7eec8478b9911c8c039200d9c597d82866e17 100644 |
--- a/chrome/browser/extensions/extension_service.cc |
+++ b/chrome/browser/extensions/extension_service.cc |
@@ -52,6 +52,8 @@ |
#include "chrome/browser/extensions/extension_sorting.h" |
#include "chrome/browser/extensions/extension_special_storage_policy.h" |
#include "chrome/browser/extensions/extension_sync_data.h" |
+#include "chrome/browser/extensions/extension_system.h" |
+#include "chrome/browser/extensions/extension_system_factory.h" |
#include "chrome/browser/extensions/extension_updater.h" |
#include "chrome/browser/extensions/extension_web_ui.h" |
#include "chrome/browser/extensions/extension_webnavigation_api.h" |
@@ -375,6 +377,7 @@ ExtensionService::ExtensionService(Profile* profile, |
bool autoupdate_enabled, |
bool extensions_enabled) |
: profile_(profile), |
+ system_(ExtensionSystemFactory::GetForProfile(profile)), |
extension_prefs_(extension_prefs), |
settings_frontend_(extensions::SettingsFrontend::Create(profile)), |
pending_extension_manager_(*ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
@@ -692,7 +695,8 @@ void ExtensionService::ReloadExtension(const std::string& extension_id) { |
// If the extension has an inspector open for its background page, detach |
// the inspector and hang onto a cookie for it, so that we can reattach |
// later. |
- ExtensionProcessManager* manager = profile_->GetExtensionProcessManager(); |
+ // TODO(yoz): this is not incognito-safe! |
+ ExtensionProcessManager* manager = system_->process_manager(); |
ExtensionHost* host = manager->GetBackgroundHostForExtension(extension_id); |
if (host && DevToolsAgentHostRegistry::HasDevToolsAgentHost( |
host->render_view_host())) { |
@@ -981,7 +985,7 @@ void ExtensionService::NotifyExtensionLoaded(const Extension* extension) { |
// that the request context doesn't yet know about. The profile is responsible |
// for ensuring its URLRequestContexts appropriately discover the loaded |
// extension. |
- profile_->RegisterExtensionWithRequestContexts(extension); |
+ system_->RegisterExtensionWithRequestContexts(extension); |
// Tell renderers about the new extension, unless it's a theme (renderers |
// don't need to know about themes). |
@@ -1128,7 +1132,7 @@ void ExtensionService::NotifyExtensionUnloaded( |
host->Send(new ExtensionMsg_Unloaded(extension->id())); |
} |
- profile_->UnregisterExtensionWithRequestContexts(extension->id(), reason); |
+ system_->UnregisterExtensionWithRequestContexts(extension->id(), reason); |
profile_->GetExtensionSpecialStoragePolicy()-> |
RevokeRightsForExtension(extension); |
@@ -1929,7 +1933,7 @@ void ExtensionService::UnloadExtension( |
if (!extension) { |
// In case the extension may have crashed/uninstalled. Allow the profile to |
// clean up its RequestContexts. |
- profile_->UnregisterExtensionWithRequestContexts(extension_id, reason); |
+ system_->UnregisterExtensionWithRequestContexts(extension_id, reason); |
return; |
} |
@@ -1954,7 +1958,7 @@ if (disabled_extensions_.Contains(extension->id())) { |
// Make sure the profile cleans up its RequestContexts when an already |
// disabled extension is unloaded (since they are also tracking the disabled |
// extensions). |
- profile_->UnregisterExtensionWithRequestContexts(extension_id, reason); |
+ system_->UnregisterExtensionWithRequestContexts(extension_id, reason); |
return; |
} |
@@ -2501,7 +2505,7 @@ void ExtensionService::Observe(int type, |
BrowserThread::PostTask( |
BrowserThread::IO, FROM_HERE, |
base::Bind(&ExtensionInfoMap::UnregisterAllExtensionsInProcess, |
- profile_->GetExtensionInfoMap(), |
+ system_->info_map(), |
process->GetID())); |
break; |
} |