| 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_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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 virtual BuilderInterface* WithSchemeWildcard() OVERRIDE; | 213 virtual BuilderInterface* WithSchemeWildcard() OVERRIDE; |
| 214 | 214 |
| 215 virtual BuilderInterface* WithPath(const std::string& path) OVERRIDE; | 215 virtual BuilderInterface* WithPath(const std::string& path) OVERRIDE; |
| 216 | 216 |
| 217 virtual BuilderInterface* Invalid() OVERRIDE; | 217 virtual BuilderInterface* Invalid() OVERRIDE; |
| 218 | 218 |
| 219 virtual ContentSettingsPattern Build() OVERRIDE; | 219 virtual ContentSettingsPattern Build() OVERRIDE; |
| 220 private: | 220 private: |
| 221 // Canonicalizes the pattern parts so that they are ASCII only, either | 221 // Canonicalizes the pattern parts so that they are ASCII only, either |
| 222 // in original (if it was already ASCII) or punycode form. | 222 // in original (if it was already ASCII) or punycode form. Returns true if |
| 223 static void Canonicalize(PatternParts* parts); | 223 // the canonicalization was successful. |
| 224 static bool Canonicalize(PatternParts* parts); |
| 224 | 225 |
| 225 // Returns true when the pattern |parts| represent a valid pattern. | 226 // Returns true when the pattern |parts| represent a valid pattern. |
| 226 static bool Validate(const PatternParts& parts); | 227 static bool Validate(const PatternParts& parts); |
| 227 | 228 |
| 228 static bool LegacyValidate(const PatternParts& parts); | 229 static bool LegacyValidate(const PatternParts& parts); |
| 229 | 230 |
| 230 bool is_valid_; | 231 bool is_valid_; |
| 231 | 232 |
| 232 bool use_legacy_validate_; | 233 bool use_legacy_validate_; |
| 233 | 234 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 258 }; | 259 }; |
| 259 | 260 |
| 260 // Stream operator so ContentSettingsPattern can be used in assertion | 261 // Stream operator so ContentSettingsPattern can be used in assertion |
| 261 // statements. | 262 // statements. |
| 262 inline std::ostream& operator<<( | 263 inline std::ostream& operator<<( |
| 263 std::ostream& out, const ContentSettingsPattern& pattern) { | 264 std::ostream& out, const ContentSettingsPattern& pattern) { |
| 264 return out << pattern.ToString(); | 265 return out << pattern.ToString(); |
| 265 } | 266 } |
| 266 | 267 |
| 267 #endif // CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_ | 268 #endif // CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_ |
| OLD | NEW |