Commit 023a90ac authored by tdresser@chromium.org's avatar tdresser@chromium.org

Use multi-value switch to enable/disable the unified gesture detector.

BUG=332418

Review URL: https://codereview.chromium.org/290733013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272652 0039d316-1c4b-4281-b951-d872f2087c98
parent 1d7f248f
......@@ -681,10 +681,10 @@ class GestureRecognizerTest : public AuraTestBase,
virtual void SetUp() OVERRIDE {
// TODO(tdresser): Once unified GR has landed, only run these tests once.
if (UsingUnifiedGR()) {
CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kUseUnifiedGestureDetector);
}
CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kUnifiedGestureDetector,
UsingUnifiedGR() ? switches::kUnifiedGestureDetectorEnabled
: switches::kUnifiedGestureDetectorDisabled);
AuraTestBase::SetUp();
}
......
......@@ -19,8 +19,18 @@ const char kTouchEventsAuto[] = "auto";
const char kTouchEventsEnabled[] = "enabled";
// disabled: touch events are disabled.
const char kTouchEventsDisabled[] = "disabled";
// Use the unified gesture detector, instead of the aura gesture detector.
const char kUseUnifiedGestureDetector[] = "use-unified-gesture-detector";
// Enable the unified gesture detector, instead of the aura gesture detector.
const char kUnifiedGestureDetector[] = "unified-gesture-detector";
// The values the kUnifiedGestureDetector switch may have, as in
// --unified-gesture-detector=disabled.
// auto: Same as disabled.
const char kUnifiedGestureDetectorAuto[] = "auto";
// enabled: Use the unified gesture detector.
const char kUnifiedGestureDetectorEnabled[] = "enabled";
// disabled: Use the aura gesture detector.
const char kUnifiedGestureDetectorDisabled[] = "disabled";
#if defined(OS_LINUX)
// Tells chrome to interpret events from these devices as touch events. Only
......
......@@ -15,7 +15,10 @@ EVENTS_BASE_EXPORT extern const char kTouchEvents[];
EVENTS_BASE_EXPORT extern const char kTouchEventsAuto[];
EVENTS_BASE_EXPORT extern const char kTouchEventsEnabled[];
EVENTS_BASE_EXPORT extern const char kTouchEventsDisabled[];
EVENTS_BASE_EXPORT extern const char kUseUnifiedGestureDetector[];
EVENTS_BASE_EXPORT extern const char kUnifiedGestureDetector[];
EVENTS_BASE_EXPORT extern const char kUnifiedGestureDetectorAuto[];
EVENTS_BASE_EXPORT extern const char kUnifiedGestureDetectorEnabled[];
EVENTS_BASE_EXPORT extern const char kUnifiedGestureDetectorDisabled[];
#if defined(OS_LINUX)
EVENTS_BASE_EXPORT extern const char kTouchDevices[];
......
......@@ -68,9 +68,29 @@ GestureProviderAura* CreateGestureProvider(GestureProviderAuraClient* client) {
////////////////////////////////////////////////////////////////////////////////
// GestureRecognizerImpl, public:
GestureRecognizerImpl::GestureRecognizerImpl()
: use_unified_gesture_detector_(CommandLine::ForCurrentProcess()->HasSwitch(
switches::kUseUnifiedGestureDetector)) {
GestureRecognizerImpl::GestureRecognizerImpl() {
// Default to not using the unified gesture detector.
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;
const bool kUseUnifiedGestureDetectorByDefault = false;
if (unified_gd_enabled_switch.empty() ||
unified_gd_enabled_switch == switches::kUnifiedGestureDetectorEnabled) {
use_unified_gesture_detector_ = true;
} else if (unified_gd_enabled_switch ==
switches::kUnifiedGestureDetectorDisabled) {
use_unified_gesture_detector_ = false;
} else if (unified_gd_enabled_switch ==
switches::kUnifiedGestureDetectorAuto) {
use_unified_gesture_detector_ = kUseUnifiedGestureDetectorByDefault;
} else {
LOG(ERROR) << "Invalid --unified-gesture-detector option: "
<< unified_gd_enabled_switch;
use_unified_gesture_detector_ = false;
}
}
GestureRecognizerImpl::~GestureRecognizerImpl() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment