| 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/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 11 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" | 12 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
| 12 | 13 |
| 13 namespace ui { | 14 namespace ui { |
| 14 | 15 |
| 15 class Event; | 16 class Event; |
| 17 class EventDeviceInfo; |
| 16 | 18 |
| 17 typedef base::Callback<void(Event*)> EventDispatchCallback; | 19 typedef base::Callback<void(Event*)> EventDispatchCallback; |
| 18 | 20 |
| 19 class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdev | 21 class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdev |
| 20 : public base::MessagePumpLibevent::Watcher { | 22 : public base::MessagePumpLibevent::Watcher { |
| 21 public: | 23 public: |
| 22 EventConverterEvdev(int fd, const base::FilePath& path); | 24 EventConverterEvdev(int fd, |
| 25 const base::FilePath& path, |
| 26 scoped_ptr<EventDeviceInfo> device_info); |
| 23 virtual ~EventConverterEvdev(); | 27 virtual ~EventConverterEvdev(); |
| 24 | 28 |
| 29 EventDeviceInfo* device_info() const { return device_info_.get(); } |
| 30 |
| 25 // Start reading events. | 31 // Start reading events. |
| 26 void Start(); | 32 void Start(); |
| 27 | 33 |
| 28 // Stop reading events. | 34 // Stop reading events. |
| 29 void Stop(); | 35 void Stop(); |
| 30 | 36 |
| 31 protected: | 37 protected: |
| 32 // base::MessagePumpLibevent::Watcher: | 38 // base::MessagePumpLibevent::Watcher: |
| 33 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; | 39 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; |
| 34 | 40 |
| 35 // File descriptor to read. | 41 // File descriptor to read. |
| 36 int fd_; | 42 int fd_; |
| 37 | 43 |
| 38 // Path to input device. | 44 // Path to input device. |
| 39 base::FilePath path_; | 45 base::FilePath path_; |
| 40 | 46 |
| 47 scoped_ptr<EventDeviceInfo> device_info_; |
| 48 |
| 41 // Controller for watching the input fd. | 49 // Controller for watching the input fd. |
| 42 base::MessagePumpLibevent::FileDescriptorWatcher controller_; | 50 base::MessagePumpLibevent::FileDescriptorWatcher controller_; |
| 43 | 51 |
| 44 private: | 52 private: |
| 45 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdev); | 53 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdev); |
| 46 }; | 54 }; |
| 47 | 55 |
| 48 } // namespace ui | 56 } // namespace ui |
| 49 | 57 |
| 50 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ | 58 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ |
| OLD | NEW |