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