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 // 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, or because the same type is being used in multiple | 11 // public members, or because the same type is being used in multiple |
12 // *_messages.h headers. | 12 // *_messages.h headers. |
13 | 13 |
14 #ifndef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 14 #ifndef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
15 #define CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 15 #define CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
16 | 16 |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
19 #include "content/public/common/common_param_traits_macros.h" | 19 #include "content/public/common/common_param_traits_macros.h" |
20 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
21 #include "ipc/ipc_message_utils.h" | 21 #include "ipc/ipc_message_utils.h" |
22 #include "net/base/ip_endpoint.h" | 22 #include "net/base/ip_endpoint.h" |
23 #include "net/url_request/url_request_status.h" | 23 #include "net/url_request/url_request_status.h" |
24 #include "ui/gfx/native_widget_types.h" | 24 #include "ui/gfx/native_widget_types.h" |
25 #include "ui/surface/transport_dib.h" | 25 #include "ui/surface/transport_dib.h" |
26 | 26 |
27 class SkBitmap; | 27 class SkBitmap; |
| 28 class WebUploadData; |
28 | 29 |
29 namespace content { | 30 namespace content { |
30 struct Referrer; | 31 struct Referrer; |
31 } | 32 } |
32 | 33 |
33 namespace gfx { | 34 namespace gfx { |
34 class Point; | 35 class Point; |
35 class Rect; | 36 class Rect; |
36 class RectF; | 37 class RectF; |
37 class Size; | 38 class Size; |
(...skipping 28 matching lines...) Expand all Loading... |
66 }; | 67 }; |
67 | 68 |
68 template <> | 69 template <> |
69 struct CONTENT_EXPORT ParamTraits<scoped_refptr<net::UploadData> > { | 70 struct CONTENT_EXPORT ParamTraits<scoped_refptr<net::UploadData> > { |
70 typedef scoped_refptr<net::UploadData> param_type; | 71 typedef scoped_refptr<net::UploadData> param_type; |
71 static void Write(Message* m, const param_type& p); | 72 static void Write(Message* m, const param_type& p); |
72 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 73 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
73 static void Log(const param_type& p, std::string* l); | 74 static void Log(const param_type& p, std::string* l); |
74 }; | 75 }; |
75 | 76 |
| 77 template <> |
| 78 struct CONTENT_EXPORT ParamTraits<scoped_refptr<WebUploadData> > { |
| 79 typedef scoped_refptr<WebUploadData> param_type; |
| 80 static void Write(Message* m, const param_type& p); |
| 81 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 82 static void Log(const param_type& p, std::string* l); |
| 83 }; |
| 84 |
76 template<> | 85 template<> |
77 struct CONTENT_EXPORT ParamTraits<net::HostPortPair> { | 86 struct CONTENT_EXPORT ParamTraits<net::HostPortPair> { |
78 typedef net::HostPortPair param_type; | 87 typedef net::HostPortPair param_type; |
79 static void Write(Message* m, const param_type& p); | 88 static void Write(Message* m, const param_type& p); |
80 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 89 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
81 static void Log(const param_type& p, std::string* l); | 90 static void Log(const param_type& p, std::string* l); |
82 }; | 91 }; |
83 | 92 |
84 template <> | 93 template <> |
85 struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > { | 94 struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 // Note: This function expects parameter |r| to be of type &SkBitmap since | 234 // Note: This function expects parameter |r| to be of type &SkBitmap since |
226 // r->SetConfig() and r->SetPixels() are called. | 235 // r->SetConfig() and r->SetPixels() are called. |
227 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 236 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
228 | 237 |
229 static void Log(const param_type& p, std::string* l); | 238 static void Log(const param_type& p, std::string* l); |
230 }; | 239 }; |
231 | 240 |
232 } // namespace IPC | 241 } // namespace IPC |
233 | 242 |
234 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 243 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
OLD | NEW |