| 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 #include "chrome/browser/chromeos/system/input_device_settings.h" | 5 #include "chrome/browser/chromeos/system/input_device_settings.h" |
| 6 | 6 |
| 7 #include "content/public/browser/browser_thread.h" | 7 #include "content/public/browser/browser_thread.h" |
| 8 #include "ui/ozone/public/input_controller.h" | 8 #include "ui/ozone/public/input_controller.h" |
| 9 #include "ui/ozone/public/ozone_platform.h" | 9 #include "ui/ozone/public/ozone_platform.h" |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 void SetTapToClick(bool enabled) override; | 32 void SetTapToClick(bool enabled) override; |
| 33 void SetThreeFingerClick(bool enabled) override; | 33 void SetThreeFingerClick(bool enabled) override; |
| 34 void SetTapDragging(bool enabled) override; | 34 void SetTapDragging(bool enabled) override; |
| 35 void SetNaturalScroll(bool enabled) override; | 35 void SetNaturalScroll(bool enabled) override; |
| 36 void MouseExists(const DeviceExistsCallback& callback) override; | 36 void MouseExists(const DeviceExistsCallback& callback) override; |
| 37 void UpdateMouseSettings(const MouseSettings& settings) override; | 37 void UpdateMouseSettings(const MouseSettings& settings) override; |
| 38 void SetMouseSensitivity(int value) override; | 38 void SetMouseSensitivity(int value) override; |
| 39 void SetPrimaryButtonRight(bool right) override; | 39 void SetPrimaryButtonRight(bool right) override; |
| 40 void ReapplyTouchpadSettings() override; | 40 void ReapplyTouchpadSettings() override; |
| 41 void ReapplyMouseSettings() override; | 41 void ReapplyMouseSettings() override; |
| 42 void SetInternalTouchpadEnabled(bool enabled) override; |
| 43 void SetTouchscreensEnabled(bool enabled) override; |
| 42 | 44 |
| 43 // Cached InputController pointer. It should be fixed throughout the browser | 45 // Cached InputController pointer. It should be fixed throughout the browser |
| 44 // session. | 46 // session. |
| 45 ui::InputController* input_controller_; | 47 ui::InputController* input_controller_; |
| 46 | 48 |
| 47 // Respective device setting objects. | 49 // Respective device setting objects. |
| 48 TouchpadSettings current_touchpad_settings_; | 50 TouchpadSettings current_touchpad_settings_; |
| 49 MouseSettings current_mouse_settings_; | 51 MouseSettings current_mouse_settings_; |
| 50 | 52 |
| 51 DISALLOW_COPY_AND_ASSIGN(InputDeviceSettingsImplOzone); | 53 DISALLOW_COPY_AND_ASSIGN(InputDeviceSettingsImplOzone); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 123 } |
| 122 | 124 |
| 123 void InputDeviceSettingsImplOzone::ReapplyTouchpadSettings() { | 125 void InputDeviceSettingsImplOzone::ReapplyTouchpadSettings() { |
| 124 TouchpadSettings::Apply(current_touchpad_settings_, this); | 126 TouchpadSettings::Apply(current_touchpad_settings_, this); |
| 125 } | 127 } |
| 126 | 128 |
| 127 void InputDeviceSettingsImplOzone::ReapplyMouseSettings() { | 129 void InputDeviceSettingsImplOzone::ReapplyMouseSettings() { |
| 128 MouseSettings::Apply(current_mouse_settings_, this); | 130 MouseSettings::Apply(current_mouse_settings_, this); |
| 129 } | 131 } |
| 130 | 132 |
| 133 void InputDeviceSettingsImplOzone::SetInternalTouchpadEnabled(bool enabled) { |
| 134 input_controller_->SetInternalTouchpadEnabled(enabled); |
| 135 } |
| 136 |
| 137 void InputDeviceSettingsImplOzone::SetTouchscreensEnabled(bool enabled) { |
| 138 input_controller_->SetTouchscreensEnabled(enabled); |
| 139 } |
| 140 |
| 131 } // namespace | 141 } // namespace |
| 132 | 142 |
| 133 // static | 143 // static |
| 134 InputDeviceSettings* InputDeviceSettings::Get() { | 144 InputDeviceSettings* InputDeviceSettings::Get() { |
| 135 if (g_test_instance) | 145 if (g_test_instance) |
| 136 return g_test_instance; | 146 return g_test_instance; |
| 137 if (!g_instance) | 147 if (!g_instance) |
| 138 g_instance = new InputDeviceSettingsImplOzone; | 148 g_instance = new InputDeviceSettingsImplOzone; |
| 139 return g_instance; | 149 return g_instance; |
| 140 } | 150 } |
| 141 | 151 |
| 142 // static | 152 // static |
| 143 void InputDeviceSettings::SetSettingsForTesting( | 153 void InputDeviceSettings::SetSettingsForTesting( |
| 144 InputDeviceSettings* test_settings) { | 154 InputDeviceSettings* test_settings) { |
| 145 if (g_test_instance == test_settings) | 155 if (g_test_instance == test_settings) |
| 146 return; | 156 return; |
| 147 delete g_test_instance; | 157 delete g_test_instance; |
| 148 g_test_instance = test_settings; | 158 g_test_instance = test_settings; |
| 149 } | 159 } |
| 150 | 160 |
| 151 } // namespace system | 161 } // namespace system |
| 152 } // namespace chromeos | 162 } // namespace chromeos |
| OLD | NEW |