| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 160 |
| 161 // True if this is a valid pattern. | 161 // True if this is a valid pattern. |
| 162 bool IsValid() const { return is_valid_; } | 162 bool IsValid() const { return is_valid_; } |
| 163 | 163 |
| 164 // True if |url| matches this pattern. | 164 // True if |url| matches this pattern. |
| 165 bool Matches(const GURL& url) const; | 165 bool Matches(const GURL& url) const; |
| 166 | 166 |
| 167 // True if this pattern matches all hosts (i.e. it has a host wildcard). | 167 // True if this pattern matches all hosts (i.e. it has a host wildcard). |
| 168 bool MatchesAllHosts() const; | 168 bool MatchesAllHosts() const; |
| 169 | 169 |
| 170 // True if this pattern has no wildcards (and therefore matches exactly one |
| 171 // host). |
| 172 bool HasNoWildcard() const; |
| 173 |
| 170 // Returns a std::string representation of this pattern. | 174 // Returns a std::string representation of this pattern. |
| 171 std::string ToString() const; | 175 std::string ToString() const; |
| 172 | 176 |
| 173 // Compares the pattern with a given |other| pattern and returns the | 177 // Compares the pattern with a given |other| pattern and returns the |
| 174 // |Relation| of the two patterns. | 178 // |Relation| of the two patterns. |
| 175 Relation Compare(const ContentSettingsPattern& other) const; | 179 Relation Compare(const ContentSettingsPattern& other) const; |
| 176 | 180 |
| 177 // Returns true if the pattern and the |other| pattern are identical. | 181 // Returns true if the pattern and the |other| pattern are identical. |
| 178 bool operator==(const ContentSettingsPattern& other) const; | 182 bool operator==(const ContentSettingsPattern& other) const; |
| 179 | 183 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 210 const ContentSettingsPattern::PatternParts& other_parts); | 214 const ContentSettingsPattern::PatternParts& other_parts); |
| 211 | 215 |
| 212 ContentSettingsPattern(const PatternParts& parts, bool valid); | 216 ContentSettingsPattern(const PatternParts& parts, bool valid); |
| 213 | 217 |
| 214 PatternParts parts_; | 218 PatternParts parts_; |
| 215 | 219 |
| 216 bool is_valid_; | 220 bool is_valid_; |
| 217 }; | 221 }; |
| 218 | 222 |
| 219 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_PATTERN_H_ | 223 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_PATTERN_H_ |
| OLD | NEW |