summaryrefslogtreecommitdiffstats
path: root/extensions/common/event_matcher.cc
diff options
context:
space:
mode:
authorfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-19 11:35:41 +0000
committerfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-19 11:35:41 +0000
commit4593797103757f5b928558015d5149511ae47903 (patch)
tree1124dab76e20e983c72774c245a8f38b2b489d98 /extensions/common/event_matcher.cc
parent3be8a36a7f83b58b4deff0dfbc51a74d5b9281e1 (diff)
downloadchromium_src-4593797103757f5b928558015d5149511ae47903.zip
chromium_src-4593797103757f5b928558015d5149511ae47903.tar.gz
chromium_src-4593797103757f5b928558015d5149511ae47903.tar.bz2
<webview>: Add support for filtering extension events by instanceId.
BUG=166165 Review URL: https://chromiumcodereview.appspot.com/17419004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207213 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions/common/event_matcher.cc')
-rw-r--r--extensions/common/event_matcher.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/extensions/common/event_matcher.cc b/extensions/common/event_matcher.cc
index c982937..937c783 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);
+ return instance_id;
+}
+
} // namespace extensions