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

Unified Diff: extensions/common/event_matcher.cc

Issue 17419004: <webview>: Add support for filtering extension events by instanceId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@filter_listener
Patch Set: Correct diff Created 7 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/common/event_matcher.cc
diff --git a/extensions/common/event_matcher.cc b/extensions/common/event_matcher.cc
index c9829373c9102a16a331066f346c19fb0e8d2eef..937c783745f5182d7bd539178afd220570fef496 100644
--- a/extensions/common/event_matcher.cc
+++ b/extensions/common/event_matcher.cc
@@ -21,8 +21,9 @@ EventMatcher::~EventMatcher() {
bool EventMatcher::MatchNonURLCriteria(
const EventFilteringInfo& event_info) const {
- // There is currently no criteria apart from URL criteria.
- return true;
+ if (!event_info.has_instance_id())
+ return true;
+ return event_info.instance_id() == GetInstanceID();
}
int EventMatcher::GetURLFilterCount() const {
@@ -44,4 +45,10 @@ int EventMatcher::HasURLFilters() const {
return GetURLFilterCount() != 0;
}
+int EventMatcher::GetInstanceID() const {
+ int instance_id = 0;
+ filter_->GetInteger("instanceId", &instance_id);
Matt Perry 2013/06/18 23:29:02 Is 0 an invalid instanceId? (I'm wondering what wi
Fady Samuel 2013/06/19 01:15:16 Yes, 0 is an invalid instanceId. If a listener doe
+ return instance_id;
+}
+
} // namespace extensions
« extensions/common/event_filtering_info.h ('K') | « extensions/common/event_matcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698