OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef UI_OZONE_PUBLIC_INPUT_CONTROLLER_H_ |
| 6 #define UI_OZONE_PUBLIC_INPUT_CONTROLLER_H_ |
| 7 |
| 8 #include <set> |
| 9 #include <string> |
| 10 #include <vector> |
| 11 |
| 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" |
| 17 |
| 18 namespace base { |
| 19 class TimeDelta; |
| 20 } |
| 21 |
| 22 namespace ui { |
| 23 |
| 24 enum class DomCode; |
| 25 |
| 26 // Platform-specific interface for controlling input devices. |
| 27 // |
| 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; |
| 37 |
| 38 InputController() {} |
| 39 virtual ~InputController() {} |
| 40 |
| 41 // Functions for checking devices existence. |
| 42 virtual bool HasMouse() = 0; |
| 43 virtual bool HasTouchpad() = 0; |
| 44 |
| 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; |
| 55 |
| 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; |
| 62 |
| 63 // Mouse settings. |
| 64 virtual void SetMouseSensitivity(int value) = 0; |
| 65 virtual void SetPrimaryButtonRight(bool right) = 0; |
| 66 |
| 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 |
| 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; |
| 75 |
| 76 virtual void SetInternalTouchpadEnabled(bool enabled) = 0; |
| 77 |
| 78 // If |enable_filter| is true, all keys on the internal keyboard except |
| 79 // |allowed_keys| are disabled. |
| 80 virtual void SetInternalKeyboardFilter(bool enable_filter, |
| 81 std::vector<DomCode> allowed_keys) = 0; |
| 82 |
| 83 private: |
| 84 DISALLOW_COPY_AND_ASSIGN(InputController); |
| 85 }; |
| 86 |
| 87 // Create an input controller that does nothing. |
| 88 OZONE_EXPORT scoped_ptr<InputController> CreateStubInputController(); |
| 89 |
| 90 } // namespace ui |
| 91 |
| 92 #endif // UI_OZONE_PUBLIC_INPUT_CONTROLLER_H_ |
OLD | NEW |