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

Unified Diff: extensions/common/matcher/url_matcher.h

Issue 13699007: Provide a mechanism to the decl. WebRequest API to match URLs without the query against a RegEx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/common/matcher/regex_set_matcher.cc ('k') | extensions/common/matcher/url_matcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/matcher/url_matcher.h
diff --git a/extensions/common/matcher/url_matcher.h b/extensions/common/matcher/url_matcher.h
index fb7ace0f0c1a5e9898d5f2ec2985ea92d5a192aa..d93a60670130f97f6dea451f67d7b88ffa28f4c5 100644
--- a/extensions/common/matcher/url_matcher.h
+++ b/extensions/common/matcher/url_matcher.h
@@ -53,6 +53,7 @@ class URLMatcherCondition {
URL_CONTAINS,
URL_EQUALS,
URL_MATCHES,
+ ORIGIN_AND_PATH_MATCHES, // Matches the URL minus its query string.
};
URLMatcherCondition();
@@ -77,6 +78,10 @@ class URLMatcherCondition {
// handled by a regex matcher instead of a substring matcher.
bool IsRegexCondition() const;
+ // Returns whether this URLMatcherCondition is a regular expression that shall
+ // be evaluated on the URL without the query parameter.
+ bool IsOriginAndPathRegexCondition() const;
+
// Returns whether this condition is fulfilled according to
// |matching_patterns| and |url|.
bool IsMatch(const std::set<StringPattern::ID>& matching_patterns,
@@ -155,6 +160,9 @@ class URLMatcherConditionFactory {
// Canonicalizes a URL for "CreateURLMatchesCondition" searches.
std::string CanonicalizeURLForRegexSearches(const GURL& url) const;
+ // Canonicalizes a URL for "CreateOriginAndPathMatchesCondition" searches.
+ std::string CanonicalizeURLForOriginAndPathRegexSearches(
+ const GURL& url) const;
URLMatcherCondition CreateURLPrefixCondition(const std::string& prefix);
URLMatcherCondition CreateURLSuffixCondition(const std::string& suffix);
@@ -162,6 +170,8 @@ class URLMatcherConditionFactory {
URLMatcherCondition CreateURLEqualsCondition(const std::string& str);
URLMatcherCondition CreateURLMatchesCondition(const std::string& regex);
+ URLMatcherCondition CreateOriginAndPathMatchesCondition(
+ const std::string& regex);
// Removes all patterns from |pattern_singletons_| that are not listed in
// |used_patterns|. These patterns are not referenced any more and get
@@ -197,6 +207,7 @@ class URLMatcherConditionFactory {
PatternSingletons;
PatternSingletons substring_pattern_singletons_;
PatternSingletons regex_pattern_singletons_;
+ PatternSingletons origin_and_path_regex_pattern_singletons_;
DISALLOW_COPY_AND_ASSIGN(URLMatcherConditionFactory);
};
@@ -332,6 +343,7 @@ class URLMatcher {
SubstringSetMatcher full_url_matcher_;
SubstringSetMatcher url_component_matcher_;
RegexSetMatcher regex_set_matcher_;
+ RegexSetMatcher origin_and_path_regex_set_matcher_;
std::set<const StringPattern*> registered_full_url_patterns_;
std::set<const StringPattern*> registered_url_component_patterns_;
« no previous file with comments | « extensions/common/matcher/regex_set_matcher.cc ('k') | extensions/common/matcher/url_matcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698