| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef UI_EVENTS_MOJO_EVENT_STRUCT_TRAITS_H_ | 5 #ifndef UI_EVENTS_MOJO_EVENT_STRUCT_TRAITS_H_ |
| 6 #define UI_EVENTS_MOJO_EVENT_STRUCT_TRAITS_H_ | 6 #define UI_EVENTS_MOJO_EVENT_STRUCT_TRAITS_H_ |
| 7 | 7 |
| 8 #include "ui/events/mojo/event.mojom.h" | 8 #include "ui/events/mojo/event.mojom.h" |
| 9 | 9 |
| 10 namespace ui { | 10 namespace ui { |
| 11 class Event; | 11 class Event; |
| 12 class LatencyInfo; |
| 12 } | 13 } |
| 13 | 14 |
| 14 namespace mojo { | 15 namespace mojo { |
| 15 | 16 |
| 16 using EventUniquePtr = std::unique_ptr<ui::Event>; | 17 using EventUniquePtr = std::unique_ptr<ui::Event>; |
| 17 | 18 |
| 18 template <> | 19 template <> |
| 19 struct StructTraits<ui::mojom::EventDataView, EventUniquePtr> { | 20 struct StructTraits<ui::mojom::EventDataView, EventUniquePtr> { |
| 20 static ui::mojom::EventType action(const EventUniquePtr& event); | 21 static ui::mojom::EventType action(const EventUniquePtr& event); |
| 21 static int32_t flags(const EventUniquePtr& event); | 22 static int32_t flags(const EventUniquePtr& event); |
| 22 static int64_t time_stamp(const EventUniquePtr& event); | 23 static int64_t time_stamp(const EventUniquePtr& event); |
| 24 static const ui::LatencyInfo& latency(const EventUniquePtr& event); |
| 23 static ui::mojom::KeyDataPtr key_data(const EventUniquePtr& event); | 25 static ui::mojom::KeyDataPtr key_data(const EventUniquePtr& event); |
| 24 static ui::mojom::PointerDataPtr pointer_data(const EventUniquePtr& event); | 26 static ui::mojom::PointerDataPtr pointer_data(const EventUniquePtr& event); |
| 25 static bool Read(ui::mojom::EventDataView r, EventUniquePtr* out); | 27 static bool Read(ui::mojom::EventDataView r, EventUniquePtr* out); |
| 26 }; | 28 }; |
| 27 | 29 |
| 28 } // namespace mojo | 30 } // namespace mojo |
| 29 | 31 |
| 30 #endif // UI_EVENTS_MOJO_EVENT_STRUCT_TRAITS_H_ | 32 #endif // UI_EVENTS_MOJO_EVENT_STRUCT_TRAITS_H_ |
| OLD | NEW |