OLD | NEW |
---|---|
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 // detection allows for rapid and responsive single-tap gestures. | 59 // detection allows for rapid and responsive single-tap gestures. |
60 void SetDoubleTapSupportForPageEnabled(bool enabled); | 60 void SetDoubleTapSupportForPageEnabled(bool enabled); |
61 | 61 |
62 // Whether a scroll gesture is in-progress. | 62 // Whether a scroll gesture is in-progress. |
63 bool IsScrollInProgress() const; | 63 bool IsScrollInProgress() const; |
64 | 64 |
65 // Whether a pinch gesture is in-progress (i.e. a pinch update has been | 65 // Whether a pinch gesture is in-progress (i.e. a pinch update has been |
66 // forwarded and detection is still active). | 66 // forwarded and detection is still active). |
67 bool IsPinchInProgress() const; | 67 bool IsPinchInProgress() const; |
68 | 68 |
69 // Whether a double tap-gesture is in-progress. | 69 // Whether a double-tap gesture is in-progress (either double-tap or |
70 // double-tap drag zoom). | |
70 bool IsDoubleTapInProgress() const; | 71 bool IsDoubleTapInProgress() const; |
71 | 72 |
73 // Whether double-tap gesture detection is supported. | |
74 bool IsDoubleTapSupportedEnabled() const; | |
tdresser
2014/04/03 17:53:30
SupportedEnabled -> Supported|Enabled.
jdduke (slow)
2014/04/03 19:28:01
Done.
| |
75 | |
72 // Whether the tap gesture delay is explicitly disabled (independent of | 76 // Whether the tap gesture delay is explicitly disabled (independent of |
73 // whether double-tap is supported), see |Config.disable_click_delay|. | 77 // whether double-tap is supported), see |Config.disable_click_delay|. |
74 bool IsClickDelayDisabled() const; | 78 bool IsClickDelayDisabled() const; |
75 | 79 |
76 // May be NULL if there is no currently active touch sequence. | 80 // May be NULL if there is no currently active touch sequence. |
77 const ui::MotionEvent* current_down_event() const { | 81 const ui::MotionEvent* current_down_event() const { |
78 return current_down_event_.get(); | 82 return current_down_event_.get(); |
79 } | 83 } |
80 | 84 |
81 private: | 85 private: |
82 void InitGestureDetectors(const Config& config); | 86 void InitGestureDetectors(const Config& config); |
83 | 87 |
84 bool CanHandle(const MotionEvent& event) const; | 88 bool CanHandle(const MotionEvent& event) const; |
85 | 89 |
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 UpdateDoubleTapDetectionSupport(); | |
96 | 101 |
97 GestureProviderClient* const client_; | 102 GestureProviderClient* const client_; |
98 | 103 |
99 class GestureListenerImpl; | 104 class GestureListenerImpl; |
100 friend class GestureListenerImpl; | 105 friend class GestureListenerImpl; |
101 scoped_ptr<GestureListenerImpl> gesture_listener_; | 106 scoped_ptr<GestureListenerImpl> gesture_listener_; |
102 | 107 |
103 class ScaleGestureListenerImpl; | 108 class ScaleGestureListenerImpl; |
104 friend class ScaleGestureListenerImpl; | 109 friend class ScaleGestureListenerImpl; |
105 scoped_ptr<ScaleGestureListenerImpl> scale_gesture_listener_; | 110 scoped_ptr<ScaleGestureListenerImpl> scale_gesture_listener_; |
106 | 111 |
107 scoped_ptr<MotionEvent> current_down_event_; | 112 scoped_ptr<MotionEvent> current_down_event_; |
108 | 113 |
109 // Whether a GESTURE_SHOW_PRESS was sent for the current touch sequence. | 114 // Whether a GESTURE_SHOW_PRESS was sent for the current touch sequence. |
110 // Sending a GESTURE_TAP event will forward a GESTURE_SHOW_PRESS if one has | 115 // Sending a GESTURE_TAP event will forward a GESTURE_SHOW_PRESS if one has |
111 // not yet been sent. | 116 // not yet been sent. |
112 bool needs_show_press_event_; | 117 bool needs_show_press_event_; |
113 | 118 |
114 // Whether a sent GESTURE_TAP_DOWN event has yet to be accompanied by a | 119 // Whether a sent GESTURE_TAP_DOWN event has yet to be accompanied by a |
115 // corresponding GESTURE_TAP, GESTURE_TAP_CANCEL or GESTURE_DOUBLE_TAP. | 120 // corresponding GESTURE_TAP, GESTURE_TAP_CANCEL or GESTURE_DOUBLE_TAP. |
116 bool needs_tap_ending_event_; | 121 bool needs_tap_ending_event_; |
117 | 122 |
118 // Whether the respective {SCROLL,PINCH}_BEGIN gestures have been terminated | 123 // Whether the respective {SCROLL,PINCH}_BEGIN gestures have been terminated |
119 // with a {SCROLL,PINCH}_END. | 124 // with a {SCROLL,PINCH}_END. |
120 bool touch_scroll_in_progress_; | 125 bool touch_scroll_in_progress_; |
121 bool pinch_in_progress_; | 126 bool pinch_in_progress_; |
122 | 127 |
128 // Whether double-tap gesture detection is currently supported. | |
129 bool double_tap_support_for_page_; | |
130 bool double_tap_support_for_platform_; | |
131 | |
123 // Keeps track of the current GESTURE_LONG_PRESS event. If a context menu is | 132 // 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 | 133 // opened after a GESTURE_LONG_PRESS, this is used to insert a |
125 // GESTURE_TAP_CANCEL for removing any ::active styling. | 134 // GESTURE_TAP_CANCEL for removing any ::active styling. |
126 base::TimeTicks current_longpress_time_; | 135 base::TimeTicks current_longpress_time_; |
127 }; | 136 }; |
128 | 137 |
129 } // namespace ui | 138 } // namespace ui |
130 | 139 |
131 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ | 140 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ |
OLD | NEW |