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

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

Issue 6961027: Change event routers from singletons to being owned by the ExtensionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: all is built on sand Created 9 years, 7 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_processes_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_processes_api.cc
diff --git a/chrome/browser/extensions/extension_processes_api.cc b/chrome/browser/extensions/extension_processes_api.cc
index 266afdc37d84db0e1deb92bcf65241eba41702ea..92d61b8929112a07c7abf2b85790e448096a9c10 100644
--- a/chrome/browser/extensions/extension_processes_api.cc
+++ b/chrome/browser/extensions/extension_processes_api.cc
@@ -42,21 +42,17 @@ DictionaryValue* CreateProcessValue(int process_id,
return result;
}
-ExtensionProcessesEventRouter* ExtensionProcessesEventRouter::GetInstance() {
- return Singleton<ExtensionProcessesEventRouter>::get();
-}
-
-ExtensionProcessesEventRouter::ExtensionProcessesEventRouter() {
- model_ = TaskManager::GetInstance()->model();
- model_->AddObserver(this);
+ExtensionProcessesEventRouter::ExtensionProcessesEventRouter(Profile* profile)
+ : profile_(profile) {
}
ExtensionProcessesEventRouter::~ExtensionProcessesEventRouter() {
model_->RemoveObserver(this);
}
-void ExtensionProcessesEventRouter::ObserveProfile(Profile* profile) {
- profiles_.insert(profile);
+void ExtensionProcessesEventRouter::Init() {
+ model_ = TaskManager::GetInstance()->model();
+ model_->AddObserver(this);
}
void ExtensionProcessesEventRouter::ListenerAdded() {
@@ -138,12 +134,8 @@ void ExtensionProcessesEventRouter::OnItemsChanged(int start, int length) {
std::string json_args;
base::JSONWriter::Write(&args, false, &json_args);
- // Notify each profile that is interested.
- for (ProfileSet::iterator it = profiles_.begin();
- it != profiles_.end(); it++) {
- Profile* profile = *it;
- DispatchEvent(profile, keys::kOnUpdated, json_args);
- }
+ // Notify the profile.
+ DispatchEvent(profile_, keys::kOnUpdated, json_args);
}
}
« no previous file with comments | « chrome/browser/extensions/extension_processes_api.h ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698