OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_BROWSER_RENDERER_HOST_INPUT_STYLUS_TEXT_SELECTOR_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_STYLUS_TEXT_SELECTOR_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_STYLUS_TEXT_SELECTOR_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_STYLUS_TEXT_SELECTOR_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // Interface with which the StylusTextSelector conveys drag and tap gestures | 24 // Interface with which the StylusTextSelector conveys drag and tap gestures |
25 // when the activating button is pressed. | 25 // when the activating button is pressed. |
26 // selection handles, or long press. | 26 // selection handles, or long press. |
27 class CONTENT_EXPORT StylusTextSelectorClient { | 27 class CONTENT_EXPORT StylusTextSelectorClient { |
28 public: | 28 public: |
29 virtual ~StylusTextSelectorClient() {} | 29 virtual ~StylusTextSelectorClient() {} |
30 | 30 |
31 // (x0, y0) and (x1, y1) indicate the bounds of the initial selection. | 31 // (x0, y0) and (x1, y1) indicate the bounds of the initial selection. |
32 virtual void OnStylusSelectBegin(float x0, float y0, float x1, float y1) = 0; | 32 virtual void OnStylusSelectBegin(float x0, float y0, float x1, float y1) = 0; |
33 virtual void OnStylusSelectUpdate(float x, float y) = 0; | 33 virtual void OnStylusSelectUpdate(float x, float y) = 0; |
34 virtual void OnStylusSelectEnd() = 0; | |
35 virtual void OnStylusSelectTap(base::TimeTicks time, float x, float y) = 0; | 34 virtual void OnStylusSelectTap(base::TimeTicks time, float x, float y) = 0; |
36 }; | 35 }; |
37 | 36 |
38 // Provides stylus-based text selection and interaction, including: | 37 // Provides stylus-based text selection and interaction, including: |
39 // * Selection manipulation when an activating stylus button is pressed and | 38 // * Selection manipulation when an activating stylus button is pressed and |
40 // the stylus is dragged. | 39 // the stylus is dragged. |
41 // * Word selection and context menu activation when the when an activating | 40 // * Word selection and context menu activation when the when an activating |
42 // stylus button is pressed and the stylus is tapped. | 41 // stylus button is pressed and the stylus is tapped. |
43 class CONTENT_EXPORT StylusTextSelector : public ui::SimpleGestureListener { | 42 class CONTENT_EXPORT StylusTextSelector : public ui::SimpleGestureListener { |
44 public: | 43 public: |
(...skipping 15 matching lines...) Expand all Loading... |
60 const ui::MotionEvent& secondary_pointer_down, | 59 const ui::MotionEvent& secondary_pointer_down, |
61 float distance_x, | 60 float distance_x, |
62 float distance_y) override; | 61 float distance_y) override; |
63 | 62 |
64 static bool ShouldStartTextSelection(const ui::MotionEvent& event); | 63 static bool ShouldStartTextSelection(const ui::MotionEvent& event); |
65 | 64 |
66 StylusTextSelectorClient* client_; | 65 StylusTextSelectorClient* client_; |
67 bool text_selection_triggered_; | 66 bool text_selection_triggered_; |
68 bool secondary_button_pressed_; | 67 bool secondary_button_pressed_; |
69 bool dragging_; | 68 bool dragging_; |
70 bool dragged_; | |
71 float anchor_x_; | 69 float anchor_x_; |
72 float anchor_y_; | 70 float anchor_y_; |
73 std::unique_ptr<ui::GestureDetector> gesture_detector_; | 71 std::unique_ptr<ui::GestureDetector> gesture_detector_; |
74 | 72 |
75 DISALLOW_COPY_AND_ASSIGN(StylusTextSelector); | 73 DISALLOW_COPY_AND_ASSIGN(StylusTextSelector); |
76 }; | 74 }; |
77 | 75 |
78 } // namespace content | 76 } // namespace content |
79 | 77 |
80 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_STYLUS_TEXT_SELECTOR_H_ | 78 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_STYLUS_TEXT_SELECTOR_H_ |
OLD | NEW |