| 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_TOUCH_SELECTION_CONTROLLER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_SELECTION_CONTROLLER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_SELECTION_CONTROLLER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_SELECTION_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "cc/output/viewport_selection_bound.h" |
| 8 #include "content/browser/renderer_host/input/selection_event_type.h" | 9 #include "content/browser/renderer_host/input/selection_event_type.h" |
| 9 #include "content/browser/renderer_host/input/touch_handle.h" | 10 #include "content/browser/renderer_host/input/touch_handle.h" |
| 10 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 11 #include "ui/gfx/geometry/point_f.h" | 12 #include "ui/gfx/geometry/point_f.h" |
| 12 #include "ui/gfx/geometry/rect_f.h" | 13 #include "ui/gfx/geometry/rect_f.h" |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 class WebInputEvent; | 16 class WebInputEvent; |
| 16 } | 17 } |
| 17 | 18 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 39 | 40 |
| 40 // Controller for manipulating text selection via touch input. | 41 // Controller for manipulating text selection via touch input. |
| 41 class CONTENT_EXPORT TouchSelectionController : public TouchHandleClient { | 42 class CONTENT_EXPORT TouchSelectionController : public TouchHandleClient { |
| 42 public: | 43 public: |
| 43 explicit TouchSelectionController(TouchSelectionControllerClient* client); | 44 explicit TouchSelectionController(TouchSelectionControllerClient* client); |
| 44 virtual ~TouchSelectionController(); | 45 virtual ~TouchSelectionController(); |
| 45 | 46 |
| 46 // To be called when the selection bounds have changed. | 47 // To be called when the selection bounds have changed. |
| 47 // Note that such updates will trigger handle updates only if preceded | 48 // Note that such updates will trigger handle updates only if preceded |
| 48 // by an appropriate call to allow automatic showing. | 49 // by an appropriate call to allow automatic showing. |
| 49 void OnSelectionBoundsChanged(const gfx::RectF& start_rect, | 50 void OnSelectionBoundsChanged(const cc::ViewportSelectionBound& start, |
| 50 TouchHandleOrientation start_orientation, | 51 const cc::ViewportSelectionBound& end); |
| 51 bool start_visible, | |
| 52 const gfx::RectF& end_rect, | |
| 53 TouchHandleOrientation end_orientation, | |
| 54 bool end_visible); | |
| 55 | 52 |
| 56 // Allows touch-dragging of the handle. | 53 // Allows touch-dragging of the handle. |
| 57 // Returns true iff the event was consumed, in which case the caller should | 54 // Returns true iff the event was consumed, in which case the caller should |
| 58 // cease further handling of the event. | 55 // cease further handling of the event. |
| 59 bool WillHandleTouchEvent(const ui::MotionEvent& event); | 56 bool WillHandleTouchEvent(const ui::MotionEvent& event); |
| 60 | 57 |
| 61 // To be called before forwarding a tap event. This allows automatically | 58 // To be called before forwarding a tap event. This allows automatically |
| 62 // showing the insertion handle from subsequent bounds changes. | 59 // showing the insertion handle from subsequent bounds changes. |
| 63 void OnTapEvent(); | 60 void OnTapEvent(); |
| 64 | 61 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 97 |
| 101 void OnInsertionChanged(); | 98 void OnInsertionChanged(); |
| 102 void OnSelectionChanged(); | 99 void OnSelectionChanged(); |
| 103 | 100 |
| 104 void ActivateInsertion(); | 101 void ActivateInsertion(); |
| 105 void DeactivateInsertion(); | 102 void DeactivateInsertion(); |
| 106 void ActivateSelection(); | 103 void ActivateSelection(); |
| 107 void DeactivateSelection(); | 104 void DeactivateSelection(); |
| 108 void ResetCachedValuesIfInactive(); | 105 void ResetCachedValuesIfInactive(); |
| 109 | 106 |
| 110 gfx::PointF GetStartPosition() const; | 107 const gfx::PointF& GetStartPosition() const; |
| 111 gfx::PointF GetEndPosition() const; | 108 const gfx::PointF& GetEndPosition() const; |
| 112 float GetStartLineHeight() const; | 109 gfx::Vector2dF GetStartLineOffset() const; |
| 113 float GetEndLineHeight() const; | 110 gfx::Vector2dF GetEndLineOffset() const; |
| 114 bool GetStartVisible() const; | 111 bool GetStartVisible() const; |
| 115 bool GetEndVisible() const; | 112 bool GetEndVisible() const; |
| 116 TouchHandle::AnimationStyle GetAnimationStyle(bool was_active) const; | 113 TouchHandle::AnimationStyle GetAnimationStyle(bool was_active) const; |
| 117 | 114 |
| 118 TouchSelectionControllerClient* const client_; | 115 TouchSelectionControllerClient* const client_; |
| 119 | 116 |
| 120 InputEventType response_pending_input_event_; | 117 InputEventType response_pending_input_event_; |
| 121 | 118 |
| 122 gfx::RectF start_rect_; | 119 cc::ViewportSelectionBound start_; |
| 120 cc::ViewportSelectionBound end_; |
| 123 TouchHandleOrientation start_orientation_; | 121 TouchHandleOrientation start_orientation_; |
| 124 bool start_visible_; | |
| 125 gfx::RectF end_rect_; | |
| 126 TouchHandleOrientation end_orientation_; | 122 TouchHandleOrientation end_orientation_; |
| 127 bool end_visible_; | |
| 128 | 123 |
| 129 scoped_ptr<TouchHandle> insertion_handle_; | 124 scoped_ptr<TouchHandle> insertion_handle_; |
| 130 bool is_insertion_active_; | 125 bool is_insertion_active_; |
| 131 bool activate_insertion_automatically_; | 126 bool activate_insertion_automatically_; |
| 132 | 127 |
| 133 scoped_ptr<TouchHandle> start_selection_handle_; | 128 scoped_ptr<TouchHandle> start_selection_handle_; |
| 134 scoped_ptr<TouchHandle> end_selection_handle_; | 129 scoped_ptr<TouchHandle> end_selection_handle_; |
| 135 gfx::PointF fixed_handle_position_; | 130 gfx::PointF fixed_handle_position_; |
| 136 bool is_selection_active_; | 131 bool is_selection_active_; |
| 137 bool activate_selection_automatically_; | 132 bool activate_selection_automatically_; |
| 138 | 133 |
| 139 bool selection_empty_; | 134 bool selection_empty_; |
| 140 bool selection_editable_; | 135 bool selection_editable_; |
| 141 | 136 |
| 142 bool temporarily_hidden_; | 137 bool temporarily_hidden_; |
| 143 | 138 |
| 144 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); | 139 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); |
| 145 }; | 140 }; |
| 146 | 141 |
| 147 } // namespace content | 142 } // namespace content |
| 148 | 143 |
| 149 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_SELECTION_CONTROLLER_H_ | 144 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_SELECTION_CONTROLLER_H_ |
| OLD | NEW |