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(scoped_ptr<std::set<DomCode>> allowed_keys) = 0; |
| 40 |
| 41 // Allows all keys to be processed. |
| 42 virtual void AllowAllKeys() = 0; |
37 }; | 43 }; |
38 | 44 |
39 EventReaderLibevdevCros(int fd, | 45 EventReaderLibevdevCros(int fd, |
40 const base::FilePath& path, | 46 const base::FilePath& path, |
41 int id, | 47 int id, |
42 InputDeviceType type, | 48 InputDeviceType type, |
43 const EventDeviceInfo& devinfo, | 49 const EventDeviceInfo& devinfo, |
44 scoped_ptr<Delegate> delegate); | 50 scoped_ptr<Delegate> delegate); |
45 ~EventReaderLibevdevCros(); | 51 ~EventReaderLibevdevCros(); |
46 | 52 |
47 // EventConverterEvdev: | 53 // EventConverterEvdev: |
48 void OnFileCanReadWithoutBlocking(int fd) override; | 54 void OnFileCanReadWithoutBlocking(int fd) override; |
49 bool HasKeyboard() const override; | 55 bool HasKeyboard() const override; |
| 56 bool HasTouchpad() const override; |
| 57 void SetAllowedKeys(scoped_ptr<std::set<DomCode>> allowed_keys) override; |
| 58 void AllowAllKeys() override; |
50 | 59 |
51 private: | 60 private: |
52 static void OnSynReport(void* data, | 61 static void OnSynReport(void* data, |
53 EventStateRec* evstate, | 62 EventStateRec* evstate, |
54 struct timeval* tv); | 63 struct timeval* tv); |
55 static void OnLogMessage(void*, int level, const char*, ...); | 64 static void OnLogMessage(void*, int level, const char*, ...); |
56 | 65 |
57 // Input modalities for this device. | 66 // Input modalities for this device. |
58 bool has_keyboard_; | 67 bool has_keyboard_; |
| 68 bool has_touchpad_; |
59 | 69 |
60 // Libevdev state. | 70 // Libevdev state. |
61 Evdev evdev_; | 71 Evdev evdev_; |
62 | 72 |
63 // Event state. | 73 // Event state. |
64 EventStateRec evstate_; | 74 EventStateRec evstate_; |
65 | 75 |
66 // Path to input device. | 76 // Path to input device. |
67 base::FilePath path_; | 77 base::FilePath path_; |
68 | 78 |
69 // Delegate for event processing. | 79 // Delegate for event processing. |
70 scoped_ptr<Delegate> delegate_; | 80 scoped_ptr<Delegate> delegate_; |
71 | 81 |
72 DISALLOW_COPY_AND_ASSIGN(EventReaderLibevdevCros); | 82 DISALLOW_COPY_AND_ASSIGN(EventReaderLibevdevCros); |
73 }; | 83 }; |
74 | 84 |
75 } // namspace ui | 85 } // namspace ui |
76 | 86 |
77 #endif // UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_EVENT_READER_LIBEVDEV_CROS_H_ | 87 #endif // UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_EVENT_READER_LIBEVDEV_CROS_H_ |
OLD | NEW |