Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: chrome/common/content_settings_pattern.h

Issue 8676020: Detect invalid content settings pattern that were not detected yet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move one more check to the Validate method Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 false if
223 static void Canonicalize(PatternParts* parts); 223 // the pattern parts are not valid.
Bernhard Bauer 2011/11/24 15:50:32 Canonicalize seems to use a different definition o
markusheintz_ 2011/11/24 16:37:51 I rephrased it.
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
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_
OLDNEW
« no previous file with comments | « no previous file | chrome/common/content_settings_pattern.cc » ('j') | chrome/common/content_settings_pattern_parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698