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

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

Issue 7243012: Change many extension event routers to not be singletons and to be more profile-aware. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bookmark remove observer Created 9 years, 6 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
« no previous file with comments | « chrome/browser/extensions/extension_management_api.h ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_management_api.cc
diff --git a/chrome/browser/extensions/extension_management_api.cc b/chrome/browser/extensions/extension_management_api.cc
index 0053b1d3a48a60fea7835900faa2f0b9ed91cf00..1bc789447996ff23e0cbbddff33ddd7d20db57c7 100644
--- a/chrome/browser/extensions/extension_management_api.cc
+++ b/chrome/browser/extensions/extension_management_api.cc
@@ -248,16 +248,11 @@ bool UninstallFunction::RunImpl() {
return true;
}
-// static
-ExtensionManagementEventRouter* ExtensionManagementEventRouter::GetInstance() {
- return Singleton<ExtensionManagementEventRouter>::get();
-}
-
ExtensionManagementEventRouter::ExtensionManagementEventRouter() {}
ExtensionManagementEventRouter::~ExtensionManagementEventRouter() {}
-void ExtensionManagementEventRouter::Init() {
+void ExtensionManagementEventRouter::ObserveProfile(Profile* profile) {
NotificationType::Type types[] = {
NotificationType::EXTENSION_INSTALLED,
NotificationType::EXTENSION_UNINSTALLED,
@@ -265,13 +260,14 @@ void ExtensionManagementEventRouter::Init() {
NotificationType::EXTENSION_UNLOADED
};
- // Don't re-init (eg in the case of multiple profiles).
- if (registrar_.IsEmpty()) {
- for (size_t i = 0; i < arraysize(types); i++) {
- registrar_.Add(this,
- types[i],
- NotificationService::AllSources());
- }
+ CHECK(registrar_.IsEmpty());
+ for (size_t i = 0; i < arraysize(types); i++) {
+ registrar_.Add(this,
+ types[i],
+ Source<Profile>(profile));
+ registrar_.Add(this,
+ types[i],
+ Source<Profile>(profile->GetOffTheRecordProfile()));
}
}
« no previous file with comments | « chrome/browser/extensions/extension_management_api.h ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698