Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: content/browser/renderer_host/input/stylus_text_selector.h

Issue 2885243003: [Android] Introduce state machine in stylus text selection (Closed)
Patch Set: Fixed the review comments related to naming and other issues. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/input/stylus_text_selector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_WITH_BUTTON_PRESSED,
56 DRAGGING_WITH_BUTTON_RELEASED,
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_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/input/stylus_text_selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698