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