OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 #ifndef CHROME_COMMON_CONTENT_SETTINGS_PATTERN_SERIALIZER_H_ | 5 #ifndef CHROME_COMMON_CONTENT_SETTINGS_PATTERN_SERIALIZER_H_ |
6 #define CHROME_COMMON_CONTENT_SETTINGS_PATTERN_SERIALIZER_H_ | 6 #define CHROME_COMMON_CONTENT_SETTINGS_PATTERN_SERIALIZER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 | 9 |
10 namespace base { | 10 namespace base { |
11 class Pickle; | 11 class Pickle; |
12 class PickleIterator; | 12 class PickleIterator; |
| 13 class PickleSizer; |
13 } | 14 } |
14 | 15 |
15 class ContentSettingsPattern; | 16 class ContentSettingsPattern; |
16 | 17 |
17 class ContentSettingsPatternSerializer { | 18 class ContentSettingsPatternSerializer { |
18 public: | 19 public: |
| 20 // Gets the serialized pattern's size. |
| 21 static void GetSize(const ContentSettingsPattern& pattern, |
| 22 base::PickleSizer* s); |
| 23 |
19 // Serializes the pattern to an IPC message. | 24 // Serializes the pattern to an IPC message. |
20 static void WriteToMessage(const ContentSettingsPattern& pattern, | 25 static void WriteToMessage(const ContentSettingsPattern& pattern, |
21 base::Pickle* m); | 26 base::Pickle* m); |
22 // Deserializes the pattern from the IPC message. | 27 // Deserializes the pattern from the IPC message. |
23 static bool ReadFromMessage(const base::Pickle* m, | 28 static bool ReadFromMessage(const base::Pickle* m, |
24 base::PickleIterator* iter, | 29 base::PickleIterator* iter, |
25 ContentSettingsPattern* pattern); | 30 ContentSettingsPattern* pattern); |
26 | 31 |
27 private: | 32 private: |
28 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingsPatternSerializer); | 33 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingsPatternSerializer); |
29 }; | 34 }; |
30 | 35 |
31 #endif // CHROME_COMMON_CONTENT_SETTINGS_PATTERN_SERIALIZER_H_ | 36 #endif // CHROME_COMMON_CONTENT_SETTINGS_PATTERN_SERIALIZER_H_ |
OLD | NEW |