Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4883)

Unified Diff: chrome/browser/extensions/extension_service.cc

Issue 9369013: Take extensions out of Profile into a profile-keyed service, ExtensionSystem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 84397982cc4e10874b4d7d1a24dfd29d71d0adef..c7f12b24bf590a50ddb274d01c00a447ca1d309f 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -51,6 +51,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"
@@ -376,6 +378,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)),
@@ -695,7 +698,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())) {
@@ -977,7 +981,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).
@@ -1124,7 +1128,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);
@@ -1913,7 +1917,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;
}
@@ -1938,7 +1942,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;
}
@@ -2483,7 +2487,7 @@ void ExtensionService::Observe(int type,
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&ExtensionInfoMap::UnregisterAllExtensionsInProcess,
- profile_->GetExtensionInfoMap(),
+ system_->info_map(),
process->GetID()));
break;
}

Powered by Google App Engine
This is Rietveld 408576698