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_BASE_GESTURES_GESTURE_RECOGNIZER_H_ | 5 #ifndef UI_BASE_GESTURES_GESTURE_RECOGNIZER_H_ |
6 #define UI_BASE_GESTURES_GESTURE_RECOGNIZER_H_ | 6 #define UI_BASE_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 14 matching lines...) Expand all Loading... |
25 virtual ~GestureRecognizer() {} | 25 virtual ~GestureRecognizer() {} |
26 | 26 |
27 // Invoked for each touch event that could contribute to the current gesture. | 27 // Invoked for each touch event that could contribute to the current gesture. |
28 // Returns list of zero or more GestureEvents identified after processing | 28 // Returns list of zero or more GestureEvents identified after processing |
29 // TouchEvent. | 29 // TouchEvent. |
30 // Caller would be responsible for freeing up Gestures. | 30 // Caller would be responsible for freeing up Gestures. |
31 virtual Gestures* ProcessTouchEventForGesture(const TouchEvent& event, | 31 virtual Gestures* ProcessTouchEventForGesture(const TouchEvent& event, |
32 ui::EventResult result, | 32 ui::EventResult result, |
33 GestureConsumer* consumer) = 0; | 33 GestureConsumer* consumer) = 0; |
34 | 34 |
35 // Touch-events can be queued to be played back at a later time. The queues | 35 // This is called when the consumer is destroyed. So this should cleanup any |
36 // are identified by the target window. | 36 // internal state maintained for |consumer|. |
37 virtual void QueueTouchEventForGesture(GestureConsumer* consumer, | 37 virtual void CleanupStateForConsumer(GestureConsumer* consumer) = 0; |
38 const TouchEvent& event) = 0; | |
39 | |
40 // Process the touch-event in the queue for the window. Returns a list of | |
41 // zero or more GestureEvents identified after processing the queueud | |
42 // TouchEvent. Caller is responsible for freeing up Gestures. | |
43 virtual Gestures* AdvanceTouchQueue(GestureConsumer* consumer, | |
44 bool processed) = 0; | |
45 | |
46 // Flushes the touch event queue (or removes the queue) for the window. | |
47 virtual void FlushTouchQueue(GestureConsumer* consumer) = 0; | |
48 | 38 |
49 // Return the window which should handle this TouchEvent, in the case where | 39 // Return the window which should handle this TouchEvent, in the case where |
50 // the touch is already associated with a target. | 40 // the touch is already associated with a target. |
51 // Otherwise, returns null. | 41 // Otherwise, returns null. |
52 virtual GestureConsumer* GetTouchLockedTarget(TouchEvent* event) = 0; | 42 virtual GestureConsumer* GetTouchLockedTarget(TouchEvent* event) = 0; |
53 | 43 |
54 // Return the window which should handle this GestureEvent. | 44 // Return the window which should handle this GestureEvent. |
55 virtual GestureConsumer* GetTargetForGestureEvent(GestureEvent* event) = 0; | 45 virtual GestureConsumer* GetTargetForGestureEvent(GestureEvent* event) = 0; |
56 | 46 |
57 // If there is an active touch within | 47 // If there is an active touch within |
(...skipping 10 matching lines...) Expand all Loading... |
68 // If a gesture is underway for |consumer| |point| is set to the last touch | 58 // If a gesture is underway for |consumer| |point| is set to the last touch |
69 // point and true is returned. If no touch events have been processed for | 59 // point and true is returned. If no touch events have been processed for |
70 // |consumer| false is returned and |point| is untouched. | 60 // |consumer| false is returned and |point| is untouched. |
71 virtual bool GetLastTouchPointForTarget(GestureConsumer* consumer, | 61 virtual bool GetLastTouchPointForTarget(GestureConsumer* consumer, |
72 gfx::Point* point) = 0; | 62 gfx::Point* point) = 0; |
73 }; | 63 }; |
74 | 64 |
75 } // namespace ui | 65 } // namespace ui |
76 | 66 |
77 #endif // UI_BASE_GESTURES_GESTURE_RECOGNIZER_H_ | 67 #endif // UI_BASE_GESTURES_GESTURE_RECOGNIZER_H_ |
OLD | NEW |