summaryrefslogtreecommitdiffstats
path: root/ui/events/gestures/gesture_recognizer_impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'ui/events/gestures/gesture_recognizer_impl.h')
-rw-r--r--ui/events/gestures/gesture_recognizer_impl.h26
1 files changed, 22 insertions, 4 deletions
diff --git a/ui/events/gestures/gesture_recognizer_impl.h b/ui/events/gestures/gesture_recognizer_impl.h
index 2ede77d5..35ddaac 100644
--- a/ui/events/gestures/gesture_recognizer_impl.h
+++ b/ui/events/gestures/gesture_recognizer_impl.h
@@ -13,6 +13,7 @@
#include "ui/events/event_constants.h"
#include "ui/events/events_export.h"
#include "ui/events/gestures/gesture_recognizer.h"
+#include "ui/events/gestures/gesture_sequence.h"
#include "ui/gfx/point.h"
namespace ui {
@@ -22,13 +23,16 @@ class GestureEventHelper;
class GestureSequence;
class TouchEvent;
-class EVENTS_EXPORT GestureRecognizerImpl : public GestureRecognizer {
+class EVENTS_EXPORT GestureRecognizerImpl : public GestureRecognizer,
+ public GestureSequenceDelegate {
public:
typedef std::map<int, GestureConsumer*> TouchIdToConsumerMap;
- explicit GestureRecognizerImpl(GestureEventHelper* helper);
+ GestureRecognizerImpl();
virtual ~GestureRecognizerImpl();
+ std::vector<GestureEventHelper*>& helpers() { return helpers_; }
+
// Overridden from GestureRecognizer
virtual GestureConsumer* GetTouchLockedTarget(TouchEvent* event) OVERRIDE;
virtual GestureConsumer* GetTargetForGestureEvent(
@@ -41,7 +45,7 @@ class EVENTS_EXPORT GestureRecognizerImpl : public GestureRecognizer {
gfx::Point* point) OVERRIDE;
protected:
- virtual GestureSequence* CreateSequence(GestureEventHelper* helper);
+ virtual GestureSequence* CreateSequence(GestureSequenceDelegate* delegate);
virtual GestureSequence* GetGestureSequenceForConsumer(GestureConsumer* c);
private:
@@ -54,6 +58,15 @@ class EVENTS_EXPORT GestureRecognizerImpl : public GestureRecognizer {
ui::EventResult result,
GestureConsumer* target) OVERRIDE;
virtual void CleanupStateForConsumer(GestureConsumer* consumer) OVERRIDE;
+ virtual void AddGestureEventHelper(GestureEventHelper* helper) OVERRIDE;
+ virtual void RemoveGestureEventHelper(GestureEventHelper* helper) OVERRIDE;
+
+ // Overridden from ui::GestureSequenceDelegate.
+ virtual void DispatchLongPressGestureEvent(GestureEvent* event) OVERRIDE;
+
+ // Convenience method to find the GestureEventHelper that can dispatch events
+ // to a specific |consumer|.
+ GestureEventHelper* FindDispatchHelperForConsumer(GestureConsumer* consumer);
std::map<GestureConsumer*, GestureSequence*> consumer_sequence_;
@@ -67,11 +80,16 @@ class EVENTS_EXPORT GestureRecognizerImpl : public GestureRecognizer {
// Touches cancelled by touch capture are routed to the
// gesture_consumer_ignorer_.
scoped_ptr<GestureConsumer> gesture_consumer_ignorer_;
- GestureEventHelper* helper_;
+
+ std::vector<GestureEventHelper*> helpers_;
DISALLOW_COPY_AND_ASSIGN(GestureRecognizerImpl);
};
+// Provided only for testing:
+EVENTS_EXPORT void SetGestureRecognizerForTesting(
+ GestureRecognizer* gesture_recognizer);
+
} // namespace ui
#endif // UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_IMPL_H_