Chromium Code Reviews| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 class CONTENT_EXPORT StylusTextSelector : public ui::SimpleGestureListener { | 43 class CONTENT_EXPORT StylusTextSelector : public ui::SimpleGestureListener { |
| 44 public: | 44 public: |
| 45 explicit StylusTextSelector(StylusTextSelectorClient* client); | 45 explicit StylusTextSelector(StylusTextSelectorClient* client); |
| 46 ~StylusTextSelector() override; | 46 ~StylusTextSelector() override; |
| 47 | 47 |
| 48 // This should be called before |event| is seen by the platform gesture | 48 // This should be called before |event| is seen by the platform gesture |
| 49 // detector or forwarded to web content. | 49 // detector or forwarded to web content. |
| 50 bool OnTouchEvent(const ui::MotionEvent& event); | 50 bool OnTouchEvent(const ui::MotionEvent& event); |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 enum DragState { | |
| 54 NO_DRAG, | |
| 55 DRAGGING_IN_PROGRESS, | |
|
aelias_OOO_until_Jul13
2017/05/17 20:54:24
How about renaming these as:
NO_DRAG,
DRAGGING_WI
AKVT
2017/05/18 10:12:19
Done. Now it's more clear for readability.
| |
| 56 WAS_DRAGGED, | |
| 57 }; | |
| 53 friend class StylusTextSelectorTest; | 58 friend class StylusTextSelectorTest; |
| 54 FRIEND_TEST_ALL_PREFIXES(StylusTextSelectorTest, ShouldStartTextSelection); | 59 FRIEND_TEST_ALL_PREFIXES(StylusTextSelectorTest, ShouldStartTextSelection); |
| 55 | 60 |
| 56 // SimpleGestureListener implementation. | 61 // SimpleGestureListener implementation. |
| 57 bool OnSingleTapUp(const ui::MotionEvent& e, int tap_count) override; | 62 bool OnSingleTapUp(const ui::MotionEvent& e, int tap_count) override; |
| 58 bool OnScroll(const ui::MotionEvent& e1, | 63 bool OnScroll(const ui::MotionEvent& e1, |
| 59 const ui::MotionEvent& e2, | 64 const ui::MotionEvent& e2, |
| 60 const ui::MotionEvent& secondary_pointer_down, | 65 const ui::MotionEvent& secondary_pointer_down, |
| 61 float distance_x, | 66 float distance_x, |
| 62 float distance_y) override; | 67 float distance_y) override; |
| 63 | 68 |
| 64 static bool ShouldStartTextSelection(const ui::MotionEvent& event); | 69 static bool ShouldStartTextSelection(const ui::MotionEvent& event); |
| 65 | 70 |
| 66 StylusTextSelectorClient* client_; | 71 StylusTextSelectorClient* client_; |
| 67 bool text_selection_triggered_; | 72 bool text_selection_triggered_; |
| 68 bool secondary_button_pressed_; | 73 bool secondary_button_pressed_; |
| 69 bool dragging_; | 74 DragState drag_state_; |
| 70 bool dragged_; | |
| 71 float anchor_x_; | 75 float anchor_x_; |
| 72 float anchor_y_; | 76 float anchor_y_; |
| 73 std::unique_ptr<ui::GestureDetector> gesture_detector_; | 77 std::unique_ptr<ui::GestureDetector> gesture_detector_; |
| 74 | 78 |
| 75 DISALLOW_COPY_AND_ASSIGN(StylusTextSelector); | 79 DISALLOW_COPY_AND_ASSIGN(StylusTextSelector); |
| 76 }; | 80 }; |
| 77 | 81 |
| 78 } // namespace content | 82 } // namespace content |
| 79 | 83 |
| 80 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_STYLUS_TEXT_SELECTOR_H_ | 84 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_STYLUS_TEXT_SELECTOR_H_ |
| OLD | NEW |