OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle
r.h" | 5 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle
r.h" |
6 | 6 |
7 #include "content/browser/renderer_host/input/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" | 8 #include "content/browser/renderer_host/input/tap_suppression_controller_client.
h" |
9 | 9 #include "ui/events/gestures/gesture_configuration.h" |
10 // The default implementation of the TouchpadTapSuppressionController does not | |
11 // suppress taps. Touchpad tap suppression is needed only on CrOS. | |
12 | 10 |
13 namespace content { | 11 namespace content { |
14 | 12 |
15 TouchpadTapSuppressionController::TouchpadTapSuppressionController( | 13 TouchpadTapSuppressionController::TouchpadTapSuppressionController( |
16 TouchpadTapSuppressionControllerClient* /* client */) | 14 TouchpadTapSuppressionControllerClient* client, |
17 : client_(NULL) {} | 15 const TapSuppressionController::Config& config) |
| 16 : client_(client), controller_(this, config) {} |
18 | 17 |
19 TouchpadTapSuppressionController::~TouchpadTapSuppressionController() {} | 18 TouchpadTapSuppressionController::~TouchpadTapSuppressionController() {} |
20 | 19 |
21 void TouchpadTapSuppressionController::GestureFlingCancel() {} | 20 void TouchpadTapSuppressionController::GestureFlingCancel() { |
| 21 controller_.GestureFlingCancel(); |
| 22 } |
22 | 23 |
23 void TouchpadTapSuppressionController::GestureFlingCancelAck( | 24 void TouchpadTapSuppressionController::GestureFlingCancelAck(bool processed) { |
24 bool /*processed*/) { | 25 controller_.GestureFlingCancelAck(processed); |
25 } | 26 } |
26 | 27 |
27 bool TouchpadTapSuppressionController::ShouldDeferMouseDown( | 28 bool TouchpadTapSuppressionController::ShouldDeferMouseDown( |
28 const MouseEventWithLatencyInfo& /*event*/) { | 29 const MouseEventWithLatencyInfo& event) { |
29 return false; | 30 bool should_defer = controller_.ShouldDeferTapDown(); |
| 31 if (should_defer) |
| 32 stashed_mouse_down_ = event; |
| 33 return should_defer; |
30 } | 34 } |
31 | 35 |
32 bool TouchpadTapSuppressionController::ShouldSuppressMouseUp() { return false; } | 36 bool TouchpadTapSuppressionController::ShouldSuppressMouseUp() { |
33 | 37 return controller_.ShouldSuppressTapEnd(); |
34 int TouchpadTapSuppressionController::MaxCancelToDownTimeInMs() { | |
35 return 0; | |
36 } | |
37 | |
38 int TouchpadTapSuppressionController::MaxTapGapTimeInMs() { | |
39 return 0; | |
40 } | 38 } |
41 | 39 |
42 void TouchpadTapSuppressionController::DropStashedTapDown() { | 40 void TouchpadTapSuppressionController::DropStashedTapDown() { |
43 } | 41 } |
44 | 42 |
45 void TouchpadTapSuppressionController::ForwardStashedTapDown() { | 43 void TouchpadTapSuppressionController::ForwardStashedTapDown() { |
| 44 // Mouse downs are not handled by gesture event filter; so, they are |
| 45 // immediately forwarded to the renderer. |
| 46 client_->SendMouseEventImmediately(stashed_mouse_down_); |
46 } | 47 } |
47 | 48 |
48 } // namespace content | 49 } // namespace content |
OLD | NEW |