Chromium Code Reviews| 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 // Transfer the gesture stream from the drag source (current_consumer) to the |
| 66 // |current_consumer|. Touches targeting all other targets are | 66 // consumer used for dragging (new_consumer). This dispatches cancel events to |
| 67 // canceled. The caller is responsible for updating the state of the | 67 // |current_consumer| to ensure that its touch stream remains valid. |
| 68 // consumers to be aware of this transfer of control (there are no | 68 virtual void BeginDragAndDrop(GestureConsumer* current_consumer, |
| 69 // ENTERED/EXITED events). | |
| 70 virtual void TransferEventsTo(GestureConsumer* current_consumer, | |
| 71 GestureConsumer* new_consumer) = 0; | 69 GestureConsumer* new_consumer) = 0; |
| 72 | 70 |
| 71 // Transfer the gesture stream from the drag source (current_consumer) to the | |
| 72 // consumer used for dragging (new_consumer). This doesn't dispatch cancel | |
| 73 // events to |current_consumer|. | |
| 74 virtual void BeginTabDrag(GestureConsumer* current_consumer, | |
|
sadrul
2016/05/03 18:38:16
GR is a fairly low-level component; it shouldn't n
tdresser
2016/05/03 18:56:42
That was my instinct initially too, but I changed
sadrul
2016/05/04 13:28:18
I think it's OK for the 'transfer sequence from A
| |
| 75 GestureConsumer* new_consumer) = 0; | |
| 76 | |
| 73 // If a gesture is underway for |consumer| |point| is set to the last touch | 77 // 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 | 78 // point and true is returned. If no touch events have been processed for |
| 75 // |consumer| false is returned and |point| is untouched. | 79 // |consumer| false is returned and |point| is untouched. |
| 76 virtual bool GetLastTouchPointForTarget(GestureConsumer* consumer, | 80 virtual bool GetLastTouchPointForTarget(GestureConsumer* consumer, |
| 77 gfx::PointF* point) = 0; | 81 gfx::PointF* point) = 0; |
| 78 | 82 |
| 79 // Sends a touch cancel event for every active touch. Returns true iff any | 83 // Sends a touch cancel event for every active touch. Returns true iff any |
| 80 // touch cancels were sent. | 84 // touch cancels were sent. |
| 81 virtual bool CancelActiveTouches(GestureConsumer* consumer) = 0; | 85 virtual bool CancelActiveTouches(GestureConsumer* consumer) = 0; |
| 82 | 86 |
| 83 // Subscribes |helper| for dispatching async gestures such as long press. | 87 // Subscribes |helper| for dispatching async gestures such as long press. |
| 84 // The Gesture Recognizer does NOT take ownership of |helper| and it is the | 88 // The Gesture Recognizer does NOT take ownership of |helper| and it is the |
| 85 // responsibility of the |helper| to call |RemoveGestureEventHelper()| on | 89 // responsibility of the |helper| to call |RemoveGestureEventHelper()| on |
| 86 // destruction. | 90 // destruction. |
| 87 virtual void AddGestureEventHelper(GestureEventHelper* helper) = 0; | 91 virtual void AddGestureEventHelper(GestureEventHelper* helper) = 0; |
| 88 | 92 |
| 89 // Unsubscribes |helper| from async gesture dispatch. | 93 // Unsubscribes |helper| from async gesture dispatch. |
| 90 // Since the GestureRecognizer does not own the |helper|, it is not deleted | 94 // Since the GestureRecognizer does not own the |helper|, it is not deleted |
| 91 // and must be cleaned up appropriately by the caller. | 95 // and must be cleaned up appropriately by the caller. |
| 92 virtual void RemoveGestureEventHelper(GestureEventHelper* helper) = 0; | 96 virtual void RemoveGestureEventHelper(GestureEventHelper* helper) = 0; |
| 93 }; | 97 }; |
| 94 | 98 |
| 95 } // namespace ui | 99 } // namespace ui |
| 96 | 100 |
| 97 #endif // UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_H_ | 101 #endif // UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_H_ |
| OLD | NEW |