| 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_COMMON_CONTENT_PARAM_TRAITS_H_ | 14 #ifndef CONTENT_COMMON_CONTENT_PARAM_TRAITS_H_ |
| 15 #define CONTENT_COMMON_CONTENT_PARAM_TRAITS_H_ | 15 #define CONTENT_COMMON_CONTENT_PARAM_TRAITS_H_ |
| 16 | 16 |
| 17 #include "content/common/content_param_traits_macros.h" | 17 #include "content/common/content_param_traits_macros.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 19 #include "webkit/glue/npruntime_util.h" | 19 #include "webkit/glue/npruntime_util.h" |
| 20 #include "webkit/glue/webcursor.h" | 20 #include "webkit/glue/webcursor.h" |
| 21 | 21 |
| 22 namespace net { | 22 namespace net { |
| 23 class IPEndPoint; | 23 class IPEndPoint; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace ui { | 26 namespace ui { |
| 27 class Range; | 27 class Range; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace content { |
| 31 |
| 30 // Define the NPVariant_Param struct and its enum here since it needs manual | 32 // Define the NPVariant_Param struct and its enum here since it needs manual |
| 31 // serialization code. | 33 // serialization code. |
| 32 enum NPVariant_ParamEnum { | 34 enum NPVariant_ParamEnum { |
| 33 NPVARIANT_PARAM_VOID, | 35 NPVARIANT_PARAM_VOID, |
| 34 NPVARIANT_PARAM_NULL, | 36 NPVARIANT_PARAM_NULL, |
| 35 NPVARIANT_PARAM_BOOL, | 37 NPVARIANT_PARAM_BOOL, |
| 36 NPVARIANT_PARAM_INT, | 38 NPVARIANT_PARAM_INT, |
| 37 NPVARIANT_PARAM_DOUBLE, | 39 NPVARIANT_PARAM_DOUBLE, |
| 38 NPVARIANT_PARAM_STRING, | 40 NPVARIANT_PARAM_STRING, |
| 39 // Used when when the NPObject is running in the caller's process, so we | 41 // Used when when the NPObject is running in the caller's process, so we |
| (...skipping 17 matching lines...) Expand all Loading... |
| 57 int npobject_routing_id; | 59 int npobject_routing_id; |
| 58 }; | 60 }; |
| 59 | 61 |
| 60 struct NPIdentifier_Param { | 62 struct NPIdentifier_Param { |
| 61 NPIdentifier_Param(); | 63 NPIdentifier_Param(); |
| 62 ~NPIdentifier_Param(); | 64 ~NPIdentifier_Param(); |
| 63 | 65 |
| 64 NPIdentifier identifier; | 66 NPIdentifier identifier; |
| 65 }; | 67 }; |
| 66 | 68 |
| 69 } // namespace content |
| 70 |
| 67 namespace IPC { | 71 namespace IPC { |
| 68 | 72 |
| 69 template <> | 73 template <> |
| 70 struct ParamTraits<net::IPEndPoint> { | 74 struct ParamTraits<net::IPEndPoint> { |
| 71 typedef net::IPEndPoint param_type; | 75 typedef net::IPEndPoint param_type; |
| 72 static void Write(Message* m, const param_type& p); | 76 static void Write(Message* m, const param_type& p); |
| 73 static bool Read(const Message* m, PickleIterator* iter, param_type* p); | 77 static bool Read(const Message* m, PickleIterator* iter, param_type* p); |
| 74 static void Log(const param_type& p, std::string* l); | 78 static void Log(const param_type& p, std::string* l); |
| 75 }; | 79 }; |
| 76 | 80 |
| 77 template <> | 81 template <> |
| 78 struct ParamTraits<NPVariant_Param> { | 82 struct ParamTraits<content::NPVariant_Param> { |
| 79 typedef NPVariant_Param param_type; | 83 typedef content::NPVariant_Param param_type; |
| 80 static void Write(Message* m, const param_type& p); | 84 static void Write(Message* m, const param_type& p); |
| 81 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 85 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 82 static void Log(const param_type& p, std::string* l); | 86 static void Log(const param_type& p, std::string* l); |
| 83 }; | 87 }; |
| 84 | 88 |
| 85 template <> | 89 template <> |
| 86 struct ParamTraits<NPIdentifier_Param> { | 90 struct ParamTraits<content::NPIdentifier_Param> { |
| 87 typedef NPIdentifier_Param param_type; | 91 typedef content::NPIdentifier_Param param_type; |
| 88 static void Write(Message* m, const param_type& p); | 92 static void Write(Message* m, const param_type& p); |
| 89 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 93 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 90 static void Log(const param_type& p, std::string* l); | 94 static void Log(const param_type& p, std::string* l); |
| 91 }; | 95 }; |
| 92 | 96 |
| 93 template <> | 97 template <> |
| 94 struct ParamTraits<ui::Range> { | 98 struct ParamTraits<ui::Range> { |
| 95 typedef ui::Range param_type; | 99 typedef ui::Range param_type; |
| 96 static void Write(Message* m, const param_type& p); | 100 static void Write(Message* m, const param_type& p); |
| 97 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 101 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 LogParam(p->type, l); | 152 LogParam(p->type, l); |
| 149 l->append(", "); | 153 l->append(", "); |
| 150 LogParam(p->timeStampSeconds, l); | 154 LogParam(p->timeStampSeconds, l); |
| 151 l->append(")"); | 155 l->append(")"); |
| 152 } | 156 } |
| 153 }; | 157 }; |
| 154 | 158 |
| 155 } // namespace IPC | 159 } // namespace IPC |
| 156 | 160 |
| 157 #endif // CONTENT_COMMON_CONTENT_PARAM_TRAITS_H_ | 161 #endif // CONTENT_COMMON_CONTENT_PARAM_TRAITS_H_ |
| OLD | NEW |