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_IMPL_H_ | 5 #ifndef UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_IMPL_H_ |
| 6 #define UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_IMPL_H_ | 6 #define UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "ui/events/event_constants.h" | 14 #include "ui/events/event_constants.h" |
| 14 #include "ui/events/events_export.h" | 15 #include "ui/events/events_export.h" |
| 15 #include "ui/events/gestures/gesture_provider_aura.h" | 16 #include "ui/events/gestures/gesture_provider_aura.h" |
| 16 #include "ui/events/gestures/gesture_recognizer.h" | 17 #include "ui/events/gestures/gesture_recognizer.h" |
| 17 #include "ui/events/gestures/gesture_sequence.h" | 18 #include "ui/events/gestures/gesture_sequence.h" |
| 18 #include "ui/gfx/point.h" | 19 #include "ui/gfx/point.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 // Overridden from ui::GestureSequenceDelegate. | 88 // Overridden from ui::GestureSequenceDelegate. |
| 88 virtual void DispatchPostponedGestureEvent(GestureEvent* event) OVERRIDE; | 89 virtual void DispatchPostponedGestureEvent(GestureEvent* event) OVERRIDE; |
| 89 | 90 |
| 90 // Overridden from GestureProviderAuraClient | 91 // Overridden from GestureProviderAuraClient |
| 91 virtual void OnGestureEvent(GestureEvent* event) OVERRIDE; | 92 virtual void OnGestureEvent(GestureEvent* event) OVERRIDE; |
| 92 | 93 |
| 93 // Convenience method to find the GestureEventHelper that can dispatch events | 94 // Convenience method to find the GestureEventHelper that can dispatch events |
| 94 // to a specific |consumer|. | 95 // to a specific |consumer|. |
| 95 GestureEventHelper* FindDispatchHelperForConsumer(GestureConsumer* consumer); | 96 GestureEventHelper* FindDispatchHelperForConsumer(GestureConsumer* consumer); |
| 96 | 97 |
| 98 // for all the GestureConsumers in the touches | |
|
tdresser
2014/08/13 19:57:58
Capitalize comments, and end them with a period.
lanwei
2014/08/14 00:38:46
Done.
| |
| 99 // create a map from touch id to the touch location | |
| 100 std::map<int, gfx::PointF> GroupGestureConsumerWithTouchPoints( | |
| 101 std::vector<std::pair<int, GestureConsumer*> >* touches); | |
| 102 | |
| 103 // create a map between the touch_id to the touch point location | |
| 104 // by iterating through the pointer_state in GestureConsumer's | |
| 105 // GestureProviderAura | |
| 106 std::map<int, gfx::PointF> MapTouchIDWithPointLocation( | |
| 107 GestureConsumer* consumer); | |
| 108 | |
| 97 std::map<GestureConsumer*, GestureSequence*> consumer_sequence_; | 109 std::map<GestureConsumer*, GestureSequence*> consumer_sequence_; |
| 98 std::map<GestureConsumer*, GestureProviderAura*> consumer_gesture_provider_; | 110 std::map<GestureConsumer*, GestureProviderAura*> consumer_gesture_provider_; |
| 99 | 111 |
| 100 // Both |touch_id_target_| and |touch_id_target_for_gestures_| map a touch-id | 112 // Both |touch_id_target_| and |touch_id_target_for_gestures_| map a touch-id |
| 101 // to its target window. touch-ids are removed from |touch_id_target_| on | 113 // to its target window. touch-ids are removed from |touch_id_target_| on |
| 102 // ET_TOUCH_RELEASE and ET_TOUCH_CANCEL. |touch_id_target_for_gestures_| are | 114 // ET_TOUCH_RELEASE and ET_TOUCH_CANCEL. |touch_id_target_for_gestures_| are |
| 103 // removed in ConsumerDestroyed(). | 115 // removed in ConsumerDestroyed(). |
| 104 TouchIdToConsumerMap touch_id_target_; | 116 TouchIdToConsumerMap touch_id_target_; |
| 105 TouchIdToConsumerMap touch_id_target_for_gestures_; | 117 TouchIdToConsumerMap touch_id_target_for_gestures_; |
| 106 | 118 |
| 107 std::vector<GestureEventHelper*> helpers_; | 119 std::vector<GestureEventHelper*> helpers_; |
| 108 | 120 |
| 109 bool use_unified_gesture_detector_; | 121 bool use_unified_gesture_detector_; |
| 110 | 122 |
| 111 DISALLOW_COPY_AND_ASSIGN(GestureRecognizerImpl); | 123 DISALLOW_COPY_AND_ASSIGN(GestureRecognizerImpl); |
| 112 }; | 124 }; |
| 113 | 125 |
| 114 // Provided only for testing: | 126 // Provided only for testing: |
| 115 EVENTS_EXPORT void SetGestureRecognizerForTesting( | 127 EVENTS_EXPORT void SetGestureRecognizerForTesting( |
| 116 GestureRecognizer* gesture_recognizer); | 128 GestureRecognizer* gesture_recognizer); |
| 117 | 129 |
| 118 } // namespace ui | 130 } // namespace ui |
| 119 | 131 |
| 120 #endif // UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_IMPL_H_ | 132 #endif // UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_IMPL_H_ |
| OLD | NEW |