| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 static GestureRecognizer* Create(); | 21 static GestureRecognizer* Create(); |
| 22 static GestureRecognizer* Get(); | 22 static GestureRecognizer* Get(); |
| 23 static void Reset(); | 23 static void Reset(); |
| 24 | 24 |
| 25 // List of GestureEvent*. | 25 // List of GestureEvent*. |
| 26 typedef ScopedVector<GestureEvent> Gestures; | 26 typedef ScopedVector<GestureEvent> Gestures; |
| 27 | 27 |
| 28 virtual ~GestureRecognizer() {} | 28 virtual ~GestureRecognizer() {} |
| 29 | 29 |
| 30 // Invoked for each touch event that could contribute to the current gesture. | 30 // Invoked for each touch event that could contribute to the current gesture. |
| 31 // Returns false iff the touch event is invalid in some way, and should not be |
| 32 // processed further. |
| 33 virtual bool ProcessTouchEventForGesture(const TouchEvent& event, |
| 34 GestureConsumer* consumer) = 0; |
| 35 |
| 36 // TODO(tdresser): remove during cleanup of old Aura GR, as part of |
| 37 // crbug.com/332418. |
| 38 // Invoked for each touch event that could contribute to the current gesture. |
| 31 // Returns list of zero or more GestureEvents identified after processing | 39 // Returns list of zero or more GestureEvents identified after processing |
| 32 // TouchEvent. | 40 // TouchEvent. |
| 33 // Caller would be responsible for freeing up Gestures. | 41 // Caller would be responsible for freeing up Gestures. |
| 34 virtual Gestures* ProcessTouchEventForGesture(const TouchEvent& event, | 42 virtual Gestures* ProcessTouchEventForGestureForOldAuraGR( |
| 35 ui::EventResult result, | 43 const TouchEvent& event, |
| 36 GestureConsumer* consumer) = 0; | 44 ui::EventResult result, |
| 45 GestureConsumer* target) = 0; |
| 46 |
| 47 // Sends an ack to the gesture detector, and returns any gestures triggered by |
| 48 // the ack. |
| 49 virtual ScopedVector<GestureEvent>* AckTouchEventForGesture( |
| 50 ui::EventResult result, |
| 51 GestureConsumer* target) = 0; |
| 37 | 52 |
| 38 // This is called when the consumer is destroyed. So this should cleanup any | 53 // This is called when the consumer is destroyed. So this should cleanup any |
| 39 // internal state maintained for |consumer|. Returns true iff there was | 54 // internal state maintained for |consumer|. Returns true iff there was |
| 40 // state relating to |consumer| to clean up. | 55 // state relating to |consumer| to clean up. |
| 41 virtual bool CleanupStateForConsumer(GestureConsumer* consumer) = 0; | 56 virtual bool CleanupStateForConsumer(GestureConsumer* consumer) = 0; |
| 42 | 57 |
| 43 // Return the window which should handle this TouchEvent, in the case where | 58 // Return the window which should handle this TouchEvent, in the case where |
| 44 // the touch is already associated with a target. | 59 // the touch is already associated with a target. |
| 45 // Otherwise, returns null. | 60 // Otherwise, returns null. |
| 46 virtual GestureConsumer* GetTouchLockedTarget(const TouchEvent& event) = 0; | 61 virtual GestureConsumer* GetTouchLockedTarget(const TouchEvent& event) = 0; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 99 |
| 85 // Unsubscribes |helper| from async gesture dispatch. | 100 // Unsubscribes |helper| from async gesture dispatch. |
| 86 // Since the GestureRecognizer does not own the |helper|, it is not deleted | 101 // Since the GestureRecognizer does not own the |helper|, it is not deleted |
| 87 // and must be cleaned up appropriately by the caller. | 102 // and must be cleaned up appropriately by the caller. |
| 88 virtual void RemoveGestureEventHelper(GestureEventHelper* helper) = 0; | 103 virtual void RemoveGestureEventHelper(GestureEventHelper* helper) = 0; |
| 89 }; | 104 }; |
| 90 | 105 |
| 91 } // namespace ui | 106 } // namespace ui |
| 92 | 107 |
| 93 #endif // UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_H_ | 108 #endif // UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_H_ |
| OLD | NEW |