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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 float tap_slop, | 42 float tap_slop, |
43 bool show_on_tap_for_empty_editable); | 43 bool show_on_tap_for_empty_editable); |
44 ~TouchSelectionController() override; | 44 ~TouchSelectionController() override; |
45 | 45 |
46 // To be called when the selection bounds have changed. | 46 // To be called when the selection bounds have changed. |
47 // Note that such updates will trigger handle updates only if preceded | 47 // Note that such updates will trigger handle updates only if preceded |
48 // by an appropriate call to allow automatic showing. | 48 // by an appropriate call to allow automatic showing. |
49 void OnSelectionBoundsChanged(const SelectionBound& start, | 49 void OnSelectionBoundsChanged(const SelectionBound& start, |
50 const SelectionBound& end); | 50 const SelectionBound& end); |
51 | 51 |
| 52 // To be called when the viewport size has been changed. This is used for |
| 53 // setting the state of the handles. |
| 54 void OnViewportChanged(const gfx::RectF viewport_rect); |
| 55 |
52 // Allows touch-dragging of the handle. | 56 // Allows touch-dragging of the handle. |
53 // Returns true iff the event was consumed, in which case the caller should | 57 // Returns true iff the event was consumed, in which case the caller should |
54 // cease further handling of the event. | 58 // cease further handling of the event. |
55 bool WillHandleTouchEvent(const MotionEvent& event); | 59 bool WillHandleTouchEvent(const MotionEvent& event); |
56 | 60 |
57 // To be called before forwarding a tap event. This allows automatically | 61 // To be called before forwarding a tap event. This allows automatically |
58 // showing the insertion handle from subsequent bounds changes. | 62 // showing the insertion handle from subsequent bounds changes. |
59 void OnTapEvent(); | 63 void OnTapEvent(); |
60 | 64 |
61 // To be called before forwarding a longpress event. This allows automatically | 65 // To be called before forwarding a longpress event. This allows automatically |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 scoped_ptr<TouchHandle> start_selection_handle_; | 145 scoped_ptr<TouchHandle> start_selection_handle_; |
142 scoped_ptr<TouchHandle> end_selection_handle_; | 146 scoped_ptr<TouchHandle> end_selection_handle_; |
143 bool is_selection_active_; | 147 bool is_selection_active_; |
144 bool activate_selection_automatically_; | 148 bool activate_selection_automatically_; |
145 | 149 |
146 bool selection_empty_; | 150 bool selection_empty_; |
147 bool selection_editable_; | 151 bool selection_editable_; |
148 | 152 |
149 bool temporarily_hidden_; | 153 bool temporarily_hidden_; |
150 | 154 |
| 155 gfx::RectF viewport_rect_; |
| 156 bool viewport_size_changed_; |
| 157 |
151 base::TimeTicks selection_start_time_; | 158 base::TimeTicks selection_start_time_; |
152 // Whether a selection handle was dragged during the current 'selection | 159 // Whether a selection handle was dragged during the current 'selection |
153 // session' - i.e. since the current selection has been activated. | 160 // session' - i.e. since the current selection has been activated. |
154 bool selection_handle_dragged_; | 161 bool selection_handle_dragged_; |
155 | 162 |
156 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); | 163 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); |
157 }; | 164 }; |
158 | 165 |
159 } // namespace ui | 166 } // namespace ui |
160 | 167 |
161 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ | 168 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ |
OLD | NEW |