Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: ui/events/ozone/evdev/event_converter_evdev.h

Issue 806693009: Port ScopedDisableInternalMouseAndKeyboardX11 to Ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_EVENT_CONVERTER_EVDEV_H_ 5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_
6 #define UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_
7 7
8 #include <set>
9
8 #include "base/callback.h" 10 #include "base/callback.h"
9 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
10 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
11 #include "ui/events/devices/input_device.h" 13 #include "ui/events/devices/input_device.h"
14 #include "ui/events/keycodes/keyboard_codes.h"
12 #include "ui/events/ozone/evdev/event_dispatch_callback.h" 15 #include "ui/events/ozone/evdev/event_dispatch_callback.h"
13 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" 16 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
14 #include "ui/gfx/geometry/size.h" 17 #include "ui/gfx/geometry/size.h"
15 18
16 namespace ui { 19 namespace ui {
17 20
18 class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdev 21 class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdev
19 : public base::MessagePumpLibevent::Watcher { 22 : public base::MessagePumpLibevent::Watcher {
20 public: 23 public:
21 EventConverterEvdev(int fd, 24 EventConverterEvdev(int fd,
22 const base::FilePath& path, 25 const base::FilePath& path,
23 int id, 26 int id,
24 InputDeviceType type); 27 InputDeviceType type);
25 ~EventConverterEvdev() override; 28 ~EventConverterEvdev() override;
26 29
27 int id() const { return id_; } 30 int id() const { return id_; }
28 31
29 const base::FilePath& path() const { return path_; } 32 const base::FilePath& path() const { return path_; }
30 33
31 InputDeviceType type() const { return type_; } 34 InputDeviceType type() const { return type_; }
32 35
36 void set_ignore_events(bool ignore_events) { ignore_events_ = ignore_events; }
37
33 // Start reading events. 38 // Start reading events.
34 void Start(); 39 void Start();
35 40
36 // Stop reading events. 41 // Stop reading events.
37 void Stop(); 42 void Stop();
38 43
39 // Returns true of the converter is used for a keyboard device. 44 // Returns true if the converter is used for a keyboard device.
40 virtual bool HasKeyboard() const; 45 virtual bool HasKeyboard() const;
41 46
42 // Returns true of the converter is used for a touchscreen device. 47 // Returns true if the converter is used for a touchpad device.
48 virtual bool HasTouchpad() const;
49
50 // Returns true if the converter is used for a touchscreen device.
43 virtual bool HasTouchscreen() const; 51 virtual bool HasTouchscreen() const;
44 52
53 // Sets which keyboard keys should be processed.
54 virtual void SetAllowedKeys(scoped_ptr<std::set<KeyboardCode>> allowed_keys);
55
56 // Allows all keys to be processed.
57 virtual void AllowAllKeys();
58
45 // Returns the size of the touchscreen device if the converter is used for a 59 // Returns the size of the touchscreen device if the converter is used for a
46 // touchscreen device. 60 // touchscreen device.
47 virtual gfx::Size GetTouchscreenSize() const; 61 virtual gfx::Size GetTouchscreenSize() const;
48 62
49 protected: 63 protected:
50 // base::MessagePumpLibevent::Watcher: 64 // base::MessagePumpLibevent::Watcher:
51 void OnFileCanWriteWithoutBlocking(int fd) override; 65 void OnFileCanWriteWithoutBlocking(int fd) override;
52 66
53 // File descriptor to read. 67 // File descriptor to read.
54 int fd_; 68 int fd_;
55 69
56 // Path to input device. 70 // Path to input device.
57 base::FilePath path_; 71 base::FilePath path_;
58 72
59 // Uniquely identifies an event converter. 73 // Uniquely identifies an event converter.
60 int id_; 74 int id_;
61 75
62 // Type (internal or external). 76 // Type (internal or external).
63 InputDeviceType type_; 77 InputDeviceType type_;
64 78
79 // Whether events from the device should be ignored.
80 bool ignore_events_;
81
65 // Controller for watching the input fd. 82 // Controller for watching the input fd.
66 base::MessagePumpLibevent::FileDescriptorWatcher controller_; 83 base::MessagePumpLibevent::FileDescriptorWatcher controller_;
67 84
68 private: 85 private:
69 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdev); 86 DISALLOW_COPY_AND_ASSIGN(EventConverterEvdev);
70 }; 87 };
71 88
72 } // namespace ui 89 } // namespace ui
73 90
74 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_ 91 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_CONVERTER_EVDEV_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698