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/touchpad_tap_suppression_controller.h"
7 #include "content/browser/renderer_host/input/tap_suppression_controller.h"
8 #include "content/browser/renderer_host/input/tap_suppression_controller_client.h"
9 #include "ui/events/gestures/gesture_configuration.h"
13 TouchpadTapSuppressionController::TouchpadTapSuppressionController(
14 TouchpadTapSuppressionControllerClient* client)
16 controller_(new TapSuppressionController(this)) {
19 TouchpadTapSuppressionController::~TouchpadTapSuppressionController() {}
21 void TouchpadTapSuppressionController::GestureFlingCancel() {
22 controller_->GestureFlingCancel();
25 void TouchpadTapSuppressionController::GestureFlingCancelAck(bool processed) {
26 controller_->GestureFlingCancelAck(processed);
29 bool TouchpadTapSuppressionController::ShouldDeferMouseDown(
30 const MouseEventWithLatencyInfo& event) {
31 bool should_defer = controller_->ShouldDeferTapDown();
33 stashed_mouse_down_ = event;
37 bool TouchpadTapSuppressionController::ShouldSuppressMouseUp() {
38 return controller_->ShouldSuppressTapEnd();
41 int TouchpadTapSuppressionController::MaxCancelToDownTimeInMs() {
42 return ui::GestureConfiguration::fling_max_cancel_to_down_time_in_ms();
45 int TouchpadTapSuppressionController::MaxTapGapTimeInMs() {
46 return ui::GestureConfiguration::fling_max_tap_gap_time_in_ms();
49 void TouchpadTapSuppressionController::DropStashedTapDown() {
52 void TouchpadTapSuppressionController::ForwardStashedTapDown() {
53 // Mouse downs are not handled by gesture event filter; so, they are
54 // immediately forwarded to the renderer.
55 client_->SendMouseEventImmediately(stashed_mouse_down_);
58 } // namespace content