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 #ifndef CHROME_COMMON_EXTENSIONS_MATCHER_URL_MATCHER_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_MATCHER_URL_MATCHER_H_ |
6 #define CHROME_COMMON_EXTENSIONS_MATCHER_URL_MATCHER_H_ | 6 #define CHROME_COMMON_EXTENSIONS_MATCHER_URL_MATCHER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // all created URLMatcherCondition and the SubstringSetMatcher. | 106 // all created URLMatcherCondition and the SubstringSetMatcher. |
107 class URLMatcherConditionFactory { | 107 class URLMatcherConditionFactory { |
108 public: | 108 public: |
109 URLMatcherConditionFactory(); | 109 URLMatcherConditionFactory(); |
110 ~URLMatcherConditionFactory(); | 110 ~URLMatcherConditionFactory(); |
111 | 111 |
112 // Canonicalizes a URL for "Create{Host,Path,Query}*Condition" searches. | 112 // Canonicalizes a URL for "Create{Host,Path,Query}*Condition" searches. |
113 std::string CanonicalizeURLForComponentSearches(const GURL& url); | 113 std::string CanonicalizeURLForComponentSearches(const GURL& url); |
114 | 114 |
115 // Factory methods for various condition types. | 115 // Factory methods for various condition types. |
| 116 // |
| 117 // Note that these methods fill the pattern_singletons_. If you create |
| 118 // conditions and don't register them to a URLMatcher, they will continue to |
| 119 // consume memory. You need to call ForgetUnusedPatterns() or |
| 120 // URLMatcher::ClearUnusedConditionSets() in this case. |
116 URLMatcherCondition CreateHostPrefixCondition(const std::string& prefix); | 121 URLMatcherCondition CreateHostPrefixCondition(const std::string& prefix); |
117 URLMatcherCondition CreateHostSuffixCondition(const std::string& suffix); | 122 URLMatcherCondition CreateHostSuffixCondition(const std::string& suffix); |
118 URLMatcherCondition CreateHostContainsCondition(const std::string& str); | 123 URLMatcherCondition CreateHostContainsCondition(const std::string& str); |
119 URLMatcherCondition CreateHostEqualsCondition(const std::string& str); | 124 URLMatcherCondition CreateHostEqualsCondition(const std::string& str); |
120 | 125 |
121 URLMatcherCondition CreatePathPrefixCondition(const std::string& prefix); | 126 URLMatcherCondition CreatePathPrefixCondition(const std::string& prefix); |
122 URLMatcherCondition CreatePathSuffixCondition(const std::string& suffix); | 127 URLMatcherCondition CreatePathSuffixCondition(const std::string& suffix); |
123 URLMatcherCondition CreatePathContainsCondition(const std::string& str); | 128 URLMatcherCondition CreatePathContainsCondition(const std::string& str); |
124 URLMatcherCondition CreatePathEqualsCondition(const std::string& str); | 129 URLMatcherCondition CreatePathEqualsCondition(const std::string& str); |
125 | 130 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 SubstringSetMatcher url_component_matcher_; | 315 SubstringSetMatcher url_component_matcher_; |
311 std::set<const SubstringPattern*> registered_full_url_patterns_; | 316 std::set<const SubstringPattern*> registered_full_url_patterns_; |
312 std::set<const SubstringPattern*> registered_url_component_patterns_; | 317 std::set<const SubstringPattern*> registered_url_component_patterns_; |
313 | 318 |
314 DISALLOW_COPY_AND_ASSIGN(URLMatcher); | 319 DISALLOW_COPY_AND_ASSIGN(URLMatcher); |
315 }; | 320 }; |
316 | 321 |
317 } // namespace extensions | 322 } // namespace extensions |
318 | 323 |
319 #endif // CHROME_COMMON_EXTENSIONS_MATCHER_URL_MATCHER_H_ | 324 #endif // CHROME_COMMON_EXTENSIONS_MATCHER_URL_MATCHER_H_ |
OLD | NEW |