| 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_LIBGESTURES_GLUE_EVENT_READER_LIBEVDEV_CROS_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_EVENT_READER_LIBEVDEV_CROS_H_ |
| 6 #define UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_EVENT_READER_LIBEVDEV_CROS_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_EVENT_READER_LIBEVDEV_CROS_H_ |
| 7 | 7 |
| 8 #include <libevdev/libevdev.h> | 8 #include <libevdev/libevdev.h> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 public: | 27 public: |
| 28 virtual ~Delegate(); | 28 virtual ~Delegate(); |
| 29 | 29 |
| 30 // Notifier for open. This is called with the initial event state. | 30 // Notifier for open. This is called with the initial event state. |
| 31 virtual void OnLibEvdevCrosOpen(Evdev* evdev, EventStateRec* evstate) = 0; | 31 virtual void OnLibEvdevCrosOpen(Evdev* evdev, EventStateRec* evstate) = 0; |
| 32 | 32 |
| 33 // Notifier for event. This is called with the updated event state. | 33 // Notifier for event. This is called with the updated event state. |
| 34 virtual void OnLibEvdevCrosEvent(Evdev* evdev, | 34 virtual void OnLibEvdevCrosEvent(Evdev* evdev, |
| 35 EventStateRec* state, | 35 EventStateRec* state, |
| 36 const timeval& time) = 0; | 36 const timeval& time) = 0; |
| 37 |
| 38 // Sets which keyboard keys should be processed. |
| 39 virtual void SetAllowedKeys( |
| 40 scoped_ptr<std::set<KeyboardCode>> allowed_keys) = 0; |
| 41 |
| 42 // Allows all keys to be processed. |
| 43 virtual void AllowAllKeys() = 0; |
| 37 }; | 44 }; |
| 38 | 45 |
| 39 EventReaderLibevdevCros(int fd, | 46 EventReaderLibevdevCros(int fd, |
| 40 const base::FilePath& path, | 47 const base::FilePath& path, |
| 41 int id, | 48 int id, |
| 42 InputDeviceType type, | 49 InputDeviceType type, |
| 43 const EventDeviceInfo& devinfo, | 50 const EventDeviceInfo& devinfo, |
| 44 scoped_ptr<Delegate> delegate); | 51 scoped_ptr<Delegate> delegate); |
| 45 ~EventReaderLibevdevCros(); | 52 ~EventReaderLibevdevCros(); |
| 46 | 53 |
| 47 // EventConverterEvdev: | 54 // EventConverterEvdev: |
| 48 void OnFileCanReadWithoutBlocking(int fd) override; | 55 void OnFileCanReadWithoutBlocking(int fd) override; |
| 56 void SetAllowedKeys(scoped_ptr<std::set<KeyboardCode>> allowed_keys) override; |
| 57 void AllowAllKeys() override; |
| 49 bool HasKeyboard() const override; | 58 bool HasKeyboard() const override; |
| 59 bool HasTouchpad() const override; |
| 50 | 60 |
| 51 private: | 61 private: |
| 52 static void OnSynReport(void* data, | 62 static void OnSynReport(void* data, |
| 53 EventStateRec* evstate, | 63 EventStateRec* evstate, |
| 54 struct timeval* tv); | 64 struct timeval* tv); |
| 55 static void OnLogMessage(void*, int level, const char*, ...); | 65 static void OnLogMessage(void*, int level, const char*, ...); |
| 56 | 66 |
| 57 // Input modalities for this device. | 67 // Input modalities for this device. |
| 58 bool has_keyboard_; | 68 bool has_keyboard_; |
| 69 bool has_touchpad_; |
| 59 | 70 |
| 60 // Libevdev state. | 71 // Libevdev state. |
| 61 Evdev evdev_; | 72 Evdev evdev_; |
| 62 | 73 |
| 63 // Event state. | 74 // Event state. |
| 64 EventStateRec evstate_; | 75 EventStateRec evstate_; |
| 65 | 76 |
| 66 // Path to input device. | 77 // Path to input device. |
| 67 base::FilePath path_; | 78 base::FilePath path_; |
| 68 | 79 |
| 69 // Delegate for event processing. | 80 // Delegate for event processing. |
| 70 scoped_ptr<Delegate> delegate_; | 81 scoped_ptr<Delegate> delegate_; |
| 71 | 82 |
| 72 DISALLOW_COPY_AND_ASSIGN(EventReaderLibevdevCros); | 83 DISALLOW_COPY_AND_ASSIGN(EventReaderLibevdevCros); |
| 73 }; | 84 }; |
| 74 | 85 |
| 75 } // namspace ui | 86 } // namspace ui |
| 76 | 87 |
| 77 #endif // UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_EVENT_READER_LIBEVDEV_CROS_H_ | 88 #endif // UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_EVENT_READER_LIBEVDEV_CROS_H_ |
| OLD | NEW |