Chromium Code Reviews| Index: ui/events/gestures/unified_gesture_detector_enabled.cc |
| diff --git a/ui/events/gestures/unified_gesture_detector_enabled.cc b/ui/events/gestures/unified_gesture_detector_enabled.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e31cb1e805bed6f65def1005d0dcd5b4b665adc5 |
| --- /dev/null |
| +++ b/ui/events/gestures/unified_gesture_detector_enabled.cc |
| @@ -0,0 +1,37 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
|
sadrul
2014/06/11 20:58:13
2014 (I wish we had presubmit scripts for this sor
tdresser
2014/06/12 12:45:24
Thanks, done.
It might be a bit tricky to make th
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/command_line.h" |
| +#include "base/logging.h" |
| +#include "ui/events/event_switches.h" |
| +#include "ui/events/gestures/unified_gesture_detector_enabled.h" |
| + |
| +namespace ui { |
| + |
| +bool IsUnifiedGestureDetectorEnabled() { |
| + const bool kUseUnifiedGestureDetectorByDefault = false; |
| + |
| + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| + const std::string unified_gd_enabled_switch = |
| + command_line.HasSwitch(switches::kUnifiedGestureDetector) ? |
| + command_line.GetSwitchValueASCII(switches::kUnifiedGestureDetector) : |
| + switches::kUnifiedGestureDetectorAuto; |
| + |
| + if (unified_gd_enabled_switch.empty() || |
| + unified_gd_enabled_switch == switches::kUnifiedGestureDetectorEnabled) { |
| + return true; |
| + } |
| + |
| + if (unified_gd_enabled_switch == switches::kUnifiedGestureDetectorDisabled) |
| + return false; |
| + |
| + if (unified_gd_enabled_switch == switches::kUnifiedGestureDetectorAuto) |
| + return kUseUnifiedGestureDetectorByDefault; |
| + |
| + LOG(ERROR) << "Invalid --unified-gesture-detector option: " |
| + << unified_gd_enabled_switch; |
| + return false; |
| +} |
| + |
| +} // namespace ui |