forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored touch-events flag test, correcting "enabled" logic.
We previously ignored the "enabled" flag if there was no touch device detected. We also ignored "disabled" in many places, so that we always ended up with touch if there was a touch device. Also, remove reference to gestures - no longer reachable. BUG=176058 Review URL: https://chromiumcodereview.appspot.com/19805005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214535 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
girard@chromium.org
committed
Jul 31, 2013
1 parent
3d27d27
commit 6d636e6
Showing
8 changed files
with
68 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2013 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ui/base/touch/touch_enabled.h" | ||
#include "base/command_line.h" | ||
#include "base/logging.h" | ||
#include "ui/base/touch/touch_device.h" | ||
#include "ui/base/ui_base_switches.h" | ||
|
||
namespace ui { | ||
|
||
bool AreTouchEventsEnabled() { | ||
const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | ||
const std::string touch_enabled_switch = | ||
command_line.HasSwitch(switches::kTouchEvents) ? | ||
command_line.GetSwitchValueASCII(switches::kTouchEvents) : | ||
switches::kTouchEventsAuto; | ||
|
||
if (touch_enabled_switch.empty() || | ||
touch_enabled_switch == switches::kTouchEventsEnabled) | ||
return true; | ||
if (touch_enabled_switch == switches::kTouchEventsAuto) | ||
return IsTouchDevicePresent(); | ||
if (touch_enabled_switch != switches::kTouchEventsDisabled) | ||
LOG(ERROR) << "Invalid --touch-events option: " << touch_enabled_switch; | ||
return false; | ||
} | ||
|
||
} // namespace ui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2013 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef UI_BASE_TOUCH_TOUCH_ENABLED_H_ | ||
#define UI_BASE_TOUCH_TOUCH_ENABLED_H_ | ||
|
||
#include "ui/base/ui_export.h" | ||
|
||
namespace ui { | ||
|
||
// Returns true if the touch-enabled flag is enabled, or if it is set to auto | ||
// and a touch device is present. | ||
UI_EXPORT bool AreTouchEventsEnabled(); | ||
|
||
} // namespace ui | ||
|
||
#endif // UI_BASE_TOUCH_TOUCH_ENABLED_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters