| 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 "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "ui/base/touch/selection_bound.h" | 9 #include "ui/base/touch/selection_bound.h" |
| 10 #include "ui/gfx/geometry/point_f.h" | 10 #include "ui/gfx/geometry/point_f.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 void OnSelectionBoundsChanged(const SelectionBound& start, | 75 void OnSelectionBoundsChanged(const SelectionBound& start, |
| 76 const SelectionBound& end); | 76 const SelectionBound& end); |
| 77 | 77 |
| 78 // Allows touch-dragging of the handle. | 78 // Allows touch-dragging of the handle. |
| 79 // Returns true iff the event was consumed, in which case the caller should | 79 // Returns true iff the event was consumed, in which case the caller should |
| 80 // cease further handling of the event. | 80 // cease further handling of the event. |
| 81 bool WillHandleTouchEvent(const MotionEvent& event); | 81 bool WillHandleTouchEvent(const MotionEvent& event); |
| 82 | 82 |
| 83 // To be called before forwarding a tap event. This allows automatically | 83 // To be called before forwarding a tap event. This allows automatically |
| 84 // showing the insertion handle from subsequent bounds changes. | 84 // showing the insertion handle from subsequent bounds changes. |
| 85 bool WillHandleTapEvent(const gfx::PointF& location); | 85 // |tap_count| is tap index in a repeated sequence, i.e., 1 for the first |
| 86 // tap, 2 for the second tap, etc... |
| 87 bool WillHandleTapEvent(const gfx::PointF& location, int tap_count); |
| 86 | 88 |
| 87 // To be called before forwarding a longpress event. This allows automatically | 89 // To be called before forwarding a longpress event. This allows automatically |
| 88 // showing the selection or insertion handles from subsequent bounds changes. | 90 // showing the selection or insertion handles from subsequent bounds changes. |
| 89 bool WillHandleLongPressEvent(base::TimeTicks event_time, | 91 bool WillHandleLongPressEvent(base::TimeTicks event_time, |
| 90 const gfx::PointF& location); | 92 const gfx::PointF& location); |
| 91 | 93 |
| 92 // Allow showing the selection handles from the most recent selection bounds | 94 // Allow showing the selection handles from the most recent selection bounds |
| 93 // update (if valid), or a future valid bounds update. | 95 // update (if valid), or a future valid bounds update. |
| 94 void AllowShowingFromCurrentSelection(); | 96 void AllowShowingFromCurrentSelection(); |
| 95 | 97 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 126 const gfx::PointF& GetEndPosition() const; | 128 const gfx::PointF& GetEndPosition() const; |
| 127 | 129 |
| 128 const SelectionBound& start() const { return start_; } | 130 const SelectionBound& start() const { return start_; } |
| 129 const SelectionBound& end() const { return end_; } | 131 const SelectionBound& end() const { return end_; } |
| 130 | 132 |
| 131 ActiveStatus active_status() const { return active_status_; } | 133 ActiveStatus active_status() const { return active_status_; } |
| 132 | 134 |
| 133 private: | 135 private: |
| 134 friend class TouchSelectionControllerTestApi; | 136 friend class TouchSelectionControllerTestApi; |
| 135 | 137 |
| 136 enum InputEventType { TAP, LONG_PRESS, INPUT_EVENT_TYPE_NONE }; | 138 enum InputEventType { TAP, REPEATED_TAP, LONG_PRESS, INPUT_EVENT_TYPE_NONE }; |
| 137 | 139 |
| 138 // TouchHandleClient implementation. | 140 // TouchHandleClient implementation. |
| 139 void OnDragBegin(const TouchSelectionDraggable& draggable, | 141 void OnDragBegin(const TouchSelectionDraggable& draggable, |
| 140 const gfx::PointF& drag_position) override; | 142 const gfx::PointF& drag_position) override; |
| 141 void OnDragUpdate(const TouchSelectionDraggable& draggable, | 143 void OnDragUpdate(const TouchSelectionDraggable& draggable, |
| 142 const gfx::PointF& drag_position) override; | 144 const gfx::PointF& drag_position) override; |
| 143 void OnDragEnd(const TouchSelectionDraggable& draggable) override; | 145 void OnDragEnd(const TouchSelectionDraggable& draggable) override; |
| 144 bool IsWithinTapSlop(const gfx::Vector2dF& delta) const override; | 146 bool IsWithinTapSlop(const gfx::Vector2dF& delta) const override; |
| 145 void OnHandleTapped(const TouchHandle& handle) override; | 147 void OnHandleTapped(const TouchHandle& handle) override; |
| 146 void SetNeedsAnimate() override; | 148 void SetNeedsAnimate() override; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 // Whether a selection handle was dragged during the current 'selection | 222 // Whether a selection handle was dragged during the current 'selection |
| 221 // session' - i.e. since the current selection has been activated. | 223 // session' - i.e. since the current selection has been activated. |
| 222 bool selection_handle_dragged_; | 224 bool selection_handle_dragged_; |
| 223 | 225 |
| 224 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); | 226 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); |
| 225 }; | 227 }; |
| 226 | 228 |
| 227 } // namespace ui | 229 } // namespace ui |
| 228 | 230 |
| 229 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ | 231 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ |
| OLD | NEW |