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

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

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
Index: chrome/browser/extensions/extension_processes_api.h
diff --git a/chrome/browser/extensions/extension_processes_api.h b/chrome/browser/extensions/extension_processes_api.h
index fe0a2f9cd21b7012773fe8c0cf254a2fa78d3e77..18e871f957fd248fd32ce9c160b6b0bb2b9f3c9c 100644
--- a/chrome/browser/extensions/extension_processes_api.h
+++ b/chrome/browser/extensions/extension_processes_api.h
@@ -13,15 +13,16 @@
#include "chrome/browser/task_manager/task_manager.h"
#include "content/common/notification_registrar.h"
+class Profile;
+
// Observes the Task Manager and routes the notifications as events to the
// extension system.
class ExtensionProcessesEventRouter : public TaskManagerModelObserver {
public:
- // Single instance of the event router.
- static ExtensionProcessesEventRouter* GetInstance();
+ explicit ExtensionProcessesEventRouter(Profile* profile);
+ virtual ~ExtensionProcessesEventRouter();
- // Safe to call multiple times.
- void ObserveProfile(Profile* profile);
+ void Init();
// Called when an extension process wants to listen to process events.
void ListenerAdded();
@@ -30,10 +31,6 @@ class ExtensionProcessesEventRouter : public TaskManagerModelObserver {
void ListenerRemoved();
private:
- friend struct DefaultSingletonTraits<ExtensionProcessesEventRouter>;
-
- ExtensionProcessesEventRouter();
- virtual ~ExtensionProcessesEventRouter();
// TaskManagerModelObserver methods.
virtual void OnModelChanged() {}
@@ -48,9 +45,8 @@ class ExtensionProcessesEventRouter : public TaskManagerModelObserver {
// Used for tracking registrations to process related notifications.
NotificationRegistrar registrar_;
- // Registered profiles.
- typedef std::set<Profile*> ProfileSet;
- ProfileSet profiles_;
+ // The associated Profile owns us transitively via ExtensionService.
+ Profile* profile_;
// TaskManager to observe for updates.
TaskManagerModel* model_;
« no previous file with comments | « chrome/browser/extensions/extension_preference_api.cc ('k') | chrome/browser/extensions/extension_processes_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698