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.
5 #ifndef UI_EVENTS_OZONE_EVDEV_INPUT_CONTROLLER_EVDEV_H_
6 #define UI_EVENTS_OZONE_EVDEV_INPUT_CONTROLLER_EVDEV_H_
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"
18 class InputDeviceFactoryEvdevProxy
;
20 class MouseButtonMapEvdev
;
22 // Ozone InputController implementation for the Linux input subsystem ("evdev").
23 class EVENTS_OZONE_EVDEV_EXPORT InputControllerEvdev
: public InputController
{
25 InputControllerEvdev(KeyboardEvdev
* keyboard
,
26 MouseButtonMapEvdev
* button_map
);
27 ~InputControllerEvdev() override
;
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
);
34 void set_has_mouse(bool has_mouse
);
35 void set_has_touchpad(bool has_touchpad
);
38 bool HasMouse() override
;
39 bool HasTouchpad() override
;
40 bool IsCapsLockEnabled() override
;
41 void SetCapsLockEnabled(bool enabled
) override
;
42 void SetNumLockEnabled(bool enabled
) override
;
43 bool IsAutoRepeatEnabled() override
;
44 void SetAutoRepeatEnabled(bool enabled
) override
;
45 void SetAutoRepeatRate(const base::TimeDelta
& delay
,
46 const base::TimeDelta
& interval
) override
;
47 void GetAutoRepeatRate(base::TimeDelta
* delay
,
48 base::TimeDelta
* interval
) override
;
49 void SetTouchpadSensitivity(int value
) override
;
50 void SetTapToClick(bool enabled
) override
;
51 void SetThreeFingerClick(bool enabled
) override
;
52 void SetTapDragging(bool enabled
) override
;
53 void SetNaturalScroll(bool enabled
) override
;
54 void SetMouseSensitivity(int value
) override
;
55 void SetPrimaryButtonRight(bool right
) override
;
56 void SetTapToClickPaused(bool state
) override
;
57 void GetTouchDeviceStatus(const GetTouchDeviceStatusReply
& reply
) override
;
58 void GetTouchEventLog(const base::FilePath
& out_dir
,
59 const GetTouchEventLogReply
& reply
) override
;
60 void DisableInternalTouchpad() override
;
61 void EnableInternalTouchpad() override
;
62 void DisableInternalKeyboardExceptKeys(
63 scoped_ptr
<std::set
<DomCode
>> excepted_keys
) override
;
64 void EnableInternalKeyboard() override
;
67 // Post task to update settings.
68 void ScheduleUpdateDeviceSettings();
70 // Send settings update to input_device_factory_.
71 void UpdateDeviceSettings();
73 // Send caps lock update to input_device_factory_.
74 void UpdateCapsLockLed();
76 // Configuration that needs to be passed on to InputDeviceFactory.
77 InputDeviceSettingsEvdev input_device_settings_
;
79 // Task to update config from input_device_settings_ is pending.
80 bool settings_update_pending_
;
82 // Factory for devices. Needed to update device config.
83 InputDeviceFactoryEvdevProxy
* input_device_factory_
;
86 KeyboardEvdev
* keyboard_
;
89 MouseButtonMapEvdev
* button_map_
;
96 bool caps_lock_led_state_
;
98 base::WeakPtrFactory
<InputControllerEvdev
> weak_ptr_factory_
;
100 DISALLOW_COPY_AND_ASSIGN(InputControllerEvdev
);
105 #endif // UI_EVENTS_OZONE_EVDEV_INPUT_CONTROLLER_EVDEV_H_