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 #include "ui/touch_selection/touch_selection_controller.h" | 5 #include "ui/touch_selection/touch_selection_controller.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 | 10 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 response_pending_input_event_ = INPUT_EVENT_TYPE_NONE; | 109 response_pending_input_event_ = INPUT_EVENT_TYPE_NONE; |
110 base::AutoReset<InputEventType> auto_reset_response_pending_input_event( | 110 base::AutoReset<InputEventType> auto_reset_response_pending_input_event( |
111 &response_pending_input_event_, causal_input_event); | 111 &response_pending_input_event_, causal_input_event); |
112 | 112 |
113 const bool is_selection_dragging = active_status_ == SELECTION_ACTIVE && | 113 const bool is_selection_dragging = active_status_ == SELECTION_ACTIVE && |
114 (start_selection_handle_->IsActive() || | 114 (start_selection_handle_->IsActive() || |
115 end_selection_handle_->IsActive()); | 115 end_selection_handle_->IsActive()); |
116 | 116 |
117 // It's possible that the bounds temporarily overlap while a selection handle | 117 // It's possible that the bounds temporarily overlap while a selection handle |
118 // is being dragged, incorrectly reporting a CENTER orientation. | 118 // is being dragged, incorrectly reporting a CENTER orientation. |
119 // TODO(jdduke): This safeguard is racy, as it's possible the delayed response | |
120 // from handle positioning occurs *after* the handle dragging has ceased. | |
121 // Instead, prevent selection -> insertion transitions without an intervening | |
122 // action or selection clearing of some sort, crbug.com/392696. | |
123 if (is_selection_dragging) { | 119 if (is_selection_dragging) { |
124 if (start_orientation_ == TouchHandleOrientation::CENTER) | 120 if (start_orientation_ == TouchHandleOrientation::CENTER) |
125 start_orientation_ = start_selection_handle_->orientation(); | 121 start_orientation_ = start_selection_handle_->orientation(); |
126 if (end_orientation_ == TouchHandleOrientation::CENTER) | 122 if (end_orientation_ == TouchHandleOrientation::CENTER) |
127 end_orientation_ = end_selection_handle_->orientation(); | 123 end_orientation_ = end_selection_handle_->orientation(); |
128 } | 124 } |
129 | 125 |
130 if (GetStartPosition() != GetEndPosition() || | 126 if (GetStartPosition() != GetEndPosition() || |
131 (is_selection_dragging && | 127 (is_selection_dragging && |
132 start_orientation_ != TouchHandleOrientation::UNDEFINED && | 128 start_orientation_ != TouchHandleOrientation::UNDEFINED && |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 base::TimeDelta duration = base::TimeTicks::Now() - selection_start_time_; | 661 base::TimeDelta duration = base::TimeTicks::Now() - selection_start_time_; |
666 UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelection.WasDraggedDuration", | 662 UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelection.WasDraggedDuration", |
667 duration, | 663 duration, |
668 base::TimeDelta::FromMilliseconds(500), | 664 base::TimeDelta::FromMilliseconds(500), |
669 base::TimeDelta::FromSeconds(60), | 665 base::TimeDelta::FromSeconds(60), |
670 60); | 666 60); |
671 } | 667 } |
672 } | 668 } |
673 | 669 |
674 } // namespace ui | 670 } // namespace ui |
OLD | NEW |