OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_EVENTS_OZONE_EVDEV_GESTURES_EVENT_READER_LIBEVDEV_CROS_H_ | |
6 #define UI_EVENTS_OZONE_EVDEV_GESTURES_EVENT_READER_LIBEVDEV_CROS_H_ | |
7 | |
8 #include <libevdev/libevdev.h> | |
9 | |
10 #include "base/files/file_path.h" | |
11 #include "base/message_loop/message_pump_ozone.h" | |
12 #include "ui/events/ozone/evdev/event_converter_evdev.h" | |
13 | |
14 namespace ui { | |
15 | |
rjkroege
2014/03/11 12:58:47
add a comment to say what this is for?
spang
2014/03/11 16:38:11
Done.
| |
16 class EventReaderLibevdevCros : public base::MessagePumpOzone::Watcher, | |
17 public EventConverterEvdev { | |
18 public: | |
19 class Delegate { | |
20 public: | |
21 virtual ~Delegate(); | |
22 | |
23 // Notifier for open. This is called with the initial event state. | |
24 virtual void OnLibEvdevCrosOpen(Evdev* evdev, EventStateRec* evstate) = 0; | |
25 | |
26 // Notifier for event. This is called with the updated event state. | |
27 virtual void OnLibEvdevCrosEvent(Evdev* evdev, | |
28 EventStateRec* state, | |
29 const timeval& time) = 0; | |
30 }; | |
31 | |
32 EventReaderLibevdevCros(int fd, | |
33 const base::FilePath& path, | |
34 scoped_ptr<Delegate> delegate); | |
35 ~EventReaderLibevdevCros(); | |
36 | |
37 // Overridden from ui::EventDeviceEvdev. | |
38 void Start() OVERRIDE; | |
39 void Stop() OVERRIDE; | |
40 | |
41 // Overidden from base::MessagePumpOzone::Watcher. | |
42 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; | |
43 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; | |
44 | |
45 private: | |
46 static void OnSynReport(void* data, | |
47 EventStateRec* evstate, | |
48 struct timeval* tv); | |
49 static void OnLogMessage(void*, int level, const char*, ...); | |
50 | |
51 // Libevdev state. | |
52 Evdev evdev_; | |
53 | |
54 // Event state. | |
55 EventStateRec evstate_; | |
56 | |
57 // Path to input device. | |
58 base::FilePath path_; | |
59 | |
60 // Delegate for event processing. | |
61 scoped_ptr<Delegate> delegate_; | |
62 | |
63 // Controller for watching the input fd. | |
64 base::MessagePumpOzone::FileDescriptorWatcher controller_; | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(EventReaderLibevdevCros); | |
67 }; | |
68 | |
69 } // namspace ui | |
70 | |
71 #endif // UI_EVENTS_OZONE_EVDEV_GESTURES_EVENT_READER_LIBEVDEV_CROS_H_ | |
OLD | NEW |