[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / ui / base / touch / touch_enabled.cc
blob6d2aebf03cf29172c6283c8d081031eea3f468e4
1 // Copyright 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.
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 #include "ui/events/event_switches.h"
12 namespace ui {
14 bool AreTouchEventsEnabled() {
15 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
16 const std::string touch_enabled_switch =
17 command_line.HasSwitch(switches::kTouchEvents) ?
18 command_line.GetSwitchValueASCII(switches::kTouchEvents) :
19 switches::kTouchEventsAuto;
21 if (touch_enabled_switch.empty() ||
22 touch_enabled_switch == switches::kTouchEventsEnabled)
23 return true;
24 if (touch_enabled_switch == switches::kTouchEventsAuto)
25 return IsTouchDevicePresent();
26 if (touch_enabled_switch != switches::kTouchEventsDisabled)
27 LOG(ERROR) << "Invalid --touch-events option: " << touch_enabled_switch;
28 return false;
31 } // namespace ui