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

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

Issue 2533373002: Enabled/disable touch screen in TabletPowerButtonController (Closed)
Patch Set: add SetTouchscreenEnabled and OnLoginStateChanged Created 4 years 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..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() {

Powered by Google App Engine
This is Rietveld 408576698