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 "content/browser/renderer_host/input/touchscreen_tap_suppression_controller.h"
7 #include "content/browser/renderer_host/input/gesture_event_filter.h"
8 #include "content/browser/renderer_host/input/tap_suppression_controller.h"
9 #include "ui/events/gestures/gesture_configuration.h"
13 TouchscreenTapSuppressionController::TouchscreenTapSuppressionController(
14 GestureEventFilter* gef)
15 : gesture_event_filter_(gef),
16 controller_(new TapSuppressionController(this)) {
19 TouchscreenTapSuppressionController::~TouchscreenTapSuppressionController() {}
21 void TouchscreenTapSuppressionController::GestureFlingCancel() {
22 controller_->GestureFlingCancel();
25 void TouchscreenTapSuppressionController::GestureFlingCancelAck(
27 controller_->GestureFlingCancelAck(processed);
30 bool TouchscreenTapSuppressionController::ShouldDeferGestureTapDown(
31 const GestureEventWithLatencyInfo& event) {
32 bool should_defer = controller_->ShouldDeferTapDown();
34 stashed_tap_down_ = event;
38 bool TouchscreenTapSuppressionController::ShouldSuppressGestureTap() {
39 return controller_->ShouldSuppressTapUp();
42 bool TouchscreenTapSuppressionController::ShouldSuppressGestureTapCancel() {
43 return controller_->ShouldSuppressTapCancel();
46 int TouchscreenTapSuppressionController::MaxCancelToDownTimeInMs() {
47 return ui::GestureConfiguration::fling_max_cancel_to_down_time_in_ms();
50 int TouchscreenTapSuppressionController::MaxTapGapTimeInMs() {
51 return static_cast<int>(
52 ui::GestureConfiguration::semi_long_press_time_in_seconds() * 1000);
55 void TouchscreenTapSuppressionController::DropStashedTapDown() {
58 void TouchscreenTapSuppressionController::ForwardStashedTapDown() {
59 gesture_event_filter_->ForwardGestureEvent(stashed_tap_down_);
62 } // namespace content