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

Unified Diff: extensions/browser/event_router.h

Issue 430243002: Use ExtensionRegistry in EventRouter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 | « no previous file | extensions/browser/event_router.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/event_router.h
diff --git a/extensions/browser/event_router.h b/extensions/browser/event_router.h
index c8c5226b71a0fa6bc39121e578e4bc07050d3100..fba6144307de9c0bf3bf082e1c7e075ad7a4764d 100644
--- a/extensions/browser/event_router.h
+++ b/extensions/browser/event_router.h
@@ -15,10 +15,12 @@
#include "base/containers/hash_tables.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
+#include "base/scoped_observer.h"
#include "base/values.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "extensions/browser/event_listener_map.h"
+#include "extensions/browser/extension_registry_observer.h"
#include "extensions/common/event_filtering_info.h"
#include "ipc/ipc_sender.h"
@@ -35,12 +37,14 @@ class ActivityLog;
class Extension;
class ExtensionHost;
class ExtensionPrefs;
+class ExtensionRegistry;
struct Event;
struct EventDispatchInfo;
struct EventListenerInfo;
class EventRouter : public content::NotificationObserver,
+ public ExtensionRegistryObserver,
public EventListenerMap::Delegate {
public:
// These constants convey the state of our knowledge of whether we're in
@@ -207,6 +211,13 @@ class EventRouter : public content::NotificationObserver,
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
+ // ExtensionRegistryObserver implementation.
+ virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
+ const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) OVERRIDE;
// Returns true if the given listener map contains a event listeners for
// the given event. If |extension_id| is non-empty, we also check that that
@@ -292,6 +303,9 @@ class EventRouter : public content::NotificationObserver,
content::NotificationRegistrar registrar_;
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
+ extension_registry_observer_;
+
EventListenerMap listeners_;
// Map from base event name to observer.
« no previous file with comments | « no previous file | extensions/browser/event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698