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

Unified Diff: chrome/browser/extensions/extension_history_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_history_api.h
diff --git a/chrome/browser/extensions/extension_history_api.h b/chrome/browser/extensions/extension_history_api.h
index f6ddcdc5de0fea4e499dc836ac859bdca6fd6e97..b5f720810733b800a6f125d01acea3c0d1c4bb4f 100644
--- a/chrome/browser/extensions/extension_history_api.h
+++ b/chrome/browser/extensions/extension_history_api.h
@@ -9,28 +9,23 @@
#include <map>
#include <string>
-#include "base/memory/singleton.h"
#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/history_notifications.h"
#include "content/common/notification_registrar.h"
+class Profile;
+
// Observes History service and routes the notifications as events to the
// extension system.
class ExtensionHistoryEventRouter : public NotificationObserver {
public:
- // Single instance of the event router.
- static ExtensionHistoryEventRouter* GetInstance();
+ explicit ExtensionHistoryEventRouter(Profile* profile);
+ virtual ~ExtensionHistoryEventRouter();
- // Safe to call multiple times.
- void ObserveProfile(Profile* profile);
+ void Init();
private:
- friend struct DefaultSingletonTraits<ExtensionHistoryEventRouter>;
-
- ExtensionHistoryEventRouter();
- virtual ~ExtensionHistoryEventRouter();
-
// NotificationObserver::Observe.
virtual void Observe(NotificationType type,
const NotificationSource& source,
@@ -49,9 +44,8 @@ class ExtensionHistoryEventRouter : public NotificationObserver {
// Used for tracking registrations to history service notifications.
NotificationRegistrar registrar_;
- // Registered profiles.
- typedef std::map<uintptr_t, Profile*> ProfileMap;
- ProfileMap profiles_;
+ // The associated Profile owns us transitively via ExtensionService.
+ Profile* profile_;
DISALLOW_COPY_AND_ASSIGN(ExtensionHistoryEventRouter);
};
« no previous file with comments | « chrome/browser/extensions/extension_event_router.cc ('k') | chrome/browser/extensions/extension_history_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698