OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef UI_EVENTS_OZONE_EVDEV_INPUT_CONTROLLER_EVDEV_H_ |
| 6 #define UI_EVENTS_OZONE_EVDEV_INPUT_CONTROLLER_EVDEV_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
| 13 #include "ui/events/ozone/evdev/input_device_settings_evdev.h" |
| 14 #include "ui/ozone/public/input_controller.h" |
| 15 |
| 16 namespace ui { |
| 17 |
| 18 class InputDeviceFactoryEvdevProxy; |
| 19 class KeyboardEvdev; |
| 20 class MouseButtonMapEvdev; |
| 21 |
| 22 // Ozone InputController implementation for the Linux input subsystem ("evdev"). |
| 23 class EVENTS_OZONE_EVDEV_EXPORT InputControllerEvdev : public InputController { |
| 24 public: |
| 25 InputControllerEvdev(KeyboardEvdev* keyboard, |
| 26 MouseButtonMapEvdev* button_map); |
| 27 ~InputControllerEvdev() override; |
| 28 |
| 29 // Initialize device factory. This would be in the constructor if it was |
| 30 // built early enough for that to be possible. |
| 31 void SetInputDeviceFactory( |
| 32 InputDeviceFactoryEvdevProxy* input_device_factory); |
| 33 |
| 34 void set_has_mouse(bool has_mouse); |
| 35 void set_has_touchpad(bool has_touchpad); |
| 36 |
| 37 void SetInputDevicesEnabled(bool enabled); |
| 38 |
| 39 // InputController: |
| 40 bool HasMouse() override; |
| 41 bool HasTouchpad() override; |
| 42 bool IsCapsLockEnabled() override; |
| 43 void SetCapsLockEnabled(bool enabled) override; |
| 44 void SetNumLockEnabled(bool enabled) override; |
| 45 bool IsAutoRepeatEnabled() override; |
| 46 void SetAutoRepeatEnabled(bool enabled) override; |
| 47 void SetAutoRepeatRate(const base::TimeDelta& delay, |
| 48 const base::TimeDelta& interval) override; |
| 49 void GetAutoRepeatRate(base::TimeDelta* delay, |
| 50 base::TimeDelta* interval) override; |
| 51 void SetTouchpadSensitivity(int value) override; |
| 52 void SetTapToClick(bool enabled) override; |
| 53 void SetThreeFingerClick(bool enabled) override; |
| 54 void SetTapDragging(bool enabled) override; |
| 55 void SetNaturalScroll(bool enabled) override; |
| 56 void SetMouseSensitivity(int value) override; |
| 57 void SetPrimaryButtonRight(bool right) override; |
| 58 void SetTapToClickPaused(bool state) override; |
| 59 void GetTouchDeviceStatus(const GetTouchDeviceStatusReply& reply) override; |
| 60 void GetTouchEventLog(const base::FilePath& out_dir, |
| 61 const GetTouchEventLogReply& reply) override; |
| 62 void SetInternalTouchpadEnabled(bool enabled) override; |
| 63 void SetInternalKeyboardFilter(bool enable_filter, |
| 64 std::vector<DomCode> allowed_keys) override; |
| 65 |
| 66 private: |
| 67 // Post task to update settings. |
| 68 void ScheduleUpdateDeviceSettings(); |
| 69 |
| 70 // Send settings update to input_device_factory_. |
| 71 void UpdateDeviceSettings(); |
| 72 |
| 73 // Send caps lock update to input_device_factory_. |
| 74 void UpdateCapsLockLed(); |
| 75 |
| 76 // Configuration that needs to be passed on to InputDeviceFactory. |
| 77 InputDeviceSettingsEvdev input_device_settings_; |
| 78 |
| 79 // Task to update config from input_device_settings_ is pending. |
| 80 bool settings_update_pending_ = false; |
| 81 |
| 82 // Factory for devices. Needed to update device config. |
| 83 InputDeviceFactoryEvdevProxy* input_device_factory_ = nullptr; |
| 84 |
| 85 // Keyboard state. |
| 86 KeyboardEvdev* keyboard_; |
| 87 |
| 88 // Mouse button map. |
| 89 MouseButtonMapEvdev* button_map_; |
| 90 |
| 91 // Device presence. |
| 92 bool has_mouse_ = false; |
| 93 bool has_touchpad_ = false; |
| 94 |
| 95 // LED state. |
| 96 bool caps_lock_led_state_ = false; |
| 97 |
| 98 base::WeakPtrFactory<InputControllerEvdev> weak_ptr_factory_; |
| 99 |
| 100 DISALLOW_COPY_AND_ASSIGN(InputControllerEvdev); |
| 101 }; |
| 102 |
| 103 } // namespace ui |
| 104 |
| 105 #endif // UI_EVENTS_OZONE_EVDEV_INPUT_CONTROLLER_EVDEV_H_ |
OLD | NEW |