| 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 "ui/gfx/native_widget_types.h" | 22 #include "ui/gfx/native_widget_types.h" |
| 23 #include "ui/surface/transport_dib.h" | 23 #include "ui/surface/transport_dib.h" |
| 24 | 24 |
| 25 class SkBitmap; | 25 class SkBitmap; |
| 26 | 26 |
| 27 namespace content { | 27 namespace content { |
| 28 class PageState; |
| 28 struct Referrer; | 29 struct Referrer; |
| 29 } | 30 } |
| 30 | 31 |
| 31 namespace gfx { | 32 namespace gfx { |
| 32 class Point; | 33 class Point; |
| 33 class Rect; | 34 class Rect; |
| 34 class RectF; | 35 class RectF; |
| 35 class Size; | 36 class Size; |
| 36 class Vector2d; | 37 class Vector2d; |
| 37 } // namespace gfx | 38 } // namespace gfx |
| (...skipping 14 matching lines...) Expand all Loading... |
| 52 | 53 |
| 53 template<> | 54 template<> |
| 54 struct CONTENT_EXPORT ParamTraits<net::HostPortPair> { | 55 struct CONTENT_EXPORT ParamTraits<net::HostPortPair> { |
| 55 typedef net::HostPortPair param_type; | 56 typedef net::HostPortPair param_type; |
| 56 static void Write(Message* m, const param_type& p); | 57 static void Write(Message* m, const param_type& p); |
| 57 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 58 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 58 static void Log(const param_type& p, std::string* l); | 59 static void Log(const param_type& p, std::string* l); |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 template <> | 62 template <> |
| 63 struct CONTENT_EXPORT ParamTraits<content::PageState> { |
| 64 typedef content::PageState param_type; |
| 65 static void Write(Message* m, const param_type& p); |
| 66 static bool Read(const Message* m, PickleIterator* iter, param_type* p); |
| 67 static void Log(const param_type& p, std::string* l); |
| 68 }; |
| 69 |
| 70 template <> |
| 62 struct CONTENT_EXPORT ParamTraits<content::Referrer> { | 71 struct CONTENT_EXPORT ParamTraits<content::Referrer> { |
| 63 typedef content::Referrer param_type; | 72 typedef content::Referrer param_type; |
| 64 static void Write(Message* m, const param_type& p); | 73 static void Write(Message* m, const param_type& p); |
| 65 static bool Read(const Message* m, PickleIterator* iter, param_type* p); | 74 static bool Read(const Message* m, PickleIterator* iter, param_type* p); |
| 66 static void Log(const param_type& p, std::string* l); | 75 static void Log(const param_type& p, std::string* l); |
| 67 }; | 76 }; |
| 68 | 77 |
| 69 template <> | 78 template <> |
| 70 struct CONTENT_EXPORT ParamTraits<gfx::Point> { | 79 struct CONTENT_EXPORT ParamTraits<gfx::Point> { |
| 71 typedef gfx::Point param_type; | 80 typedef gfx::Point param_type; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // Note: This function expects parameter |r| to be of type &SkBitmap since | 219 // Note: This function expects parameter |r| to be of type &SkBitmap since |
| 211 // r->SetConfig() and r->SetPixels() are called. | 220 // r->SetConfig() and r->SetPixels() are called. |
| 212 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 221 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 213 | 222 |
| 214 static void Log(const param_type& p, std::string* l); | 223 static void Log(const param_type& p, std::string* l); |
| 215 }; | 224 }; |
| 216 | 225 |
| 217 } // namespace IPC | 226 } // namespace IPC |
| 218 | 227 |
| 219 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 228 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
| OLD | NEW |