Index: ui/touch_selection/touch_selection_controller.h |
diff --git a/ui/touch_selection/touch_selection_controller.h b/ui/touch_selection/touch_selection_controller.h |
index 115dd0d637046b44aa49c42e832fc5e82489cc95..d71146289d2676ca95a142ab2312282fed4d26d0 100644 |
--- a/ui/touch_selection/touch_selection_controller.h |
+++ b/ui/touch_selection/touch_selection_controller.h |
@@ -5,9 +5,12 @@ |
#ifndef UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ |
#define UI_TOUCH_SELECTION_TOUCH_SELECTION_CONTROLLER_H_ |
+#include "base/time/time.h" |
#include "ui/base/touch/selection_bound.h" |
#include "ui/gfx/geometry/point_f.h" |
#include "ui/gfx/geometry/rect_f.h" |
+#include "ui/gfx/geometry/vector2d_f.h" |
+#include "ui/touch_selection/longpress_drag_selector.h" |
#include "ui/touch_selection/selection_event_type.h" |
#include "ui/touch_selection/touch_handle.h" |
#include "ui/touch_selection/touch_handle_orientation.h" |
@@ -59,7 +62,8 @@ class UI_TOUCH_SELECTION_EXPORT TouchSelectionController |
// To be called before forwarding a longpress event. This allows automatically |
// showing the selection or insertion handles from subsequent bounds changes. |
- void OnLongPressEvent(); |
+ void OnLongPressEvent(base::TimeTicks event_time, |
+ const gfx::PointF& location); |
// Allow showing the selection handles from the most recent selection bounds |
// update (if valid), or a future valid bounds update. |
@@ -101,10 +105,11 @@ class UI_TOUCH_SELECTION_EXPORT TouchSelectionController |
enum InputEventType { TAP, LONG_PRESS, INPUT_EVENT_TYPE_NONE }; |
// TouchHandleClient implementation. |
- void OnHandleDragBegin(const TouchHandle& handle) override; |
- void OnHandleDragUpdate(const TouchHandle& handle, |
- const gfx::PointF& new_position) override; |
- void OnHandleDragEnd(const TouchHandle& handle) override; |
+ void OnDragBegin(const TouchSelectionDraggable& draggable, |
+ const gfx::PointF& drag_position) override; |
+ void OnDragUpdate(const TouchSelectionDraggable& draggable, |
+ const gfx::PointF& drag_position) override; |
+ void OnDragEnd(const TouchSelectionDraggable& draggable) override; |
void OnHandleTapped(const TouchHandle& handle) override; |
void SetNeedsAnimate() override; |
scoped_ptr<TouchHandleDrawable> CreateDrawable() override; |
@@ -123,6 +128,10 @@ class UI_TOUCH_SELECTION_EXPORT TouchSelectionController |
void DeactivateSelection(); |
void ResetCachedValuesIfInactive(); |
+ bool WillHandleTouchEventForLongPressDrag(const MotionEvent& event); |
+ void SetTemporarilyHiddenForLongPressDrag(bool hidden); |
+ void OnHandleVisibilityOverrideMaybeChanged(); |
+ |
gfx::Vector2dF GetStartLineOffset() const; |
gfx::Vector2dF GetEndLineOffset() const; |
bool GetStartVisible() const; |
@@ -160,6 +169,14 @@ class UI_TOUCH_SELECTION_EXPORT TouchSelectionController |
bool temporarily_hidden_; |
+ // Offset from the start of a drag sequence to a reasonable position on the |
+ // corresponding line of text. This helps ensure that the initial selection |
+ // induced by the drag doesn't "jump" between lines. |
+ gfx::Vector2dF drag_line_offset_; |
+ |
+ // Longpress drag allows direct manipulation of longpress-initiated selection. |
+ LongPressDragSelector longpress_drag_selector_; |
+ |
base::TimeTicks selection_start_time_; |
// Whether a selection handle was dragged during the current 'selection |
// session' - i.e. since the current selection has been activated. |