OLD | NEW |
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/timer/timer.h" | 8 #include "base/timer/timer.h" |
9 #include "ui/aura/window_observer.h" | 9 #include "ui/aura/window_observer.h" |
10 #include "ui/base/touch/touch_editing_controller.h" | 10 #include "ui/base/touch/touch_editing_controller.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 public: | 30 public: |
31 class EditingHandleView; | 31 class EditingHandleView; |
32 | 32 |
33 // Use TextSelectionController::create(). | 33 // Use TextSelectionController::create(). |
34 explicit TouchSelectionControllerImpl( | 34 explicit TouchSelectionControllerImpl( |
35 ui::TouchEditable* client_view); | 35 ui::TouchEditable* client_view); |
36 | 36 |
37 virtual ~TouchSelectionControllerImpl(); | 37 virtual ~TouchSelectionControllerImpl(); |
38 | 38 |
39 // TextSelectionController. | 39 // TextSelectionController. |
40 virtual void SelectionChanged() OVERRIDE; | 40 virtual void SelectionChanged() override; |
41 virtual bool IsHandleDragInProgress() OVERRIDE; | 41 virtual bool IsHandleDragInProgress() override; |
42 virtual void HideHandles(bool quick) OVERRIDE; | 42 virtual void HideHandles(bool quick) override; |
43 | 43 |
44 private: | 44 private: |
45 friend class TouchSelectionControllerImplTest; | 45 friend class TouchSelectionControllerImplTest; |
46 friend class test::WidgetTestInteractive; | 46 friend class test::WidgetTestInteractive; |
47 | 47 |
48 void SetDraggingHandle(EditingHandleView* handle); | 48 void SetDraggingHandle(EditingHandleView* handle); |
49 | 49 |
50 // Callback to inform the client view that the selection handle has been | 50 // Callback to inform the client view that the selection handle has been |
51 // dragged, hence selection may need to be updated. | 51 // dragged, hence selection may need to be updated. |
52 void SelectionHandleDragged(const gfx::Point& drag_pos); | 52 void SelectionHandleDragged(const gfx::Point& drag_pos); |
53 | 53 |
54 // Convenience method to convert a point from a selection handle's coordinate | 54 // Convenience method to convert a point from a selection handle's coordinate |
55 // system to that of the client view. | 55 // system to that of the client view. |
56 void ConvertPointToClientView(EditingHandleView* source, gfx::Point* point); | 56 void ConvertPointToClientView(EditingHandleView* source, gfx::Point* point); |
57 | 57 |
58 // Convenience method to set a handle's selection rect and hide it if it is | 58 // Convenience method to set a handle's selection rect and hide it if it is |
59 // located out of client view. | 59 // located out of client view. |
60 void SetHandleSelectionRect(EditingHandleView* handle, const gfx::Rect& rect, | 60 void SetHandleSelectionRect(EditingHandleView* handle, const gfx::Rect& rect, |
61 const gfx::Rect& rect_in_screen); | 61 const gfx::Rect& rect_in_screen); |
62 | 62 |
63 // Checks if handle should be shown for a selection end-point at |rect|. | 63 // Checks if handle should be shown for a selection end-point at |rect|. |
64 // |rect| should be the clipped version of the selection end-point. | 64 // |rect| should be the clipped version of the selection end-point. |
65 bool ShouldShowHandleFor(const gfx::Rect& rect) const; | 65 bool ShouldShowHandleFor(const gfx::Rect& rect) const; |
66 | 66 |
67 // Overridden from TouchEditingMenuController. | 67 // Overridden from TouchEditingMenuController. |
68 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 68 virtual bool IsCommandIdEnabled(int command_id) const override; |
69 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 69 virtual void ExecuteCommand(int command_id, int event_flags) override; |
70 virtual void OpenContextMenu() OVERRIDE; | 70 virtual void OpenContextMenu() override; |
71 virtual void OnMenuClosed(TouchEditingMenuView* menu) OVERRIDE; | 71 virtual void OnMenuClosed(TouchEditingMenuView* menu) override; |
72 | 72 |
73 // Overriden from aura::WindowObserver. | 73 // Overriden from aura::WindowObserver. |
74 virtual void OnAncestorWindowTransformed(aura::Window* source, | 74 virtual void OnAncestorWindowTransformed(aura::Window* source, |
75 aura::Window* window) OVERRIDE; | 75 aura::Window* window) override; |
76 | 76 |
77 // Overridden from WidgetObserver. We will observe the widget backing the | 77 // Overridden from WidgetObserver. We will observe the widget backing the |
78 // |client_view_| so that when its moved/resized, we can update the selection | 78 // |client_view_| so that when its moved/resized, we can update the selection |
79 // handles appropriately. | 79 // handles appropriately. |
80 virtual void OnWidgetClosing(Widget* widget) OVERRIDE; | 80 virtual void OnWidgetClosing(Widget* widget) override; |
81 virtual void OnWidgetBoundsChanged(Widget* widget, | 81 virtual void OnWidgetBoundsChanged(Widget* widget, |
82 const gfx::Rect& new_bounds) OVERRIDE; | 82 const gfx::Rect& new_bounds) override; |
83 | 83 |
84 // Overriden from ui::EventHandler. | 84 // Overriden from ui::EventHandler. |
85 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 85 virtual void OnKeyEvent(ui::KeyEvent* event) override; |
86 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 86 virtual void OnMouseEvent(ui::MouseEvent* event) override; |
87 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; | 87 virtual void OnScrollEvent(ui::ScrollEvent* event) override; |
88 | 88 |
89 // Time to show context menu. | 89 // Time to show context menu. |
90 void ContextMenuTimerFired(); | 90 void ContextMenuTimerFired(); |
91 | 91 |
92 void StartContextMenuTimer(); | 92 void StartContextMenuTimer(); |
93 | 93 |
94 // Convenience method to update the position/visibility of the context menu. | 94 // Convenience method to update the position/visibility of the context menu. |
95 void UpdateContextMenu(); | 95 void UpdateContextMenu(); |
96 | 96 |
97 // Convenience method for hiding context menu. | 97 // Convenience method for hiding context menu. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // Selection end points, clipped to client view's boundaries. | 131 // Selection end points, clipped to client view's boundaries. |
132 gfx::Rect selection_end_point_1_clipped_; | 132 gfx::Rect selection_end_point_1_clipped_; |
133 gfx::Rect selection_end_point_2_clipped_; | 133 gfx::Rect selection_end_point_2_clipped_; |
134 | 134 |
135 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerImpl); | 135 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerImpl); |
136 }; | 136 }; |
137 | 137 |
138 } // namespace views | 138 } // namespace views |
139 | 139 |
140 #endif // UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_ | 140 #endif // UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_ |
OLD | NEW |