| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_GESTURES_GESTURE_RECOGNIZER_H_ | 5 #ifndef UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_H_ |
| 6 #define UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_H_ | 6 #define UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // |source_device_id|, within | 55 // |source_device_id|, within |
| 56 // GestureConfiguration::max_separation_for_gesture_touches_in_pixels of | 56 // GestureConfiguration::max_separation_for_gesture_touches_in_pixels of |
| 57 // |location|, or NULL if no such point exists. | 57 // |location|, or NULL if no such point exists. |
| 58 virtual GestureConsumer* GetTargetForLocation( | 58 virtual GestureConsumer* GetTargetForLocation( |
| 59 const gfx::PointF& location, int source_device_id) = 0; | 59 const gfx::PointF& location, int source_device_id) = 0; |
| 60 | 60 |
| 61 // Cancels all touches except those targeted to |not_cancelled|. If | 61 // Cancels all touches except those targeted to |not_cancelled|. If |
| 62 // |not_cancelled| == nullptr, cancels all touches. | 62 // |not_cancelled| == nullptr, cancels all touches. |
| 63 virtual void CancelActiveTouchesExcept(GestureConsumer* not_cancelled) = 0; | 63 virtual void CancelActiveTouchesExcept(GestureConsumer* not_cancelled) = 0; |
| 64 | 64 |
| 65 // Makes |new_consumer| the target for events previously targeting | 65 enum class ShouldCancelTouches { Cancel, DontCancel }; |
| 66 // |current_consumer|. Touches targeting all other targets are | 66 |
| 67 // canceled. The caller is responsible for updating the state of the | 67 // Transfer the gesture stream from the drag source (current_consumer) to the |
| 68 // consumers to be aware of this transfer of control (there are no | 68 // consumer used for dragging (new_consumer). If |should_cancel_touches| is |
| 69 // ENTERED/EXITED events). | 69 // Cancel, dispatches cancel events to |current_consumer| to ensure that its |
| 70 // touch stream remains valid. |
| 70 virtual void TransferEventsTo(GestureConsumer* current_consumer, | 71 virtual void TransferEventsTo(GestureConsumer* current_consumer, |
| 71 GestureConsumer* new_consumer) = 0; | 72 GestureConsumer* new_consumer, |
| 73 ShouldCancelTouches should_cancel_touches) = 0; |
| 72 | 74 |
| 73 // If a gesture is underway for |consumer| |point| is set to the last touch | 75 // If a gesture is underway for |consumer| |point| is set to the last touch |
| 74 // point and true is returned. If no touch events have been processed for | 76 // point and true is returned. If no touch events have been processed for |
| 75 // |consumer| false is returned and |point| is untouched. | 77 // |consumer| false is returned and |point| is untouched. |
| 76 virtual bool GetLastTouchPointForTarget(GestureConsumer* consumer, | 78 virtual bool GetLastTouchPointForTarget(GestureConsumer* consumer, |
| 77 gfx::PointF* point) = 0; | 79 gfx::PointF* point) = 0; |
| 78 | 80 |
| 79 // Sends a touch cancel event for every active touch. Returns true iff any | 81 // Sends a touch cancel event for every active touch. Returns true iff any |
| 80 // touch cancels were sent. | 82 // touch cancels were sent. |
| 81 virtual bool CancelActiveTouches(GestureConsumer* consumer) = 0; | 83 virtual bool CancelActiveTouches(GestureConsumer* consumer) = 0; |
| 82 | 84 |
| 83 // Subscribes |helper| for dispatching async gestures such as long press. | 85 // Subscribes |helper| for dispatching async gestures such as long press. |
| 84 // The Gesture Recognizer does NOT take ownership of |helper| and it is the | 86 // The Gesture Recognizer does NOT take ownership of |helper| and it is the |
| 85 // responsibility of the |helper| to call |RemoveGestureEventHelper()| on | 87 // responsibility of the |helper| to call |RemoveGestureEventHelper()| on |
| 86 // destruction. | 88 // destruction. |
| 87 virtual void AddGestureEventHelper(GestureEventHelper* helper) = 0; | 89 virtual void AddGestureEventHelper(GestureEventHelper* helper) = 0; |
| 88 | 90 |
| 89 // Unsubscribes |helper| from async gesture dispatch. | 91 // Unsubscribes |helper| from async gesture dispatch. |
| 90 // Since the GestureRecognizer does not own the |helper|, it is not deleted | 92 // Since the GestureRecognizer does not own the |helper|, it is not deleted |
| 91 // and must be cleaned up appropriately by the caller. | 93 // and must be cleaned up appropriately by the caller. |
| 92 virtual void RemoveGestureEventHelper(GestureEventHelper* helper) = 0; | 94 virtual void RemoveGestureEventHelper(GestureEventHelper* helper) = 0; |
| 93 }; | 95 }; |
| 94 | 96 |
| 95 } // namespace ui | 97 } // namespace ui |
| 96 | 98 |
| 97 #endif // UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_H_ | 99 #endif // UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_H_ |
| OLD | NEW |