| 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_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_H_ |
| 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_H_ |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/message_loop/message_pump_ozone.h" | 9 #include "base/message_loop/message_pump_ozone.h" |
| 10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
| 11 #include "ui/events/events_export.h" | 11 #include "ui/events/events_export.h" |
| 12 #include "ui/events/ozone/evdev/event_modifiers.h" | 12 #include "ui/events/ozone/evdev/event_modifiers.h" |
| 13 #include "ui/events/ozone/event_converter_ozone.h" | 13 #include "ui/events/ozone/event_converter_ozone.h" |
| 14 | 14 |
| 15 struct input_event; | 15 struct input_event; |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 | 18 |
| 19 class EVENTS_EXPORT EventConverterEvdev : public EventConverterOzone { | 19 class EVENTS_EXPORT EventConverterEvdev : public EventConverterOzone, |
| 20 base::MessagePumpLibevent::Watcher { |
| 20 public: | 21 public: |
| 21 EventConverterEvdev(int fd, | 22 EventConverterEvdev(int fd, |
| 22 base::FilePath path, | 23 base::FilePath path, |
| 23 EventModifiersEvdev* modifiers); | 24 EventModifiersEvdev* modifiers); |
| 24 virtual ~EventConverterEvdev(); | 25 virtual ~EventConverterEvdev(); |
| 25 | 26 |
| 26 // Overidden from base::MessagePumpLibevent::Watcher. | 27 // Overidden from base::MessagePumpLibevent::Watcher. |
| 27 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; | 28 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; |
| 28 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; | 29 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; |
| 29 | 30 |
| 31 // Overridden from EventConverterOzone. |
| 32 void Start() OVERRIDE; |
| 33 void Stop() OVERRIDE; |
| 34 |
| 30 protected: | 35 protected: |
| 31 // Process & dispatch events read from the device. | 36 // Process & dispatch events read from the device. |
| 32 virtual void ProcessEvents(const struct input_event* inputs, int count) = 0; | 37 virtual void ProcessEvents(const struct input_event* inputs, int count) = 0; |
| 33 | 38 |
| 34 // File descriptor for the /dev/input/event* instance. | 39 // File descriptor for the /dev/input/event* instance. |
| 35 int fd_; | 40 int fd_; |
| 36 | 41 |
| 37 // Path to input device. | 42 // Path to input device. |
| 38 base::FilePath path_; | 43 base::FilePath path_; |
| 39 | 44 |
| 40 // Shared modifier state. | 45 // Shared modifier state. |
| 41 EventModifiersEvdev* modifiers_; | 46 EventModifiersEvdev* modifiers_; |
| 42 | 47 |
| 48 // Controller for watching the input fd. |
| 49 base::MessagePumpLibevent::FileDescriptorWatcher controller_; |
| 50 |
| 43 private: | 51 private: |
| 44 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdev); | 52 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdev); |
| 45 }; | 53 }; |
| 46 | 54 |
| 47 } // namspace ui | 55 } // namspace ui |
| 48 | 56 |
| 49 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_H_ | 57 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_H_ |
| OLD | NEW |