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

Side by Side Diff: ui/base/touch/touch_enabled.cc

Issue 19805005: Refactored touch-events flag test, correcting "enabled" logic. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Renamed IsTouchEnabled to AreTouchEventsEnabled. Created 7 years, 4 months 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
« no previous file with comments | « ui/base/touch/touch_enabled.h ('k') | ui/ui.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 #include "base/command_line.h"
7 #include "base/logging.h"
8 #include "ui/base/touch/touch_device.h"
9 #include "ui/base/ui_base_switches.h"
10
11 namespace ui {
12
13 bool AreTouchEventsEnabled() {
14 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
15 const std::string touch_enabled_switch =
16 command_line.HasSwitch(switches::kTouchEvents) ?
17 command_line.GetSwitchValueASCII(switches::kTouchEvents) :
18 switches::kTouchEventsAuto;
19
20 if (touch_enabled_switch.empty() ||
21 touch_enabled_switch == switches::kTouchEventsEnabled)
22 return true;
23 if (touch_enabled_switch == switches::kTouchEventsAuto)
24 return IsTouchDevicePresent();
25 if (touch_enabled_switch != switches::kTouchEventsDisabled)
26 LOG(ERROR) << "Invalid --touch-events option: " << touch_enabled_switch;
27 return false;
28 }
29
30 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/touch/touch_enabled.h ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698