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 used by the content code, and which need | 9 // specializations for types that are used by the content code, and which need |
10 // manual serialization code. This is usually because they're not structs with | 10 // manual serialization code. This is usually because they're not structs with |
11 // public members.. | 11 // public members.. |
12 | 12 |
13 #ifndef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 13 #ifndef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
14 #define CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 14 #define CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
15 #pragma once | 15 #pragma once |
16 | 16 |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/platform_file.h" | 18 #include "base/platform_file.h" |
19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
20 #include "content/public/common/page_transition_types.h" | 20 #include "content/public/common/page_transition_types.h" |
21 #include "content/public/common/security_style.h" | 21 #include "content/public/common/security_style.h" |
22 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
23 #include "ipc/ipc_message_utils.h" | 23 #include "ipc/ipc_message_utils.h" |
| 24 #include "media/audio/audio_parameters.h" |
24 #include "net/base/ip_endpoint.h" | 25 #include "net/base/ip_endpoint.h" |
25 #include "net/url_request/url_request_status.h" | 26 #include "net/url_request/url_request_status.h" |
26 #include "ui/gfx/native_widget_types.h" | 27 #include "ui/gfx/native_widget_types.h" |
27 #include "ui/gfx/surface/transport_dib.h" | 28 #include "ui/gfx/surface/transport_dib.h" |
28 #include "webkit/glue/resource_type.h" | 29 #include "webkit/glue/resource_type.h" |
29 | 30 |
30 class SkBitmap; | 31 class SkBitmap; |
31 | 32 |
32 namespace gfx { | 33 namespace gfx { |
33 class Point; | 34 class Point; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 130 |
130 template <> | 131 template <> |
131 struct CONTENT_EXPORT ParamTraits<gfx::Rect> { | 132 struct CONTENT_EXPORT ParamTraits<gfx::Rect> { |
132 typedef gfx::Rect param_type; | 133 typedef gfx::Rect param_type; |
133 static void Write(Message* m, const param_type& p); | 134 static void Write(Message* m, const param_type& p); |
134 static bool Read(const Message* m, void** iter, param_type* r); | 135 static bool Read(const Message* m, void** iter, param_type* r); |
135 static void Log(const param_type& p, std::string* l); | 136 static void Log(const param_type& p, std::string* l); |
136 }; | 137 }; |
137 | 138 |
138 template <> | 139 template <> |
| 140 struct CONTENT_EXPORT ParamTraits<AudioParameters> { |
| 141 typedef AudioParameters param_type; |
| 142 static void Write(Message* m, const param_type& p); |
| 143 static bool Read(const Message* m, void** iter, param_type* r); |
| 144 static void Log(const param_type& p, std::string* l); |
| 145 }; |
| 146 |
| 147 template <> |
139 struct ParamTraits<gfx::NativeWindow> { | 148 struct ParamTraits<gfx::NativeWindow> { |
140 typedef gfx::NativeWindow param_type; | 149 typedef gfx::NativeWindow param_type; |
141 static void Write(Message* m, const param_type& p) { | 150 static void Write(Message* m, const param_type& p) { |
142 #if defined(OS_WIN) | 151 #if defined(OS_WIN) |
143 // HWNDs are always 32 bits on Windows, even on 64 bit systems. | 152 // HWNDs are always 32 bits on Windows, even on 64 bit systems. |
144 m->WriteUInt32(reinterpret_cast<uint32>(p)); | 153 m->WriteUInt32(reinterpret_cast<uint32>(p)); |
145 #else | 154 #else |
146 m->WriteData(reinterpret_cast<const char*>(&p), sizeof(p)); | 155 m->WriteData(reinterpret_cast<const char*>(&p), sizeof(p)); |
147 #endif | 156 #endif |
148 } | 157 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 }; | 247 }; |
239 | 248 |
240 template <> | 249 template <> |
241 struct SimilarTypeTraits<content::SecurityStyle> { | 250 struct SimilarTypeTraits<content::SecurityStyle> { |
242 typedef int Type; | 251 typedef int Type; |
243 }; | 252 }; |
244 | 253 |
245 } // namespace IPC | 254 } // namespace IPC |
246 | 255 |
247 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 256 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
OLD | NEW |