| 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 UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ |
| 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "ui/events/events_export.h" | 11 #include "ui/events/events_export.h" |
| 12 | 12 |
| 13 namespace ui { | 13 namespace ui { |
| 14 | 14 |
| 15 class Event; | 15 class Event; |
| 16 class EventModifiersEvdev; | 16 class EventModifiersEvdev; |
| 17 | 17 |
| 18 typedef base::Callback<void(Event*)> EventDispatchCallback; |
| 19 |
| 18 // Base class for device-specific evdev event conversion. | 20 // Base class for device-specific evdev event conversion. |
| 19 class EVENTS_EXPORT EventConverterEvdev { | 21 class EVENTS_EXPORT EventConverterEvdev { |
| 20 public: | 22 public: |
| 21 EventConverterEvdev(); | 23 EventConverterEvdev(); |
| 24 explicit EventConverterEvdev(const EventDispatchCallback& callback); |
| 22 virtual ~EventConverterEvdev(); | 25 virtual ~EventConverterEvdev(); |
| 23 | 26 |
| 24 void SetDispatchCallback(base::Callback<void(void*)> callback) { | |
| 25 dispatch_callback_ = callback; | |
| 26 } | |
| 27 | |
| 28 // Start converting events. | 27 // Start converting events. |
| 29 virtual void Start() = 0; | 28 virtual void Start() = 0; |
| 30 | 29 |
| 31 // Stop converting events. | 30 // Stop converting events. |
| 32 virtual void Stop() = 0; | 31 virtual void Stop() = 0; |
| 33 | 32 |
| 34 protected: | 33 protected: |
| 35 // Dispatches an event using the dispatch-callback set using | 34 // Dispatches an event using the dispatch-callback set using |
| 36 // |SetDispatchCalback()|. | 35 // |SetDispatchCalback()|. |
| 37 virtual void DispatchEventToCallback(ui::Event* event); | 36 virtual void DispatchEventToCallback(ui::Event* event); |
| 38 | 37 |
| 39 private: | 38 private: |
| 40 base::Callback<void(void*)> dispatch_callback_; | 39 EventDispatchCallback dispatch_callback_; |
| 41 | 40 |
| 42 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdev); | 41 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdev); |
| 43 }; | 42 }; |
| 44 | 43 |
| 45 } // namespace ui | 44 } // namespace ui |
| 46 | 45 |
| 47 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ | 46 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ |
| OLD | NEW |