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

Side by Side Diff: ui/views/touchui/touch_selection_controller_impl.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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_ 5 #ifndef UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_
6 #define UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_ 6 #define UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 #include "ui/aura/window_observer.h" 10 #include "ui/aura/window_observer.h"
11 #include "ui/base/touch/selection_bound.h"
12 #include "ui/base/touch/touch_editing_controller.h" 11 #include "ui/base/touch/touch_editing_controller.h"
13 #include "ui/gfx/geometry/point.h" 12 #include "ui/gfx/geometry/point.h"
13 #include "ui/gfx/selection_bound.h"
14 #include "ui/touch_selection/touch_selection_menu_runner.h" 14 #include "ui/touch_selection/touch_selection_menu_runner.h"
15 #include "ui/views/view.h" 15 #include "ui/views/view.h"
16 #include "ui/views/views_export.h" 16 #include "ui/views/views_export.h"
17 #include "ui/views/widget/widget_observer.h" 17 #include "ui/views/widget/widget_observer.h"
18 18
19 namespace views { 19 namespace views {
20 class WidgetDelegateView; 20 class WidgetDelegateView;
21 21
22 namespace test { 22 namespace test {
23 class WidgetTestInteractive; 23 class WidgetTestInteractive;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // specified in handle's coordinates 58 // specified in handle's coordinates
59 void SelectionHandleDragged(const gfx::Point& drag_pos); 59 void SelectionHandleDragged(const gfx::Point& drag_pos);
60 60
61 // Convenience method to convert a point from a selection handle's coordinate 61 // Convenience method to convert a point from a selection handle's coordinate
62 // system to that of the client view. 62 // system to that of the client view.
63 void ConvertPointToClientView(EditingHandleView* source, gfx::Point* point); 63 void ConvertPointToClientView(EditingHandleView* source, gfx::Point* point);
64 64
65 // Convenience method to set a handle's selection bound and hide it if it is 65 // Convenience method to set a handle's selection bound and hide it if it is
66 // located out of client view. 66 // located out of client view.
67 void SetHandleBound(EditingHandleView* handle, 67 void SetHandleBound(EditingHandleView* handle,
68 const ui::SelectionBound& bound, 68 const gfx::SelectionBound& bound,
69 const ui::SelectionBound& bound_in_screen); 69 const gfx::SelectionBound& bound_in_screen);
70 70
71 // Checks if handle should be shown for selection bound. 71 // Checks if handle should be shown for selection bound.
72 // |bound| should be the clipped version of the selection bound. 72 // |bound| should be the clipped version of the selection bound.
73 bool ShouldShowHandleFor(const ui::SelectionBound& bound) const; 73 bool ShouldShowHandleFor(const gfx::SelectionBound& bound) const;
74 74
75 // Overridden from ui::TouchSelectionMenuClient. 75 // Overridden from ui::TouchSelectionMenuClient.
76 bool IsCommandIdEnabled(int command_id) const override; 76 bool IsCommandIdEnabled(int command_id) const override;
77 void ExecuteCommand(int command_id, int event_flags) override; 77 void ExecuteCommand(int command_id, int event_flags) override;
78 void RunContextMenu() override; 78 void RunContextMenu() override;
79 79
80 // Overriden from aura::WindowObserver. 80 // Overriden from aura::WindowObserver.
81 void OnAncestorWindowTransformed(aura::Window* source, 81 void OnAncestorWindowTransformed(aura::Window* source,
82 aura::Window* window) override; 82 aura::Window* window) override;
83 83
(...skipping 19 matching lines...) Expand all
103 103
104 // Convenience method for hiding quick menu. 104 // Convenience method for hiding quick menu.
105 void HideQuickMenu(); 105 void HideQuickMenu();
106 106
107 // Convenience method to calculate anchor rect for quick menu, in screen 107 // Convenience method to calculate anchor rect for quick menu, in screen
108 // coordinates. 108 // coordinates.
109 gfx::Rect GetQuickMenuAnchorRect() const; 109 gfx::Rect GetQuickMenuAnchorRect() const;
110 110
111 // Convenience methods for testing. 111 // Convenience methods for testing.
112 gfx::NativeView GetCursorHandleNativeView(); 112 gfx::NativeView GetCursorHandleNativeView();
113 ui::SelectionBound::Type GetSelectionHandle1Type(); 113 gfx::SelectionBound::Type GetSelectionHandle1Type();
114 gfx::Rect GetSelectionHandle1Bounds(); 114 gfx::Rect GetSelectionHandle1Bounds();
115 gfx::Rect GetSelectionHandle2Bounds(); 115 gfx::Rect GetSelectionHandle2Bounds();
116 gfx::Rect GetCursorHandleBounds(); 116 gfx::Rect GetCursorHandleBounds();
117 bool IsSelectionHandle1Visible(); 117 bool IsSelectionHandle1Visible();
118 bool IsSelectionHandle2Visible(); 118 bool IsSelectionHandle2Visible();
119 bool IsCursorHandleVisible(); 119 bool IsCursorHandleVisible();
120 gfx::Rect GetExpectedHandleBounds(const ui::SelectionBound& bound); 120 gfx::Rect GetExpectedHandleBounds(const gfx::SelectionBound& bound);
121 views::WidgetDelegateView* GetHandle1View(); 121 views::WidgetDelegateView* GetHandle1View();
122 views::WidgetDelegateView* GetHandle2View(); 122 views::WidgetDelegateView* GetHandle2View();
123 123
124 ui::TouchEditable* client_view_; 124 ui::TouchEditable* client_view_;
125 Widget* client_widget_; 125 Widget* client_widget_;
126 std::unique_ptr<EditingHandleView> selection_handle_1_; 126 std::unique_ptr<EditingHandleView> selection_handle_1_;
127 std::unique_ptr<EditingHandleView> selection_handle_2_; 127 std::unique_ptr<EditingHandleView> selection_handle_2_;
128 std::unique_ptr<EditingHandleView> cursor_handle_; 128 std::unique_ptr<EditingHandleView> cursor_handle_;
129 bool command_executed_; 129 bool command_executed_;
130 base::TimeTicks selection_start_time_; 130 base::TimeTicks selection_start_time_;
131 131
132 // Timer to trigger quick menu (Quick menu is not shown if the selection 132 // Timer to trigger quick menu (Quick menu is not shown if the selection
133 // handles are being updated. It appears only when the handles are stationary 133 // handles are being updated. It appears only when the handles are stationary
134 // for a certain amount of time). 134 // for a certain amount of time).
135 base::OneShotTimer quick_menu_timer_; 135 base::OneShotTimer quick_menu_timer_;
136 136
137 // Pointer to the SelectionHandleView being dragged during a drag session. 137 // Pointer to the SelectionHandleView being dragged during a drag session.
138 EditingHandleView* dragging_handle_; 138 EditingHandleView* dragging_handle_;
139 139
140 // In cursor mode, the two selection bounds are the same and correspond to 140 // In cursor mode, the two selection bounds are the same and correspond to
141 // |cursor_handle_|; otherwise, they correspond to |selection_handle_1_| and 141 // |cursor_handle_|; otherwise, they correspond to |selection_handle_1_| and
142 // |selection_handle_2_|, respectively. These values should be used when 142 // |selection_handle_2_|, respectively. These values should be used when
143 // selection bounds needed rather than position of handles which might be 143 // selection bounds needed rather than position of handles which might be
144 // invalid when handles are hidden. 144 // invalid when handles are hidden.
145 ui::SelectionBound selection_bound_1_; 145 gfx::SelectionBound selection_bound_1_;
146 ui::SelectionBound selection_bound_2_; 146 gfx::SelectionBound selection_bound_2_;
147 147
148 // Selection bounds, clipped to client view's boundaries. 148 // Selection bounds, clipped to client view's boundaries.
149 ui::SelectionBound selection_bound_1_clipped_; 149 gfx::SelectionBound selection_bound_1_clipped_;
150 ui::SelectionBound selection_bound_2_clipped_; 150 gfx::SelectionBound selection_bound_2_clipped_;
151 151
152 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerImpl); 152 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerImpl);
153 }; 153 };
154 154
155 } // namespace views 155 } // namespace views
156 156
157 #endif // UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_ 157 #endif // UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | ui/views/touchui/touch_selection_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698