| 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 "cc/output/viewport_selection_bound.h" |
| 9 #include "content/browser/renderer_host/input/selection_event_type.h" | 9 #include "content/browser/renderer_host/input/selection_event_type.h" |
| 10 #include "content/browser/renderer_host/input/touch_handle.h" | 10 #include "content/browser/renderer_host/input/touch_handle.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 const gfx::PointF& position) = 0; | 37 const gfx::PointF& position) = 0; |
| 38 virtual scoped_ptr<TouchHandleDrawable> CreateDrawable() = 0; | 38 virtual scoped_ptr<TouchHandleDrawable> CreateDrawable() = 0; |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // Controller for manipulating text selection via touch input. | 41 // Controller for manipulating text selection via touch input. |
| 42 class CONTENT_EXPORT TouchSelectionController : public TouchHandleClient { | 42 class CONTENT_EXPORT TouchSelectionController : public TouchHandleClient { |
| 43 public: | 43 public: |
| 44 TouchSelectionController(TouchSelectionControllerClient* client, | 44 TouchSelectionController(TouchSelectionControllerClient* client, |
| 45 base::TimeDelta tap_timeout, | 45 base::TimeDelta tap_timeout, |
| 46 float tap_slop); | 46 float tap_slop); |
| 47 virtual ~TouchSelectionController(); | 47 ~TouchSelectionController() override; |
| 48 | 48 |
| 49 // To be called when the selection bounds have changed. | 49 // To be called when the selection bounds have changed. |
| 50 // Note that such updates will trigger handle updates only if preceded | 50 // Note that such updates will trigger handle updates only if preceded |
| 51 // by an appropriate call to allow automatic showing. | 51 // by an appropriate call to allow automatic showing. |
| 52 void OnSelectionBoundsChanged(const cc::ViewportSelectionBound& start, | 52 void OnSelectionBoundsChanged(const cc::ViewportSelectionBound& start, |
| 53 const cc::ViewportSelectionBound& end); | 53 const cc::ViewportSelectionBound& end); |
| 54 | 54 |
| 55 // Allows touch-dragging of the handle. | 55 // Allows touch-dragging of the handle. |
| 56 // Returns true iff the event was consumed, in which case the caller should | 56 // Returns true iff the event was consumed, in which case the caller should |
| 57 // cease further handling of the event. | 57 // cease further handling of the event. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 79 void OnSelectionEmpty(bool empty); | 79 void OnSelectionEmpty(bool empty); |
| 80 | 80 |
| 81 // Ticks an active animation, as requested to the client by |SetNeedsAnimate|. | 81 // Ticks an active animation, as requested to the client by |SetNeedsAnimate|. |
| 82 // Returns true if an animation is active and requires further ticking. | 82 // Returns true if an animation is active and requires further ticking. |
| 83 bool Animate(base::TimeTicks animate_time); | 83 bool Animate(base::TimeTicks animate_time); |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 enum InputEventType { TAP, LONG_PRESS, INPUT_EVENT_TYPE_NONE }; | 86 enum InputEventType { TAP, LONG_PRESS, INPUT_EVENT_TYPE_NONE }; |
| 87 | 87 |
| 88 // TouchHandleClient implementation. | 88 // TouchHandleClient implementation. |
| 89 virtual void OnHandleDragBegin(const TouchHandle& handle) override; | 89 void OnHandleDragBegin(const TouchHandle& handle) override; |
| 90 virtual void OnHandleDragUpdate(const TouchHandle& handle, | 90 void OnHandleDragUpdate(const TouchHandle& handle, |
| 91 const gfx::PointF& new_position) override; | 91 const gfx::PointF& new_position) override; |
| 92 virtual void OnHandleDragEnd(const TouchHandle& handle) override; | 92 void OnHandleDragEnd(const TouchHandle& handle) override; |
| 93 virtual void OnHandleTapped(const TouchHandle& handle) override; | 93 void OnHandleTapped(const TouchHandle& handle) override; |
| 94 virtual void SetNeedsAnimate() override; | 94 void SetNeedsAnimate() override; |
| 95 virtual scoped_ptr<TouchHandleDrawable> CreateDrawable() override; | 95 scoped_ptr<TouchHandleDrawable> CreateDrawable() override; |
| 96 virtual base::TimeDelta GetTapTimeout() const override; | 96 base::TimeDelta GetTapTimeout() const override; |
| 97 virtual float GetTapSlop() const override; | 97 float GetTapSlop() const override; |
| 98 | 98 |
| 99 void ShowInsertionHandleAutomatically(); | 99 void ShowInsertionHandleAutomatically(); |
| 100 void ShowSelectionHandlesAutomatically(); | 100 void ShowSelectionHandlesAutomatically(); |
| 101 | 101 |
| 102 void OnInsertionChanged(); | 102 void OnInsertionChanged(); |
| 103 void OnSelectionChanged(); | 103 void OnSelectionChanged(); |
| 104 | 104 |
| 105 void ActivateInsertion(); | 105 void ActivateInsertion(); |
| 106 void DeactivateInsertion(); | 106 void DeactivateInsertion(); |
| 107 void ActivateSelection(); | 107 void ActivateSelection(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 bool selection_editable_; | 141 bool selection_editable_; |
| 142 | 142 |
| 143 bool temporarily_hidden_; | 143 bool temporarily_hidden_; |
| 144 | 144 |
| 145 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); | 145 DISALLOW_COPY_AND_ASSIGN(TouchSelectionController); |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 } // namespace content | 148 } // namespace content |
| 149 | 149 |
| 150 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_SELECTION_CONTROLLER_H_ | 150 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_SELECTION_CONTROLLER_H_ |
| OLD | NEW |