Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: content/browser/renderer_host/tap_suppression_controller.h

Issue 11361150: Suppress sending mousedown / mouseup when in fling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed checking GEF's queue back when it is empty in unit tests Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_TAP_SUPPRESSION_CONTROLLER_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_TAP_SUPPRESSION_CONTROLLER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_TAP_SUPPRESSION_CONTROLLER_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_TAP_SUPPRESSION_CONTROLLER_H_
7 7
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "base/timer.h" 9 #include "base/timer.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 class MockRenderWidgetHost;
14 class RenderWidgetHostImpl; 15 class RenderWidgetHostImpl;
15 16
16 // Controls the suppression of taps (rapid mousedown/mouseup sequences) 17 // Controls the suppression of taps (rapid mousedown/mouseup sequences)
17 // immediately following the dispatch of a WebGestureFlingCancel event. 18 // immediately following the dispatch of a WebGestureFlingCancel event.
18 // Only mousedown/mouseup of sufficient speed and within a specified time 19 // Only mousedown/mouseup of sufficient speed and within a specified time
19 // window after a WebGestureFlingCancel are suppressed. 20 // window after a WebGestureFlingCancel are suppressed.
20 class TapSuppressionController { 21 class TapSuppressionController {
21 public: 22 public:
22 23
23 explicit TapSuppressionController(RenderWidgetHostImpl*); 24 explicit TapSuppressionController(RenderWidgetHostImpl*);
(...skipping 10 matching lines...) Expand all
34 35
35 // Called on an ack of WebGestureFlingCancel event. |processed| is true when 36 // Called on an ack of WebGestureFlingCancel event. |processed| is true when
36 // the GestureFlingCancel actually stopped a fling and therefore should 37 // the GestureFlingCancel actually stopped a fling and therefore should
37 // suppress the forwarding of the following tap. 38 // suppress the forwarding of the following tap.
38 void GestureFlingCancelAck(bool processed); 39 void GestureFlingCancelAck(bool processed);
39 40
40 // Called on the dispatch of a WebGestureFlingCancel event. 41 // Called on the dispatch of a WebGestureFlingCancel event.
41 void GestureFlingCancel(double cancel_time); 42 void GestureFlingCancel(double cancel_time);
42 43
43 private: 44 private:
45 friend class MockRenderWidgetHost;
46
44 enum State { 47 enum State {
45 NOTHING, 48 NOTHING,
46 GFC_IN_PROGRESS, 49 GFC_IN_PROGRESS,
47 MD_STASHED, 50 MD_STASHED,
48 LAST_CANCEL_STOPPED_FLING, 51 LAST_CANCEL_STOPPED_FLING,
49 }; 52 };
50 53
51 // Invoked once the maximum time deemed a tap from a mouse down event 54 // Invoked once the maximum time deemed a tap from a mouse down event
52 // has expired. If the mouse up has not yet arrived, indicates that the mouse 55 // has expired. If the mouse up has not yet arrived, indicates that the mouse
53 // down / mouse up pair do not form a tap. 56 // down / mouse up pair do not form a tap.
54 void MouseDownTimerExpired(); 57 void MouseDownTimerExpired();
55 58
56 // Only a RenderWidgetHostViewImpl can own an instance. 59 // Only a RenderWidgetHostViewImpl can own an instance.
57 RenderWidgetHostImpl* render_widget_host_; 60 RenderWidgetHostImpl* render_widget_host_;
58 base::OneShotTimer<TapSuppressionController> mouse_down_timer_; 61 base::OneShotTimer<TapSuppressionController> mouse_down_timer_;
59 WebKit::WebMouseEvent stashed_mouse_down_; 62 WebKit::WebMouseEvent stashed_mouse_down_;
60 State state_; 63 State state_;
61 64
62 // TODO(rjkroege): During debugging, the event times did not prove reliable. 65 // TODO(rjkroege): During debugging, the event times did not prove reliable.
63 // Replace the use of base::TimeTicks with an accurate event time when they 66 // Replace the use of base::TimeTicks with an accurate event time when they
64 // become available post http://crbug.com/119556. 67 // become available post http://crbug.com/119556.
65 base::TimeTicks fling_cancel_time_; 68 base::TimeTicks fling_cancel_time_;
66 69
67 DISALLOW_COPY_AND_ASSIGN(TapSuppressionController); 70 DISALLOW_COPY_AND_ASSIGN(TapSuppressionController);
68 }; 71 };
69 72
70 } // namespace content 73 } // namespace content
71 74
72 #endif // CONTENT_BROWSER_RENDERER_HOST_TAP_SUPPRESSION_CONTROLLER_H_ 75 #endif // CONTENT_BROWSER_RENDERER_HOST_TAP_SUPPRESSION_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698