1 // Copyright (c) 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/touchpad_tap_suppression_controller.h"
7 #include "content/browser/renderer_host/render_widget_host_impl.h"
8 #include "content/browser/renderer_host/tap_suppression_controller.h"
9 #include "content/browser/renderer_host/tap_suppression_controller_client.h"
10 #include "ui/base/gestures/gesture_configuration.h"
14 TouchpadTapSuppressionController::TouchpadTapSuppressionController(
15 RenderWidgetHostImpl
* rwhv
)
16 : render_widget_host_(rwhv
),
17 controller_(new TapSuppressionController(this)) {
20 TouchpadTapSuppressionController::~TouchpadTapSuppressionController() {}
22 void TouchpadTapSuppressionController::GestureFlingCancel() {
23 controller_
->GestureFlingCancel();
26 void TouchpadTapSuppressionController::GestureFlingCancelAck(bool processed
) {
27 controller_
->GestureFlingCancelAck(processed
);
30 bool TouchpadTapSuppressionController::ShouldDeferMouseDown(
31 const MouseEventWithLatencyInfo
& event
) {
32 bool should_defer
= controller_
->ShouldDeferTapDown();
34 stashed_mouse_down_
= event
;
38 bool TouchpadTapSuppressionController::ShouldSuppressMouseUp() {
39 return controller_
->ShouldSuppressTapUp();
42 int TouchpadTapSuppressionController::MaxCancelToDownTimeInMs() {
43 return ui::GestureConfiguration::fling_max_cancel_to_down_time_in_ms();
46 int TouchpadTapSuppressionController::MaxTapGapTimeInMs() {
47 return ui::GestureConfiguration::fling_max_tap_gap_time_in_ms();
50 void TouchpadTapSuppressionController::DropStashedTapDown() {
53 void TouchpadTapSuppressionController::ForwardStashedTapDownForDeferral() {
54 // Mouse downs are not handled by gesture event filter; so, they are
55 // immediately forwarded to the renderer.
56 render_widget_host_
->ForwardMouseEventImmediately(stashed_mouse_down_
);
59 void TouchpadTapSuppressionController::ForwardStashedTapDownSkipDeferral() {
60 // Mouse downs are not handled by gesture event filter; so, they are
61 // immediately forwarded to the renderer.
62 render_widget_host_
->ForwardMouseEventImmediately(stashed_mouse_down_
);
65 } // namespace content