| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_MUS_COMMON_EVENT_PARAM_TRAITS_H_ | |
| 6 #define COMPONENTS_MUS_COMMON_EVENT_PARAM_TRAITS_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "components/mus/common/event_param_traits_macros.h" | |
| 11 #include "components/mus/common/mus_common_export.h" | |
| 12 #include "ui/events/event.h" | |
| 13 #include "ui/events/gesture_event_details.h" | |
| 14 | |
| 15 namespace base { | |
| 16 class Pickle; | |
| 17 class PickleIterator; | |
| 18 } | |
| 19 | |
| 20 namespace ui { | |
| 21 class Event; | |
| 22 } | |
| 23 | |
| 24 namespace IPC { | |
| 25 | |
| 26 // Non-serialized data: | |
| 27 // | |
| 28 // Some event data only makes sense and/or is needed in the context where the | |
| 29 // raw event came from. As such, some data are explicitly NOT | |
| 30 // serialized. These data are as follows: | |
| 31 // base::NativeEvent native_event_; | |
| 32 // LatencyInfo* latency_; | |
| 33 // int source_device_id_; | |
| 34 | |
| 35 template <> | |
| 36 struct MUS_COMMON_EXPORT ParamTraits<ui::ScopedEvent> { | |
| 37 typedef ui::ScopedEvent param_type; | |
| 38 static void GetSize(base::PickleSizer* s, const param_type& p); | |
| 39 static void Write(base::Pickle* m, const param_type& p); | |
| 40 static bool Read(const base::Pickle* m, | |
| 41 base::PickleIterator* iter, | |
| 42 param_type* p); | |
| 43 static void Log(const param_type& p, std::string* l); | |
| 44 | |
| 45 static void SizeEvent(ui::EventType type, | |
| 46 base::TimeDelta time_stamp, | |
| 47 int flags, | |
| 48 base::PickleSizer* s, | |
| 49 const ui::ScopedEvent& p); | |
| 50 static void WriteEvent(ui::EventType type, | |
| 51 base::TimeDelta time_stamp, | |
| 52 int flags, | |
| 53 base::Pickle* m, | |
| 54 const ui::ScopedEvent& p); | |
| 55 static bool ReadEvent(ui::EventType type, | |
| 56 base::TimeDelta time_stamp, | |
| 57 int flags, | |
| 58 const base::Pickle* m, | |
| 59 base::PickleIterator* iter, | |
| 60 ui::ScopedEvent* p); | |
| 61 static void LogEvent(ui::EventType type, | |
| 62 base::TimeDelta time_stamp, | |
| 63 int flags, | |
| 64 const ui::ScopedEvent& p, | |
| 65 std::string* l); | |
| 66 }; | |
| 67 | |
| 68 // Manually implements no-op implementation for ui::CancelModeEvent because IPC | |
| 69 // BEGIN/END macros with no MEMBER or PARENT in between cause compiler | |
| 70 // errors. | |
| 71 template <> | |
| 72 struct ParamTraits<ui::CancelModeEvent> { | |
| 73 typedef ui::CancelModeEvent param_type; | |
| 74 static void GetSize(base::PickleSizer* s, const param_type& p); | |
| 75 static void Write(base::Pickle* m, const param_type& p); | |
| 76 static bool Read(const base::Pickle* m, | |
| 77 base::PickleIterator* iter, | |
| 78 param_type* p); | |
| 79 static void Log(const param_type& p, std::string* l); | |
| 80 }; | |
| 81 | |
| 82 template <> | |
| 83 struct ParamTraits<ui::GestureEventDetails::Details> { | |
| 84 typedef ui::GestureEventDetails::Details param_type; | |
| 85 static void GetSize(base::PickleSizer* s, const param_type& p); | |
| 86 static void Write(base::Pickle* m, const param_type& p); | |
| 87 static bool Read(const base::Pickle* m, | |
| 88 base::PickleIterator* iter, | |
| 89 param_type* p); | |
| 90 static void Log(const param_type& p, std::string* l); | |
| 91 }; | |
| 92 | |
| 93 } // namespace IPC | |
| 94 | |
| 95 #endif // COMPONENTS_MUS_COMMON_EVENT_PARAM_TRAITS_H_ | |
| OLD | NEW |