Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 // Given a stream of |MotionEvent|'s, provides gesture detection and gesture | 25 // Given a stream of |MotionEvent|'s, provides gesture detection and gesture |
| 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 | |
| 36 // There is normally a delay before a tap event is fired, in order to allow | |
|
jdduke (slow)
2014/04/04 19:08:36
Nit: |When double-tap support is enabled, there wi
tdresser
2014/04/07 13:42:55
Done.
| |
| 37 // the double tap gesture to occur without firing any tap events. If | |
| 38 // |disable_click_delay| is true, there will be no delay before a tap event | |
| 39 // is fired. | |
| 35 bool disable_click_delay; | 40 bool disable_click_delay; |
| 41 | |
| 42 // If |gesture_begin_end_types_enabled| is true, fire an ET_GESTURE_BEGIN | |
| 43 // event for every added touch point, and an ET_GESTURE_END event for every | |
| 44 // removed touch point. | |
| 45 bool gesture_begin_end_types_enabled; | |
| 36 }; | 46 }; |
| 37 | 47 |
| 38 GestureProvider(const Config& config, GestureProviderClient* client); | 48 GestureProvider(const Config& config, GestureProviderClient* client); |
| 39 ~GestureProvider(); | 49 ~GestureProvider(); |
| 40 | 50 |
| 41 // Handle the incoming MotionEvent, returning false if the event could not | 51 // Handle the incoming MotionEvent, returning false if the event could not |
| 42 // be handled. | 52 // be handled. |
| 43 bool OnTouchEvent(const MotionEvent& event); | 53 bool OnTouchEvent(const MotionEvent& event); |
| 44 | 54 |
| 45 // Resets all gesture detectors; called on DidStartLoading(). | 55 // Resets all gesture detectors; called on DidStartLoading(). |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 void Fling(base::TimeTicks time, | 100 void Fling(base::TimeTicks time, |
| 91 float x, | 101 float x, |
| 92 float y, | 102 float y, |
| 93 float velocity_x, | 103 float velocity_x, |
| 94 float velocity_y); | 104 float velocity_y); |
| 95 void Send(const GestureEventData& gesture); | 105 void Send(const GestureEventData& gesture); |
| 96 void SendTapCancelIfNecessary(const MotionEvent& event); | 106 void SendTapCancelIfNecessary(const MotionEvent& event); |
| 97 bool SendLongTapIfNecessary(const MotionEvent& event); | 107 bool SendLongTapIfNecessary(const MotionEvent& event); |
| 98 void EndTouchScrollIfNecessary(base::TimeTicks time, | 108 void EndTouchScrollIfNecessary(base::TimeTicks time, |
| 99 bool send_scroll_end_event); | 109 bool send_scroll_end_event); |
| 110 void OnTouchEventHandlingBegin(const MotionEvent& event); | |
| 111 void OnTouchEventHandlingEnd(const MotionEvent& event); | |
| 112 | |
| 100 void UpdateDoubleTapDetectionSupport(); | 113 void UpdateDoubleTapDetectionSupport(); |
| 101 | 114 |
| 102 GestureProviderClient* const client_; | 115 GestureProviderClient* const client_; |
| 103 | 116 |
| 104 class GestureListenerImpl; | 117 class GestureListenerImpl; |
| 105 friend class GestureListenerImpl; | 118 friend class GestureListenerImpl; |
| 106 scoped_ptr<GestureListenerImpl> gesture_listener_; | 119 scoped_ptr<GestureListenerImpl> gesture_listener_; |
| 107 | 120 |
| 108 class ScaleGestureListenerImpl; | 121 class ScaleGestureListenerImpl; |
| 109 friend class ScaleGestureListenerImpl; | 122 friend class ScaleGestureListenerImpl; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 126 bool pinch_in_progress_; | 139 bool pinch_in_progress_; |
| 127 | 140 |
| 128 // Whether double-tap gesture detection is currently supported. | 141 // Whether double-tap gesture detection is currently supported. |
| 129 bool double_tap_support_for_page_; | 142 bool double_tap_support_for_page_; |
| 130 bool double_tap_support_for_platform_; | 143 bool double_tap_support_for_platform_; |
| 131 | 144 |
| 132 // Keeps track of the current GESTURE_LONG_PRESS event. If a context menu is | 145 // Keeps track of the current GESTURE_LONG_PRESS event. If a context menu is |
| 133 // opened after a GESTURE_LONG_PRESS, this is used to insert a | 146 // opened after a GESTURE_LONG_PRESS, this is used to insert a |
| 134 // GESTURE_TAP_CANCEL for removing any ::active styling. | 147 // GESTURE_TAP_CANCEL for removing any ::active styling. |
| 135 base::TimeTicks current_longpress_time_; | 148 base::TimeTicks current_longpress_time_; |
| 149 | |
| 150 bool gesture_begin_end_types_enabled_; | |
| 136 }; | 151 }; |
| 137 | 152 |
| 138 } // namespace ui | 153 } // namespace ui |
| 139 | 154 |
| 140 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ | 155 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ |
| OLD | NEW |