OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_URL_MATCHER_URL_MATCHER_H_ | 5 #ifndef COMPONENTS_URL_MATCHER_URL_MATCHER_H_ |
6 #define COMPONENTS_URL_MATCHER_URL_MATCHER_H_ | 6 #define COMPONENTS_URL_MATCHER_URL_MATCHER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // Note that substring patterns and regex patterns will use different IDs. | 208 // Note that substring patterns and regex patterns will use different IDs. |
209 int id_counter_; | 209 int id_counter_; |
210 | 210 |
211 // This comparison considers only the pattern() value of the | 211 // This comparison considers only the pattern() value of the |
212 // StringPatterns. | 212 // StringPatterns. |
213 struct StringPatternPointerCompare { | 213 struct StringPatternPointerCompare { |
214 bool operator()(StringPattern* lhs, StringPattern* rhs) const; | 214 bool operator()(StringPattern* lhs, StringPattern* rhs) const; |
215 }; | 215 }; |
216 // Set to ensure that we generate only one StringPattern for each content | 216 // Set to ensure that we generate only one StringPattern for each content |
217 // of StringPattern::pattern(). | 217 // of StringPattern::pattern(). |
218 typedef std::set<StringPattern*, StringPatternPointerCompare> | 218 using PatternSingletons = std::map<StringPattern*, |
219 PatternSingletons; | 219 std::unique_ptr<StringPattern>, |
| 220 StringPatternPointerCompare>; |
220 PatternSingletons substring_pattern_singletons_; | 221 PatternSingletons substring_pattern_singletons_; |
221 PatternSingletons regex_pattern_singletons_; | 222 PatternSingletons regex_pattern_singletons_; |
222 PatternSingletons origin_and_path_regex_pattern_singletons_; | 223 PatternSingletons origin_and_path_regex_pattern_singletons_; |
223 | 224 |
224 DISALLOW_COPY_AND_ASSIGN(URLMatcherConditionFactory); | 225 DISALLOW_COPY_AND_ASSIGN(URLMatcherConditionFactory); |
225 }; | 226 }; |
226 | 227 |
227 // This class represents a single URL query matching condition. The query | 228 // This class represents a single URL query matching condition. The query |
228 // matching is done as a search for a key and optionally a value. | 229 // matching is done as a search for a key and optionally a value. |
229 // The matching makes use of CanonicalizeURLForComponentSearches to ensure that | 230 // The matching makes use of CanonicalizeURLForComponentSearches to ensure that |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 RegexSetMatcher origin_and_path_regex_set_matcher_; | 427 RegexSetMatcher origin_and_path_regex_set_matcher_; |
427 std::set<const StringPattern*> registered_full_url_patterns_; | 428 std::set<const StringPattern*> registered_full_url_patterns_; |
428 std::set<const StringPattern*> registered_url_component_patterns_; | 429 std::set<const StringPattern*> registered_url_component_patterns_; |
429 | 430 |
430 DISALLOW_COPY_AND_ASSIGN(URLMatcher); | 431 DISALLOW_COPY_AND_ASSIGN(URLMatcher); |
431 }; | 432 }; |
432 | 433 |
433 } // namespace url_matcher | 434 } // namespace url_matcher |
434 | 435 |
435 #endif // COMPONENTS_URL_MATCHER_URL_MATCHER_H_ | 436 #endif // COMPONENTS_URL_MATCHER_URL_MATCHER_H_ |
OLD | NEW |