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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // Whether a double-tap gesture is in-progress (either double-tap or | 84 // Whether a double-tap gesture is in-progress (either double-tap or |
85 // double-tap drag zoom). | 85 // double-tap drag zoom). |
86 bool IsDoubleTapInProgress() const; | 86 bool IsDoubleTapInProgress() const; |
87 | 87 |
88 // May be NULL if there is no currently active touch sequence. | 88 // May be NULL if there is no currently active touch sequence. |
89 const ui::MotionEvent* current_down_event() const { | 89 const ui::MotionEvent* current_down_event() const { |
90 return current_down_event_.get(); | 90 return current_down_event_.get(); |
91 } | 91 } |
92 | 92 |
93 private: | 93 private: |
94 void InitGestureDetectors(const Config& config); | |
95 | |
96 bool CanHandle(const MotionEvent& event) const; | 94 bool CanHandle(const MotionEvent& event) const; |
97 | |
98 void Fling(const MotionEvent& e, float velocity_x, float velocity_y); | |
99 void Send(GestureEventData gesture); | |
100 bool SendLongTapIfNecessary(const MotionEvent& event); | |
101 void EndTouchScrollIfNecessary(const MotionEvent& event, | |
102 bool send_scroll_end_event); | |
103 void OnTouchEventHandlingBegin(const MotionEvent& event); | 95 void OnTouchEventHandlingBegin(const MotionEvent& event); |
104 void OnTouchEventHandlingEnd(const MotionEvent& event); | 96 void OnTouchEventHandlingEnd(const MotionEvent& event); |
105 void UpdateDoubleTapDetectionSupport(); | 97 void UpdateDoubleTapDetectionSupport(); |
106 | 98 |
107 GestureProviderClient* const client_; | |
108 | |
109 class GestureListenerImpl; | 99 class GestureListenerImpl; |
110 friend class GestureListenerImpl; | |
111 scoped_ptr<GestureListenerImpl> gesture_listener_; | 100 scoped_ptr<GestureListenerImpl> gesture_listener_; |
112 | 101 |
113 class ScaleGestureListenerImpl; | |
114 friend class ScaleGestureListenerImpl; | |
115 scoped_ptr<ScaleGestureListenerImpl> scale_gesture_listener_; | |
116 | |
117 scoped_ptr<MotionEvent> current_down_event_; | 102 scoped_ptr<MotionEvent> current_down_event_; |
118 | 103 |
119 // Whether the respective {SCROLL,PINCH}_BEGIN gestures have been terminated | |
120 // with a {SCROLL,PINCH}_END. | |
121 bool touch_scroll_in_progress_; | |
122 bool pinch_in_progress_; | |
123 | |
124 // Whether double-tap gesture detection is currently supported. | 104 // Whether double-tap gesture detection is currently supported. |
125 bool double_tap_support_for_page_; | 105 bool double_tap_support_for_page_; |
126 bool double_tap_support_for_platform_; | 106 bool double_tap_support_for_platform_; |
127 | 107 |
128 // Keeps track of the current GESTURE_LONG_PRESS event. If a context menu is | |
129 // opened after a GESTURE_LONG_PRESS, this is used to insert a | |
130 // GESTURE_TAP_CANCEL for removing any ::active styling. | |
131 base::TimeTicks current_longpress_time_; | |
132 | |
133 const bool gesture_begin_end_types_enabled_; | 108 const bool gesture_begin_end_types_enabled_; |
134 | |
135 const float min_gesture_bounds_length_; | |
136 const float max_gesture_bounds_length_; | |
137 }; | 109 }; |
138 | 110 |
139 } // namespace ui | 111 } // namespace ui |
140 | 112 |
141 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ | 113 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ |
OLD | NEW |