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 #ifndef CONTENT_BROWSER_RENDERER_HOST_TOUCHSCREEN_TAP_SUPPRESSION_CONTROLLER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_TOUCHSCREEN_TAP_SUPPRESSION_CONTROLLER_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/browser/renderer_host/tap_suppression_controller_client.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.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 WebKit::WebGestureEvent& 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 ForwardStashedTapDownForDeferral() OVERRIDE; |
| 51 virtual void ForwardStashedTapDownSkipDeferral() OVERRIDE; |
| 52 |
| 53 GestureEventFilter* gesture_event_filter_; |
| 54 WebKit::WebGestureEvent stashed_tap_down_; |
| 55 |
| 56 // The core controller of tap suppression. |
| 57 scoped_ptr<TapSuppressionController> controller_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(TouchscreenTapSuppressionController); |
| 60 }; |
| 61 |
| 62 } // namespace content |
| 63 |
| 64 #endif // CONTENT_BROWSER_RENDERER_HOST_TOUCHSCREEN_TAP_SUPPRESSION_CONTROLLER_
H_ |
OLD | NEW |