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