Chromium Code Reviews| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 const std::string ToString() const; | 115 const std::string ToString() const; |
| 116 | 116 |
| 117 // Compares the pattern with a given |other| pattern and returns the | 117 // Compares the pattern with a given |other| pattern and returns the |
| 118 // |Relation| of the two patterns. | 118 // |Relation| of the two patterns. |
| 119 Relation Compare(const ContentSettingsPattern& other) const; | 119 Relation Compare(const ContentSettingsPattern& other) const; |
| 120 | 120 |
| 121 bool operator==(const ContentSettingsPattern& other) const { | 121 bool operator==(const ContentSettingsPattern& other) const { |
| 122 return Compare(other) == IDENTITY; | 122 return Compare(other) == IDENTITY; |
| 123 } | 123 } |
| 124 | 124 |
| 125 bool operator < (const ContentSettingsPattern& other) const { | |
|
Bernhard Bauer
2011/05/26 23:14:42
Nit: no space around the less-than-sign.
markusheintz_
2011/05/31 11:46:41
Done. Same below
| |
| 126 return Compare(other) == SUCCESSOR; | |
| 127 } | |
| 128 | |
| 129 bool operator > (const ContentSettingsPattern& other) const { | |
| 130 return Compare(other) == PREDECESSOR; | |
| 131 } | |
| 132 | |
| 125 private: | 133 private: |
| 126 friend class content_settings::PatternParser; | 134 friend class content_settings::PatternParser; |
| 127 friend class ContentSettingsPatternParserTest_SerializePatterns_Test; | 135 friend class ContentSettingsPatternParserTest_SerializePatterns_Test; |
| 128 friend class Builder; | 136 friend class Builder; |
| 129 | 137 |
| 130 struct PatternParts { | 138 struct PatternParts { |
| 131 PatternParts(); | 139 PatternParts(); |
| 132 ~PatternParts(); | 140 ~PatternParts(); |
| 133 | 141 |
| 134 // Lowercase string of the URL scheme to match. This string is empty if the | 142 // Lowercase string of the URL scheme to match. This string is empty if the |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 218 }; | 226 }; |
| 219 | 227 |
| 220 // Stream operator so ContentSettingsPattern can be used in assertion | 228 // Stream operator so ContentSettingsPattern can be used in assertion |
| 221 // statements. | 229 // statements. |
| 222 inline std::ostream& operator<<( | 230 inline std::ostream& operator<<( |
| 223 std::ostream& out, const ContentSettingsPattern& pattern) { | 231 std::ostream& out, const ContentSettingsPattern& pattern) { |
| 224 return out << pattern.ToString(); | 232 return out << pattern.ToString(); |
| 225 } | 233 } |
| 226 | 234 |
| 227 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PATTERN_H_ | 235 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PATTERN_H_ |
| OLD | NEW |