Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4090)

Unified Diff: chrome/browser/chromeos/system/input_device_settings.cc

Issue 2533373002: Enabled/disable touch screen in TabletPowerButtonController (Closed)
Patch Set: touch_screen_status Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..fcd3557b234eb05aea436456cd131a05b68d556e 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();
const bool touch_pad_status =
user_prefs->HasPrefPath(::prefs::kTouchPadEnabled)
@@ -263,15 +260,22 @@ void InputDeviceSettings::ToggleTouchscreen() {
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();
user_prefs->SetBoolean(::prefs::kTouchScreenEnabled, !touch_screen_status);
SetTouchscreensEnabled(!touch_screen_status);
}
+bool InputDeviceSettings::IsTouchscreenEnabled() const {
+ PrefService* user_prefs = GetActiveProfilePrefs();
+ if (!user_prefs)
+ return true;
+
+ return user_prefs->HasPrefPath(::prefs::kTouchScreenEnabled)
+ ? user_prefs->GetBoolean(::prefs::kTouchScreenEnabled)
+ : true;
+}
+
void InputDeviceSettings::ToggleTouchpad() {
PrefService* user_prefs = GetActiveProfilePrefs();
if (!user_prefs)

Powered by Google App Engine
This is Rietveld 408576698