Chromium Code Reviews| Index: chrome/browser/chromeos/system/input_device_settings.cc |
| diff --git a/chrome/browser/chromeos/system/input_device_settings.cc b/chrome/browser/chromeos/system/input_device_settings.cc |
| index eb941053623c398f05500578868c35f5f357ae43..a38795d228c9987cf94e920ea26738ec0a6a6798 100644 |
| --- a/chrome/browser/chromeos/system/input_device_settings.cc |
| +++ b/chrome/browser/chromeos/system/input_device_settings.cc |
| @@ -244,10 +244,7 @@ void InputDeviceSettings::UpdateTouchDevicesStatusFromActiveProfilePrefs() { |
| if (!user_prefs) |
| return; |
| - const bool touch_screen_status = |
| - user_prefs->HasPrefPath(::prefs::kTouchScreenEnabled) |
| - ? user_prefs->GetBoolean(::prefs::kTouchScreenEnabled) |
| - : true; |
| + const bool touch_screen_status = IsTouchscreenEnabled(); |
|
Daniel Erat
2016/11/30 22:58:07
mind just inlining this in the SetTouchscreensEnab
Qiang(Joe) Xu
2016/12/02 17:42:52
Done.
|
| const bool touch_pad_status = |
| user_prefs->HasPrefPath(::prefs::kTouchPadEnabled) |
| @@ -258,18 +255,23 @@ void InputDeviceSettings::UpdateTouchDevicesStatusFromActiveProfilePrefs() { |
| SetInternalTouchpadEnabled(touch_pad_status); |
| } |
| -void InputDeviceSettings::ToggleTouchscreen() { |
| +bool InputDeviceSettings::IsTouchscreenEnabled() const { |
|
Daniel Erat
2016/11/30 22:58:07
mind renaming this to IsTouchscreenEnabledInPrefs(
Qiang(Joe) Xu
2016/12/02 17:42:52
Done.
|
| PrefService* user_prefs = GetActiveProfilePrefs(); |
| if (!user_prefs) |
| - return; |
| + return true; |
| - const bool touch_screen_status = |
| - user_prefs->HasPrefPath(::prefs::kTouchScreenEnabled) |
| - ? user_prefs->GetBoolean(::prefs::kTouchScreenEnabled) |
| - : true; |
| + return user_prefs->HasPrefPath(::prefs::kTouchScreenEnabled) |
| + ? user_prefs->GetBoolean(::prefs::kTouchScreenEnabled) |
| + : true; |
| +} |
| + |
| +void InputDeviceSettings::SetTouchscreenEnabled(bool enabled) { |
| + PrefService* user_prefs = GetActiveProfilePrefs(); |
| + if (!user_prefs) |
| + return; |
| - user_prefs->SetBoolean(::prefs::kTouchScreenEnabled, !touch_screen_status); |
| - SetTouchscreensEnabled(!touch_screen_status); |
| + user_prefs->SetBoolean(::prefs::kTouchScreenEnabled, enabled); |
| + SetTouchscreensEnabled(enabled); |
| } |
| void InputDeviceSettings::ToggleTouchpad() { |