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 |
11 #ifndef CHROME_COMMON_COMMON_PARAM_TRAITS_H_ | 11 #ifndef CHROME_COMMON_COMMON_PARAM_TRAITS_H_ |
12 #define CHROME_COMMON_COMMON_PARAM_TRAITS_H_ | 12 #define CHROME_COMMON_COMMON_PARAM_TRAITS_H_ |
13 #pragma once | 13 #pragma once |
14 | 14 |
15 #include "app/surface/transport_dib.h" | 15 #include "app/surface/transport_dib.h" |
16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
17 #include "base/platform_file.h" | 17 #include "base/platform_file.h" |
18 #include "base/ref_counted.h" | 18 #include "base/ref_counted.h" |
19 #include "chrome/common/content_settings.h" | 19 #include "chrome/common/content_settings.h" |
20 #include "chrome/common/page_zoom.h" | 20 #include "chrome/common/page_zoom.h" |
21 #include "ipc/ipc_message_utils.h" | 21 #include "ipc/ipc_message_utils.h" |
22 #include "net/url_request/url_request_status.h" | |
23 #include "printing/native_metafile.h" | 22 #include "printing/native_metafile.h" |
24 // !!! WARNING: DO NOT ADD NEW WEBKIT DEPENDENCIES !!! | 23 // !!! WARNING: DO NOT ADD NEW WEBKIT DEPENDENCIES !!! |
25 // | 24 // |
26 // That means don't add #includes to any file in 'webkit/' or | 25 // That means don't add #includes to any file in 'webkit/' or |
27 // 'third_party/WebKit/'. Chrome Frame and NACL build parts of base/ and | 26 // 'third_party/WebKit/'. Chrome Frame and NACL build parts of base/ and |
28 // chrome/common/ for a mini-library that doesn't depend on webkit. | 27 // chrome/common/ for a mini-library that doesn't depend on webkit. |
29 // | 28 // |
30 // TODO(erg): The following two headers are historical and only work because | 29 // TODO(erg): The following headers are historical and only work because |
31 // their definitions are inlined, which also needs to be fixed. | 30 // their definitions are inlined, which also needs to be fixed. |
32 #include "ui/gfx/native_widget_types.h" | 31 #include "ui/gfx/native_widget_types.h" |
33 #include "webkit/glue/webcursor.h" | 32 #include "webkit/glue/webcursor.h" |
34 #include "webkit/glue/window_open_disposition.h" | 33 #include "webkit/glue/window_open_disposition.h" |
35 | 34 |
36 // Forward declarations. | 35 // Forward declarations. |
37 struct Geoposition; | 36 struct Geoposition; |
38 class SkBitmap; | 37 class SkBitmap; |
39 class DictionaryValue; | 38 class DictionaryValue; |
40 class ListValue; | 39 class ListValue; |
41 struct ThumbnailScore; | 40 struct ThumbnailScore; |
42 struct WebApplicationInfo; | 41 struct WebApplicationInfo; |
43 class WebCursor; | 42 class WebCursor; |
44 | 43 |
45 namespace gfx { | 44 namespace gfx { |
46 class Point; | 45 class Point; |
47 class Rect; | 46 class Rect; |
48 class Size; | 47 class Size; |
49 } // namespace gfx | 48 } // namespace gfx |
50 | 49 |
51 namespace net { | |
52 class HostPortPair; | |
53 class UploadData; | |
54 class URLRequestStatus; | |
55 } | |
56 | |
57 namespace printing { | 50 namespace printing { |
58 struct PageRange; | 51 struct PageRange; |
59 struct PrinterCapsAndDefaults; | 52 struct PrinterCapsAndDefaults; |
60 } // namespace printing | 53 } // namespace printing |
61 | 54 |
62 namespace webkit_glue { | 55 namespace webkit_glue { |
63 struct PasswordForm; | 56 struct PasswordForm; |
64 } // namespace webkit_glue | 57 } // namespace webkit_glue |
65 | 58 |
66 namespace IPC { | 59 namespace IPC { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 static void Log(const param_type& p, std::string* l) { | 239 static void Log(const param_type& p, std::string* l) { |
247 l->append("TransportDIB("); | 240 l->append("TransportDIB("); |
248 LogParam(p.handle, l); | 241 LogParam(p.handle, l); |
249 l->append(", "); | 242 l->append(", "); |
250 LogParam(p.sequence_num, l); | 243 LogParam(p.sequence_num, l); |
251 l->append(")"); | 244 l->append(")"); |
252 } | 245 } |
253 }; | 246 }; |
254 #endif | 247 #endif |
255 | 248 |
256 // Traits for HostPortPair | |
257 template<> | |
258 struct ParamTraits<net::HostPortPair> { | |
259 typedef net::HostPortPair param_type; | |
260 static void Write(Message* m, const param_type& p); | |
261 static bool Read(const Message* m, void** iter, param_type* r); | |
262 static void Log(const param_type& p, std::string* l); | |
263 }; | |
264 | |
265 // Traits for URLRequestStatus | |
266 template <> | |
267 struct ParamTraits<net::URLRequestStatus> { | |
268 typedef net::URLRequestStatus param_type; | |
269 static void Write(Message* m, const param_type& p); | |
270 static bool Read(const Message* m, void** iter, param_type* r); | |
271 static void Log(const param_type& p, std::string* l); | |
272 }; | |
273 | |
274 // Traits for net::UploadData. | |
275 template <> | |
276 struct ParamTraits<scoped_refptr<net::UploadData> > { | |
277 typedef scoped_refptr<net::UploadData> param_type; | |
278 static void Write(Message* m, const param_type& p); | |
279 static bool Read(const Message* m, void** iter, param_type* r); | |
280 static void Log(const param_type& p, std::string* l); | |
281 }; | |
282 | |
283 template<> | 249 template<> |
284 struct ParamTraits<ThumbnailScore> { | 250 struct ParamTraits<ThumbnailScore> { |
285 typedef ThumbnailScore param_type; | 251 typedef ThumbnailScore param_type; |
286 static void Write(Message* m, const param_type& p); | 252 static void Write(Message* m, const param_type& p); |
287 static bool Read(const Message* m, void** iter, param_type* r); | 253 static bool Read(const Message* m, void** iter, param_type* r); |
288 static void Log(const param_type& p, std::string* l); | 254 static void Log(const param_type& p, std::string* l); |
289 }; | 255 }; |
290 | 256 |
291 template <> | 257 template <> |
292 struct ParamTraits<Geoposition> { | 258 struct ParamTraits<Geoposition> { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 struct ParamTraits<printing::PrinterCapsAndDefaults> { | 304 struct ParamTraits<printing::PrinterCapsAndDefaults> { |
339 typedef printing::PrinterCapsAndDefaults param_type; | 305 typedef printing::PrinterCapsAndDefaults param_type; |
340 static void Write(Message* m, const param_type& p); | 306 static void Write(Message* m, const param_type& p); |
341 static bool Read(const Message* m, void** iter, param_type* r); | 307 static bool Read(const Message* m, void** iter, param_type* r); |
342 static void Log(const param_type& p, std::string* l); | 308 static void Log(const param_type& p, std::string* l); |
343 }; | 309 }; |
344 | 310 |
345 } // namespace IPC | 311 } // namespace IPC |
346 | 312 |
347 #endif // CHROME_COMMON_COMMON_PARAM_TRAITS_H_ | 313 #endif // CHROME_COMMON_COMMON_PARAM_TRAITS_H_ |
OLD | NEW |