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

Side by Side Diff: chrome/common/extensions/matcher/url_matcher.h

Issue 10692158: Refactor URLBlacklistManager to use URLMatcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years, 5 months 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 | Annotate | Revision Log
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 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 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 26 matching lines...) Expand all
37 HOST_EQUALS, 37 HOST_EQUALS,
38 PATH_PREFIX, 38 PATH_PREFIX,
39 PATH_SUFFIX, 39 PATH_SUFFIX,
40 PATH_CONTAINS, 40 PATH_CONTAINS,
41 PATH_EQUALS, 41 PATH_EQUALS,
42 QUERY_PREFIX, 42 QUERY_PREFIX,
43 QUERY_SUFFIX, 43 QUERY_SUFFIX,
44 QUERY_CONTAINS, 44 QUERY_CONTAINS,
45 QUERY_EQUALS, 45 QUERY_EQUALS,
46 HOST_SUFFIX_PATH_PREFIX, 46 HOST_SUFFIX_PATH_PREFIX,
47 HOST_EQUALS_PATH_PREFIX,
47 URL_PREFIX, 48 URL_PREFIX,
48 URL_SUFFIX, 49 URL_SUFFIX,
49 URL_CONTAINS, 50 URL_CONTAINS,
50 URL_EQUALS, 51 URL_EQUALS,
51 }; 52 };
52 53
53 URLMatcherCondition(); 54 URLMatcherCondition();
54 ~URLMatcherCondition(); 55 ~URLMatcherCondition();
55 URLMatcherCondition(Criterion criterion, 56 URLMatcherCondition(Criterion criterion,
56 const SubstringPattern* substring_pattern); 57 const SubstringPattern* substring_pattern);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 URLMatcherCondition CreateQuerySuffixCondition(const std::string& suffix); 132 URLMatcherCondition CreateQuerySuffixCondition(const std::string& suffix);
132 URLMatcherCondition CreateQueryContainsCondition(const std::string& str); 133 URLMatcherCondition CreateQueryContainsCondition(const std::string& str);
133 URLMatcherCondition CreateQueryEqualsCondition(const std::string& str); 134 URLMatcherCondition CreateQueryEqualsCondition(const std::string& str);
134 135
135 // This covers the common case, where you don't care whether a domain 136 // This covers the common case, where you don't care whether a domain
136 // "foobar.com" is expressed as "foobar.com" or "www.foobar.com", and it 137 // "foobar.com" is expressed as "foobar.com" or "www.foobar.com", and it
137 // should be followed by a given |path_prefix|. 138 // should be followed by a given |path_prefix|.
138 URLMatcherCondition CreateHostSuffixPathPrefixCondition( 139 URLMatcherCondition CreateHostSuffixPathPrefixCondition(
139 const std::string& host_suffix, 140 const std::string& host_suffix,
140 const std::string& path_prefix); 141 const std::string& path_prefix);
142 URLMatcherCondition CreateHostEqualsPathPrefixCondition(
143 const std::string& host,
144 const std::string& path_prefix);
141 145
142 // Canonicalizes a URL for "CreateURL*Condition" searches. 146 // Canonicalizes a URL for "CreateURL*Condition" searches.
143 std::string CanonicalizeURLForFullSearches(const GURL& url); 147 std::string CanonicalizeURLForFullSearches(const GURL& url);
144 148
145 URLMatcherCondition CreateURLPrefixCondition(const std::string& prefix); 149 URLMatcherCondition CreateURLPrefixCondition(const std::string& prefix);
146 URLMatcherCondition CreateURLSuffixCondition(const std::string& suffix); 150 URLMatcherCondition CreateURLSuffixCondition(const std::string& suffix);
147 URLMatcherCondition CreateURLContainsCondition(const std::string& str); 151 URLMatcherCondition CreateURLContainsCondition(const std::string& str);
148 URLMatcherCondition CreateURLEqualsCondition(const std::string& str); 152 URLMatcherCondition CreateURLEqualsCondition(const std::string& str);
149 153
150 // Removes all patterns from |pattern_singletons_| that are not listed in 154 // Removes all patterns from |pattern_singletons_| that are not listed in
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 SubstringSetMatcher url_component_matcher_; 318 SubstringSetMatcher url_component_matcher_;
315 std::set<const SubstringPattern*> registered_full_url_patterns_; 319 std::set<const SubstringPattern*> registered_full_url_patterns_;
316 std::set<const SubstringPattern*> registered_url_component_patterns_; 320 std::set<const SubstringPattern*> registered_url_component_patterns_;
317 321
318 DISALLOW_COPY_AND_ASSIGN(URLMatcher); 322 DISALLOW_COPY_AND_ASSIGN(URLMatcher);
319 }; 323 };
320 324
321 } // namespace extensions 325 } // namespace extensions
322 326
323 #endif // CHROME_COMMON_EXTENSIONS_MATCHER_URL_MATCHER_H_ 327 #endif // CHROME_COMMON_EXTENSIONS_MATCHER_URL_MATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698