| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 defines IPC::ParamTraits<> specializations for several | 5 // This file defines IPC::ParamTraits<> specializations for several |
| 6 // input-related types that require manual serialiation code. | 6 // input-related types that require manual serialiation code. |
| 7 | 7 |
| 8 #ifndef CONTENT_COMMON_INPUT_INPUT_PARAM_TRAITS_H_ | 8 #ifndef CONTENT_COMMON_INPUT_INPUT_PARAM_TRAITS_H_ |
| 9 #define CONTENT_COMMON_INPUT_INPUT_PARAM_TRAITS_H_ | 9 #define CONTENT_COMMON_INPUT_INPUT_PARAM_TRAITS_H_ |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "content/common/content_param_traits_macros.h" | 12 #include "content/common/content_param_traits_macros.h" |
| 13 #include "content/common/input/event_packet.h" | |
| 14 #include "content/common/input/input_event.h" | 13 #include "content/common/input/input_event.h" |
| 15 #include "content/common/input/web_input_event_payload.h" | 14 #include "content/common/input/web_input_event_payload.h" |
| 16 | 15 |
| 17 namespace IPC { | 16 namespace IPC { |
| 18 | 17 |
| 19 // TODO(jdduke): There should be a common copy of this utility somewhere... | 18 // TODO(jdduke): There should be a common copy of this utility somewhere... |
| 20 // Move or remove appropriately. | 19 // Move or remove appropriately. |
| 21 template <class P> | 20 template <class P> |
| 22 struct ParamTraits<scoped_ptr<P> > { | 21 struct ParamTraits<scoped_ptr<P> > { |
| 23 typedef scoped_ptr<P> param_type; | 22 typedef scoped_ptr<P> param_type; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 46 } | 45 } |
| 47 static void Log(const param_type& p, std::string* l) { | 46 static void Log(const param_type& p, std::string* l) { |
| 48 if (p) | 47 if (p) |
| 49 LogParam(*p, l); | 48 LogParam(*p, l); |
| 50 else | 49 else |
| 51 l->append("NULL"); | 50 l->append("NULL"); |
| 52 } | 51 } |
| 53 }; | 52 }; |
| 54 | 53 |
| 55 template <> | 54 template <> |
| 56 struct CONTENT_EXPORT ParamTraits<content::EventPacket> { | |
| 57 typedef content::EventPacket param_type; | |
| 58 static void Write(Message* m, const param_type& p); | |
| 59 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | |
| 60 static void Log(const param_type& p, std::string* l); | |
| 61 }; | |
| 62 | |
| 63 template <> | |
| 64 struct CONTENT_EXPORT ParamTraits<content::InputEvent> { | 55 struct CONTENT_EXPORT ParamTraits<content::InputEvent> { |
| 65 typedef content::InputEvent param_type; | 56 typedef content::InputEvent param_type; |
| 66 static void Write(Message* m, const param_type& p); | 57 static void Write(Message* m, const param_type& p); |
| 67 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 58 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 68 static void Log(const param_type& p, std::string* l); | 59 static void Log(const param_type& p, std::string* l); |
| 69 }; | 60 }; |
| 70 | 61 |
| 71 template <> | 62 template <> |
| 72 struct CONTENT_EXPORT ParamTraits<content::WebInputEventPayload> { | 63 struct CONTENT_EXPORT ParamTraits<content::WebInputEventPayload> { |
| 73 typedef content::WebInputEventPayload param_type; | 64 typedef content::WebInputEventPayload param_type; |
| 74 static void Write(Message* m, const param_type& p); | 65 static void Write(Message* m, const param_type& p); |
| 75 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 66 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 76 static void Log(const param_type& p, std::string* l); | 67 static void Log(const param_type& p, std::string* l); |
| 77 }; | 68 }; |
| 78 | 69 |
| 79 } // namespace IPC | 70 } // namespace IPC |
| 80 | 71 |
| 81 #endif // CONTENT_COMMON_INPUT_INPUT_PARAM_TRAITS_H_ | 72 #endif // CONTENT_COMMON_INPUT_INPUT_PARAM_TRAITS_H_ |
| OLD | NEW |