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

Unified Diff: extensions/browser/event_router.cc

Issue 2973903002: [Extensions Bindings] Introduce a supportsLazyListeners property (Closed)
Patch Set: onMessage event fix Created 3 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 | « extensions/browser/event_router.h ('k') | extensions/renderer/bindings/api_binding.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/event_router.cc
diff --git a/extensions/browser/event_router.cc b/extensions/browser/event_router.cc
index 4cab317e42e3bae5f27dc5b812020fe7c8ccb963..6013cfefad9e4d8434b4bbbe49e2aff4e3306d4d 100644
--- a/extensions/browser/event_router.cc
+++ b/extensions/browser/event_router.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
+#include <algorithm>
#include <utility>
#include "base/atomic_sequence_num.h"
@@ -405,6 +406,16 @@ void EventRouter::ClearRegisteredEventsForTest(
RegisteredEventType::kServiceWorker);
}
+bool EventRouter::HasLazyEventListenerForTesting(
+ const std::string& event_name) {
+ const EventListenerMap::ListenerList& listeners =
+ listeners_.GetEventListenersByName(event_name);
+ return std::any_of(listeners.begin(), listeners.end(),
+ [](const std::unique_ptr<EventListener>& listener) {
+ return listener->IsLazy();
+ });
+}
+
void EventRouter::RemoveFilterFromEvent(const std::string& event_name,
const std::string& extension_id,
const DictionaryValue* filter) {
« no previous file with comments | « extensions/browser/event_router.h ('k') | extensions/renderer/bindings/api_binding.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698