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

Side by Side Diff: ui/events/gesture_detection/gesture_provider.h

Issue 223673006: Support GestureBegin and GestureEnd in ui::GestureProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address jdduke's comments. Created 6 years, 8 months 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ 5 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_
6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ 6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "ui/events/gesture_detection/gesture_detection_export.h" 10 #include "ui/events/gesture_detection/gesture_detection_export.h"
(...skipping 15 matching lines...) Expand all
26 // event dispatch. 26 // event dispatch.
27 class GESTURE_DETECTION_EXPORT GestureProvider { 27 class GESTURE_DETECTION_EXPORT GestureProvider {
28 public: 28 public:
29 struct GESTURE_DETECTION_EXPORT Config { 29 struct GESTURE_DETECTION_EXPORT Config {
30 Config(); 30 Config();
31 ~Config(); 31 ~Config();
32 GestureDetector::Config gesture_detector_config; 32 GestureDetector::Config gesture_detector_config;
33 ScaleGestureDetector::Config scale_gesture_detector_config; 33 ScaleGestureDetector::Config scale_gesture_detector_config;
34 SnapScrollController::Config snap_scroll_controller_config; 34 SnapScrollController::Config snap_scroll_controller_config;
35 bool disable_click_delay; 35 bool disable_click_delay;
36 bool gesture_begin_end_types_enabled;
jdduke (slow) 2014/04/03 22:03:28 Maybe a short comment explaining what this does?
tdresser 2014/04/04 16:39:31 Done. Please double check, particularly the commen
36 }; 37 };
37 38
38 GestureProvider(const Config& config, GestureProviderClient* client); 39 GestureProvider(const Config& config, GestureProviderClient* client);
39 ~GestureProvider(); 40 ~GestureProvider();
40 41
41 // Handle the incoming MotionEvent, returning false if the event could not 42 // Handle the incoming MotionEvent, returning false if the event could not
42 // be handled. 43 // be handled.
43 bool OnTouchEvent(const MotionEvent& event); 44 bool OnTouchEvent(const MotionEvent& event);
44 45
45 // Resets all gesture detectors; called on DidStartLoading(). 46 // Resets all gesture detectors; called on DidStartLoading().
46 void ResetGestureDetectors(); 47 void ResetGestureDetectors();
47 48
48 // Update whether multi-touch gestures are supported. 49 // Update whether multi-touch gestures are supported.
49 void SetMultiTouchSupportEnabled(bool enabled); 50 void SetMultiTouchSupportEnabled(bool enabled);
50 51
51 // Update whether double-tap gestures are supported. This allows 52 // Update whether double-tap gestures are supported. This allows
52 // double-tap gesture suppression independent of whether or not the page's 53 // double-tap gesture suppression independent of whether or not the page's
53 // viewport and scale would normally prevent double-tap. 54 // viewport and scale would normally prevent double-tap.
54 // Note: This should not be called while a double-tap gesture is in progress. 55 // Note: This should not be called while a double-tap gesture is in progress.
55 void SetDoubleTapSupportForPlatformEnabled(bool enabled); 56 void SetDoubleTapSupportForPlatformEnabled(bool enabled);
56 57
57 // Update whether double-tap gesture detection should be suppressed due to 58 // Update whether double-tap gesture detection should be suppressed due to
58 // the viewport or scale of the current page. Suppressing double-tap gesture 59 // the viewport or scale of the current page. Suppressing double-tap gesture
59 // detection allows for rapid and responsive single-tap gestures. 60 // detection allows for rapid and responsive single-tap gestures.
60 void SetDoubleTapSupportForPageEnabled(bool enabled); 61 void SetDoubleTapSupportForPageEnabled(bool enabled);
61 62
63 // Update whether GestureBegin and GestureEnd events are supported.
64 void SetBeginEndTypesEnabled(bool enabled);
65
62 // Whether a scroll gesture is in-progress. 66 // Whether a scroll gesture is in-progress.
63 bool IsScrollInProgress() const; 67 bool IsScrollInProgress() const;
64 68
65 // Whether a pinch gesture is in-progress (i.e. a pinch update has been 69 // Whether a pinch gesture is in-progress (i.e. a pinch update has been
66 // forwarded and detection is still active). 70 // forwarded and detection is still active).
67 bool IsPinchInProgress() const; 71 bool IsPinchInProgress() const;
68 72
69 // Whether a double tap-gesture is in-progress. 73 // Whether a double tap-gesture is in-progress.
70 bool IsDoubleTapInProgress() const; 74 bool IsDoubleTapInProgress() const;
71 75
(...skipping 14 matching lines...) Expand all
86 void Fling(base::TimeTicks time, 90 void Fling(base::TimeTicks time,
87 float x, 91 float x,
88 float y, 92 float y,
89 float velocity_x, 93 float velocity_x,
90 float velocity_y); 94 float velocity_y);
91 void Send(const GestureEventData& gesture); 95 void Send(const GestureEventData& gesture);
92 void SendTapCancelIfNecessary(const MotionEvent& event); 96 void SendTapCancelIfNecessary(const MotionEvent& event);
93 bool SendLongTapIfNecessary(const MotionEvent& event); 97 bool SendLongTapIfNecessary(const MotionEvent& event);
94 void EndTouchScrollIfNecessary(base::TimeTicks time, 98 void EndTouchScrollIfNecessary(base::TimeTicks time,
95 bool send_scroll_end_event); 99 bool send_scroll_end_event);
100 void OnTouchEventHandlingBegin(const MotionEvent& event);
101 void OnTouchEventHandlingEnd(const MotionEvent& event,
102 bool handled,
103 bool was_touch_scrolling);
96 104
97 GestureProviderClient* const client_; 105 GestureProviderClient* const client_;
98 106
99 class GestureListenerImpl; 107 class GestureListenerImpl;
100 friend class GestureListenerImpl; 108 friend class GestureListenerImpl;
101 scoped_ptr<GestureListenerImpl> gesture_listener_; 109 scoped_ptr<GestureListenerImpl> gesture_listener_;
102 110
103 class ScaleGestureListenerImpl; 111 class ScaleGestureListenerImpl;
104 friend class ScaleGestureListenerImpl; 112 friend class ScaleGestureListenerImpl;
105 scoped_ptr<ScaleGestureListenerImpl> scale_gesture_listener_; 113 scoped_ptr<ScaleGestureListenerImpl> scale_gesture_listener_;
(...skipping 11 matching lines...) Expand all
117 125
118 // Whether the respective {SCROLL,PINCH}_BEGIN gestures have been terminated 126 // Whether the respective {SCROLL,PINCH}_BEGIN gestures have been terminated
119 // with a {SCROLL,PINCH}_END. 127 // with a {SCROLL,PINCH}_END.
120 bool touch_scroll_in_progress_; 128 bool touch_scroll_in_progress_;
121 bool pinch_in_progress_; 129 bool pinch_in_progress_;
122 130
123 // Keeps track of the current GESTURE_LONG_PRESS event. If a context menu is 131 // Keeps track of the current GESTURE_LONG_PRESS event. If a context menu is
124 // opened after a GESTURE_LONG_PRESS, this is used to insert a 132 // opened after a GESTURE_LONG_PRESS, this is used to insert a
125 // GESTURE_TAP_CANCEL for removing any ::active styling. 133 // GESTURE_TAP_CANCEL for removing any ::active styling.
126 base::TimeTicks current_longpress_time_; 134 base::TimeTicks current_longpress_time_;
135
136 bool gesture_begin_end_types_enabled_;
127 }; 137 };
128 138
129 } // namespace ui 139 } // namespace ui
130 140
131 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ 141 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698