OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 private: | 145 private: |
146 // Overridden from InputDeviceSettings. | 146 // Overridden from InputDeviceSettings. |
147 virtual void TouchpadExists(const DeviceExistsCallback& callback) OVERRIDE; | 147 virtual void TouchpadExists(const DeviceExistsCallback& callback) OVERRIDE; |
148 virtual void UpdateTouchpadSettings(const TouchpadSettings& settings) | 148 virtual void UpdateTouchpadSettings(const TouchpadSettings& settings) |
149 OVERRIDE; | 149 OVERRIDE; |
150 virtual void SetTouchpadSensitivity(int value) OVERRIDE; | 150 virtual void SetTouchpadSensitivity(int value) OVERRIDE; |
151 virtual void SetTapToClick(bool enabled) OVERRIDE; | 151 virtual void SetTapToClick(bool enabled) OVERRIDE; |
152 virtual void SetThreeFingerClick(bool enabled) OVERRIDE; | 152 virtual void SetThreeFingerClick(bool enabled) OVERRIDE; |
153 virtual void SetTapDragging(bool enabled) OVERRIDE; | 153 virtual void SetTapDragging(bool enabled) OVERRIDE; |
| 154 virtual void SetNaturalScroll(bool enabled) OVERRIDE; |
154 virtual void MouseExists(const DeviceExistsCallback& callback) OVERRIDE; | 155 virtual void MouseExists(const DeviceExistsCallback& callback) OVERRIDE; |
155 virtual void UpdateMouseSettings(const MouseSettings& update) OVERRIDE; | 156 virtual void UpdateMouseSettings(const MouseSettings& update) OVERRIDE; |
156 virtual void SetMouseSensitivity(int value) OVERRIDE; | 157 virtual void SetMouseSensitivity(int value) OVERRIDE; |
157 virtual void SetPrimaryButtonRight(bool right) OVERRIDE; | 158 virtual void SetPrimaryButtonRight(bool right) OVERRIDE; |
158 virtual bool ForceKeyboardDrivenUINavigation() OVERRIDE; | 159 virtual bool ForceKeyboardDrivenUINavigation() OVERRIDE; |
159 virtual void ReapplyTouchpadSettings() OVERRIDE; | 160 virtual void ReapplyTouchpadSettings() OVERRIDE; |
160 virtual void ReapplyMouseSettings() OVERRIDE; | 161 virtual void ReapplyMouseSettings() OVERRIDE; |
161 | 162 |
162 private: | 163 private: |
163 TouchpadSettings current_touchpad_settings_; | 164 TouchpadSettings current_touchpad_settings_; |
(...skipping 15 matching lines...) Expand all Loading... |
179 if (current_touchpad_settings_.Update(settings, &argv)) | 180 if (current_touchpad_settings_.Update(settings, &argv)) |
180 ExecuteScript(argv); | 181 ExecuteScript(argv); |
181 } | 182 } |
182 | 183 |
183 void InputDeviceSettingsImpl::SetTouchpadSensitivity(int value) { | 184 void InputDeviceSettingsImpl::SetTouchpadSensitivity(int value) { |
184 TouchpadSettings settings; | 185 TouchpadSettings settings; |
185 settings.SetSensitivity(value); | 186 settings.SetSensitivity(value); |
186 UpdateTouchpadSettings(settings); | 187 UpdateTouchpadSettings(settings); |
187 } | 188 } |
188 | 189 |
| 190 void InputDeviceSettingsImpl::SetNaturalScroll(bool enabled) { |
| 191 TouchpadSettings settings; |
| 192 settings.SetNaturalScroll(enabled); |
| 193 UpdateTouchpadSettings(settings); |
| 194 } |
| 195 |
189 void InputDeviceSettingsImpl::SetTapToClick(bool enabled) { | 196 void InputDeviceSettingsImpl::SetTapToClick(bool enabled) { |
190 TouchpadSettings settings; | 197 TouchpadSettings settings; |
191 settings.SetTapToClick(enabled); | 198 settings.SetTapToClick(enabled); |
192 UpdateTouchpadSettings(settings); | 199 UpdateTouchpadSettings(settings); |
193 } | 200 } |
194 | 201 |
195 void InputDeviceSettingsImpl::SetThreeFingerClick(bool enabled) { | 202 void InputDeviceSettingsImpl::SetThreeFingerClick(bool enabled) { |
196 // For Alex/ZGB. | 203 // For Alex/ZGB. |
197 TouchpadSettings settings; | 204 TouchpadSettings settings; |
198 settings.SetThreeFingerClick(enabled); | 205 settings.SetThreeFingerClick(enabled); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } // namespace | 276 } // namespace |
270 | 277 |
271 TouchpadSettings::TouchpadSettings() {} | 278 TouchpadSettings::TouchpadSettings() {} |
272 | 279 |
273 TouchpadSettings& TouchpadSettings::operator=(const TouchpadSettings& other) { | 280 TouchpadSettings& TouchpadSettings::operator=(const TouchpadSettings& other) { |
274 if (&other != this) { | 281 if (&other != this) { |
275 sensitivity_ = other.sensitivity_; | 282 sensitivity_ = other.sensitivity_; |
276 tap_to_click_ = other.tap_to_click_; | 283 tap_to_click_ = other.tap_to_click_; |
277 three_finger_click_ = other.three_finger_click_; | 284 three_finger_click_ = other.three_finger_click_; |
278 tap_dragging_ = other.tap_dragging_; | 285 tap_dragging_ = other.tap_dragging_; |
| 286 natural_scroll_ = other.natural_scroll_; |
279 } | 287 } |
280 return *this; | 288 return *this; |
281 } | 289 } |
282 | 290 |
283 void TouchpadSettings::SetSensitivity(int value) { | 291 void TouchpadSettings::SetSensitivity(int value) { |
284 sensitivity_.Set(value); | 292 sensitivity_.Set(value); |
285 } | 293 } |
286 | 294 |
287 int TouchpadSettings::GetSensitivity() const { | 295 int TouchpadSettings::GetSensitivity() const { |
288 return sensitivity_.value(); | 296 return sensitivity_.value(); |
289 } | 297 } |
290 | 298 |
291 void TouchpadSettings::SetTapToClick(bool enabled) { | 299 void TouchpadSettings::SetTapToClick(bool enabled) { |
292 tap_to_click_.Set(enabled); | 300 tap_to_click_.Set(enabled); |
293 } | 301 } |
294 | 302 |
295 bool TouchpadSettings::GetTapToClick() const { | 303 bool TouchpadSettings::GetTapToClick() const { |
296 return tap_to_click_.value(); | 304 return tap_to_click_.value(); |
297 } | 305 } |
298 | 306 |
| 307 void TouchpadSettings::SetNaturalScroll(bool enabled) { |
| 308 natural_scroll_.Set(enabled); |
| 309 } |
| 310 |
| 311 bool TouchpadSettings::GetNaturalScroll() const { |
| 312 return natural_scroll_.value(); |
| 313 } |
| 314 |
299 void TouchpadSettings::SetThreeFingerClick(bool enabled) { | 315 void TouchpadSettings::SetThreeFingerClick(bool enabled) { |
300 three_finger_click_.Set(enabled); | 316 three_finger_click_.Set(enabled); |
301 } | 317 } |
302 | 318 |
303 bool TouchpadSettings::GetThreeFingerClick() const { | 319 bool TouchpadSettings::GetThreeFingerClick() const { |
304 return three_finger_click_.value(); | 320 return three_finger_click_.value(); |
305 } | 321 } |
306 | 322 |
307 void TouchpadSettings::SetTapDragging(bool enabled) { | 323 void TouchpadSettings::SetTapDragging(bool enabled) { |
308 tap_dragging_.Set(enabled); | 324 tap_dragging_.Set(enabled); |
(...skipping 23 matching lines...) Expand all Loading... |
332 if (argv) | 348 if (argv) |
333 AddTPControlArguments("t5r2_three_finger_click", | 349 AddTPControlArguments("t5r2_three_finger_click", |
334 three_finger_click_.value(), | 350 three_finger_click_.value(), |
335 argv); | 351 argv); |
336 } | 352 } |
337 if (tap_dragging_.Update(settings.tap_dragging_)) { | 353 if (tap_dragging_.Update(settings.tap_dragging_)) { |
338 updated = true; | 354 updated = true; |
339 if (argv) | 355 if (argv) |
340 AddTPControlArguments("tapdrag", tap_dragging_.value(), argv); | 356 AddTPControlArguments("tapdrag", tap_dragging_.value(), argv); |
341 } | 357 } |
| 358 if (natural_scroll_.Update(settings.natural_scroll_)) { |
| 359 updated = true; |
| 360 if (argv) |
| 361 AddTPControlArguments("australian_scrolling", natural_scroll_.value(), |
| 362 argv); |
| 363 } |
342 return updated; | 364 return updated; |
343 } | 365 } |
344 | 366 |
345 MouseSettings::MouseSettings() {} | 367 MouseSettings::MouseSettings() {} |
346 | 368 |
347 MouseSettings& MouseSettings::operator=(const MouseSettings& other) { | 369 MouseSettings& MouseSettings::operator=(const MouseSettings& other) { |
348 if (&other != this) { | 370 if (&other != this) { |
349 sensitivity_ = other.sensitivity_; | 371 sensitivity_ = other.sensitivity_; |
350 primary_button_right_ = other.primary_button_right_; | 372 primary_button_right_ = other.primary_button_right_; |
351 } | 373 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 void InputDeviceSettings::SetSettingsForTesting( | 423 void InputDeviceSettings::SetSettingsForTesting( |
402 InputDeviceSettings* test_settings) { | 424 InputDeviceSettings* test_settings) { |
403 if (g_test_instance_ == test_settings) | 425 if (g_test_instance_ == test_settings) |
404 return; | 426 return; |
405 delete g_test_instance_; | 427 delete g_test_instance_; |
406 g_test_instance_ = test_settings; | 428 g_test_instance_ = test_settings; |
407 } | 429 } |
408 | 430 |
409 } // namespace system | 431 } // namespace system |
410 } // namespace chromeos | 432 } // namespace chromeos |
OLD | NEW |