OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "extensions/common/event_matcher.h" | 5 #include "extensions/common/event_matcher.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "extensions/common/event_filtering_info.h" | 10 #include "extensions/common/event_filtering_info.h" |
11 | 11 |
12 namespace { | 12 namespace { |
13 const char kUrlFiltersKey[] = "url"; | 13 const char kUrlFiltersKey[] = "url"; |
14 const char kWindowTypesKey[] = "windowTypes"; | 14 const char kWindowTypesKey[] = "windowTypes"; |
15 } | 15 } |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 | 18 |
19 const char kEventFilterServiceTypeKey[] = "serviceType"; | 19 const char kEventFilterServiceTypeKey[] = "serviceType"; |
20 | 20 |
21 EventMatcher::EventMatcher(scoped_ptr<base::DictionaryValue> filter, | 21 EventMatcher::EventMatcher(std::unique_ptr<base::DictionaryValue> filter, |
22 int routing_id) | 22 int routing_id) |
23 : filter_(std::move(filter)), routing_id_(routing_id) {} | 23 : filter_(std::move(filter)), routing_id_(routing_id) {} |
24 | 24 |
25 EventMatcher::~EventMatcher() { | 25 EventMatcher::~EventMatcher() { |
26 } | 26 } |
27 | 27 |
28 bool EventMatcher::MatchNonURLCriteria( | 28 bool EventMatcher::MatchNonURLCriteria( |
29 const EventFilteringInfo& event_info) const { | 29 const EventFilteringInfo& event_info) const { |
30 if (event_info.has_instance_id()) { | 30 if (event_info.has_instance_id()) { |
31 return event_info.instance_id() == GetInstanceID(); | 31 return event_info.instance_id() == GetInstanceID(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 bool EventMatcher::HasWindowTypes() const { | 103 bool EventMatcher::HasWindowTypes() const { |
104 return GetWindowTypeCount() != 0; | 104 return GetWindowTypeCount() != 0; |
105 } | 105 } |
106 | 106 |
107 int EventMatcher::GetRoutingID() const { | 107 int EventMatcher::GetRoutingID() const { |
108 return routing_id_; | 108 return routing_id_; |
109 } | 109 } |
110 | 110 |
111 } // namespace extensions | 111 } // namespace extensions |
OLD | NEW |