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_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ | 5 #ifndef UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ |
6 #define UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ | 6 #define UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ |
7 | 7 |
8 #include "ui/base/touch/selection_bound.h" | 8 #include "ui/base/touch/selection_bound.h" |
9 #include "ui/gfx/geometry/point_f.h" | 9 #include "ui/gfx/geometry/point_f.h" |
10 #include "ui/gfx/geometry/rect_f.h" | 10 #include "ui/gfx/geometry/rect_f.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 void OnSelectionBoundsChanged(const SelectionBound& start, | 54 void OnSelectionBoundsChanged(const SelectionBound& start, |
55 const SelectionBound& end); | 55 const SelectionBound& end); |
56 | 56 |
57 // Allows touch-dragging of the handle. | 57 // Allows touch-dragging of the handle. |
58 // Returns true iff the event was consumed, in which case the caller should | 58 // Returns true iff the event was consumed, in which case the caller should |
59 // cease further handling of the event. | 59 // cease further handling of the event. |
60 bool WillHandleTouchEvent(const MotionEvent& event); | 60 bool WillHandleTouchEvent(const MotionEvent& event); |
61 | 61 |
62 // To be called before forwarding a tap event. This allows automatically | 62 // To be called before forwarding a tap event. This allows automatically |
63 // showing the insertion handle from subsequent bounds changes. | 63 // showing the insertion handle from subsequent bounds changes. |
64 void OnTapEvent(); | 64 bool WillHandleTapEvent(const gfx::PointF& location); |
65 | 65 |
66 // To be called before forwarding a longpress event. This allows automatically | 66 // To be called before forwarding a longpress event. This allows automatically |
67 // showing the selection or insertion handles from subsequent bounds changes. | 67 // showing the selection or insertion handles from subsequent bounds changes. |
68 void OnLongPressEvent(); | 68 bool WillHandleLongPressEvent(const gfx::PointF& location); |
69 | 69 |
70 // Allow showing the selection handles from the most recent selection bounds | 70 // Allow showing the selection handles from the most recent selection bounds |
71 // update (if valid), or a future valid bounds update. | 71 // update (if valid), or a future valid bounds update. |
72 void AllowShowingFromCurrentSelection(); | 72 void AllowShowingFromCurrentSelection(); |
73 | 73 |
74 // Hide the handles and suppress bounds updates until the next explicit | 74 // Hide the handles and suppress bounds updates until the next explicit |
75 // showing allowance. | 75 // showing allowance. |
76 void HideAndDisallowShowingAutomatically(); | 76 void HideAndDisallowShowingAutomatically(); |
77 | 77 |
78 // Override the handle visibility according to |hidden|. | 78 // Override the handle visibility according to |hidden|. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 const gfx::PointF& new_position) override; | 117 const gfx::PointF& new_position) override; |
118 void OnHandleDragEnd(const TouchHandle& handle) override; | 118 void OnHandleDragEnd(const TouchHandle& handle) override; |
119 void OnHandleTapped(const TouchHandle& handle) override; | 119 void OnHandleTapped(const TouchHandle& handle) override; |
120 void SetNeedsAnimate() override; | 120 void SetNeedsAnimate() override; |
121 scoped_ptr<TouchHandleDrawable> CreateDrawable() override; | 121 scoped_ptr<TouchHandleDrawable> CreateDrawable() override; |
122 base::TimeDelta GetTapTimeout() const override; | 122 base::TimeDelta GetTapTimeout() const override; |
123 float GetTapSlop() const override; | 123 float GetTapSlop() const override; |
124 | 124 |
125 void ShowInsertionHandleAutomatically(); | 125 void ShowInsertionHandleAutomatically(); |
126 void ShowSelectionHandlesAutomatically(); | 126 void ShowSelectionHandlesAutomatically(); |
| 127 bool WillHandleTapOrLongPress(const gfx::PointF& location); |
127 | 128 |
128 void OnInsertionChanged(); | 129 void OnInsertionChanged(); |
129 void OnSelectionChanged(); | 130 void OnSelectionChanged(); |
130 | 131 |
131 void ActivateInsertion(); | 132 void ActivateInsertion(); |
132 void DeactivateInsertion(); | 133 void DeactivateInsertion(); |
133 void ActivateSelection(); | 134 void ActivateSelection(); |
134 void DeactivateSelection(); | 135 void DeactivateSelection(); |
135 void ForceNextUpdateIfInactive(); | 136 void ForceNextUpdateIfInactive(); |
136 | 137 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // Whether a selection handle was dragged during the current 'selection | 180 // Whether a selection handle was dragged during the current 'selection |
180 // session' - i.e. since the current selection has been activated. | 181 // session' - i.e. since the current selection has been activated. |
181 bool selection_handle_dragged_; | 182 bool selection_handle_dragged_; |
182 | 183 |
183 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); | 184 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); |
184 }; | 185 }; |
185 | 186 |
186 } // namespace ui | 187 } // namespace ui |
187 | 188 |
188 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ | 189 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ |
OLD | NEW |