| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_VIEWS_SELECTION_CONTROLLER_H_ | 5 #ifndef UI_VIEWS_SELECTION_CONTROLLER_H_ |
| 6 #define UI_VIEWS_SELECTION_CONTROLLER_H_ | 6 #define UI_VIEWS_SELECTION_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
| 10 #include "ui/gfx/geometry/point.h" | 10 #include "ui/gfx/geometry/point.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Sets whether the SelectionController should update or paste the | 46 // Sets whether the SelectionController should update or paste the |
| 47 // selection clipboard on middle-click. Default is false. | 47 // selection clipboard on middle-click. Default is false. |
| 48 void set_handles_selection_clipboard(bool value) { | 48 void set_handles_selection_clipboard(bool value) { |
| 49 handles_selection_clipboard_ = value; | 49 handles_selection_clipboard_ = value; |
| 50 } | 50 } |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 // Tracks the mouse clicks for single/double/triple clicks. | 53 // Tracks the mouse clicks for single/double/triple clicks. |
| 54 void TrackMouseClicks(const ui::MouseEvent& event); | 54 void TrackMouseClicks(const ui::MouseEvent& event); |
| 55 | 55 |
| 56 // Selects the word at the given |point|. |
| 57 void SelectWord(const gfx::Point& point); |
| 58 |
| 56 // Returns the associated render text instance via the |delegate_|. | 59 // Returns the associated render text instance via the |delegate_|. |
| 57 gfx::RenderText* GetRenderText(); | 60 gfx::RenderText* GetRenderText(); |
| 58 | 61 |
| 59 // Helper function to update the selection on a mouse drag as per | 62 // Helper function to update the selection on a mouse drag as per |
| 60 // |last_drag_location_|. Can be called asynchronously, through a timer. | 63 // |last_drag_location_|. Can be called asynchronously, through a timer. |
| 61 void SelectThroughLastDragLocation(); | 64 void SelectThroughLastDragLocation(); |
| 62 | 65 |
| 63 // A timer and point used to modify the selection when dragging. | 66 // A timer and point used to modify the selection when dragging. |
| 64 base::RepeatingTimer drag_selection_timer_; | 67 base::RepeatingTimer drag_selection_timer_; |
| 65 gfx::Point last_drag_location_; | 68 gfx::Point last_drag_location_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 81 | 84 |
| 82 // Whether the selection clipboard is handled. | 85 // Whether the selection clipboard is handled. |
| 83 bool handles_selection_clipboard_; | 86 bool handles_selection_clipboard_; |
| 84 | 87 |
| 85 DISALLOW_COPY_AND_ASSIGN(SelectionController); | 88 DISALLOW_COPY_AND_ASSIGN(SelectionController); |
| 86 }; | 89 }; |
| 87 | 90 |
| 88 } // namespace views | 91 } // namespace views |
| 89 | 92 |
| 90 #endif // UI_VIEWS_SELECTION_CONTROLLER_H_ | 93 #endif // UI_VIEWS_SELECTION_CONTROLLER_H_ |
| OLD | NEW |