OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCHSCREEN_TAP_SUPPRESSION_CONTROLL
ER_H_ | |
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCHSCREEN_TAP_SUPPRESSION_CONTROLL
ER_H_ | |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "content/browser/renderer_host/input/gesture_event_filter.h" | |
10 #include "content/browser/renderer_host/input/tap_suppression_controller_client.
h" | |
11 | |
12 namespace content { | |
13 | |
14 class GestureEventFilter; | |
15 class TapSuppressionController; | |
16 | |
17 // Controls the suppression of touchscreen taps immediately following the | |
18 // dispatch of a GestureFlingCancel event. | |
19 class TouchscreenTapSuppressionController | |
20 : public TapSuppressionControllerClient { | |
21 public: | |
22 explicit TouchscreenTapSuppressionController(GestureEventFilter* gef); | |
23 virtual ~TouchscreenTapSuppressionController(); | |
24 | |
25 // Should be called on arrival of GestureFlingCancel events. | |
26 void GestureFlingCancel(); | |
27 | |
28 // Should be called on arrival of ACK for a GestureFlingCancel event. | |
29 // |processed| is true if the GestureFlingCancel successfully stopped a fling. | |
30 void GestureFlingCancelAck(bool processed); | |
31 | |
32 // Should be called on arrival of GestureTapDown events. Returns true if the | |
33 // caller should stop normal handling of the GestureTapDown. In this case, the | |
34 // caller is responsible for saving the event for later use, if needed. | |
35 bool ShouldDeferGestureTapDown(const GestureEventWithLatencyInfo& event); | |
36 | |
37 // Should be called on arrival of GestureTap events. Returns true if the | |
38 // caller should stop normal handling of the GestureTap. | |
39 bool ShouldSuppressGestureTap(); | |
40 | |
41 // Should be called on arrival of GestureTapCancel events. Returns true if the | |
42 // caller should stop normal handling of the GestureTapCancel. | |
43 bool ShouldSuppressGestureTapCancel(); | |
44 | |
45 private: | |
46 // TapSuppressionControllerClient implementation. | |
47 virtual int MaxCancelToDownTimeInMs() OVERRIDE; | |
48 virtual int MaxTapGapTimeInMs() OVERRIDE; | |
49 virtual void DropStashedTapDown() OVERRIDE; | |
50 virtual void ForwardStashedTapDown() OVERRIDE; | |
51 | |
52 GestureEventFilter* gesture_event_filter_; | |
53 GestureEventWithLatencyInfo stashed_tap_down_; | |
54 | |
55 // The core controller of tap suppression. | |
56 scoped_ptr<TapSuppressionController> controller_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(TouchscreenTapSuppressionController); | |
59 }; | |
60 | |
61 } // namespace content | |
62 | |
63 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCHSCREEN_TAP_SUPPRESSION_CONTR
OLLER_H_ | |
OLD | NEW |