| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Patterns used in content setting rules. | 5 // Patterns used in content setting rules. |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PATTERN_H_ | 7 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PATTERN_H_ |
| 8 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PATTERN_H_ | 8 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PATTERN_H_ |
| 9 #pragma once | 9 #pragma once |
| 10 | 10 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 static const size_t kDomainWildcardLength; | 92 static const size_t kDomainWildcardLength; |
| 93 | 93 |
| 94 // Returns a wildcard content settings pattern that matches all possible valid | 94 // Returns a wildcard content settings pattern that matches all possible valid |
| 95 // origins. | 95 // origins. |
| 96 static ContentSettingsPattern Wildcard(); | 96 static ContentSettingsPattern Wildcard(); |
| 97 | 97 |
| 98 // Returns a pattern that matches the scheme and host of this URL, as well as | 98 // Returns a pattern that matches the scheme and host of this URL, as well as |
| 99 // all subdomains and ports. | 99 // all subdomains and ports. |
| 100 static ContentSettingsPattern FromURL(const GURL& url); | 100 static ContentSettingsPattern FromURL(const GURL& url); |
| 101 | 101 |
| 102 static ContentSettingsPattern LegacyFromURL(const GURL& url); | |
| 103 | |
| 104 // Returns a pattern that matches exactly this URL. | 102 // Returns a pattern that matches exactly this URL. |
| 105 static ContentSettingsPattern FromURLNoWildcard(const GURL& url); | 103 static ContentSettingsPattern FromURLNoWildcard(const GURL& url); |
| 106 | 104 |
| 107 static ContentSettingsPattern LegacyFromURLNoWildcard(const GURL& url); | |
| 108 | |
| 109 // Returns a pattern that matches the given pattern specification. | 105 // Returns a pattern that matches the given pattern specification. |
| 110 // Valid patterns specifications are: | 106 // Valid patterns specifications are: |
| 111 // - [*.]domain.tld (matches domain.tld and all sub-domains) | 107 // - [*.]domain.tld (matches domain.tld and all sub-domains) |
| 112 // - host (matches an exact hostname) | 108 // - host (matches an exact hostname) |
| 113 // - scheme://host:port (supported schemes: http,https) | 109 // - scheme://host:port (supported schemes: http,https) |
| 114 // - scheme://[*.]domain.tld:port (supported schemes: http,https) | 110 // - scheme://[*.]domain.tld:port (supported schemes: http,https) |
| 115 // - file://path (The path has to be an absolute path and start with a '/') | 111 // - file://path (The path has to be an absolute path and start with a '/') |
| 116 // - a.b.c.d (matches an exact IPv4 ip) | 112 // - a.b.c.d (matches an exact IPv4 ip) |
| 117 // - [a:b:c:d:e:f:g:h] (matches an exact IPv6 ip) | 113 // - [a:b:c:d:e:f:g:h] (matches an exact IPv6 ip) |
| 118 static ContentSettingsPattern FromString(const std::string& pattern_spec); | 114 static ContentSettingsPattern FromString(const std::string& pattern_spec); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 }; | 245 }; |
| 250 | 246 |
| 251 // Stream operator so ContentSettingsPattern can be used in assertion | 247 // Stream operator so ContentSettingsPattern can be used in assertion |
| 252 // statements. | 248 // statements. |
| 253 inline std::ostream& operator<<( | 249 inline std::ostream& operator<<( |
| 254 std::ostream& out, const ContentSettingsPattern& pattern) { | 250 std::ostream& out, const ContentSettingsPattern& pattern) { |
| 255 return out << pattern.ToString(); | 251 return out << pattern.ToString(); |
| 256 } | 252 } |
| 257 | 253 |
| 258 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PATTERN_H_ | 254 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PATTERN_H_ |
| OLD | NEW |