| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 void OnSelectionBoundsChanged(const SelectionBound& start, | 48 void OnSelectionBoundsChanged(const SelectionBound& start, |
| 49 const SelectionBound& end); | 49 const SelectionBound& end); |
| 50 | 50 |
| 51 // Allows touch-dragging of the handle. | 51 // Allows touch-dragging of the handle. |
| 52 // Returns true iff the event was consumed, in which case the caller should | 52 // Returns true iff the event was consumed, in which case the caller should |
| 53 // cease further handling of the event. | 53 // cease further handling of the event. |
| 54 bool WillHandleTouchEvent(const MotionEvent& event); | 54 bool WillHandleTouchEvent(const MotionEvent& event); |
| 55 | 55 |
| 56 // To be called before forwarding a tap event. This allows automatically | 56 // To be called before forwarding a tap event. This allows automatically |
| 57 // showing the insertion handle from subsequent bounds changes. | 57 // showing the insertion handle from subsequent bounds changes. |
| 58 void OnTapEvent(); | 58 bool WillHandleTapEvent(const gfx::PointF& location); |
| 59 | 59 |
| 60 // To be called before forwarding a longpress event. This allows automatically | 60 // To be called before forwarding a longpress event. This allows automatically |
| 61 // showing the selection or insertion handles from subsequent bounds changes. | 61 // showing the selection or insertion handles from subsequent bounds changes. |
| 62 void OnLongPressEvent(); | 62 bool WillHandleLongPressEvent(const gfx::PointF& location); |
| 63 | 63 |
| 64 // Allow showing the selection handles from the most recent selection bounds | 64 // Allow showing the selection handles from the most recent selection bounds |
| 65 // update (if valid), or a future valid bounds update. | 65 // update (if valid), or a future valid bounds update. |
| 66 void AllowShowingFromCurrentSelection(); | 66 void AllowShowingFromCurrentSelection(); |
| 67 | 67 |
| 68 // Hide the handles and suppress bounds updates until the next explicit | 68 // Hide the handles and suppress bounds updates until the next explicit |
| 69 // showing allowance. | 69 // showing allowance. |
| 70 void HideAndDisallowShowingAutomatically(); | 70 void HideAndDisallowShowingAutomatically(); |
| 71 | 71 |
| 72 // Override the handle visibility according to |hidden|. | 72 // Override the handle visibility according to |hidden|. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 const gfx::PointF& new_position) override; | 106 const gfx::PointF& new_position) override; |
| 107 void OnHandleDragEnd(const TouchHandle& handle) override; | 107 void OnHandleDragEnd(const TouchHandle& handle) override; |
| 108 void OnHandleTapped(const TouchHandle& handle) override; | 108 void OnHandleTapped(const TouchHandle& handle) override; |
| 109 void SetNeedsAnimate() override; | 109 void SetNeedsAnimate() override; |
| 110 scoped_ptr<TouchHandleDrawable> CreateDrawable() override; | 110 scoped_ptr<TouchHandleDrawable> CreateDrawable() override; |
| 111 base::TimeDelta GetTapTimeout() const override; | 111 base::TimeDelta GetTapTimeout() const override; |
| 112 float GetTapSlop() const override; | 112 float GetTapSlop() const override; |
| 113 | 113 |
| 114 void ShowInsertionHandleAutomatically(); | 114 void ShowInsertionHandleAutomatically(); |
| 115 void ShowSelectionHandlesAutomatically(); | 115 void ShowSelectionHandlesAutomatically(); |
| 116 bool WillHandleTapOrLongPress(const gfx::PointF& location); |
| 116 | 117 |
| 117 void OnInsertionChanged(); | 118 void OnInsertionChanged(); |
| 118 void OnSelectionChanged(); | 119 void OnSelectionChanged(); |
| 119 | 120 |
| 120 void ActivateInsertion(); | 121 void ActivateInsertion(); |
| 121 void DeactivateInsertion(); | 122 void DeactivateInsertion(); |
| 122 void ActivateSelection(); | 123 void ActivateSelection(); |
| 123 void DeactivateSelection(); | 124 void DeactivateSelection(); |
| 124 void ResetCachedValuesIfInactive(); | 125 void ResetCachedValuesIfInactive(); |
| 125 | 126 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // Whether a selection handle was dragged during the current 'selection | 165 // Whether a selection handle was dragged during the current 'selection |
| 165 // session' - i.e. since the current selection has been activated. | 166 // session' - i.e. since the current selection has been activated. |
| 166 bool selection_handle_dragged_; | 167 bool selection_handle_dragged_; |
| 167 | 168 |
| 168 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); | 169 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); |
| 169 }; | 170 }; |
| 170 | 171 |
| 171 } // namespace ui | 172 } // namespace ui |
| 172 | 173 |
| 173 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ | 174 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ |
| OLD | NEW |