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 bb738b57681c8996b87d0c9c3d2bfc4ba4dd9334..7bdeaaae25917794cc4e1139f56fde8f543e1ef7 100644 |
--- a/chrome/browser/chromeos/system/input_device_settings.cc |
+++ b/chrome/browser/chromeos/system/input_device_settings.cc |
@@ -4,10 +4,14 @@ |
#include "chrome/browser/chromeos/system/input_device_settings.h" |
+#include "base/prefs/pref_registry_simple.h" |
+#include "base/prefs/pref_service.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
#include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
+#include "chrome/common/pref_names.h" |
#include "chromeos/system/statistics_provider.h" |
+#include "ui/events/base_event_utils.h" |
namespace chromeos { |
namespace system { |
@@ -216,5 +220,51 @@ bool InputDeviceSettings::ForceKeyboardDrivenUINavigation() { |
return false; |
} |
+// static |
+void InputDeviceSettings::RegisterPrefs(PrefRegistrySimple* registry) { |
+ registry->RegisterBooleanPref(::prefs::kTouchScreenEnabled, true); |
+ registry->RegisterBooleanPref(::prefs::kTouchPadEnabled, true); |
+} |
+ |
+void InputDeviceSettings::InitTouchDevicesStatusFromLocalPrefs() { |
sadrul
2015/11/03 19:09:26
Should we really store developer-only flags in the
afakhry
2015/11/04 02:28:21
It's one of the requirements for this feature is t
|
+ PrefService* local_state = g_browser_process->local_state(); |
+ DCHECK(local_state); |
+ |
+ const bool touch_screen_status = |
+ local_state->HasPrefPath(::prefs::kTouchScreenEnabled) ? |
+ local_state->GetBoolean(::prefs::kTouchScreenEnabled) : true; |
+ |
+ const bool touch_pad_status = |
+ local_state->HasPrefPath(::prefs::kTouchPadEnabled) ? |
+ local_state->GetBoolean(::prefs::kTouchPadEnabled) : true; |
+ |
+ ui::SetTouchEventsEnabled(touch_screen_status); |
+ SetInternalTouchpadEnabled(touch_pad_status); |
+} |
+ |
+void InputDeviceSettings::ToggleTouchscreen() { |
+ PrefService* local_state = g_browser_process->local_state(); |
+ DCHECK(local_state); |
+ |
+ const bool touch_screen_status = |
+ local_state->HasPrefPath(::prefs::kTouchScreenEnabled) ? |
+ local_state->GetBoolean(::prefs::kTouchScreenEnabled) : true; |
+ |
+ local_state->SetBoolean(::prefs::kTouchScreenEnabled, !touch_screen_status); |
+ ui::SetTouchEventsEnabled(!touch_screen_status); |
+} |
+ |
+void InputDeviceSettings::ToggleTouchpad() { |
+ PrefService* local_state = g_browser_process->local_state(); |
+ DCHECK(local_state); |
+ |
+ const bool touch_pad_status = |
+ local_state->HasPrefPath(::prefs::kTouchPadEnabled) ? |
+ local_state->GetBoolean(::prefs::kTouchPadEnabled) : true; |
+ |
+ local_state->SetBoolean(::prefs::kTouchPadEnabled, !touch_pad_status); |
+ SetInternalTouchpadEnabled(!touch_pad_status); |
+} |
+ |
} // namespace system |
} // namespace chromeos |