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..0a6fa6f11760cfc9afe88ea1d59d9a323e2935eb 100644 |
| --- a/extensions/common/url_pattern.h |
| +++ b/extensions/common/url_pattern.h |
| @@ -103,8 +103,10 @@ 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. |
| - ParseResult Parse(const std::string& pattern_str); |
| + // 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, |
| + const bool allow_wildcard_effective_tld = false); |
|
Devlin
2017/01/26 22:47:40
default parameters aren't allowed by style
nrpeter
2017/02/03 19:32:25
Done, switched to overloading.
|
| // Gets the bitmask of valid schemes. |
| int valid_schemes() const { return valid_schemes_; } |
| @@ -119,6 +121,11 @@ class URLPattern { |
| bool match_subdomains() const { return match_subdomains_; } |
| void SetMatchSubdomains(bool val); |
| + // Gets whether to match effective TLD of host(). If false, during a match we |
|
Devlin
2017/01/26 22:47:40
This comment doesn't seem quite clear to me by its
nrpeter
2017/02/03 19:32:25
Done.
|
| + // disregard any effective TLD present in host() and treat it as a wildcard. |
| + 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 +250,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_; |