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

Side by Side Diff: ui/touch_selection/touch_selection_controller.h

Issue 759433002: Reland: Move TouchSelectionController from content to ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Excluded ui/touch_selection from Windows GN build Created 6 years 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
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_TOUCH_SELECTION_CONTROLLER_H_ 5 #ifndef UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_SELECTION_CONTROLLER_H_ 6 #define UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_
7 7
8 #include "cc/output/viewport_selection_bound.h" 8 #include "ui/base/touch/selection_bound.h"
9 #include "content/browser/renderer_host/input/selection_event_type.h"
10 #include "content/browser/renderer_host/input/touch_handle.h"
11 #include "content/common/content_export.h"
12 #include "ui/gfx/geometry/point_f.h" 9 #include "ui/gfx/geometry/point_f.h"
13 #include "ui/gfx/geometry/rect_f.h" 10 #include "ui/gfx/geometry/rect_f.h"
14 11 #include "ui/touch_selection/selection_event_type.h"
15 namespace blink { 12 #include "ui/touch_selection/touch_handle.h"
16 class WebInputEvent; 13 #include "ui/touch_selection/ui_touch_selection_export.h"
17 }
18 14
19 namespace ui { 15 namespace ui {
20 class MotionEvent; 16 class MotionEvent;
21 }
22
23 namespace content {
24 17
25 // Interface through which |TouchSelectionController| issues selection-related 18 // Interface through which |TouchSelectionController| issues selection-related
26 // commands, notifications and requests. 19 // commands, notifications and requests.
27 class CONTENT_EXPORT TouchSelectionControllerClient { 20 class UI_TOUCH_SELECTION_EXPORT TouchSelectionControllerClient {
28 public: 21 public:
29 virtual ~TouchSelectionControllerClient() {} 22 virtual ~TouchSelectionControllerClient() {}
30 23
31 virtual bool SupportsAnimation() const = 0; 24 virtual bool SupportsAnimation() const = 0;
32 virtual void SetNeedsAnimate() = 0; 25 virtual void SetNeedsAnimate() = 0;
33 virtual void MoveCaret(const gfx::PointF& position) = 0; 26 virtual void MoveCaret(const gfx::PointF& position) = 0;
34 virtual void MoveRangeSelectionExtent(const gfx::PointF& extent) = 0; 27 virtual void MoveRangeSelectionExtent(const gfx::PointF& extent) = 0;
35 virtual void SelectBetweenCoordinates(const gfx::PointF& base, 28 virtual void SelectBetweenCoordinates(const gfx::PointF& base,
36 const gfx::PointF& extent) = 0; 29 const gfx::PointF& extent) = 0;
37 virtual void OnSelectionEvent(SelectionEventType event, 30 virtual void OnSelectionEvent(SelectionEventType event,
38 const gfx::PointF& position) = 0; 31 const gfx::PointF& position) = 0;
39 virtual scoped_ptr<TouchHandleDrawable> CreateDrawable() = 0; 32 virtual scoped_ptr<TouchHandleDrawable> CreateDrawable() = 0;
40 }; 33 };
41 34
42 // Controller for manipulating text selection via touch input. 35 // Controller for manipulating text selection via touch input.
43 class CONTENT_EXPORT TouchSelectionController : public TouchHandleClient { 36 class UI_TOUCH_SELECTION_EXPORT TouchSelectionController
37 : public TouchHandleClient {
44 public: 38 public:
45 TouchSelectionController(TouchSelectionControllerClient* client, 39 TouchSelectionController(TouchSelectionControllerClient* client,
46 base::TimeDelta tap_timeout, 40 base::TimeDelta tap_timeout,
47 float tap_slop); 41 float tap_slop);
48 ~TouchSelectionController() override; 42 ~TouchSelectionController() override;
49 43
50 // To be called when the selection bounds have changed. 44 // To be called when the selection bounds have changed.
51 // Note that such updates will trigger handle updates only if preceded 45 // Note that such updates will trigger handle updates only if preceded
52 // by an appropriate call to allow automatic showing. 46 // by an appropriate call to allow automatic showing.
53 void OnSelectionBoundsChanged(const cc::ViewportSelectionBound& start, 47 void OnSelectionBoundsChanged(const SelectionBound& start,
54 const cc::ViewportSelectionBound& end); 48 const SelectionBound& end);
55 49
56 // Allows touch-dragging of the handle. 50 // Allows touch-dragging of the handle.
57 // Returns true iff the event was consumed, in which case the caller should 51 // Returns true iff the event was consumed, in which case the caller should
58 // cease further handling of the event. 52 // cease further handling of the event.
59 bool WillHandleTouchEvent(const ui::MotionEvent& event); 53 bool WillHandleTouchEvent(const MotionEvent& event);
60 54
61 // To be called before forwarding a tap event. This allows automatically 55 // To be called before forwarding a tap event. This allows automatically
62 // showing the insertion handle from subsequent bounds changes. 56 // showing the insertion handle from subsequent bounds changes.
63 void OnTapEvent(); 57 void OnTapEvent();
64 58
65 // To be called before forwarding a longpress event. This allows automatically 59 // To be called before forwarding a longpress event. This allows automatically
66 // showing the selection or insertion handles from subsequent bounds changes. 60 // showing the selection or insertion handles from subsequent bounds changes.
67 void OnLongPressEvent(); 61 void OnLongPressEvent();
68 62
69 // Allow showing the selection handles from the most recent selection bounds 63 // Allow showing the selection handles from the most recent selection bounds
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 bool GetStartVisible() const; 114 bool GetStartVisible() const;
121 bool GetEndVisible() const; 115 bool GetEndVisible() const;
122 TouchHandle::AnimationStyle GetAnimationStyle(bool was_active) const; 116 TouchHandle::AnimationStyle GetAnimationStyle(bool was_active) const;
123 117
124 TouchSelectionControllerClient* const client_; 118 TouchSelectionControllerClient* const client_;
125 const base::TimeDelta tap_timeout_; 119 const base::TimeDelta tap_timeout_;
126 const float tap_slop_; 120 const float tap_slop_;
127 121
128 InputEventType response_pending_input_event_; 122 InputEventType response_pending_input_event_;
129 123
130 cc::ViewportSelectionBound start_; 124 SelectionBound start_;
131 cc::ViewportSelectionBound end_; 125 SelectionBound end_;
132 TouchHandleOrientation start_orientation_; 126 TouchHandleOrientation start_orientation_;
133 TouchHandleOrientation end_orientation_; 127 TouchHandleOrientation end_orientation_;
134 128
135 scoped_ptr<TouchHandle> insertion_handle_; 129 scoped_ptr<TouchHandle> insertion_handle_;
136 bool is_insertion_active_; 130 bool is_insertion_active_;
137 bool activate_insertion_automatically_; 131 bool activate_insertion_automatically_;
138 132
139 scoped_ptr<TouchHandle> start_selection_handle_; 133 scoped_ptr<TouchHandle> start_selection_handle_;
140 scoped_ptr<TouchHandle> end_selection_handle_; 134 scoped_ptr<TouchHandle> end_selection_handle_;
141 bool is_selection_active_; 135 bool is_selection_active_;
142 bool activate_selection_automatically_; 136 bool activate_selection_automatically_;
143 137
144 bool selection_empty_; 138 bool selection_empty_;
145 bool selection_editable_; 139 bool selection_editable_;
146 140
147 bool temporarily_hidden_; 141 bool temporarily_hidden_;
148 142
149 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); 143 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController);
150 }; 144 };
151 145
152 } // namespace content 146 } // namespace ui
153 147
154 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_SELECTION_CONTROLLER_H_ 148 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ui/touch_selection/touch_handle_unittest.cc ('k') | ui/touch_selection/touch_selection_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698