OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_OZONE_PUBLIC_INPUT_CONTROLLER_H_ | 5 #ifndef UI_OZONE_PUBLIC_INPUT_CONTROLLER_H_ |
6 #define UI_OZONE_PUBLIC_INPUT_CONTROLLER_H_ | 6 #define UI_OZONE_PUBLIC_INPUT_CONTROLLER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
| 9 #include <string> |
9 | 10 |
| 11 #include "base/callback.h" |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
12 #include "ui/ozone/ozone_export.h" | 14 #include "ui/ozone/ozone_export.h" |
13 | 15 |
14 namespace base { | 16 namespace base { |
15 class TimeDelta; | 17 class TimeDelta; |
16 } | 18 } |
17 | 19 |
18 namespace ui { | 20 namespace ui { |
19 | 21 |
20 enum class DomCode; | 22 enum class DomCode; |
21 | 23 |
22 // Platform-specific interface for controlling input devices. | 24 // Platform-specific interface for controlling input devices. |
23 // | 25 // |
24 // The object provides methods for the preference page to configure input | 26 // The object provides methods for the preference page to configure input |
25 // devices w.r.t. the user setting. On ChromeOS, this replaces the inputcontrol | 27 // devices w.r.t. the user setting. On ChromeOS, this replaces the inputcontrol |
26 // script that is originally located at /opt/google/chrome/. | 28 // script that is originally located at /opt/google/chrome/. |
27 class OZONE_EXPORT InputController { | 29 class OZONE_EXPORT InputController { |
28 public: | 30 public: |
| 31 typedef base::Callback<void(scoped_ptr<std::string>)> |
| 32 GetTouchDeviceStatusReply; |
| 33 |
29 InputController() {} | 34 InputController() {} |
30 virtual ~InputController() {} | 35 virtual ~InputController() {} |
31 | 36 |
32 // Functions for checking devices existence. | 37 // Functions for checking devices existence. |
33 virtual bool HasMouse() = 0; | 38 virtual bool HasMouse() = 0; |
34 virtual bool HasTouchpad() = 0; | 39 virtual bool HasTouchpad() = 0; |
35 | 40 |
36 // Keyboard settings. | 41 // Keyboard settings. |
37 virtual bool IsCapsLockEnabled() = 0; | 42 virtual bool IsCapsLockEnabled() = 0; |
38 virtual void SetCapsLockEnabled(bool enabled) = 0; | 43 virtual void SetCapsLockEnabled(bool enabled) = 0; |
39 virtual void SetNumLockEnabled(bool enabled) = 0; | 44 virtual void SetNumLockEnabled(bool enabled) = 0; |
40 virtual bool IsAutoRepeatEnabled() = 0; | 45 virtual bool IsAutoRepeatEnabled() = 0; |
41 virtual void SetAutoRepeatEnabled(bool enabled) = 0; | 46 virtual void SetAutoRepeatEnabled(bool enabled) = 0; |
42 virtual void SetAutoRepeatRate(const base::TimeDelta& delay, | 47 virtual void SetAutoRepeatRate(const base::TimeDelta& delay, |
43 const base::TimeDelta& interval) = 0; | 48 const base::TimeDelta& interval) = 0; |
44 virtual void GetAutoRepeatRate(base::TimeDelta* delay, | 49 virtual void GetAutoRepeatRate(base::TimeDelta* delay, |
45 base::TimeDelta* interval) = 0; | 50 base::TimeDelta* interval) = 0; |
46 | 51 |
47 // Touchpad settings. | 52 // Touchpad settings. |
48 virtual void SetTouchpadSensitivity(int value) = 0; | 53 virtual void SetTouchpadSensitivity(int value) = 0; |
49 virtual void SetTapToClick(bool enabled) = 0; | 54 virtual void SetTapToClick(bool enabled) = 0; |
50 virtual void SetThreeFingerClick(bool enabled) = 0; | 55 virtual void SetThreeFingerClick(bool enabled) = 0; |
51 virtual void SetTapDragging(bool enabled) = 0; | 56 virtual void SetTapDragging(bool enabled) = 0; |
52 virtual void SetNaturalScroll(bool enabled) = 0; | 57 virtual void SetNaturalScroll(bool enabled) = 0; |
53 | 58 |
54 // Mouse settings. | 59 // Mouse settings. |
55 virtual void SetMouseSensitivity(int value) = 0; | 60 virtual void SetMouseSensitivity(int value) = 0; |
56 virtual void SetPrimaryButtonRight(bool right) = 0; | 61 virtual void SetPrimaryButtonRight(bool right) = 0; |
57 | 62 |
| 63 // Touch log collection. |
| 64 virtual void GetTouchDeviceStatus(const GetTouchDeviceStatusReply& reply) = 0; |
| 65 |
58 // Temporarily enable/disable Tap-to-click. Used to enhance the user | 66 // Temporarily enable/disable Tap-to-click. Used to enhance the user |
59 // experience in some use cases (e.g., typing, watching video). | 67 // experience in some use cases (e.g., typing, watching video). |
60 virtual void SetTapToClickPaused(bool state) = 0; | 68 virtual void SetTapToClickPaused(bool state) = 0; |
61 | 69 |
62 // Disables the internal touchpad. | 70 // Disables the internal touchpad. |
63 virtual void DisableInternalTouchpad() = 0; | 71 virtual void DisableInternalTouchpad() = 0; |
64 | 72 |
65 // Enables the internal touchpad. | 73 // Enables the internal touchpad. |
66 virtual void EnableInternalTouchpad() = 0; | 74 virtual void EnableInternalTouchpad() = 0; |
67 | 75 |
68 // Disables all keys on the internal keyboard except |excepted_keys|. | 76 // Disables all keys on the internal keyboard except |excepted_keys|. |
69 virtual void DisableInternalKeyboardExceptKeys( | 77 virtual void DisableInternalKeyboardExceptKeys( |
70 scoped_ptr<std::set<DomCode>> excepted_keys) = 0; | 78 scoped_ptr<std::set<DomCode>> excepted_keys) = 0; |
71 | 79 |
72 // Enables all keys on the internal keyboard. | 80 // Enables all keys on the internal keyboard. |
73 virtual void EnableInternalKeyboard() = 0; | 81 virtual void EnableInternalKeyboard() = 0; |
74 | 82 |
75 private: | 83 private: |
76 DISALLOW_COPY_AND_ASSIGN(InputController); | 84 DISALLOW_COPY_AND_ASSIGN(InputController); |
77 }; | 85 }; |
78 | 86 |
79 // Create an input controller that does nothing. | 87 // Create an input controller that does nothing. |
80 OZONE_EXPORT scoped_ptr<InputController> CreateStubInputController(); | 88 OZONE_EXPORT scoped_ptr<InputController> CreateStubInputController(); |
81 | 89 |
82 } // namespace ui | 90 } // namespace ui |
83 | 91 |
84 #endif // UI_OZONE_PUBLIC_INPUT_CONTROLLER_H_ | 92 #endif // UI_OZONE_PUBLIC_INPUT_CONTROLLER_H_ |
OLD | NEW |