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_OZONE_PUBLIC_INPUT_CONTROLLER_H_
6 #define UI_OZONE_PUBLIC_INPUT_CONTROLLER_H_
12 #include "base/callback.h"
13 #include "base/files/file_path.h"
14 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "ui/ozone/ozone_export.h"
26 // Platform-specific interface for controlling input devices.
28 // The object provides methods for the preference page to configure input
29 // devices w.r.t. the user setting. On ChromeOS, this replaces the inputcontrol
30 // script that is originally located at /opt/google/chrome/.
31 class OZONE_EXPORT InputController
{
33 typedef base::Callback
<void(scoped_ptr
<std::string
>)>
34 GetTouchDeviceStatusReply
;
35 typedef base::Callback
<void(scoped_ptr
<std::vector
<base::FilePath
>>)>
36 GetTouchEventLogReply
;
39 virtual ~InputController() {}
41 // Functions for checking devices existence.
42 virtual bool HasMouse() = 0;
43 virtual bool HasTouchpad() = 0;
46 virtual bool IsCapsLockEnabled() = 0;
47 virtual void SetCapsLockEnabled(bool enabled
) = 0;
48 virtual void SetNumLockEnabled(bool enabled
) = 0;
49 virtual bool IsAutoRepeatEnabled() = 0;
50 virtual void SetAutoRepeatEnabled(bool enabled
) = 0;
51 virtual void SetAutoRepeatRate(const base::TimeDelta
& delay
,
52 const base::TimeDelta
& interval
) = 0;
53 virtual void GetAutoRepeatRate(base::TimeDelta
* delay
,
54 base::TimeDelta
* interval
) = 0;
57 virtual void SetTouchpadSensitivity(int value
) = 0;
58 virtual void SetTapToClick(bool enabled
) = 0;
59 virtual void SetThreeFingerClick(bool enabled
) = 0;
60 virtual void SetTapDragging(bool enabled
) = 0;
61 virtual void SetNaturalScroll(bool enabled
) = 0;
64 virtual void SetMouseSensitivity(int value
) = 0;
65 virtual void SetPrimaryButtonRight(bool right
) = 0;
67 // Touch log collection.
68 virtual void GetTouchDeviceStatus(const GetTouchDeviceStatusReply
& reply
) = 0;
69 virtual void GetTouchEventLog(const base::FilePath
& out_dir
,
70 const GetTouchEventLogReply
& reply
) = 0;
72 // Temporarily enable/disable Tap-to-click. Used to enhance the user
73 // experience in some use cases (e.g., typing, watching video).
74 virtual void SetTapToClickPaused(bool state
) = 0;
76 // Disables the internal touchpad.
77 virtual void DisableInternalTouchpad() = 0;
79 // Enables the internal touchpad.
80 virtual void EnableInternalTouchpad() = 0;
82 // Disables all keys on the internal keyboard except |excepted_keys|.
83 virtual void DisableInternalKeyboardExceptKeys(
84 scoped_ptr
<std::set
<DomCode
>> excepted_keys
) = 0;
86 // Enables all keys on the internal keyboard.
87 virtual void EnableInternalKeyboard() = 0;
90 DISALLOW_COPY_AND_ASSIGN(InputController
);
93 // Create an input controller that does nothing.
94 OZONE_EXPORT scoped_ptr
<InputController
> CreateStubInputController();
98 #endif // UI_OZONE_PUBLIC_INPUT_CONTROLLER_H_