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

Unified Diff: extensions/common/url_pattern.h

Issue 2499493004: Communicate ExtensionSettings policy to renderers (Closed)
Patch Set: Fixed static non-pod, removed default params, fixed formatting, fixed nits, simplified code Created 3 years, 10 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
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_;

Powered by Google App Engine
This is Rietveld 408576698