Media Galleries API Metadata: Fix bugs in utility process cleanup.
[chromium-blink-merge.git] / ui / events / ozone / evdev / key_event_converter_evdev.h
blob65a16d487cef810ceff08ba0d53955fa0a8c9bba
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.
5 #ifndef UI_EVENTS_OZONE_EVDEV_KEY_EVENT_CONVERTER_EVDEV_H_
6 #define UI_EVENTS_OZONE_EVDEV_KEY_EVENT_CONVERTER_EVDEV_H_
8 #include "base/files/file_path.h"
9 #include "base/message_loop/message_pump_libevent.h"
10 #include "ui/events/event.h"
11 #include "ui/events/events_export.h"
12 #include "ui/events/ozone/evdev/event_converter_evdev.h"
13 #include "ui/events/ozone/evdev/event_modifiers_evdev.h"
15 struct input_event;
17 namespace ui {
19 class EVENTS_EXPORT KeyEventConverterEvdev
20 : public EventConverterEvdev,
21 base::MessagePumpLibevent::Watcher {
22 public:
23 KeyEventConverterEvdev(int fd,
24 base::FilePath path,
25 EventModifiersEvdev* modifiers);
26 virtual ~KeyEventConverterEvdev();
28 // Start & stop watching for events.
29 virtual void Start() OVERRIDE;
30 virtual void Stop() OVERRIDE;
32 // Overidden from base::MessagePumpLibevent::Watcher.
33 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
34 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;
36 void ProcessEvents(const struct input_event* inputs, int count);
38 private:
39 // File descriptor for the /dev/input/event* instance.
40 int fd_;
42 // Path to input device.
43 base::FilePath path_;
45 // Shared modifier state.
46 EventModifiersEvdev* modifiers_;
48 // Controller for watching the input fd.
49 base::MessagePumpLibevent::FileDescriptorWatcher controller_;
51 void ConvertKeyEvent(int key, int value);
53 DISALLOW_COPY_AND_ASSIGN(KeyEventConverterEvdev);
56 } // namspace ui
58 #endif // UI_EVENTS_OZONE_EVDEV_KEY_EVENT_CONVERTER_EVDEV_H_