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

Unified Diff: ui/events/base_event_utils.cc

Issue 1453813003: Fix a regression in checking the status of the touch events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « ui/events/base_event_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/base_event_utils.cc
diff --git a/ui/events/base_event_utils.cc b/ui/events/base_event_utils.cc
index 622d2f206179bf0886a1ffc7110366ab16e4abbc..f81c21dcbe90a4acf442e6a9acc89b319e9b71fe 100644
--- a/ui/events/base_event_utils.cc
+++ b/ui/events/base_event_utils.cc
@@ -7,6 +7,7 @@
#include "base/atomic_sequence_num.h"
#include "base/command_line.h"
#include "base/logging.h"
+#include "ui/base/touch/touch_device.h"
sadrul 2015/11/17 22:32:05 This is in the ui_base target, which depends on th
#include "ui/events/event_constants.h"
#include "ui/events/event_switches.h"
@@ -21,9 +22,9 @@ bool touch_events_enabled = true;
const int kSystemKeyModifierMask = EF_ALT_DOWN | EF_COMMAND_DOWN;
#else
const int kSystemKeyModifierMask = EF_ALT_DOWN;
+#endif // defined(OS_CHROMEOS)
-// Retrieves the status of the touch screen events from the command line on Non-
-// ChromeOS platforms.
+// Retrieves the status of the touch screen events from the command line.
bool ComputeTouchStatus() {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
@@ -33,20 +34,18 @@ bool ComputeTouchStatus() {
switches::kTouchEventsAuto;
if (touch_enabled_switch.empty() ||
- touch_enabled_switch == switches::kTouchEventsEnabled ||
- touch_enabled_switch == switches::kTouchEventsAuto) {
+ touch_enabled_switch == switches::kTouchEventsEnabled) {
return true;
}
- if (touch_enabled_switch == switches::kTouchEventsDisabled)
- return false;
+ if (touch_enabled_switch == switches::kTouchEventsAuto)
+ return IsTouchDevicePresent();
- LOG(ERROR) << "Invalid --touch-events option: " << touch_enabled_switch;
+ if (touch_enabled_switch != switches::kTouchEventsDisabled)
+ LOG(ERROR) << "Invalid --touch-events option: " << touch_enabled_switch;
return false;
}
-#endif // defined(OS_CHROMEOS)
-
} // namespace
base::StaticAtomicSequenceNumber g_next_event_id;
@@ -77,11 +76,12 @@ void SetTouchEventsEnabled(bool enabled) {
#endif // defined(OS_CHROMEOS)
bool AreTouchEventsEnabled() {
+ static bool touch_status = ComputeTouchStatus();
+
#if defined(OS_CHROMEOS)
- return touch_events_enabled;
+ return touch_events_enabled && touch_status;
#else
- static bool touch_events_enabled = ComputeTouchStatus();
- return touch_events_enabled;
+ return touch_status;
#endif // !defined(OS_CHROMEOS)
}
« no previous file with comments | « ui/events/base_event_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698