Index: extensions/browser/event_router.h |
diff --git a/extensions/browser/event_router.h b/extensions/browser/event_router.h |
index 303f4bef6321f86337db47af191822c76e34d7cc..48bc266980cce4ce121f64a3402d8afbc5926e8a 100644 |
--- a/extensions/browser/event_router.h |
+++ b/extensions/browser/event_router.h |
@@ -163,12 +163,6 @@ class EventRouter : public KeyedService, |
virtual bool ExtensionHasEventListener(const std::string& extension_id, |
const std::string& event_name); |
- // Return or set the list of events for which the given extension has |
- // registered. |
- std::set<std::string> GetRegisteredEvents(const std::string& extension_id); |
- void SetRegisteredEvents(const std::string& extension_id, |
- const std::set<std::string>& events); |
- |
// Broadcasts an event to every listener registered for that event. |
virtual void BroadcastEvent(std::unique_ptr<Event> event); |
@@ -187,6 +181,16 @@ class EventRouter : public KeyedService, |
void OnEventAck(content::BrowserContext* context, |
const std::string& extension_id); |
+ // Returns whether or not the given extension has any registered events. |
+ bool HasRegisteredEvents(const ExtensionId& extension_id) const { |
+ return !GetRegisteredEvents(extension_id).empty(); |
+ } |
+ |
+ // Clears registered events for testing purposes. |
+ void ClearRegisteredEventsForTest(const ExtensionId& extension_id) { |
+ SetRegisteredEvents(extension_id, std::set<std::string>()); |
+ } |
+ |
// Reports UMA for an event dispatched to |extension| with histogram value |
// |histogram_value|. Must be called on the UI thread. |
// |
@@ -216,6 +220,13 @@ class EventRouter : public KeyedService, |
UserGestureState user_gesture, |
const extensions::EventFilteringInfo& info); |
+ // Returns or sets the list of events for which the given extension has |
+ // registered. |
+ std::set<std::string> GetRegisteredEvents( |
+ const std::string& extension_id) const; |
+ void SetRegisteredEvents(const std::string& extension_id, |
+ const std::set<std::string>& events); |
+ |
void Observe(int type, |
const content::NotificationSource& source, |
const content::NotificationDetails& details) override; |