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" |
11 #include "ui/events/event_constants.h" | 11 #include "ui/events/event_constants.h" |
12 #include "ui/events/events_export.h" | 12 #include "ui/events/events_export.h" |
| 13 #include "ui/events/gestures/gesture_event_queue.h" |
13 #include "ui/events/gestures/gesture_types.h" | 14 #include "ui/events/gestures/gesture_types.h" |
14 | 15 |
15 namespace ui { | 16 namespace ui { |
16 // A GestureRecognizer is an abstract base class for conversion of touch events | 17 // A GestureRecognizer is an abstract base class for conversion of touch events |
17 // into gestures. | 18 // into gestures. |
18 class EVENTS_EXPORT GestureRecognizer { | 19 class EVENTS_EXPORT GestureRecognizer { |
19 public: | 20 public: |
20 static GestureRecognizer* Create(); | 21 static GestureRecognizer* Create(); |
21 static GestureRecognizer* Get(); | 22 static GestureRecognizer* Get(); |
22 | 23 |
23 // List of GestureEvent*. | 24 // List of GestureEvent*. |
24 typedef ScopedVector<GestureEvent> Gestures; | 25 typedef ScopedVector<GestureEvent> Gestures; |
25 | 26 |
26 virtual ~GestureRecognizer() {} | 27 virtual ~GestureRecognizer() {} |
27 | 28 |
28 // Invoked for each touch event that could contribute to the current gesture. | 29 // Invoked for each touch event that could contribute to the current gesture. |
29 // Returns list of zero or more GestureEvents identified after processing | 30 // Returns list of zero or more GestureEvents identified after processing |
30 // TouchEvent. | 31 // TouchEvent. |
31 // Caller would be responsible for freeing up Gestures. | 32 // Caller would be responsible for freeing up Gestures. |
32 virtual Gestures* ProcessTouchEventForGesture(const TouchEvent& event, | 33 virtual Gestures* ProcessTouchEventForGesture( |
33 ui::EventResult result, | 34 const TouchEvent& event, |
34 GestureConsumer* consumer) = 0; | 35 GestureConsumer* consumer, |
| 36 GestureEventQueueTimerInterface* geq_timers) = 0; |
35 | 37 |
36 // This is called when the consumer is destroyed. So this should cleanup any | 38 // This is called when the consumer is destroyed. So this should cleanup any |
37 // internal state maintained for |consumer|. | 39 // internal state maintained for |consumer|. |
38 virtual void CleanupStateForConsumer(GestureConsumer* consumer) = 0; | 40 virtual void CleanupStateForConsumer(GestureConsumer* consumer) = 0; |
39 | 41 |
40 // Return the window which should handle this TouchEvent, in the case where | 42 // Return the window which should handle this TouchEvent, in the case where |
41 // the touch is already associated with a target. | 43 // the touch is already associated with a target. |
42 // Otherwise, returns null. | 44 // Otherwise, returns null. |
43 virtual GestureConsumer* GetTouchLockedTarget(const TouchEvent& event) = 0; | 45 virtual GestureConsumer* GetTouchLockedTarget(const TouchEvent& event) = 0; |
44 | 46 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 80 |
79 // Unsubscribes |helper| from async gesture dispatch. | 81 // Unsubscribes |helper| from async gesture dispatch. |
80 // Since the GestureRecognizer does not own the |helper|, it is not deleted | 82 // Since the GestureRecognizer does not own the |helper|, it is not deleted |
81 // and must be cleaned up appropriately by the caller. | 83 // and must be cleaned up appropriately by the caller. |
82 virtual void RemoveGestureEventHelper(GestureEventHelper* helper) = 0; | 84 virtual void RemoveGestureEventHelper(GestureEventHelper* helper) = 0; |
83 }; | 85 }; |
84 | 86 |
85 } // namespace ui | 87 } // namespace ui |
86 | 88 |
87 #endif // UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_H_ | 89 #endif // UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_H_ |
OLD | NEW |