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_IMPL_H_ | 5 #ifndef UI_BASE_GESTURES_GESTURE_RECOGNIZER_IMPL_H_ |
6 #define UI_BASE_GESTURES_GESTURE_RECOGNIZER_IMPL_H_ | 6 #define UI_BASE_GESTURES_GESTURE_RECOGNIZER_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <vector> | 10 #include <vector> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 virtual GestureSequence* GetGestureSequenceForConsumer(GestureConsumer* c); | 46 virtual GestureSequence* GetGestureSequenceForConsumer(GestureConsumer* c); |
47 | 47 |
48 private: | 48 private: |
49 // Sets up the target consumer for gestures based on the touch-event. | 49 // Sets up the target consumer for gestures based on the touch-event. |
50 void SetupTargets(const TouchEvent& event, GestureConsumer* consumer); | 50 void SetupTargets(const TouchEvent& event, GestureConsumer* consumer); |
51 | 51 |
52 // Processes the next queued touch-event (and discards the touch-event). The | 52 // Processes the next queued touch-event (and discards the touch-event). The |
53 // called must take ownership of the returned gestures and free them when they | 53 // called must take ownership of the returned gestures and free them when they |
54 // are not needed anymore. | 54 // are not needed anymore. |
55 Gestures* AdvanceTouchQueueByOne(GestureConsumer* consumer, | 55 Gestures* AdvanceTouchQueueByOne(GestureConsumer* consumer, |
56 ui::TouchStatus status); | 56 ui::EventResult result); |
57 | 57 |
58 // Overridden from GestureRecognizer | 58 // Overridden from GestureRecognizer |
59 virtual Gestures* ProcessTouchEventForGesture( | 59 virtual Gestures* ProcessTouchEventForGesture( |
60 const TouchEvent& event, | 60 const TouchEvent& event, |
61 ui::TouchStatus status, | 61 ui::EventResult result, |
62 GestureConsumer* target) OVERRIDE; | 62 GestureConsumer* target) OVERRIDE; |
63 virtual void QueueTouchEventForGesture(GestureConsumer* consumer, | 63 virtual void QueueTouchEventForGesture(GestureConsumer* consumer, |
64 const TouchEvent& event) OVERRIDE; | 64 const TouchEvent& event) OVERRIDE; |
65 virtual Gestures* AdvanceTouchQueue(GestureConsumer* consumer, | 65 virtual Gestures* AdvanceTouchQueue(GestureConsumer* consumer, |
66 bool processed) OVERRIDE; | 66 bool processed) OVERRIDE; |
67 virtual void FlushTouchQueue(GestureConsumer* consumer) OVERRIDE; | 67 virtual void FlushTouchQueue(GestureConsumer* consumer) OVERRIDE; |
68 | 68 |
69 typedef std::queue<TouchEvent*> TouchEventQueue; | 69 typedef std::queue<TouchEvent*> TouchEventQueue; |
70 std::map<GestureConsumer*, TouchEventQueue*> event_queue_; | 70 std::map<GestureConsumer*, TouchEventQueue*> event_queue_; |
71 std::map<GestureConsumer*, GestureSequence*> consumer_sequence_; | 71 std::map<GestureConsumer*, GestureSequence*> consumer_sequence_; |
72 | 72 |
73 // Both |touch_id_target_| and |touch_id_target_for_gestures_| map a touch-id | 73 // Both |touch_id_target_| and |touch_id_target_for_gestures_| map a touch-id |
74 // to its target window. touch-ids are removed from |touch_id_target_| on | 74 // to its target window. touch-ids are removed from |touch_id_target_| on |
75 // ET_TOUCH_RELEASE and ET_TOUCH_CANCEL. |touch_id_target_for_gestures_| are | 75 // ET_TOUCH_RELEASE and ET_TOUCH_CANCEL. |touch_id_target_for_gestures_| are |
76 // removed in FlushTouchQueue(). | 76 // removed in FlushTouchQueue(). |
77 TouchIdToConsumerMap touch_id_target_; | 77 TouchIdToConsumerMap touch_id_target_; |
78 TouchIdToConsumerMap touch_id_target_for_gestures_; | 78 TouchIdToConsumerMap touch_id_target_for_gestures_; |
79 | 79 |
80 // Touches cancelled by touch capture are routed to the | 80 // Touches cancelled by touch capture are routed to the |
81 // gesture_consumer_ignorer_. | 81 // gesture_consumer_ignorer_. |
82 scoped_ptr<GestureConsumer> gesture_consumer_ignorer_; | 82 scoped_ptr<GestureConsumer> gesture_consumer_ignorer_; |
83 GestureEventHelper* helper_; | 83 GestureEventHelper* helper_; |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(GestureRecognizerImpl); | 85 DISALLOW_COPY_AND_ASSIGN(GestureRecognizerImpl); |
86 }; | 86 }; |
87 | 87 |
88 } // namespace ui | 88 } // namespace ui |
89 | 89 |
90 #endif // UI_BASE_GESTURES_GESTURE_RECOGNIZER_IMPL_H_ | 90 #endif // UI_BASE_GESTURES_GESTURE_RECOGNIZER_IMPL_H_ |
OLD | NEW |