| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 float tap_slop, | 47 float tap_slop, |
| 48 bool show_on_tap_for_empty_editable); | 48 bool show_on_tap_for_empty_editable); |
| 49 ~TouchSelectionController() override; | 49 ~TouchSelectionController() override; |
| 50 | 50 |
| 51 // To be called when the selection bounds have changed. | 51 // To be called when the selection bounds have changed. |
| 52 // Note that such updates will trigger handle updates only if preceded | 52 // Note that such updates will trigger handle updates only if preceded |
| 53 // by an appropriate call to allow automatic showing. | 53 // by an appropriate call to allow automatic showing. |
| 54 void OnSelectionBoundsChanged(const SelectionBound& start, | 54 void OnSelectionBoundsChanged(const SelectionBound& start, |
| 55 const SelectionBound& end); | 55 const SelectionBound& end); |
| 56 | 56 |
| 57 // To be called when the viewport rect has been changed. This is used for |
| 58 // setting the state of the handles. |
| 59 void OnViewportChanged(const gfx::RectF viewport_rect); |
| 60 |
| 57 // Allows touch-dragging of the handle. | 61 // Allows touch-dragging of the handle. |
| 58 // Returns true iff the event was consumed, in which case the caller should | 62 // Returns true iff the event was consumed, in which case the caller should |
| 59 // cease further handling of the event. | 63 // cease further handling of the event. |
| 60 bool WillHandleTouchEvent(const MotionEvent& event); | 64 bool WillHandleTouchEvent(const MotionEvent& event); |
| 61 | 65 |
| 62 // To be called before forwarding a tap event. This allows automatically | 66 // To be called before forwarding a tap event. This allows automatically |
| 63 // showing the insertion handle from subsequent bounds changes. | 67 // showing the insertion handle from subsequent bounds changes. |
| 64 bool WillHandleTapEvent(const gfx::PointF& location); | 68 bool WillHandleTapEvent(const gfx::PointF& location); |
| 65 | 69 |
| 66 // To be called before forwarding a longpress event. This allows automatically | 70 // To be called before forwarding a longpress event. This allows automatically |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 173 |
| 170 scoped_ptr<TouchHandle> start_selection_handle_; | 174 scoped_ptr<TouchHandle> start_selection_handle_; |
| 171 scoped_ptr<TouchHandle> end_selection_handle_; | 175 scoped_ptr<TouchHandle> end_selection_handle_; |
| 172 bool activate_selection_automatically_; | 176 bool activate_selection_automatically_; |
| 173 | 177 |
| 174 bool selection_empty_; | 178 bool selection_empty_; |
| 175 bool selection_editable_; | 179 bool selection_editable_; |
| 176 | 180 |
| 177 bool temporarily_hidden_; | 181 bool temporarily_hidden_; |
| 178 | 182 |
| 183 gfx::RectF viewport_rect_; |
| 184 |
| 179 base::TimeTicks selection_start_time_; | 185 base::TimeTicks selection_start_time_; |
| 180 // Whether a selection handle was dragged during the current 'selection | 186 // Whether a selection handle was dragged during the current 'selection |
| 181 // session' - i.e. since the current selection has been activated. | 187 // session' - i.e. since the current selection has been activated. |
| 182 bool selection_handle_dragged_; | 188 bool selection_handle_dragged_; |
| 183 | 189 |
| 184 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); | 190 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); |
| 185 }; | 191 }; |
| 186 | 192 |
| 187 } // namespace ui | 193 } // namespace ui |
| 188 | 194 |
| 189 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ | 195 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ |
| OLD | NEW |