| 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 #include "webkit/base/data_element.h" |
| 26 | 27 |
| 27 class SkBitmap; | 28 class SkBitmap; |
| 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; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 80 |
| 80 template <> | 81 template <> |
| 81 struct CONTENT_EXPORT ParamTraits<scoped_refptr< | 82 struct CONTENT_EXPORT ParamTraits<scoped_refptr< |
| 82 webkit_glue::ResourceRequestBody> > { | 83 webkit_glue::ResourceRequestBody> > { |
| 83 typedef scoped_refptr<webkit_glue::ResourceRequestBody> param_type; | 84 typedef scoped_refptr<webkit_glue::ResourceRequestBody> param_type; |
| 84 static void Write(Message* m, const param_type& p); | 85 static void Write(Message* m, const param_type& p); |
| 85 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 86 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 86 static void Log(const param_type& p, std::string* l); | 87 static void Log(const param_type& p, std::string* l); |
| 87 }; | 88 }; |
| 88 | 89 |
| 90 template <> |
| 91 struct CONTENT_EXPORT ParamTraits<webkit_base::DataElement> { |
| 92 typedef webkit_base::DataElement param_type; |
| 93 static void Write(Message* m, const param_type& p); |
| 94 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 95 static void Log(const param_type& p, std::string* l); |
| 96 }; |
| 97 |
| 89 template<> | 98 template<> |
| 90 struct CONTENT_EXPORT ParamTraits<net::HostPortPair> { | 99 struct CONTENT_EXPORT ParamTraits<net::HostPortPair> { |
| 91 typedef net::HostPortPair param_type; | 100 typedef net::HostPortPair param_type; |
| 92 static void Write(Message* m, const param_type& p); | 101 static void Write(Message* m, const param_type& p); |
| 93 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 102 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 94 static void Log(const param_type& p, std::string* l); | 103 static void Log(const param_type& p, std::string* l); |
| 95 }; | 104 }; |
| 96 | 105 |
| 97 template <> | 106 template <> |
| 98 struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > { | 107 struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 // Note: This function expects parameter |r| to be of type &SkBitmap since | 247 // Note: This function expects parameter |r| to be of type &SkBitmap since |
| 239 // r->SetConfig() and r->SetPixels() are called. | 248 // r->SetConfig() and r->SetPixels() are called. |
| 240 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 249 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 241 | 250 |
| 242 static void Log(const param_type& p, std::string* l); | 251 static void Log(const param_type& p, std::string* l); |
| 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 |