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

Unified 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: added owners 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 side-by-side diff with in-line comments
Download patch
Index: components/arc/arc_bridge_input_devices.h
diff --git a/components/arc/arc_bridge_input_devices.h b/components/arc/arc_bridge_input_devices.h
new file mode 100644
index 0000000000000000000000000000000000000000..91607df4669d32fd5961fc28f4086e60f0dd6d61
--- /dev/null
+++ b/components/arc/arc_bridge_input_devices.h
@@ -0,0 +1,73 @@
+#ifndef CHROMEOS_ARC_BRIDGE_INPUT_DEVICES_H_
jochen (gone - plz use gerrit) 2015/11/17 15:03:44 COMPONENTS_ARC_ARC_BRIDGE_INPUT_DEVICES_H_ also,
denniskempin 2015/11/19 19:22:08 Done. respective macro on new file in exo
+#define CHROMEOS_ARC_BRIDGE_INPUT_DEVICES_H_
+
+#include "base/files/scoped_file.h"
+#include "base/macros.h"
+#include "base/memory/scoped_vector.h"
+#include "ui/events/event.h"
+#include "ui/events/event_handler.h"
+
+#include <linux/types.h>
+
+namespace arc {
+
+class BridgeInputDevice : public ui::EventHandler {
+ public:
+ BridgeInputDevice(base::ScopedFD fd);
jochen (gone - plz use gerrit) 2015/11/17 15:03:44 explicit please add a virtual dtor
denniskempin 2015/11/19 19:22:08 Done.
+
+ // Send input_event through file descriptor.
jochen (gone - plz use gerrit) 2015/11/17 15:03:44 please document what type code and value are
denniskempin 2015/11/19 19:22:08 Done.
+ void SendEvent(base::TimeDelta time, __u16 type, __u16 code, __s32 value);
Luis Héctor Chávez 2015/11/17 17:51:53 Can you use types from stdint instead? I know we'r
denniskempin 2015/11/19 19:22:08 Done. It's the types used by the struct definition
+
+ // Shorthand for sending a SYN_REPORT input_event.
+ void SendSynReport(base::TimeDelta time);
+
+ private:
+ base::ScopedFD fd_;
+};
jochen (gone - plz use gerrit) 2015/11/17 15:03:44 disallow copy/assign
denniskempin 2015/11/19 19:22:08 Done.
+
+// BridgeInputDevice for handling keyboard events
+class KeyboardBridgeInputDevice : public BridgeInputDevice {
+ // input_event values for keyboard events
+ static const int kKeyReleased = 0;
jochen (gone - plz use gerrit) 2015/11/17 15:03:44 please move purely private constants to the cc fil
denniskempin 2015/11/19 19:22:08 Done.
+ static const int kKeyPressed = 1;
+ static const int kKeyRepeated = 2;
+
+ public:
+ KeyboardBridgeInputDevice(base::ScopedFD fd);
jochen (gone - plz use gerrit) 2015/11/17 15:03:44 explicit / dtor / disallow copy & assign - please
denniskempin 2015/11/19 19:22:08 Done.
+ void OnKeyEvent(ui::KeyEvent* event) override;
+};
+
+// BridgeInputDevice for handling mouse events
+class MouseBridgeInputDevice : public BridgeInputDevice {
+ public:
+ MouseBridgeInputDevice(base::ScopedFD fd);
+ void OnMouseEvent(ui::MouseEvent* event) override;
+
+ private:
+ void SendMouseButton(ui::MouseEvent* event,
+ int flag,
+ int evdev_code,
+ bool button_value);
+};
+
+// BridgeDevice for handling touch events
+class TouchscreenBridgeInputDevice : public BridgeInputDevice {
+ static const int kEmptySlot = -1;
+ static const int kMaxSlots = 32;
+
+ public:
+ TouchscreenBridgeInputDevice(base::ScopedFD fd);
+ virtual void OnTouchEvent(ui::TouchEvent* event) override;
+
+ private:
+ // Manages available slot id's and returns slot assigned to this touch event.
+ int AcquireSlot(ui::TouchEvent* event);
+ // Locates slot for tracking id
+ int FindSlot(int tracking_id);
+
+ std::vector<int> current_slot_tracking_ids_;
+ int current_slot_;
+};
+}
+
+#endif // CHROMEOS_ARC_BRIDGE_INPUT_DEVICES_H_

Powered by Google App Engine
This is Rietveld 408576698