Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1209)

Side by Side Diff: ui/touch_selection/touch_selection_controller.h

Issue 2034863002: Move SelectionBound from ui/base/touch to ui/gfx to be used by cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated views_unittests Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/touch_selection/BUILD.gn ('k') | ui/touch_selection/touch_selection_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/macros.h" 8 #include "base/macros.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "ui/base/touch/selection_bound.h"
11 #include "ui/gfx/geometry/point_f.h" 10 #include "ui/gfx/geometry/point_f.h"
12 #include "ui/gfx/geometry/rect_f.h" 11 #include "ui/gfx/geometry/rect_f.h"
13 #include "ui/gfx/geometry/vector2d_f.h" 12 #include "ui/gfx/geometry/vector2d_f.h"
13 #include "ui/gfx/selection_bound.h"
14 #include "ui/touch_selection/longpress_drag_selector.h" 14 #include "ui/touch_selection/longpress_drag_selector.h"
15 #include "ui/touch_selection/selection_event_type.h" 15 #include "ui/touch_selection/selection_event_type.h"
16 #include "ui/touch_selection/touch_handle.h" 16 #include "ui/touch_selection/touch_handle.h"
17 #include "ui/touch_selection/touch_handle_orientation.h" 17 #include "ui/touch_selection/touch_handle_orientation.h"
18 #include "ui/touch_selection/ui_touch_selection_export.h" 18 #include "ui/touch_selection/ui_touch_selection_export.h"
19 19
20 namespace ui { 20 namespace ui {
21 class MotionEvent; 21 class MotionEvent;
22 22
23 // Interface through which |TouchSelectionController| issues selection-related 23 // Interface through which |TouchSelectionController| issues selection-related
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 bool show_on_tap_for_empty_editable; 72 bool show_on_tap_for_empty_editable;
73 }; 73 };
74 74
75 TouchSelectionController(TouchSelectionControllerClient* client, 75 TouchSelectionController(TouchSelectionControllerClient* client,
76 const Config& config); 76 const Config& config);
77 ~TouchSelectionController() override; 77 ~TouchSelectionController() override;
78 78
79 // To be called when the selection bounds have changed. 79 // To be called when the selection bounds have changed.
80 // Note that such updates will trigger handle updates only if preceded 80 // Note that such updates will trigger handle updates only if preceded
81 // by an appropriate call to allow automatic showing. 81 // by an appropriate call to allow automatic showing.
82 void OnSelectionBoundsChanged(const SelectionBound& start, 82 void OnSelectionBoundsChanged(const gfx::SelectionBound& start,
83 const SelectionBound& end); 83 const gfx::SelectionBound& end);
84 84
85 // To be called when the viewport rect has been changed. This is used for 85 // To be called when the viewport rect has been changed. This is used for
86 // setting the state of the handles. 86 // setting the state of the handles.
87 void OnViewportChanged(const gfx::RectF viewport_rect); 87 void OnViewportChanged(const gfx::RectF viewport_rect);
88 88
89 // Allows touch-dragging of the handle. 89 // Allows touch-dragging of the handle.
90 // Returns true iff the event was consumed, in which case the caller should 90 // Returns true iff the event was consumed, in which case the caller should
91 // cease further handling of the event. 91 // cease further handling of the event.
92 bool WillHandleTouchEvent(const MotionEvent& event); 92 bool WillHandleTouchEvent(const MotionEvent& event);
93 93
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // Returns the visible rect of specified touch handle. For an active insertion 135 // Returns the visible rect of specified touch handle. For an active insertion
136 // these values will be identical. 136 // these values will be identical.
137 gfx::RectF GetStartHandleRect() const; 137 gfx::RectF GetStartHandleRect() const;
138 gfx::RectF GetEndHandleRect() const; 138 gfx::RectF GetEndHandleRect() const;
139 139
140 // Returns the focal point of the start and end bounds, as defined by 140 // Returns the focal point of the start and end bounds, as defined by
141 // their bottom coordinate. 141 // their bottom coordinate.
142 const gfx::PointF& GetStartPosition() const; 142 const gfx::PointF& GetStartPosition() const;
143 const gfx::PointF& GetEndPosition() const; 143 const gfx::PointF& GetEndPosition() const;
144 144
145 const SelectionBound& start() const { return start_; } 145 const gfx::SelectionBound& start() const { return start_; }
146 const SelectionBound& end() const { return end_; } 146 const gfx::SelectionBound& end() const { return end_; }
147 147
148 ActiveStatus active_status() const { return active_status_; } 148 ActiveStatus active_status() const { return active_status_; }
149 149
150 private: 150 private:
151 friend class TouchSelectionControllerTestApi; 151 friend class TouchSelectionControllerTestApi;
152 152
153 enum InputEventType { TAP, REPEATED_TAP, LONG_PRESS, INPUT_EVENT_TYPE_NONE }; 153 enum InputEventType { TAP, REPEATED_TAP, LONG_PRESS, INPUT_EVENT_TYPE_NONE };
154 154
155 // TouchHandleClient implementation. 155 // TouchHandleClient implementation.
156 void OnDragBegin(const TouchSelectionDraggable& draggable, 156 void OnDragBegin(const TouchSelectionDraggable& draggable,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 200
201 TouchSelectionControllerClient* const client_; 201 TouchSelectionControllerClient* const client_;
202 const Config config_; 202 const Config config_;
203 203
204 // Whether to force an update on the next selection event even if the 204 // Whether to force an update on the next selection event even if the
205 // cached selection matches the new selection. 205 // cached selection matches the new selection.
206 bool force_next_update_; 206 bool force_next_update_;
207 207
208 InputEventType response_pending_input_event_; 208 InputEventType response_pending_input_event_;
209 209
210 SelectionBound start_; 210 gfx::SelectionBound start_;
211 SelectionBound end_; 211 gfx::SelectionBound end_;
212 TouchHandleOrientation start_orientation_; 212 TouchHandleOrientation start_orientation_;
213 TouchHandleOrientation end_orientation_; 213 TouchHandleOrientation end_orientation_;
214 214
215 ActiveStatus active_status_; 215 ActiveStatus active_status_;
216 216
217 std::unique_ptr<TouchHandle> insertion_handle_; 217 std::unique_ptr<TouchHandle> insertion_handle_;
218 bool activate_insertion_automatically_; 218 bool activate_insertion_automatically_;
219 219
220 std::unique_ptr<TouchHandle> start_selection_handle_; 220 std::unique_ptr<TouchHandle> start_selection_handle_;
221 std::unique_ptr<TouchHandle> end_selection_handle_; 221 std::unique_ptr<TouchHandle> end_selection_handle_;
(...skipping 19 matching lines...) Expand all
241 // Whether a selection handle was dragged during the current 'selection 241 // Whether a selection handle was dragged during the current 'selection
242 // session' - i.e. since the current selection has been activated. 242 // session' - i.e. since the current selection has been activated.
243 bool selection_handle_dragged_; 243 bool selection_handle_dragged_;
244 244
245 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); 245 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController);
246 }; 246 };
247 247
248 } // namespace ui 248 } // namespace ui
249 249
250 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ 250 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ui/touch_selection/BUILD.gn ('k') | ui/touch_selection/touch_selection_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698