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