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