OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #include "content/browser/renderer_host/touchscreen_tap_suppression_controller.h " | |
6 | |
7 #include "content/browser/renderer_host/gesture_event_filter.h" | |
8 #include "content/browser/renderer_host/tap_suppression_controller.h" | |
9 #include "ui/base/gestures/gesture_configuration.h" | |
10 | |
11 namespace content { | |
12 | |
13 namespace { | |
14 | |
15 #if !defined(USE_AURA) && !defined(OS_WIN) | |
mohsen
2013/03/07 22:31:41
These parameters should normally be read from Gest
rjkroege
2013/03/14 19:48:06
Find a better way. Like not including this code in
mohsen
2013/03/17 23:09:01
Done. This code is now only included on Aura and W
| |
16 // GestureConfiguration is not available on platforms other than Aura and | |
17 // Windows. So, we use following constants for parameters we need. | |
18 static const int kMaxCancelToDownTimeMs = 400; | |
19 static const int kMaxTapGapTimeMs = 400; | |
20 #endif | |
21 | |
22 } // namespace | |
23 | |
24 TouchscreenTapSuppressionController::TouchscreenTapSuppressionController( | |
25 GestureEventFilter* gef) | |
26 : gesture_event_filter_(gef), | |
27 controller_(new TapSuppressionController(this)) { | |
28 } | |
29 | |
30 TouchscreenTapSuppressionController::~TouchscreenTapSuppressionController() {} | |
31 | |
32 void TouchscreenTapSuppressionController::GestureFlingCancel() { | |
33 controller_->GestureFlingCancel(); | |
34 } | |
35 | |
36 void TouchscreenTapSuppressionController::GestureFlingCancelAck( | |
37 bool processed) { | |
38 controller_->GestureFlingCancelAck(processed, base::TimeTicks::Now()); | |
39 } | |
40 | |
41 bool TouchscreenTapSuppressionController::ShouldDeferGestureTapDown( | |
42 const WebKit::WebGestureEvent& event) { | |
43 bool should_defer = controller_->ShouldDeferTapDown(base::TimeTicks::Now()); | |
44 if (should_defer) | |
45 stashed_tap_down_ = event; | |
46 return should_defer; | |
47 } | |
48 | |
49 bool TouchscreenTapSuppressionController::ShouldSuppressGestureTap() { | |
50 return controller_->ShouldSuppressTapUp(); | |
51 } | |
52 | |
53 bool TouchscreenTapSuppressionController::ShouldSuppressGestureTapCancel() { | |
54 return controller_->ShouldSuppressTapCancel(); | |
55 } | |
56 | |
57 int TouchscreenTapSuppressionController::MaxCancelToDownTimeInMs() { | |
58 #if !defined(USE_AURA) && !defined(OS_WIN) | |
59 return kMaxCancelToDownTimeMs; | |
60 #else | |
61 return ui::GestureConfiguration::fling_max_cancel_to_down_time_in_ms(); | |
62 #endif | |
63 } | |
64 | |
65 int TouchscreenTapSuppressionController::MaxTapGapTimeInMs() { | |
66 #if !defined(USE_AURA) && !defined(OS_WIN) | |
67 return kMaxTapGapTimeMs; | |
68 #else | |
69 return static_cast<int>( | |
70 ui::GestureConfiguration::semi_long_press_time_in_seconds() * 1000); | |
71 #endif | |
72 } | |
73 | |
74 void TouchscreenTapSuppressionController::DropStashedTapDown() { | |
75 } | |
76 | |
77 void TouchscreenTapSuppressionController::ForwardStashedTapDownForDeferral() { | |
78 gesture_event_filter_->ForwardGestureEventForDeferral(stashed_tap_down_); | |
79 } | |
80 | |
81 void TouchscreenTapSuppressionController::ForwardStashedTapDownSkipDeferral() { | |
82 gesture_event_filter_->ForwardGestureEventSkipDeferral(stashed_tap_down_); | |
83 } | |
84 | |
85 } // namespace content | |
OLD | NEW |