MD Downloads: prevent search text from overlapping with the cancel search (X)
[chromium-blink-merge.git] / ui / touch_selection / touch_selection_draggable.h
blob0bd9a70f8849fc0a245adac8eb8b327cb55bfeb9
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_TOUCH_SELECTION_DRAG_DRAGGABLE_H_
6 #define UI_TOUCH_SELECTION_DRAG_DRAGGABLE_H_
8 #include "ui/gfx/geometry/point_f.h"
9 #include "ui/touch_selection/ui_touch_selection_export.h"
11 namespace ui {
13 class MotionEvent;
14 class TouchSelectionDraggable;
16 // Interface through which TouchSelectionDraggable manipulates the selection.
17 class UI_TOUCH_SELECTION_EXPORT TouchSelectionDraggableClient {
18 public:
19 virtual ~TouchSelectionDraggableClient() {}
20 virtual void OnDragBegin(const TouchSelectionDraggable& draggable,
21 const gfx::PointF& start_position) = 0;
22 virtual void OnDragUpdate(const TouchSelectionDraggable& draggable,
23 const gfx::PointF& new_position) = 0;
24 virtual void OnDragEnd(const TouchSelectionDraggable& draggable) = 0;
25 virtual bool IsWithinTapSlop(const gfx::Vector2dF& delta) const = 0;
28 // Generic interface for entities that manipulate the selection via dragging.
29 class UI_TOUCH_SELECTION_EXPORT TouchSelectionDraggable {
30 protected:
31 virtual ~TouchSelectionDraggable() {}
33 // Offers a touch sequence to the draggable target. Returns true if the event
34 // was consumed, in which case the caller should cease further handling.
35 virtual bool WillHandleTouchEvent(const ui::MotionEvent& event) = 0;
37 // Whether a drag is active OR being detected for the current touch sequence.
38 virtual bool IsActive() const = 0;
41 } // namespace ui
43 #endif // UI_TOUCH_SELECTION_DRAG_DRAGGABLE_H_