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 // This file is used to define IPC::ParamTraits<> specializations for a number | 5 // This file is used to define IPC::ParamTraits<> specializations for a number |
6 // of types so that they can be serialized over IPC. IPC::ParamTraits<> | 6 // of types so that they can be serialized over IPC. IPC::ParamTraits<> |
7 // specializations for basic types (like int and std::string) and types in the | 7 // specializations for basic types (like int and std::string) and types in the |
8 // 'base' project can be found in ipc/ipc_message_utils.h. This file contains | 8 // 'base' project can be found in ipc/ipc_message_utils.h. This file contains |
9 // specializations for types that are shared by more than one child process. | 9 // specializations for types that are shared by more than one child process. |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 // | 21 // |
22 // That means don't add #includes to any file in 'webkit/' or | 22 // That means don't add #includes to any file in 'webkit/' or |
23 // 'third_party/WebKit/'. Chrome Frame and NACL build parts of base/ and | 23 // 'third_party/WebKit/'. Chrome Frame and NACL build parts of base/ and |
24 // chrome/common/ for a mini-library that doesn't depend on webkit. | 24 // chrome/common/ for a mini-library that doesn't depend on webkit. |
25 // | 25 // |
26 // TODO(erg): The following headers are historical and only work because | 26 // TODO(erg): The following headers are historical and only work because |
27 // their definitions are inlined, which also needs to be fixed. | 27 // their definitions are inlined, which also needs to be fixed. |
28 #include "webkit/glue/window_open_disposition.h" | 28 #include "webkit/glue/window_open_disposition.h" |
29 | 29 |
30 // Forward declarations. | 30 // Forward declarations. |
31 class SkBitmap; | |
32 class DictionaryValue; | 31 class DictionaryValue; |
33 class ListValue; | 32 class ListValue; |
34 struct ThumbnailScore; | 33 struct ThumbnailScore; |
35 struct WebApplicationInfo; | 34 struct WebApplicationInfo; |
36 | 35 |
37 namespace printing { | 36 namespace printing { |
38 struct PageRange; | 37 struct PageRange; |
39 struct PrinterCapsAndDefaults; | 38 struct PrinterCapsAndDefaults; |
40 } // namespace printing | 39 } // namespace printing |
41 | 40 |
42 namespace webkit_glue { | 41 namespace webkit_glue { |
43 struct PasswordForm; | 42 struct PasswordForm; |
44 } // namespace webkit_glue | 43 } // namespace webkit_glue |
45 | 44 |
46 namespace IPC { | 45 namespace IPC { |
47 | 46 |
48 template <> | 47 template <> |
49 struct ParamTraits<SkBitmap> { | |
50 typedef SkBitmap param_type; | |
51 static void Write(Message* m, const param_type& p); | |
52 | |
53 // Note: This function expects parameter |r| to be of type &SkBitmap since | |
54 // r->SetConfig() and r->SetPixels() are called. | |
55 static bool Read(const Message* m, void** iter, param_type* r); | |
56 | |
57 static void Log(const param_type& p, std::string* l); | |
58 }; | |
59 | |
60 template <> | |
61 struct ParamTraits<ContentSetting> { | 48 struct ParamTraits<ContentSetting> { |
62 typedef ContentSetting param_type; | 49 typedef ContentSetting param_type; |
63 static void Write(Message* m, const param_type& p); | 50 static void Write(Message* m, const param_type& p); |
64 static bool Read(const Message* m, void** iter, param_type* r); | 51 static bool Read(const Message* m, void** iter, param_type* r); |
65 static void Log(const param_type& p, std::string* l); | 52 static void Log(const param_type& p, std::string* l); |
66 }; | 53 }; |
67 | 54 |
68 template <> | 55 template <> |
69 struct ParamTraits<ContentSettingsType> { | 56 struct ParamTraits<ContentSettingsType> { |
70 typedef ContentSettingsType param_type; | 57 typedef ContentSettingsType param_type; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 struct ParamTraits<printing::PrinterCapsAndDefaults> { | 142 struct ParamTraits<printing::PrinterCapsAndDefaults> { |
156 typedef printing::PrinterCapsAndDefaults param_type; | 143 typedef printing::PrinterCapsAndDefaults param_type; |
157 static void Write(Message* m, const param_type& p); | 144 static void Write(Message* m, const param_type& p); |
158 static bool Read(const Message* m, void** iter, param_type* r); | 145 static bool Read(const Message* m, void** iter, param_type* r); |
159 static void Log(const param_type& p, std::string* l); | 146 static void Log(const param_type& p, std::string* l); |
160 }; | 147 }; |
161 | 148 |
162 } // namespace IPC | 149 } // namespace IPC |
163 | 150 |
164 #endif // CHROME_COMMON_COMMON_PARAM_TRAITS_H_ | 151 #endif // CHROME_COMMON_COMMON_PARAM_TRAITS_H_ |
OLD | NEW |