| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_PATTERN_H_ | 7 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_PATTERN_H_ |
| 8 #define COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_PATTERN_H_ | 8 #define COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_PATTERN_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 // Constructs an empty pattern. Empty patterns are invalid patterns. Invalid | 183 // Constructs an empty pattern. Empty patterns are invalid patterns. Invalid |
| 184 // patterns match nothing. | 184 // patterns match nothing. |
| 185 ContentSettingsPattern(); | 185 ContentSettingsPattern(); |
| 186 | 186 |
| 187 // True if this is a valid pattern. | 187 // True if this is a valid pattern. |
| 188 bool IsValid() const { return is_valid_; } | 188 bool IsValid() const { return is_valid_; } |
| 189 | 189 |
| 190 // True if |url| matches this pattern. | 190 // True if |url| matches this pattern. |
| 191 bool Matches(const GURL& url) const; | 191 bool Matches(const GURL& url) const; |
| 192 | 192 |
| 193 // True if the pattern matches any extension URL (i.e. the scheme is |
| 194 // a wildcard or chrome-extension, and the hostname is a wildcard or looks |
| 195 // like an extension ID). |
| 196 bool MatchesExtensionUrls() const; |
| 197 |
| 193 // True if this pattern matches all hosts (i.e. it has a host wildcard). | 198 // True if this pattern matches all hosts (i.e. it has a host wildcard). |
| 194 bool MatchesAllHosts() const; | 199 bool MatchesAllHosts() const; |
| 195 | 200 |
| 196 // Returns a std::string representation of this pattern. | 201 // Returns a std::string representation of this pattern. |
| 197 std::string ToString() const; | 202 std::string ToString() const; |
| 198 | 203 |
| 199 // Returns scheme type of pattern. | 204 // Returns scheme type of pattern. |
| 200 ContentSettingsPattern::SchemeType GetScheme() const; | 205 ContentSettingsPattern::SchemeType GetScheme() const; |
| 201 | 206 |
| 202 // True if this pattern has a non-empty path. Can only be used for patterns | 207 // True if this pattern has a non-empty path. Can only be used for patterns |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 const ContentSettingsPattern::PatternParts& other_parts); | 250 const ContentSettingsPattern::PatternParts& other_parts); |
| 246 | 251 |
| 247 ContentSettingsPattern(const PatternParts& parts, bool valid); | 252 ContentSettingsPattern(const PatternParts& parts, bool valid); |
| 248 | 253 |
| 249 PatternParts parts_; | 254 PatternParts parts_; |
| 250 | 255 |
| 251 bool is_valid_; | 256 bool is_valid_; |
| 252 }; | 257 }; |
| 253 | 258 |
| 254 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_PATTERN_H_ | 259 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_PATTERN_H_ |
| OLD | NEW |