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 |
11 #include <ostream> | 11 #include <ostream> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
17 | 17 |
18 class GURL; | 18 class GURL; |
| 19 class Pickle; |
| 20 class PickleIterator; |
19 | 21 |
20 namespace content_settings { | 22 namespace content_settings { |
21 class PatternParser; | 23 class PatternParser; |
22 } | 24 } |
23 | 25 |
24 namespace IPC { | 26 namespace IPC { |
25 class Message; | 27 class Message; |
26 } | 28 } |
27 | 29 |
28 // A pattern used in content setting rules. See |IsValid| for a description of | 30 // A pattern used in content setting rules. See |IsValid| for a description of |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 162 |
161 static ContentSettingsPattern LegacyFromString( | 163 static ContentSettingsPattern LegacyFromString( |
162 const std::string& pattern_spec); | 164 const std::string& pattern_spec); |
163 | 165 |
164 // Constructs an empty pattern. Empty patterns are invalid patterns. Invalid | 166 // Constructs an empty pattern. Empty patterns are invalid patterns. Invalid |
165 // patterns match nothing. | 167 // patterns match nothing. |
166 ContentSettingsPattern(); | 168 ContentSettingsPattern(); |
167 | 169 |
168 // Serializes the pattern to an IPC message or deserializes it. | 170 // Serializes the pattern to an IPC message or deserializes it. |
169 void WriteToMessage(IPC::Message* m) const; | 171 void WriteToMessage(IPC::Message* m) const; |
170 bool ReadFromMessage(const IPC::Message* m, void** iter); | 172 bool ReadFromMessage(const IPC::Message* m, PickleIterator* iter); |
171 | 173 |
172 // True if this is a valid pattern. | 174 // True if this is a valid pattern. |
173 bool IsValid() const { return is_valid_; } | 175 bool IsValid() const { return is_valid_; } |
174 | 176 |
175 // True if |url| matches this pattern. | 177 // True if |url| matches this pattern. |
176 bool Matches(const GURL& url) const; | 178 bool Matches(const GURL& url) const; |
177 | 179 |
178 // Returns a std::string representation of this pattern. | 180 // Returns a std::string representation of this pattern. |
179 const std::string ToString() const; | 181 const std::string ToString() const; |
180 | 182 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 }; | 269 }; |
268 | 270 |
269 // Stream operator so ContentSettingsPattern can be used in assertion | 271 // Stream operator so ContentSettingsPattern can be used in assertion |
270 // statements. | 272 // statements. |
271 inline std::ostream& operator<<( | 273 inline std::ostream& operator<<( |
272 std::ostream& out, const ContentSettingsPattern& pattern) { | 274 std::ostream& out, const ContentSettingsPattern& pattern) { |
273 return out << pattern.ToString(); | 275 return out << pattern.ToString(); |
274 } | 276 } |
275 | 277 |
276 #endif // CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_ | 278 #endif // CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_ |
OLD | NEW |