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

Side by Side Diff: components/arc/arc_bridge_input_devices.h

Issue 1408263006: chromeos: Add ArcInputBridge to components/arc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@arcxx
Patch Set: Arc: Extend ArcBridgeService with input bridge Created 5 years, 1 month 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
(Empty)
1 #ifndef CHROMEOS_ARC_BRIDGE_INPUT_DEVICES_H_
2 #define CHROMEOS_ARC_BRIDGE_INPUT_DEVICES_H_
3
4 #include "base/files/scoped_file.h"
5 #include "base/macros.h"
6 #include "base/memory/scoped_vector.h"
7 #include "ui/events/event.h"
8 #include "ui/events/event_handler.h"
9
10 #include <linux/types.h>
11
12 namespace arc {
13
14 class BridgeInputDevice : public ui::EventHandler {
15 public:
16 BridgeInputDevice(base::ScopedFD fd);
17
18 // Send input_event through file descriptor.
19 void SendEvent(base::TimeDelta time, __u16 type, __u16 code, __s32 value);
20
21 // Shorthand for sending a SYN_REPORT input_event.
22 void SendSynReport(base::TimeDelta time);
23
24 private:
25 base::ScopedFD fd_;
26 };
27
28 // BridgeInputDevice for handling keyboard events
29 class KeyboardBridgeInputDevice : public BridgeInputDevice {
30 // input_event values for keyboard events
31 static const int kKeyReleased = 0;
32 static const int kKeyPressed = 1;
33 static const int kKeyRepeated = 2;
34
35 public:
36 void OnKeyEvent(ui::KeyEvent* event) override;
37 };
38
39 // BridgeInputDevice for handling mouse events
40 class MouseBridgeInputDevice : public BridgeInputDevice {
41 public:
42 void OnMouseEvent(ui::MouseEvent* event) override;
43
44 private:
45 void SendMouseButton(ui::MouseEvent* event, int flag, int evdev_code);
46 };
47
48
49 // BridgeDevice for handling touch events
50 class TouchscreenBridgeInputDevice : public BridgeInputDevice {
51 static const int kEmptySlot = -1;
52 static const int kMaxSlots = 32;
53
54 public:
55 TouchscreenBridgeInputDevice(base::ScopedFD fd);
56
57 virtual void OnTouchEvent(ui::TouchEvent* event) override;
58
59 private:
60 // Manages available slot id's and returns slot assigned to this touch event.
61 int AcquireSlot(ui::TouchEvent* event);
62 // Locates slot for tracking id
63 int FindSlot(int tracking_id);
64
65 std::vector<uint8_t> current_slot_tracking_ids_;
66 uint8_t current_slot_;
67 };
68
69 }
70
71 #endif // CHROMEOS_ARC_BRIDGE_INPUT_DEVICES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698