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

Unified Diff: content/browser/renderer_host/input/tap_suppression_controller.cc

Issue 260923003: Revert of Consolidate all touch/gesture related constants in content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/input/tap_suppression_controller.cc
diff --git a/content/browser/renderer_host/input/tap_suppression_controller.cc b/content/browser/renderer_host/input/tap_suppression_controller.cc
index 71c9f38be3680006a253f2c85858190b2b98f8a0..641af6ad108a04b4e240ec07aa19f94439670b08 100644
--- a/content/browser/renderer_host/input/tap_suppression_controller.cc
+++ b/content/browser/renderer_host/input/tap_suppression_controller.cc
@@ -10,25 +10,16 @@
namespace content {
-TapSuppressionController::Config::Config()
- : enabled(false),
- max_cancel_to_down_time(base::TimeDelta::FromMilliseconds(180)),
- max_tap_gap_time(base::TimeDelta::FromMilliseconds(500)) {}
-
TapSuppressionController::TapSuppressionController(
- TapSuppressionControllerClient* client,
- const Config& config)
+ TapSuppressionControllerClient* client)
: client_(client),
- state_(config.enabled ? NOTHING : DISABLED),
- max_cancel_to_down_time_(config.max_cancel_to_down_time),
- max_tap_gap_time_(config.max_tap_gap_time) {}
+ state_(TapSuppressionController::NOTHING) {
+}
TapSuppressionController::~TapSuppressionController() {}
void TapSuppressionController::GestureFlingCancel() {
switch (state_) {
- case DISABLED:
- break;
case NOTHING:
case GFC_IN_PROGRESS:
case LAST_CANCEL_STOPPED_FLING:
@@ -42,7 +33,6 @@
void TapSuppressionController::GestureFlingCancelAck(bool processed) {
base::TimeTicks event_time = Now();
switch (state_) {
- case DISABLED:
case NOTHING:
break;
case GFC_IN_PROGRESS:
@@ -67,21 +57,23 @@
bool TapSuppressionController::ShouldDeferTapDown() {
base::TimeTicks event_time = Now();
switch (state_) {
- case DISABLED:
case NOTHING:
return false;
case GFC_IN_PROGRESS:
state_ = TAP_DOWN_STASHED;
- StartTapDownTimer(max_tap_gap_time_);
+ StartTapDownTimer(
+ base::TimeDelta::FromMilliseconds(client_->MaxTapGapTimeInMs()));
return true;
case TAP_DOWN_STASHED:
NOTREACHED() << "TapDown on TAP_DOWN_STASHED state";
state_ = NOTHING;
return false;
case LAST_CANCEL_STOPPED_FLING:
- if ((event_time - fling_cancel_time_) < max_cancel_to_down_time_) {
+ if ((event_time - fling_cancel_time_).InMilliseconds()
+ < client_->MaxCancelToDownTimeInMs()) {
state_ = TAP_DOWN_STASHED;
- StartTapDownTimer(max_tap_gap_time_);
+ StartTapDownTimer(
+ base::TimeDelta::FromMilliseconds(client_->MaxTapGapTimeInMs()));
return true;
} else {
state_ = NOTHING;
@@ -94,7 +86,6 @@
bool TapSuppressionController::ShouldSuppressTapEnd() {
switch (state_) {
- case DISABLED:
case NOTHING:
case GFC_IN_PROGRESS:
return false;
@@ -124,10 +115,7 @@
void TapSuppressionController::TapDownTimerExpired() {
switch (state_) {
- case DISABLED:
case NOTHING:
- NOTREACHED() << "Timer fired on invalid state.";
- break;
case GFC_IN_PROGRESS:
case LAST_CANCEL_STOPPED_FLING:
NOTREACHED() << "Timer fired on invalid state.";

Powered by Google App Engine
This is Rietveld 408576698