| 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 CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_ | 7 #ifndef CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_ |
| 8 #define CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_ | 8 #define CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_ |
| 9 #pragma once | 9 #pragma once |
| 10 | 10 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 // Serializes the pattern to an IPC message or deserializes it. | 170 // Serializes the pattern to an IPC message or deserializes it. |
| 171 void WriteToMessage(IPC::Message* m) const; | 171 void WriteToMessage(IPC::Message* m) const; |
| 172 bool ReadFromMessage(const IPC::Message* m, PickleIterator* iter); | 172 bool ReadFromMessage(const IPC::Message* m, PickleIterator* iter); |
| 173 | 173 |
| 174 // True if this is a valid pattern. | 174 // True if this is a valid pattern. |
| 175 bool IsValid() const { return is_valid_; } | 175 bool IsValid() const { return is_valid_; } |
| 176 | 176 |
| 177 // True if |url| matches this pattern. | 177 // True if |url| matches this pattern. |
| 178 bool Matches(const GURL& url) const; | 178 bool Matches(const GURL& url) const; |
| 179 | 179 |
| 180 // True if this pattern matches all hosts (i.e. it has a host wildcard). |
| 181 bool MatchesAllHosts() const; |
| 182 |
| 180 // Returns a std::string representation of this pattern. | 183 // Returns a std::string representation of this pattern. |
| 181 const std::string ToString() const; | 184 const std::string ToString() const; |
| 182 | 185 |
| 183 // Compares the pattern with a given |other| pattern and returns the | 186 // Compares the pattern with a given |other| pattern and returns the |
| 184 // |Relation| of the two patterns. | 187 // |Relation| of the two patterns. |
| 185 Relation Compare(const ContentSettingsPattern& other) const; | 188 Relation Compare(const ContentSettingsPattern& other) const; |
| 186 | 189 |
| 187 // Returns true if the pattern and the |other| pattern are identical. | 190 // Returns true if the pattern and the |other| pattern are identical. |
| 188 bool operator==(const ContentSettingsPattern& other) const; | 191 bool operator==(const ContentSettingsPattern& other) const; |
| 189 | 192 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 }; | 272 }; |
| 270 | 273 |
| 271 // Stream operator so ContentSettingsPattern can be used in assertion | 274 // Stream operator so ContentSettingsPattern can be used in assertion |
| 272 // statements. | 275 // statements. |
| 273 inline std::ostream& operator<<( | 276 inline std::ostream& operator<<( |
| 274 std::ostream& out, const ContentSettingsPattern& pattern) { | 277 std::ostream& out, const ContentSettingsPattern& pattern) { |
| 275 return out << pattern.ToString(); | 278 return out << pattern.ToString(); |
| 276 } | 279 } |
| 277 | 280 |
| 278 #endif // CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_ | 281 #endif // CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_ |
| OLD | NEW |