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