Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / ozone / public / input_controller.h
blobbb7e9d22172e4fd0c5f207c69721ee2069476555
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_
8 #include <set>
9 #include <string>
10 #include <vector>
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"
18 namespace base {
19 class TimeDelta;
22 namespace ui {
24 enum class DomCode;
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 {
32 public:
33 typedef base::Callback<void(scoped_ptr<std::string>)>
34 GetTouchDeviceStatusReply;
35 typedef base::Callback<void(scoped_ptr<std::vector<base::FilePath>>)>
36 GetTouchEventLogReply;
38 InputController() {}
39 virtual ~InputController() {}
41 // Functions for checking devices existence.
42 virtual bool HasMouse() = 0;
43 virtual bool HasTouchpad() = 0;
45 // Keyboard settings.
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;
56 // Touchpad settings.
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;
63 // Mouse settings.
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;
71 // Touchscreen log settings.
72 virtual void SetTouchEventLoggingEnabled(bool enabled) = 0;
74 // Temporarily enable/disable Tap-to-click. Used to enhance the user
75 // experience in some use cases (e.g., typing, watching video).
76 virtual void SetTapToClickPaused(bool state) = 0;
78 virtual void SetInternalTouchpadEnabled(bool enabled) = 0;
80 // If |enable_filter| is true, all keys on the internal keyboard except
81 // |allowed_keys| are disabled.
82 virtual void SetInternalKeyboardFilter(bool enable_filter,
83 std::vector<DomCode> allowed_keys) = 0;
85 private:
86 DISALLOW_COPY_AND_ASSIGN(InputController);
89 // Create an input controller that does nothing.
90 OZONE_EXPORT scoped_ptr<InputController> CreateStubInputController();
92 } // namespace ui
94 #endif // UI_OZONE_PUBLIC_INPUT_CONTROLLER_H_