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/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" | |
11 #include "ui/base/touch/touch_editing_controller.h" | 10 #include "ui/base/touch/touch_editing_controller.h" |
12 #include "ui/gfx/geometry/point.h" | 11 #include "ui/gfx/geometry/point.h" |
13 #include "ui/gfx/selection_bound.h" | 12 #include "ui/gfx/selection_bound.h" |
14 #include "ui/touch_selection/touch_selection_menu_runner.h" | 13 #include "ui/touch_selection/touch_selection_menu_runner.h" |
15 #include "ui/views/view.h" | 14 #include "ui/views/view.h" |
16 #include "ui/views/views_export.h" | 15 #include "ui/views/views_export.h" |
17 #include "ui/views/widget/widget_observer.h" | 16 #include "ui/views/widget/widget_observer.h" |
18 | 17 |
19 namespace views { | 18 namespace views { |
20 class WidgetDelegateView; | 19 class WidgetDelegateView; |
21 | 20 |
22 namespace test { | 21 namespace test { |
23 class WidgetTestInteractive; | 22 class WidgetTestInteractive; |
24 } | 23 } |
25 | 24 |
26 // Touch specific implementation of TouchEditingControllerDeprecated. | 25 // Touch specific implementation of TouchEditingControllerDeprecated. |
27 // Responsible for displaying selection handles and menu elements relevant in a | 26 // Responsible for displaying selection handles and menu elements relevant in a |
28 // touch interface. | 27 // touch interface. |
29 class VIEWS_EXPORT TouchSelectionControllerImpl | 28 class VIEWS_EXPORT TouchSelectionControllerImpl |
30 : public ui::TouchEditingControllerDeprecated, | 29 : public ui::TouchEditingControllerDeprecated, |
31 public ui::TouchSelectionMenuClient, | 30 public ui::TouchSelectionMenuClient, |
32 public aura::WindowObserver, | |
33 public WidgetObserver, | 31 public WidgetObserver, |
34 public ui::EventHandler { | 32 public ui::EventHandler { |
35 public: | 33 public: |
36 class EditingHandleView; | 34 class EditingHandleView; |
37 | 35 |
38 // Use TextSelectionController::create(). | 36 // Use TextSelectionController::create(). |
39 explicit TouchSelectionControllerImpl( | 37 explicit TouchSelectionControllerImpl( |
40 ui::TouchEditable* client_view); | 38 ui::TouchEditable* client_view); |
41 | 39 |
42 ~TouchSelectionControllerImpl() override; | 40 ~TouchSelectionControllerImpl() override; |
(...skipping 27 matching lines...) Expand all Loading... |
70 | 68 |
71 // Checks if handle should be shown for selection bound. | 69 // Checks if handle should be shown for selection bound. |
72 // |bound| should be the clipped version of the selection bound. | 70 // |bound| should be the clipped version of the selection bound. |
73 bool ShouldShowHandleFor(const gfx::SelectionBound& bound) const; | 71 bool ShouldShowHandleFor(const gfx::SelectionBound& bound) const; |
74 | 72 |
75 // Overridden from ui::TouchSelectionMenuClient. | 73 // Overridden from ui::TouchSelectionMenuClient. |
76 bool IsCommandIdEnabled(int command_id) const override; | 74 bool IsCommandIdEnabled(int command_id) const override; |
77 void ExecuteCommand(int command_id, int event_flags) override; | 75 void ExecuteCommand(int command_id, int event_flags) override; |
78 void RunContextMenu() override; | 76 void RunContextMenu() override; |
79 | 77 |
80 // Overriden from aura::WindowObserver. | |
81 void OnAncestorWindowTransformed(aura::Window* source, | |
82 aura::Window* window) override; | |
83 | |
84 // Overridden from WidgetObserver. We will observe the widget backing the | 78 // Overridden from WidgetObserver. We will observe the widget backing the |
85 // |client_view_| so that when its moved/resized, we can update the selection | 79 // |client_view_| so that when its moved/resized, we can update the selection |
86 // handles appropriately. | 80 // handles appropriately. |
87 void OnWidgetClosing(Widget* widget) override; | 81 void OnWidgetClosing(Widget* widget) override; |
88 void OnWidgetBoundsChanged(Widget* widget, | 82 void OnWidgetBoundsChanged(Widget* widget, |
89 const gfx::Rect& new_bounds) override; | 83 const gfx::Rect& new_bounds) override; |
90 | 84 |
91 // Overriden from ui::EventHandler. | 85 // Overriden from ui::EventHandler. |
92 void OnKeyEvent(ui::KeyEvent* event) override; | 86 void OnKeyEvent(ui::KeyEvent* event) override; |
93 void OnMouseEvent(ui::MouseEvent* event) override; | 87 void OnMouseEvent(ui::MouseEvent* event) override; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // Selection bounds, clipped to client view's boundaries. | 142 // Selection bounds, clipped to client view's boundaries. |
149 gfx::SelectionBound selection_bound_1_clipped_; | 143 gfx::SelectionBound selection_bound_1_clipped_; |
150 gfx::SelectionBound selection_bound_2_clipped_; | 144 gfx::SelectionBound selection_bound_2_clipped_; |
151 | 145 |
152 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerImpl); | 146 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerImpl); |
153 }; | 147 }; |
154 | 148 |
155 } // namespace views | 149 } // namespace views |
156 | 150 |
157 #endif // UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_ | 151 #endif // UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_ |
OLD | NEW |