OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 UI_TOUCH_SELECTION_LONGPRESS_DRAG_SELECTOR_H_ | 5 #ifndef UI_TOUCH_SELECTION_LONGPRESS_DRAG_SELECTOR_H_ |
6 #define UI_TOUCH_SELECTION_LONGPRESS_DRAG_SELECTOR_H_ | 6 #define UI_TOUCH_SELECTION_LONGPRESS_DRAG_SELECTOR_H_ |
7 | 7 |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "ui/gfx/geometry/point_f.h" | 9 #include "ui/gfx/geometry/point_f.h" |
10 #include "ui/gfx/geometry/vector2d_f.h" | 10 #include "ui/gfx/geometry/vector2d_f.h" |
(...skipping 22 matching lines...) Expand all Loading... | |
33 ~LongPressDragSelector() override; | 33 ~LongPressDragSelector() override; |
34 | 34 |
35 // TouchSelectionDraggable implementation. | 35 // TouchSelectionDraggable implementation. |
36 bool WillHandleTouchEvent(const MotionEvent& event) override; | 36 bool WillHandleTouchEvent(const MotionEvent& event) override; |
37 bool IsActive() const override; | 37 bool IsActive() const override; |
38 | 38 |
39 // Called just prior to a longpress event being handled. | 39 // Called just prior to a longpress event being handled. |
40 void OnLongPressEvent(base::TimeTicks event_time, | 40 void OnLongPressEvent(base::TimeTicks event_time, |
41 const gfx::PointF& position); | 41 const gfx::PointF& position); |
42 | 42 |
43 // Called when a scroll is going to happen to cancel longpress-drag gesture. | |
44 // TODO(mohsen): This is a workaround to avoid starting longpress-drag gesture | |
mfomitchev
2016/01/04 17:07:55
It seems like the root of the issue is that (witho
mohsen
2016/01/04 18:45:59
Done.
| |
45 // if the longpress is happening on an empty area far from an existing | |
46 // selection. Get rid of this workaround when we have enough information about | |
47 // the cause of the selection (see https://crbug.com/571897). | |
48 void OnScrollBeginEvent(); | |
49 | |
43 // Called when the active selection changes. | 50 // Called when the active selection changes. |
44 void OnSelectionActivated(); | 51 void OnSelectionActivated(); |
45 void OnSelectionDeactivated(); | 52 void OnSelectionDeactivated(); |
46 | 53 |
47 private: | 54 private: |
48 enum SelectionState { | 55 enum SelectionState { |
49 INACTIVE, | 56 INACTIVE, |
50 LONGPRESS_PENDING, | 57 LONGPRESS_PENDING, |
51 SELECTION_PENDING, | 58 SELECTION_PENDING, |
52 DRAG_PENDING, | 59 DRAG_PENDING, |
(...skipping 10 matching lines...) Expand all Loading... | |
63 gfx::PointF touch_down_position_; | 70 gfx::PointF touch_down_position_; |
64 | 71 |
65 gfx::Vector2dF longpress_drag_selection_offset_; | 72 gfx::Vector2dF longpress_drag_selection_offset_; |
66 gfx::PointF longpress_drag_start_anchor_; | 73 gfx::PointF longpress_drag_start_anchor_; |
67 bool has_longpress_drag_start_anchor_; | 74 bool has_longpress_drag_start_anchor_; |
68 }; | 75 }; |
69 | 76 |
70 } // namespace ui | 77 } // namespace ui |
71 | 78 |
72 #endif // UI_TOUCH_SELECTION_LONGPRESS_DRAG_SELECTOR_H_ | 79 #endif // UI_TOUCH_SELECTION_LONGPRESS_DRAG_SELECTOR_H_ |
OLD | NEW |