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

Unified Diff: chrome/common/extensions/event_matcher.cc

Issue 10534125: Extend EventFilter to handle the case where EventMatchers from event X get (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 8 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
« no previous file with comments | « chrome/common/extensions/event_matcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/event_matcher.cc
diff --git a/chrome/common/extensions/event_matcher.cc b/chrome/common/extensions/event_matcher.cc
index 1f9e47481c9baac0e2c046fbdd3bd06df53ed6fa..8a64f787fea5b92699273414a5612821924c074d 100644
--- a/chrome/common/extensions/event_matcher.cc
+++ b/chrome/common/extensions/event_matcher.cc
@@ -5,9 +5,14 @@
#include "chrome/common/extensions/event_matcher.h"
#include "chrome/common/extensions/event_filtering_info.h"
+namespace {
+const char kUrlFiltersKey[] = "url";
+}
+
namespace extensions {
-EventMatcher::EventMatcher() {
+EventMatcher::EventMatcher(scoped_ptr<base::DictionaryValue> filter)
+ : filter_(filter.Pass()) {
}
EventMatcher::~EventMatcher() {
@@ -19,4 +24,23 @@ bool EventMatcher::MatchNonURLCriteria(
return true;
}
+int EventMatcher::GetURLFilterCount() const {
+ base::ListValue* url_filters = NULL;
+ if (filter_->GetList(kUrlFiltersKey, &url_filters))
+ return url_filters->GetSize();
+ return 0;
+}
+
+bool EventMatcher::GetURLFilter(int i, base::DictionaryValue** url_filter_out) {
+ base::ListValue* url_filters = NULL;
+ if (filter_->GetList(kUrlFiltersKey, &url_filters)) {
+ return url_filters->GetDictionary(i, url_filter_out);
+ }
+ return false;
+}
+
+int EventMatcher::HasURLFilters() const {
+ return GetURLFilterCount() != 0;
+}
+
} // namespace extensions
« no previous file with comments | « chrome/common/extensions/event_matcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698