summaryrefslogtreecommitdiffstats
path: root/content/browser/renderer_host/touchpad_tap_suppression_controller_aura.cc
blob: a9ef442656ca1374358caea84692f51fbef4cab8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright (c) 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 "content/browser/renderer_host/touchpad_tap_suppression_controller.h"

#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/tap_suppression_controller.h"
#include "content/browser/renderer_host/tap_suppression_controller_client.h"
#include "ui/base/gestures/gesture_configuration.h"

namespace content {

TouchpadTapSuppressionController::TouchpadTapSuppressionController(
    RenderWidgetHostImpl* rwhv)
    : render_widget_host_(rwhv),
      controller_(new TapSuppressionController(this)) {
}

TouchpadTapSuppressionController::~TouchpadTapSuppressionController() {}

void TouchpadTapSuppressionController::GestureFlingCancel() {
  controller_->GestureFlingCancel();
}

void TouchpadTapSuppressionController::GestureFlingCancelAck(bool processed) {
  controller_->GestureFlingCancelAck(processed);
}

bool TouchpadTapSuppressionController::ShouldDeferMouseDown(
    const MouseEventWithLatencyInfo& event) {
  bool should_defer = controller_->ShouldDeferTapDown();
  if (should_defer)
    stashed_mouse_down_ = event;
  return should_defer;
}

bool TouchpadTapSuppressionController::ShouldSuppressMouseUp() {
  return controller_->ShouldSuppressTapUp();
}

int TouchpadTapSuppressionController::MaxCancelToDownTimeInMs() {
  return ui::GestureConfiguration::fling_max_cancel_to_down_time_in_ms();
}

int TouchpadTapSuppressionController::MaxTapGapTimeInMs() {
  return ui::GestureConfiguration::fling_max_tap_gap_time_in_ms();
}

void TouchpadTapSuppressionController::DropStashedTapDown() {
}

void TouchpadTapSuppressionController::ForwardStashedTapDownForDeferral() {
  // Mouse downs are not handled by gesture event filter; so, they are
  // immediately forwarded to the renderer.
  render_widget_host_->ForwardMouseEventImmediately(stashed_mouse_down_);
}

void TouchpadTapSuppressionController::ForwardStashedTapDownSkipDeferral() {
  // Mouse downs are not handled by gesture event filter; so, they are
  // immediately forwarded to the renderer.
  render_widget_host_->ForwardMouseEventImmediately(stashed_mouse_down_);
}

}  // namespace content