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_EVENT_CONVERTER_EVDEV_H_
6 #define UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_
8 #include "base/callback.h"
9 #include "base/files/file_path.h"
10 #include "base/message_loop/message_loop.h"
11 #include "ui/events/ozone/evdev/event_dispatch_callback.h"
12 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
13 #include "ui/gfx/geometry/size.h"
17 class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdev
18 : public base::MessagePumpLibevent::Watcher {
20 EventConverterEvdev(int fd, const base::FilePath& path, int id);
21 ~EventConverterEvdev() override;
23 int id() const { return id_; }
25 const base::FilePath& path() const { return path_; }
27 // Start reading events.
30 // Stop reading events.
33 // Returns true of the converter is used for a touchscreen device.
34 virtual bool HasTouchscreen() const;
36 // Returns the size of the touchscreen device if the converter is used for a
37 // touchscreen device.
38 virtual gfx::Size GetTouchscreenSize() const;
40 // Returns true if the converter is used with an internal device.
41 virtual bool IsInternal() const;
44 // base::MessagePumpLibevent::Watcher:
45 void OnFileCanWriteWithoutBlocking(int fd) override;
47 // File descriptor to read.
50 // Path to input device.
53 // Uniquely identifies an event converter.
56 // Controller for watching the input fd.
57 base::MessagePumpLibevent::FileDescriptorWatcher controller_;
60 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdev);
65 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_