Chromium Code Reviews| Index: extensions/common/url_pattern.h |
| diff --git a/extensions/common/url_pattern.h b/extensions/common/url_pattern.h |
| index ef118e4fd8406747c07a64f87e6285647b3a4683..a391d82d048d8f1b66eb568d6256ced521b12efb 100644 |
| --- a/extensions/common/url_pattern.h |
| +++ b/extensions/common/url_pattern.h |
| @@ -103,8 +103,11 @@ class URLPattern { |
| // Initializes this instance by parsing the provided string. Returns |
| // URLPattern::PARSE_SUCCESS on success, or an error code otherwise. On |
| // failure, this instance will have some intermediate values and is in an |
| - // invalid state. |
| + // invalid state. If you want to allow the match pattern to specify a wildcard |
| + // for the effective TLD, make |allow_wildcard_effective_tld| true. |
| ParseResult Parse(const std::string& pattern_str); |
| + ParseResult Parse(const std::string& pattern_str, |
| + const bool allow_wildcard_effective_tld); |
|
dcheng
2017/02/06 07:05:29
Nit: it's preferable to have explicitly named enum
nrpeter
2017/02/06 22:53:15
Done.
|
| // Gets the bitmask of valid schemes. |
| int valid_schemes() const { return valid_schemes_; } |
| @@ -119,6 +122,15 @@ class URLPattern { |
| bool match_subdomains() const { return match_subdomains_; } |
| void SetMatchSubdomains(bool val); |
| + // Gets whether host() contains an effective TLD. If false, durring |
| + // a match, the URL you're comparing must have its TLD removed |
| + // prior to comparison. |
| + // e.g. For the match pattern https://google.com/* |
| + // If this is true: host() would be google.com |
| + // If this is false host() would be google |
| + bool match_effective_tld() const { return match_effective_tld_; } |
| + void SetMatchEffectiveTld(bool val); |
| + |
| // Gets the path the pattern matches with the leading slash. This can have |
| // embedded asterisks which are interpreted using glob rules. |
| const std::string& path() const { return path_; } |
| @@ -243,6 +255,11 @@ class URLPattern { |
| // component of the pattern's host was "*". |
| bool match_subdomains_; |
| + // Whether we should match the effective TLD of the host. This is true by |
| + // default and only false if the the pattern's host ends with ".*" |
| + // (e.g. https://example.*/*). |
| + bool match_effective_tld_; |
| + |
| // The port. |
| std::string port_; |