OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 MOJO_CONVERTERS_INPUT_EVENTS_INPUT_EVENTS_TYPE_CONVERTERS_H_ | |
6 #define MOJO_CONVERTERS_INPUT_EVENTS_INPUT_EVENTS_TYPE_CONVERTERS_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "components/mus/public/interfaces/input_events.mojom.h" | |
11 #include "mojo/converters/input_events/mojo_input_events_export.h" | |
12 #include "ui/events/event.h" | |
13 | |
14 namespace mojo { | |
15 | |
16 // NOTE: the mojo input events do not necessarily provide a 1-1 mapping with | |
17 // ui::Event types. Be careful in using them! | |
18 template <> | |
19 struct MOJO_INPUT_EVENTS_EXPORT | |
20 TypeConverter<mus::mojom::EventType, ui::EventType> { | |
21 static mus::mojom::EventType Convert(ui::EventType type); | |
22 }; | |
23 | |
24 template <> | |
25 struct MOJO_INPUT_EVENTS_EXPORT TypeConverter<mus::mojom::EventPtr, ui::Event> { | |
26 static mus::mojom::EventPtr Convert(const ui::Event& input); | |
27 }; | |
28 | |
29 template <> | |
30 struct MOJO_INPUT_EVENTS_EXPORT | |
31 TypeConverter<mus::mojom::EventPtr, ui::KeyEvent> { | |
32 static mus::mojom::EventPtr Convert(const ui::KeyEvent& input); | |
33 }; | |
34 | |
35 template <> | |
36 struct MOJO_INPUT_EVENTS_EXPORT | |
37 TypeConverter<mus::mojom::EventPtr, ui::GestureEvent> { | |
38 static mus::mojom::EventPtr Convert(const ui::GestureEvent& input); | |
39 }; | |
40 | |
41 template <> | |
42 struct MOJO_INPUT_EVENTS_EXPORT | |
43 TypeConverter<std::unique_ptr<ui::Event>, mus::mojom::EventPtr> { | |
44 static std::unique_ptr<ui::Event> Convert(const mus::mojom::EventPtr& input); | |
45 }; | |
46 | |
47 } // namespace mojo | |
48 | |
49 #endif // MOJO_CONVERTERS_INPUT_EVENTS_INPUT_EVENTS_TYPE_CONVERTERS_H_ | |
OLD | NEW |