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

Unified Diff: extensions/browser/event_router.h

Issue 346193002: Use ExtensionRegistry in EventRouter and ApiResourceManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
Index: extensions/browser/event_router.h
diff --git a/extensions/browser/event_router.h b/extensions/browser/event_router.h
index 79a0c944d4eb06ddb3e43aebab6cb913e2d7f10f..cfc63352a800a456b07a28153442aed788539e9e 100644
--- a/extensions/browser/event_router.h
+++ b/extensions/browser/event_router.h
@@ -16,10 +16,12 @@
#include "base/gtest_prod_util.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"
@@ -36,12 +38,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
@@ -196,10 +200,19 @@ class EventRouter : public content::NotificationObserver,
UserGestureState user_gesture,
const extensions::EventFilteringInfo& info);
+ // content::NotificationObserver implementation.
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
// extension is one of the listeners.
@@ -282,6 +295,9 @@ class EventRouter : public content::NotificationObserver,
content::NotificationRegistrar registrar_;
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
+ extension_registry_observer_;
+
EventListenerMap listeners_;
// Map from base event name to observer.

Powered by Google App Engine
This is Rietveld 408576698