OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_GESTURE_DETECTION_GESTURE_PROVIDER_H_ | 5 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ |
6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ | 6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ui/events/gesture_detection/gesture_detection_export.h" | 10 #include "ui/events/gesture_detection/gesture_detection_export.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 // Handle the incoming MotionEvent, returning false if the event could not | 41 // Handle the incoming MotionEvent, returning false if the event could not |
42 // be handled. | 42 // be handled. |
43 bool OnTouchEvent(const MotionEvent& event); | 43 bool OnTouchEvent(const MotionEvent& event); |
44 | 44 |
45 // Resets all gesture detectors; called on DidStartLoading(). | 45 // Resets all gesture detectors; called on DidStartLoading(). |
46 void ResetGestureDetectors(); | 46 void ResetGestureDetectors(); |
47 | 47 |
48 // Cancel the current touch event sequence by sending ACTION_CANCEL, and | 48 // Cancel the current touch event sequence by sending ACTION_CANCEL, and |
49 // ignore all the subsequent events until the next ACTION_DOWN. | 49 // ignore all the subsequent events until the next ACTION_DOWN. |
50 // One example usecase is to stop processing the touch events when showing | 50 // One example usecase is to stop processing the touch events when showing |
51 // a context popup menu. | 51 // a context popup menu. Returns true if there was an active touch sequence at |
52 void CancelActiveTouchSequence(); | 52 // the time of cancellation. |
| 53 bool CancelActiveTouchSequence(); |
53 | 54 |
54 // Update whether multi-touch gestures are supported. | 55 // Update whether multi-touch gestures are supported. |
55 void SetMultiTouchSupportEnabled(bool enabled); | 56 void SetMultiTouchSupportEnabled(bool enabled); |
56 | 57 |
57 // Update whether double-tap gestures are supported. This allows | 58 // Update whether double-tap gestures are supported. This allows |
58 // double-tap gesture suppression independent of whether or not the page's | 59 // double-tap gesture suppression independent of whether or not the page's |
59 // viewport and scale would normally prevent double-tap. | 60 // viewport and scale would normally prevent double-tap. |
60 // Note: This should not be called while a double-tap gesture is in progress. | 61 // Note: This should not be called while a double-tap gesture is in progress. |
61 void SetDoubleTapSupportForPlatformEnabled(bool enabled); | 62 void SetDoubleTapSupportForPlatformEnabled(bool enabled); |
62 | 63 |
63 // Update whether double-tap gesture detection should be suppressed due to | 64 // Update whether double-tap gesture detection should be suppressed due to |
64 // the viewport or scale of the current page. Suppressing double-tap gesture | 65 // the viewport or scale of the current page. Suppressing double-tap gesture |
65 // detection allows for rapid and responsive single-tap gestures. | 66 // detection allows for rapid and responsive single-tap gestures. |
66 void SetDoubleTapSupportForPageEnabled(bool enabled); | 67 void SetDoubleTapSupportForPageEnabled(bool enabled); |
67 | 68 |
68 // Whether a scroll gesture is in-progress. | 69 // Whether a scroll gesture is in-progress. |
69 bool IsScrollInProgress() const; | 70 bool IsScrollInProgress() const; |
70 | 71 |
71 // Whether a pinch gesture is in-progress (i.e. a pinch update has been | 72 // Whether a pinch gesture is in-progress (i.e. a pinch update has been |
72 // forwarded and detection is still active). | 73 // forwarded and detection is still active). |
73 bool IsPinchInProgress() const; | 74 bool IsPinchInProgress() const; |
74 | 75 |
75 // Whether a double tap-gesture is in-progress. | 76 // Whether a double tap-gesture is in-progress. |
76 bool IsDoubleTapInProgress() const; | 77 bool IsDoubleTapInProgress() const; |
77 | 78 |
78 // Whether the tap gesture delay is explicitly disabled (independent of | 79 // Whether the tap gesture delay is explicitly disabled (independent of |
79 // whether double-tap is supported), see |Config.disable_click_delay|. | 80 // whether double-tap is supported), see |Config.disable_click_delay|. |
80 bool IsClickDelayDisabled() const; | 81 bool IsClickDelayDisabled() const; |
81 | 82 |
| 83 // May be NULL if there is no currently active touch sequence. |
| 84 const ui::MotionEvent* current_down_event() const { |
| 85 return current_down_event_.get(); |
| 86 } |
| 87 |
82 private: | 88 private: |
83 void InitGestureDetectors(const Config& config); | 89 void InitGestureDetectors(const Config& config); |
84 | 90 |
85 bool CanHandle(const MotionEvent& event) const; | 91 bool CanHandle(const MotionEvent& event) const; |
86 | 92 |
87 void Fling(base::TimeTicks time, | 93 void Fling(base::TimeTicks time, |
88 float x, | 94 float x, |
89 float y, | 95 float y, |
90 float velocity_x, | 96 float velocity_x, |
91 float velocity_y); | 97 float velocity_y); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 129 |
124 // Keeps track of the current GESTURE_LONG_PRESS event. If a context menu is | 130 // Keeps track of the current GESTURE_LONG_PRESS event. If a context menu is |
125 // opened after a GESTURE_LONG_PRESS, this is used to insert a | 131 // opened after a GESTURE_LONG_PRESS, this is used to insert a |
126 // GESTURE_TAP_CANCEL for removing any ::active styling. | 132 // GESTURE_TAP_CANCEL for removing any ::active styling. |
127 base::TimeTicks current_longpress_time_; | 133 base::TimeTicks current_longpress_time_; |
128 }; | 134 }; |
129 | 135 |
130 } // namespace ui | 136 } // namespace ui |
131 | 137 |
132 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ | 138 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ |
OLD | NEW |