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

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

Issue 103173004: Target touches to the correct display. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reset GR between test runs (caused local ASAN failure) Created 6 years, 11 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
« no previous file with comments | « ui/events/gestures/gesture_point.cc ('k') | ui/events/gestures/gesture_recognizer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 14
15 namespace ui { 15 namespace ui {
16 // A GestureRecognizer is an abstract base class for conversion of touch events 16 // A GestureRecognizer is an abstract base class for conversion of touch events
17 // into gestures. 17 // into gestures.
18 class EVENTS_EXPORT GestureRecognizer { 18 class EVENTS_EXPORT GestureRecognizer {
19 public: 19 public:
20 static GestureRecognizer* Create(); 20 static GestureRecognizer* Create();
21 static GestureRecognizer* Get(); 21 static GestureRecognizer* Get();
22 static void Reset();
22 23
23 // List of GestureEvent*. 24 // List of GestureEvent*.
24 typedef ScopedVector<GestureEvent> Gestures; 25 typedef ScopedVector<GestureEvent> Gestures;
25 26
26 virtual ~GestureRecognizer() {} 27 virtual ~GestureRecognizer() {}
27 28
28 // Invoked for each touch event that could contribute to the current gesture. 29 // Invoked for each touch event that could contribute to the current gesture.
29 // Returns list of zero or more GestureEvents identified after processing 30 // Returns list of zero or more GestureEvents identified after processing
30 // TouchEvent. 31 // TouchEvent.
31 // Caller would be responsible for freeing up Gestures. 32 // Caller would be responsible for freeing up Gestures.
32 virtual Gestures* ProcessTouchEventForGesture(const TouchEvent& event, 33 virtual Gestures* ProcessTouchEventForGesture(const TouchEvent& event,
33 ui::EventResult result, 34 ui::EventResult result,
34 GestureConsumer* consumer) = 0; 35 GestureConsumer* consumer) = 0;
35 36
36 // This is called when the consumer is destroyed. So this should cleanup any 37 // This is called when the consumer is destroyed. So this should cleanup any
37 // internal state maintained for |consumer|. 38 // internal state maintained for |consumer|.
38 virtual void CleanupStateForConsumer(GestureConsumer* consumer) = 0; 39 virtual void CleanupStateForConsumer(GestureConsumer* consumer) = 0;
39 40
40 // Return the window which should handle this TouchEvent, in the case where 41 // Return the window which should handle this TouchEvent, in the case where
41 // the touch is already associated with a target. 42 // the touch is already associated with a target.
42 // Otherwise, returns null. 43 // Otherwise, returns null.
43 virtual GestureConsumer* GetTouchLockedTarget(const TouchEvent& event) = 0; 44 virtual GestureConsumer* GetTouchLockedTarget(const TouchEvent& event) = 0;
44 45
45 // Return the window which should handle this GestureEvent. 46 // Return the window which should handle this GestureEvent.
46 virtual GestureConsumer* GetTargetForGestureEvent( 47 virtual GestureConsumer* GetTargetForGestureEvent(
47 const GestureEvent& event) = 0; 48 const GestureEvent& event) = 0;
48 49
49 // If there is an active touch within 50 // Returns the target of the nearest active touch with source device of
50 // GestureConfiguration::max_separation_for_gesture_touches_in_pixels, 51 // |source_device_id|, within
51 // of |location|, returns the target of the nearest active touch. 52 // GestureConfiguration::max_separation_for_gesture_touches_in_pixels of
52 virtual GestureConsumer* GetTargetForLocation(const gfx::Point& location) = 0; 53 // |location|, or NULL if no such point exists.
54 virtual GestureConsumer* GetTargetForLocation(
55 const gfx::Point& location, int source_device_id) = 0;
53 56
54 // Makes |new_consumer| the target for events previously targeting 57 // Makes |new_consumer| the target for events previously targeting
55 // |current_consumer|. All other targets are canceled. 58 // |current_consumer|. All other targets are canceled.
56 // The caller is responsible for updating the state of the consumers to 59 // The caller is responsible for updating the state of the consumers to
57 // be aware of this transfer of control (there are no ENTERED/EXITED events). 60 // be aware of this transfer of control (there are no ENTERED/EXITED events).
58 // If |new_consumer| is NULL, all events are canceled. 61 // If |new_consumer| is NULL, all events are canceled.
59 // If |old_consumer| is NULL, all events not already targeting |new_consumer| 62 // If |old_consumer| is NULL, all events not already targeting |new_consumer|
60 // are canceled. 63 // are canceled.
61 virtual void TransferEventsTo(GestureConsumer* current_consumer, 64 virtual void TransferEventsTo(GestureConsumer* current_consumer,
62 GestureConsumer* new_consumer) = 0; 65 GestureConsumer* new_consumer) = 0;
(...skipping 15 matching lines...) Expand all
78 81
79 // Unsubscribes |helper| from async gesture dispatch. 82 // Unsubscribes |helper| from async gesture dispatch.
80 // Since the GestureRecognizer does not own the |helper|, it is not deleted 83 // Since the GestureRecognizer does not own the |helper|, it is not deleted
81 // and must be cleaned up appropriately by the caller. 84 // and must be cleaned up appropriately by the caller.
82 virtual void RemoveGestureEventHelper(GestureEventHelper* helper) = 0; 85 virtual void RemoveGestureEventHelper(GestureEventHelper* helper) = 0;
83 }; 86 };
84 87
85 } // namespace ui 88 } // namespace ui
86 89
87 #endif // UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_H_ 90 #endif // UI_EVENTS_GESTURES_GESTURE_RECOGNIZER_H_
OLDNEW
« no previous file with comments | « ui/events/gestures/gesture_point.cc ('k') | ui/events/gestures/gesture_recognizer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698