Chromium Code Reviews| OLD | NEW | 
|---|---|
| (Empty) | |
| 1 #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
 
 | |
| 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); | |
| 
 
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.
 
 | |
| 17 | |
| 18 // 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.
 
 | |
| 19 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
 
 | |
| 20 | |
| 21 // Shorthand for sending a SYN_REPORT input_event. | |
| 22 void SendSynReport(base::TimeDelta time); | |
| 23 | |
| 24 private: | |
| 25 base::ScopedFD fd_; | |
| 26 }; | |
| 
 
jochen (gone - plz use gerrit)
2015/11/17 15:03:44
disallow copy/assign
 
denniskempin
2015/11/19 19:22:08
Done.
 
 | |
| 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; | |
| 
 
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.
 
 | |
| 32 static const int kKeyPressed = 1; | |
| 33 static const int kKeyRepeated = 2; | |
| 34 | |
| 35 public: | |
| 36 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.
 
 | |
| 37 void OnKeyEvent(ui::KeyEvent* event) override; | |
| 38 }; | |
| 39 | |
| 40 // BridgeInputDevice for handling mouse events | |
| 41 class MouseBridgeInputDevice : public BridgeInputDevice { | |
| 42 public: | |
| 43 MouseBridgeInputDevice(base::ScopedFD fd); | |
| 44 void OnMouseEvent(ui::MouseEvent* event) override; | |
| 45 | |
| 46 private: | |
| 47 void SendMouseButton(ui::MouseEvent* event, | |
| 48 int flag, | |
| 49 int evdev_code, | |
| 50 bool button_value); | |
| 51 }; | |
| 52 | |
| 53 // BridgeDevice for handling touch events | |
| 54 class TouchscreenBridgeInputDevice : public BridgeInputDevice { | |
| 55 static const int kEmptySlot = -1; | |
| 56 static const int kMaxSlots = 32; | |
| 57 | |
| 58 public: | |
| 59 TouchscreenBridgeInputDevice(base::ScopedFD fd); | |
| 60 virtual void OnTouchEvent(ui::TouchEvent* event) override; | |
| 61 | |
| 62 private: | |
| 63 // Manages available slot id's and returns slot assigned to this touch event. | |
| 64 int AcquireSlot(ui::TouchEvent* event); | |
| 65 // Locates slot for tracking id | |
| 66 int FindSlot(int tracking_id); | |
| 67 | |
| 68 std::vector<int> current_slot_tracking_ids_; | |
| 69 int current_slot_; | |
| 70 }; | |
| 71 } | |
| 72 | |
| 73 #endif // CHROMEOS_ARC_BRIDGE_INPUT_DEVICES_H_ | |
| OLD | NEW |