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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 void ResetCachedValuesIfInactive(); | 114 void ResetCachedValuesIfInactive(); |
111 | 115 |
112 const gfx::PointF& GetStartPosition() const; | 116 const gfx::PointF& GetStartPosition() const; |
113 const gfx::PointF& GetEndPosition() const; | 117 const gfx::PointF& GetEndPosition() const; |
114 gfx::Vector2dF GetStartLineOffset() const; | 118 gfx::Vector2dF GetStartLineOffset() const; |
115 gfx::Vector2dF GetEndLineOffset() const; | 119 gfx::Vector2dF GetEndLineOffset() const; |
116 bool GetStartVisible() const; | 120 bool GetStartVisible() const; |
117 bool GetEndVisible() const; | 121 bool GetEndVisible() const; |
118 TouchHandle::AnimationStyle GetAnimationStyle(bool was_active) const; | 122 TouchHandle::AnimationStyle GetAnimationStyle(bool was_active) const; |
119 | 123 |
| 124 void SetInvertedOrientation(); |
| 125 |
120 void LogSelectionEnd(); | 126 void LogSelectionEnd(); |
121 | 127 |
122 TouchSelectionControllerClient* const client_; | 128 TouchSelectionControllerClient* const client_; |
123 const base::TimeDelta tap_timeout_; | 129 const base::TimeDelta tap_timeout_; |
124 const float tap_slop_; | 130 const float tap_slop_; |
125 | 131 |
126 // Controls whether an insertion handle is shown on a tap for an empty | 132 // Controls whether an insertion handle is shown on a tap for an empty |
127 // editable text. | 133 // editable text. |
128 bool show_on_tap_for_empty_editable_; | 134 bool show_on_tap_for_empty_editable_; |
129 | 135 |
(...skipping 11 matching lines...) Expand all Loading... |
141 scoped_ptr<TouchHandle> start_selection_handle_; | 147 scoped_ptr<TouchHandle> start_selection_handle_; |
142 scoped_ptr<TouchHandle> end_selection_handle_; | 148 scoped_ptr<TouchHandle> end_selection_handle_; |
143 bool is_selection_active_; | 149 bool is_selection_active_; |
144 bool activate_selection_automatically_; | 150 bool activate_selection_automatically_; |
145 | 151 |
146 bool selection_empty_; | 152 bool selection_empty_; |
147 bool selection_editable_; | 153 bool selection_editable_; |
148 | 154 |
149 bool temporarily_hidden_; | 155 bool temporarily_hidden_; |
150 | 156 |
| 157 gfx::RectF viewport_rect_; |
| 158 bool viewport_size_changed_; |
| 159 |
151 base::TimeTicks selection_start_time_; | 160 base::TimeTicks selection_start_time_; |
152 // Whether a selection handle was dragged during the current 'selection | 161 // Whether a selection handle was dragged during the current 'selection |
153 // session' - i.e. since the current selection has been activated. | 162 // session' - i.e. since the current selection has been activated. |
154 bool selection_handle_dragged_; | 163 bool selection_handle_dragged_; |
155 | 164 |
156 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); | 165 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); |
157 }; | 166 }; |
158 | 167 |
159 } // namespace ui | 168 } // namespace ui |
160 | 169 |
161 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ | 170 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ |
OLD | NEW |