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

Side by Side Diff: ui/base/touch/touch_enabled.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: Add new sources to gn file. 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/base/touch/touch_enabled.h"
6
7 #include "base/command_line.h"
8 #include "base/logging.h"
9 #include "ui/base/touch/touch_device.h"
10 #include "ui/base/ui_base_switches.h"
11 #include "ui/events/base_event_utils.h"
12 #include "ui/events/event_switches.h"
13
14 namespace ui {
15
16 namespace {
17
18 bool ComputeTouchStatus() {
19 auto command_line = base::CommandLine::ForCurrentProcess();
sadrul 2015/11/18 19:59:24 auto*
afakhry 2015/11/18 20:08:53 Done.
20 const std::string touch_enabled_switch =
21 command_line->HasSwitch(switches::kTouchEvents) ?
22 command_line->GetSwitchValueASCII(switches::kTouchEvents) :
23 switches::kTouchEventsAuto;
24
25 if (touch_enabled_switch.empty() ||
26 touch_enabled_switch == switches::kTouchEventsEnabled) {
27 return true;
28 }
29
30 if (touch_enabled_switch == switches::kTouchEventsAuto)
31 return IsTouchDevicePresent();
32
33 if (touch_enabled_switch != switches::kTouchEventsDisabled)
34 LOG(ERROR) << "Invalid --touch-events option: " << touch_enabled_switch;
sadrul 2015/11/18 19:59:24 Use [D]LOG_IF instead
afakhry 2015/11/18 20:08:53 Done.
35 return false;
36 }
37
38 } // namespace
39
40 bool AreTouchEventsEnabled() {
41 static bool touch_status = ComputeTouchStatus();
42
43 #if defined(OS_CHROMEOS)
44 return GetTouchEventsCrOsMasterSwitch() && touch_status;
45 #else
46 return touch_status;
47 #endif // !defined(OS_CHROMEOS)
48 }
49
50 } // namespace ui
51
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698