| 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_TOUCHPAD_TAP_SUPPRESSION_CONTROLLER_H_ | |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_TOUCHPAD_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 "content/port/browser/event_with_latency_info.h" | |
| 11 #include "third_party/WebKit/public/web/WebInputEvent.h" | |
| 12 | |
| 13 namespace content { | |
| 14 | |
| 15 class InputRouter; | |
| 16 class TapSuppressionController; | |
| 17 | |
| 18 // Controls the suppression of touchpad taps immediately following the dispatch | |
| 19 // of a GestureFlingCancel event. | |
| 20 class TouchpadTapSuppressionController : public TapSuppressionControllerClient { | |
| 21 public: | |
| 22 // The |input_router| must outlive the TouchpadTapSupressionController. | |
| 23 explicit TouchpadTapSuppressionController(InputRouter* input_router); | |
| 24 virtual ~TouchpadTapSuppressionController(); | |
| 25 | |
| 26 // Should be called on arrival of GestureFlingCancel events. | |
| 27 void GestureFlingCancel(); | |
| 28 | |
| 29 // Should be called on arrival of ACK for a GestureFlingCancel event. | |
| 30 // |processed| is true if the GestureFlingCancel successfully stopped a fling. | |
| 31 void GestureFlingCancelAck(bool processed); | |
| 32 | |
| 33 // Should be called on arrival of MouseDown events. Returns true if the caller | |
| 34 // should stop normal handling of the MouseDown. In this case, the caller is | |
| 35 // responsible for saving the event for later use, if needed. | |
| 36 bool ShouldDeferMouseDown(const MouseEventWithLatencyInfo& event); | |
| 37 | |
| 38 // Should be called on arrival of MouseUp events. Returns true if the caller | |
| 39 // should stop normal handling of the MouseUp. | |
| 40 bool ShouldSuppressMouseUp(); | |
| 41 | |
| 42 private: | |
| 43 friend class MockRenderWidgetHost; | |
| 44 | |
| 45 // TapSuppressionControllerClient implementation. | |
| 46 virtual int MaxCancelToDownTimeInMs() OVERRIDE; | |
| 47 virtual int MaxTapGapTimeInMs() OVERRIDE; | |
| 48 virtual void DropStashedTapDown() OVERRIDE; | |
| 49 virtual void ForwardStashedTapDownForDeferral() OVERRIDE; | |
| 50 virtual void ForwardStashedTapDownSkipDeferral() OVERRIDE; | |
| 51 | |
| 52 InputRouter* input_router_; | |
| 53 MouseEventWithLatencyInfo stashed_mouse_down_; | |
| 54 | |
| 55 // The core controller of tap suppression. | |
| 56 scoped_ptr<TapSuppressionController> controller_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(TouchpadTapSuppressionController); | |
| 59 }; | |
| 60 | |
| 61 } // namespace content | |
| 62 | |
| 63 #endif // CONTENT_BROWSER_RENDERER_HOST_TOUCHPAD_TAP_SUPPRESSION_CONTROLLER_H_ | |
| OLD | NEW |