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

Side by Side Diff: extensions/common/event_filter.h

Issue 2500573003: Some easy linked_ptr removal from extensions/common/ (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | extensions/common/event_filter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef EXTENSIONS_COMMON_EVENT_FILTER_H_ 5 #ifndef EXTENSIONS_COMMON_EVENT_FILTER_H_
6 #define EXTENSIONS_COMMON_EVENT_FILTER_H_ 6 #define EXTENSIONS_COMMON_EVENT_FILTER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory>
9 #include <set> 10 #include <set>
10 11
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/linked_ptr.h"
13 #include "components/url_matcher/url_matcher.h" 13 #include "components/url_matcher/url_matcher.h"
14 #include "extensions/common/event_filtering_info.h" 14 #include "extensions/common/event_filtering_info.h"
15 #include "extensions/common/event_matcher.h" 15 #include "extensions/common/event_matcher.h"
16 16
17 namespace extensions { 17 namespace extensions {
18 18
19 // Matches incoming events against a collection of EventMatchers. Each added 19 // Matches incoming events against a collection of EventMatchers. Each added
20 // EventMatcher is given an id which is returned by MatchEvent() when it is 20 // EventMatcher is given an id which is returned by MatchEvent() when it is
21 // passed a matching event. 21 // passed a matching event.
22 class EventFilter { 22 class EventFilter {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 private: 81 private:
82 std::unique_ptr<EventMatcher> event_matcher_; 82 std::unique_ptr<EventMatcher> event_matcher_;
83 // The id sets in url_matcher_ that this EventMatcher owns. 83 // The id sets in url_matcher_ that this EventMatcher owns.
84 std::vector<url_matcher::URLMatcherConditionSet::ID> condition_set_ids_; 84 std::vector<url_matcher::URLMatcherConditionSet::ID> condition_set_ids_;
85 url_matcher::URLMatcher* url_matcher_; 85 url_matcher::URLMatcher* url_matcher_;
86 86
87 DISALLOW_COPY_AND_ASSIGN(EventMatcherEntry); 87 DISALLOW_COPY_AND_ASSIGN(EventMatcherEntry);
88 }; 88 };
89 89
90 // Maps from a matcher id to an event matcher entry. 90 // Maps from a matcher id to an event matcher entry.
91 typedef std::map<MatcherID, linked_ptr<EventMatcherEntry> > EventMatcherMap; 91 using EventMatcherMap =
92 std::map<MatcherID, std::unique_ptr<EventMatcherEntry>>;
92 93
93 // Maps from event name to the map of matchers that are registered for it. 94 // Maps from event name to the map of matchers that are registered for it.
94 typedef std::map<std::string, EventMatcherMap> EventMatcherMultiMap; 95 using EventMatcherMultiMap = std::map<std::string, EventMatcherMap>;
95 96
96 // Adds the list of URL filters in |matcher| to the URL matcher, having 97 // Adds the list of URL filters in |matcher| to the URL matcher, having
97 // matches for those URLs map to |id|. 98 // matches for those URLs map to |id|.
98 bool CreateConditionSets( 99 bool CreateConditionSets(
99 MatcherID id, 100 MatcherID id,
100 EventMatcher* matcher, 101 EventMatcher* matcher,
101 url_matcher::URLMatcherConditionSet::Vector* condition_sets); 102 url_matcher::URLMatcherConditionSet::Vector* condition_sets);
102 103
103 bool AddDictionaryAsConditionSet( 104 bool AddDictionaryAsConditionSet(
104 base::DictionaryValue* url_filter, 105 base::DictionaryValue* url_filter,
(...skipping 16 matching lines...) Expand all
121 122
122 // Maps from event matcher ids to the name of the event they match on. 123 // Maps from event matcher ids to the name of the event they match on.
123 std::map<MatcherID, std::string> id_to_event_name_; 124 std::map<MatcherID, std::string> id_to_event_name_;
124 125
125 DISALLOW_COPY_AND_ASSIGN(EventFilter); 126 DISALLOW_COPY_AND_ASSIGN(EventFilter);
126 }; 127 };
127 128
128 } // namespace extensions 129 } // namespace extensions
129 130
130 #endif // EXTENSIONS_COMMON_EVENT_FILTER_H_ 131 #endif // EXTENSIONS_COMMON_EVENT_FILTER_H_
OLDNEW
« no previous file with comments | « no previous file | extensions/common/event_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698