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