Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: ui/events/gestures/gesture_recognizer.h

Issue 393953012: Eager Gesture Recognition on Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_types.h" 13 #include "ui/events/gestures/gesture_types.h"
14 #include "ui/gfx/geometry/point_f.h" 14 #include "ui/gfx/geometry/point_f.h"
15 15
16 namespace ui { 16 namespace ui {
17 // 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
18 // into gestures. 18 // into gestures.
19 class EVENTS_EXPORT GestureRecognizer { 19 class EVENTS_EXPORT GestureRecognizer {
20 public: 20 public:
21 static GestureRecognizer* Create(); 21 static GestureRecognizer* Create();
22 static GestureRecognizer* Get(); 22 static GestureRecognizer* Get();
23 static void Reset(); 23 static void Reset();
24 24
25 // List of GestureEvent*. 25 // List of GestureEvent*.
26 typedef ScopedVector<GestureEvent> Gestures; 26 typedef ScopedVector<GestureEvent> Gestures;
27 27
28 virtual ~GestureRecognizer() {} 28 virtual ~GestureRecognizer() {}
29 29
30 // Invoked for each touch event that could contribute to the current gesture. 30 // Invoked before event dispatch. If the event is invalid given the current
31 // Returns list of zero or more GestureEvents identified after processing 31 // touch sequence, marks it as handled.
32 // TouchEvent. 32 virtual bool ProcessTouchEventPreDispatch(const TouchEvent& event,
33 // Caller would be responsible for freeing up Gestures. 33 GestureConsumer* consumer) = 0;
34 virtual Gestures* ProcessTouchEventForGesture(const TouchEvent& event, 34 // Returns a list of zero or more GestureEvents. The caller is responsible for
35 // freeing the returned events. Called synchronously after event dispatch.
36 virtual Gestures* ProcessTouchEventPostDispatch(
37 const TouchEvent& event,
38 ui::EventResult result,
39 GestureConsumer* consumer) = 0;
40 // Returns a list of zero or more GestureEvents. The caller is responsible for
41 // freeing the returned events. Called when a touch event receives an
42 // asynchronous ack.
43 virtual Gestures* ProcessTouchEventOnAsyncAck(const TouchEvent& event,
35 ui::EventResult result, 44 ui::EventResult result,
36 GestureConsumer* consumer) = 0; 45 GestureConsumer* consumer) = 0;
37 46
38 // This is called when the consumer is destroyed. So this should cleanup any 47 // This is called when the consumer is destroyed. So this should cleanup any
39 // internal state maintained for |consumer|. Returns true iff there was 48 // internal state maintained for |consumer|. Returns true iff there was
40 // state relating to |consumer| to clean up. 49 // state relating to |consumer| to clean up.
41 virtual bool CleanupStateForConsumer(GestureConsumer* consumer) = 0; 50 virtual bool CleanupStateForConsumer(GestureConsumer* consumer) = 0;
42 51
43 // Return the window which should handle this TouchEvent, in the case where 52 // Return the window which should handle this TouchEvent, in the case where
44 // the touch is already associated with a target. 53 // the touch is already associated with a target.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 93
85 // Unsubscribes |helper| from async gesture dispatch. 94 // Unsubscribes |helper| from async gesture dispatch.
86 // Since the GestureRecognizer does not own the |helper|, it is not deleted 95 // Since the GestureRecognizer does not own the |helper|, it is not deleted
87 // and must be cleaned up appropriately by the caller. 96 // and must be cleaned up appropriately by the caller.
88 virtual void RemoveGestureEventHelper(GestureEventHelper* helper) = 0; 97 virtual void RemoveGestureEventHelper(GestureEventHelper* helper) = 0;
89 }; 98 };
90 99
91 } // namespace ui 100 } // namespace ui
92 101
93 #endif // UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_H_ 102 #endif // UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_H_
OLDNEW
« no previous file with comments | « ui/events/gestures/gesture_provider_aura_unittest.cc ('k') | ui/events/gestures/gesture_recognizer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698