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 29 matching lines...) Expand all Loading... |
40 TouchSelectionController(TouchSelectionControllerClient* client, | 40 TouchSelectionController(TouchSelectionControllerClient* client, |
41 base::TimeDelta tap_timeout, | 41 base::TimeDelta tap_timeout, |
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 const gfx::SizeF& root_layer_size, |
| 52 const gfx::Vector2dF& offset); |
51 | 53 |
52 // Allows touch-dragging of the handle. | 54 // Allows touch-dragging of the handle. |
53 // Returns true iff the event was consumed, in which case the caller should | 55 // Returns true iff the event was consumed, in which case the caller should |
54 // cease further handling of the event. | 56 // cease further handling of the event. |
55 bool WillHandleTouchEvent(const MotionEvent& event); | 57 bool WillHandleTouchEvent(const MotionEvent& event); |
56 | 58 |
57 // To be called before forwarding a tap event. This allows automatically | 59 // To be called before forwarding a tap event. This allows automatically |
58 // showing the insertion handle from subsequent bounds changes. | 60 // showing the insertion handle from subsequent bounds changes. |
59 void OnTapEvent(); | 61 void OnTapEvent(); |
60 | 62 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 void ResetCachedValuesIfInactive(); | 112 void ResetCachedValuesIfInactive(); |
111 | 113 |
112 const gfx::PointF& GetStartPosition() const; | 114 const gfx::PointF& GetStartPosition() const; |
113 const gfx::PointF& GetEndPosition() const; | 115 const gfx::PointF& GetEndPosition() const; |
114 gfx::Vector2dF GetStartLineOffset() const; | 116 gfx::Vector2dF GetStartLineOffset() const; |
115 gfx::Vector2dF GetEndLineOffset() const; | 117 gfx::Vector2dF GetEndLineOffset() const; |
116 bool GetStartVisible() const; | 118 bool GetStartVisible() const; |
117 bool GetEndVisible() const; | 119 bool GetEndVisible() const; |
118 TouchHandle::AnimationStyle GetAnimationStyle(bool was_active) const; | 120 TouchHandle::AnimationStyle GetAnimationStyle(bool was_active) const; |
119 | 121 |
| 122 void SetInvertedOrientation(); |
| 123 |
120 void LogSelectionEnd(); | 124 void LogSelectionEnd(); |
121 | 125 |
122 TouchSelectionControllerClient* const client_; | 126 TouchSelectionControllerClient* const client_; |
123 const base::TimeDelta tap_timeout_; | 127 const base::TimeDelta tap_timeout_; |
124 const float tap_slop_; | 128 const float tap_slop_; |
125 | 129 |
126 // Controls whether an insertion handle is shown on a tap for an empty | 130 // Controls whether an insertion handle is shown on a tap for an empty |
127 // editable text. | 131 // editable text. |
128 bool show_on_tap_for_empty_editable_; | 132 bool show_on_tap_for_empty_editable_; |
129 | 133 |
(...skipping 11 matching lines...) Expand all 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::SizeF root_layer_size_; |
| 156 gfx::Vector2dF content_offset_; |
| 157 gfx::RectF viewport_rect_; |
| 158 |
151 base::TimeTicks selection_start_time_; | 159 base::TimeTicks selection_start_time_; |
152 // Whether a selection handle was dragged during the current 'selection | 160 // Whether a selection handle was dragged during the current 'selection |
153 // session' - i.e. since the current selection has been activated. | 161 // session' - i.e. since the current selection has been activated. |
154 bool selection_handle_dragged_; | 162 bool selection_handle_dragged_; |
155 | 163 |
156 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); | 164 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); |
157 }; | 165 }; |
158 | 166 |
159 } // namespace ui | 167 } // namespace ui |
160 | 168 |
161 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ | 169 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ |
OLD | NEW |