Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Side by Side Diff: ui/touch_selection/touch_selection_controller.cc

Issue 2664253002: Revert "Blink handle selection handle visibility" (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "base/metrics/user_metrics.h" 10 #include "base/metrics/user_metrics.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 enable_longpress_drag_selection(false) {} 49 enable_longpress_drag_selection(false) {}
50 50
51 TouchSelectionController::Config::~Config() { 51 TouchSelectionController::Config::~Config() {
52 } 52 }
53 53
54 TouchSelectionController::TouchSelectionController( 54 TouchSelectionController::TouchSelectionController(
55 TouchSelectionControllerClient* client, 55 TouchSelectionControllerClient* client,
56 const Config& config) 56 const Config& config)
57 : client_(client), 57 : client_(client),
58 config_(config), 58 config_(config),
59 force_next_update_(false),
59 response_pending_input_event_(INPUT_EVENT_TYPE_NONE), 60 response_pending_input_event_(INPUT_EVENT_TYPE_NONE),
60 start_orientation_(TouchHandleOrientation::UNDEFINED), 61 start_orientation_(TouchHandleOrientation::UNDEFINED),
61 end_orientation_(TouchHandleOrientation::UNDEFINED), 62 end_orientation_(TouchHandleOrientation::UNDEFINED),
62 active_status_(INACTIVE), 63 active_status_(INACTIVE),
64 activate_insertion_automatically_(false),
65 activate_selection_automatically_(false),
66 selection_empty_(false),
67 selection_editable_(false),
63 temporarily_hidden_(false), 68 temporarily_hidden_(false),
64 anchor_drag_to_selection_start_(false), 69 anchor_drag_to_selection_start_(false),
65 longpress_drag_selector_(this), 70 longpress_drag_selector_(this),
66 selection_handle_dragged_(false), 71 selection_handle_dragged_(false),
67 consume_touch_sequence_(false), 72 consume_touch_sequence_(false) {
68 show_touch_handles_(true)
69 {
70 DCHECK(client_); 73 DCHECK(client_);
71 } 74 }
72 75
73 TouchSelectionController::~TouchSelectionController() { 76 TouchSelectionController::~TouchSelectionController() {
74 } 77 }
75 78
76 void TouchSelectionController::OnSelectionBoundsChanged( 79 void TouchSelectionController::OnSelectionBoundsChanged(
77 const gfx::SelectionBound& start, 80 const gfx::SelectionBound& start,
78 const gfx::SelectionBound& end) { 81 const gfx::SelectionBound& end) {
79 if (start == start_ && end_ == end) 82 if (!force_next_update_ && start == start_ && end_ == end)
80 return; 83 return;
81 84
82 if (start.type() == gfx::SelectionBound::EMPTY || 85 // Notify if selection bounds have just been established or dissolved.
83 end.type() == gfx::SelectionBound::EMPTY || 86 if (start.type() != gfx::SelectionBound::EMPTY &&
84 !show_touch_handles_) { 87 start_.type() == gfx::SelectionBound::EMPTY) {
85 HideHandles(); 88 client_->OnSelectionEvent(SELECTION_ESTABLISHED);
86 return; 89 } else if (start.type() == gfx::SelectionBound::EMPTY &&
90 start_.type() != gfx::SelectionBound::EMPTY) {
91 client_->OnSelectionEvent(SELECTION_DISSOLVED);
87 } 92 }
88 93
89 // Swap the Handles when the start and end selection points cross each other. 94 // Swap the Handles when the start and end selection points cross each other.
90 if (active_status_ == SELECTION_ACTIVE) { 95 if (active_status_ == SELECTION_ACTIVE) {
91 if ((start_selection_handle_->IsActive() && 96 if ((start_selection_handle_->IsActive() &&
92 end_.edge_bottom() == start.edge_bottom()) || 97 end_.edge_bottom() == start.edge_bottom()) ||
93 (end_selection_handle_->IsActive() && 98 (end_selection_handle_->IsActive() &&
94 end.edge_bottom() == start_.edge_bottom())) { 99 end.edge_bottom() == start_.edge_bottom())) {
95 start_selection_handle_.swap(end_selection_handle_); 100 start_selection_handle_.swap(end_selection_handle_);
96 } 101 }
97 } 102 }
98 103
99 start_ = start; 104 start_ = start;
100 end_ = end; 105 end_ = end;
101 start_orientation_ = ToTouchHandleOrientation(start_.type()); 106 start_orientation_ = ToTouchHandleOrientation(start_.type());
102 end_orientation_ = ToTouchHandleOrientation(end_.type()); 107 end_orientation_ = ToTouchHandleOrientation(end_.type());
108 force_next_update_ = false;
109
110 if (!activate_selection_automatically_ &&
111 !activate_insertion_automatically_) {
112 DCHECK_EQ(INACTIVE, active_status_);
113 DCHECK_EQ(INPUT_EVENT_TYPE_NONE, response_pending_input_event_);
114 return;
115 }
103 116
104 // Ensure that |response_pending_input_event_| is cleared after the method 117 // Ensure that |response_pending_input_event_| is cleared after the method
105 // completes, while also making its current value available for the duration 118 // completes, while also making its current value available for the duration
106 // of the call. 119 // of the call.
107 InputEventType causal_input_event = response_pending_input_event_; 120 InputEventType causal_input_event = response_pending_input_event_;
108 response_pending_input_event_ = INPUT_EVENT_TYPE_NONE; 121 response_pending_input_event_ = INPUT_EVENT_TYPE_NONE;
109 base::AutoReset<InputEventType> auto_reset_response_pending_input_event( 122 base::AutoReset<InputEventType> auto_reset_response_pending_input_event(
110 &response_pending_input_event_, causal_input_event); 123 &response_pending_input_event_, causal_input_event);
111 124
112 const bool is_selection_dragging = active_status_ == SELECTION_ACTIVE && 125 const bool is_selection_dragging = active_status_ == SELECTION_ACTIVE &&
(...skipping 10 matching lines...) Expand all
123 } 136 }
124 137
125 if (GetStartPosition() != GetEndPosition() || 138 if (GetStartPosition() != GetEndPosition() ||
126 (is_selection_dragging && 139 (is_selection_dragging &&
127 start_orientation_ != TouchHandleOrientation::UNDEFINED && 140 start_orientation_ != TouchHandleOrientation::UNDEFINED &&
128 end_orientation_ != TouchHandleOrientation::UNDEFINED)) { 141 end_orientation_ != TouchHandleOrientation::UNDEFINED)) {
129 OnSelectionChanged(); 142 OnSelectionChanged();
130 return; 143 return;
131 } 144 }
132 145
133 if (start_orientation_ == TouchHandleOrientation::CENTER) { 146 if (start_orientation_ == TouchHandleOrientation::CENTER &&
147 selection_editable_) {
134 OnInsertionChanged(); 148 OnInsertionChanged();
135 return; 149 return;
136 } 150 }
137 151
138 HideHandles(); 152 HideAndDisallowShowingAutomatically();
139 } 153 }
140 154
141 void TouchSelectionController::OnViewportChanged( 155 void TouchSelectionController::OnViewportChanged(
142 const gfx::RectF viewport_rect) { 156 const gfx::RectF viewport_rect) {
143 // Trigger a force update if the viewport is changed, so that 157 // Trigger a force update if the viewport is changed, so that
144 // it triggers a call to change the mirror values if required. 158 // it triggers a call to change the mirror values if required.
145 if (viewport_rect_ == viewport_rect) 159 if (viewport_rect_ == viewport_rect)
146 return; 160 return;
147 161
148 viewport_rect_ = viewport_rect; 162 viewport_rect_ = viewport_rect;
(...skipping 21 matching lines...) Expand all
170 // too, regardless of value of |handled|. 184 // too, regardless of value of |handled|.
171 // TODO(mohsen): This will consume touch events until the next ACTION_DOWN. 185 // TODO(mohsen): This will consume touch events until the next ACTION_DOWN.
172 // Ideally we should consume until the final ACTION_UP/ACTION_CANCEL. 186 // Ideally we should consume until the final ACTION_UP/ACTION_CANCEL.
173 // But, apparently, we can't reliably determine the final ACTION_CANCEL in a 187 // But, apparently, we can't reliably determine the final ACTION_CANCEL in a
174 // multi-touch scenario. See https://crbug.com/653212. 188 // multi-touch scenario. See https://crbug.com/653212.
175 if (event.GetAction() == MotionEvent::ACTION_DOWN) 189 if (event.GetAction() == MotionEvent::ACTION_DOWN)
176 consume_touch_sequence_ = handled; 190 consume_touch_sequence_ = handled;
177 return handled || consume_touch_sequence_; 191 return handled || consume_touch_sequence_;
178 } 192 }
179 193
180 void TouchSelectionController::HandleTapEvent(const gfx::PointF& location, 194 bool TouchSelectionController::WillHandleTapEvent(const gfx::PointF& location,
181 int tap_count) { 195 int tap_count) {
196 if (WillHandleTapOrLongPress(location))
197 return true;
198
182 if (tap_count > 1) { 199 if (tap_count > 1) {
183 response_pending_input_event_ = REPEATED_TAP; 200 response_pending_input_event_ = REPEATED_TAP;
201 ShowSelectionHandlesAutomatically();
184 } else { 202 } else {
185 response_pending_input_event_ = TAP; 203 response_pending_input_event_ = TAP;
204 if (active_status_ != SELECTION_ACTIVE)
205 activate_selection_automatically_ = false;
186 } 206 }
207 ShowInsertionHandleAutomatically();
208 if (selection_empty_)
209 DeactivateInsertion();
210 ForceNextUpdateIfInactive();
211 return false;
187 } 212 }
188 213
189 void TouchSelectionController::HandleLongPressEvent( 214 bool TouchSelectionController::WillHandleLongPressEvent(
190 base::TimeTicks event_time, 215 base::TimeTicks event_time,
191 const gfx::PointF& location) { 216 const gfx::PointF& location) {
217 if (WillHandleTapOrLongPress(location))
218 return true;
219
192 longpress_drag_selector_.OnLongPressEvent(event_time, location); 220 longpress_drag_selector_.OnLongPressEvent(event_time, location);
193 response_pending_input_event_ = LONG_PRESS; 221 response_pending_input_event_ = LONG_PRESS;
222 ShowSelectionHandlesAutomatically();
223 ShowInsertionHandleAutomatically();
224 ForceNextUpdateIfInactive();
225 return false;
194 } 226 }
195 227
196 void TouchSelectionController::OnScrollBeginEvent() { 228 void TouchSelectionController::OnScrollBeginEvent() {
197 // When there is an active selection, if the user performs a long-press that 229 // When there is an active selection, if the user performs a long-press that
198 // does not trigger a new selection (e.g. a long-press on an empty area) and 230 // does not trigger a new selection (e.g. a long-press on an empty area) and
199 // then scrolls, the scroll will move the selection. In this case we will 231 // then scrolls, the scroll will move the selection. In this case we will
200 // think incorrectly that the selection change was due to the long-press and 232 // think incorrectly that the selection change was due to the long-press and
201 // will activate touch selection and start long-press drag gesture (see 233 // will activate touch selection and start long-press drag gesture (see
202 // ActivateInsertionIfNecessary()). To prevent this, we need to reset the 234 // ActivateInsertionIfNecessary()). To prevent this, we need to reset the
203 // state of touch selection controller and long-press drag selector. 235 // state of touch selection controller and long-press drag selector.
204 // TODO(mohsen): Remove this workaround when we have enough information about 236 // TODO(mohsen): Remove this workaround when we have enough information about
205 // the cause of a selection change (see https://crbug.com/571897). 237 // the cause of a selection change (see https://crbug.com/571897).
206 longpress_drag_selector_.OnScrollBeginEvent(); 238 longpress_drag_selector_.OnScrollBeginEvent();
207 response_pending_input_event_ = INPUT_EVENT_TYPE_NONE; 239 response_pending_input_event_ = INPUT_EVENT_TYPE_NONE;
240 if (active_status_ == INACTIVE) {
241 activate_insertion_automatically_ = false;
242 activate_selection_automatically_ = false;
243 }
208 } 244 }
209 245
210 void TouchSelectionController::HideHandles() { 246 void TouchSelectionController::AllowShowingFromCurrentSelection() {
247 if (active_status_ != INACTIVE)
248 return;
249
250 activate_selection_automatically_ = true;
251 activate_insertion_automatically_ = true;
252 if (GetStartPosition() != GetEndPosition()) {
253 OnSelectionChanged();
254 } else if (start_orientation_ == TouchHandleOrientation::CENTER &&
255 selection_editable_) {
256 OnInsertionChanged();
257 }
258 }
259
260 void TouchSelectionController::HideAndDisallowShowingAutomatically() {
211 response_pending_input_event_ = INPUT_EVENT_TYPE_NONE; 261 response_pending_input_event_ = INPUT_EVENT_TYPE_NONE;
212 DeactivateInsertion(); 262 DeactivateInsertion();
213 DeactivateSelection(); 263 DeactivateSelection();
214 start_ = gfx::SelectionBound(); 264 activate_insertion_automatically_ = false;
215 end_ = gfx::SelectionBound(); 265 activate_selection_automatically_ = false;
216 start_orientation_ = ToTouchHandleOrientation(start_.type());
217 end_orientation_ = ToTouchHandleOrientation(end_.type());
218 }
219
220 void TouchSelectionController::HideAndDisallowShowingAutomatically() {
221 HideHandles();
222 show_touch_handles_ = false;
223 } 266 }
224 267
225 void TouchSelectionController::SetTemporarilyHidden(bool hidden) { 268 void TouchSelectionController::SetTemporarilyHidden(bool hidden) {
226 if (temporarily_hidden_ == hidden) 269 if (temporarily_hidden_ == hidden)
227 return; 270 return;
228 temporarily_hidden_ = hidden; 271 temporarily_hidden_ = hidden;
229 RefreshHandleVisibility(); 272 RefreshHandleVisibility();
230 } 273 }
231 274
275 void TouchSelectionController::OnSelectionEditable(bool editable) {
276 if (selection_editable_ == editable)
277 return;
278 selection_editable_ = editable;
279 ForceNextUpdateIfInactive();
280 if (!selection_editable_)
281 DeactivateInsertion();
282 }
283
284 void TouchSelectionController::OnSelectionEmpty(bool empty) {
285 if (selection_empty_ == empty)
286 return;
287 selection_empty_ = empty;
288 ForceNextUpdateIfInactive();
289 }
290
232 bool TouchSelectionController::Animate(base::TimeTicks frame_time) { 291 bool TouchSelectionController::Animate(base::TimeTicks frame_time) {
233 if (active_status_ == INSERTION_ACTIVE) 292 if (active_status_ == INSERTION_ACTIVE)
234 return insertion_handle_->Animate(frame_time); 293 return insertion_handle_->Animate(frame_time);
235 294
236 if (active_status_ == SELECTION_ACTIVE) { 295 if (active_status_ == SELECTION_ACTIVE) {
237 bool needs_animate = start_selection_handle_->Animate(frame_time); 296 bool needs_animate = start_selection_handle_->Animate(frame_time);
238 needs_animate |= end_selection_handle_->Animate(frame_time); 297 needs_animate |= end_selection_handle_->Animate(frame_time);
239 return needs_animate; 298 return needs_animate;
240 } 299 }
241 300
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 const gfx::PointF& TouchSelectionController::GetStartPosition() const { 335 const gfx::PointF& TouchSelectionController::GetStartPosition() const {
277 return start_.edge_bottom(); 336 return start_.edge_bottom();
278 } 337 }
279 338
280 const gfx::PointF& TouchSelectionController::GetEndPosition() const { 339 const gfx::PointF& TouchSelectionController::GetEndPosition() const {
281 return end_.edge_bottom(); 340 return end_.edge_bottom();
282 } 341 }
283 342
284 bool TouchSelectionController::WillHandleTouchEventImpl( 343 bool TouchSelectionController::WillHandleTouchEventImpl(
285 const MotionEvent& event) { 344 const MotionEvent& event) {
286 show_touch_handles_ = true;
287 if (config_.enable_longpress_drag_selection && 345 if (config_.enable_longpress_drag_selection &&
288 longpress_drag_selector_.WillHandleTouchEvent(event)) { 346 longpress_drag_selector_.WillHandleTouchEvent(event)) {
289 return true; 347 return true;
290 } 348 }
291 349
292 if (active_status_ == INSERTION_ACTIVE) { 350 if (active_status_ == INSERTION_ACTIVE) {
293 DCHECK(insertion_handle_); 351 DCHECK(insertion_handle_);
294 return insertion_handle_->WillHandleTouchEvent(event); 352 return insertion_handle_->WillHandleTouchEvent(event);
295 } 353 }
296 354
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 469 }
412 470
413 gfx::PointF TouchSelectionController::GetSelectionStart() const { 471 gfx::PointF TouchSelectionController::GetSelectionStart() const {
414 return GetStartPosition(); 472 return GetStartPosition();
415 } 473 }
416 474
417 gfx::PointF TouchSelectionController::GetSelectionEnd() const { 475 gfx::PointF TouchSelectionController::GetSelectionEnd() const {
418 return GetEndPosition(); 476 return GetEndPosition();
419 } 477 }
420 478
479 void TouchSelectionController::ShowInsertionHandleAutomatically() {
480 if (activate_insertion_automatically_)
481 return;
482 activate_insertion_automatically_ = true;
483 ForceNextUpdateIfInactive();
484 }
485
486 void TouchSelectionController::ShowSelectionHandlesAutomatically() {
487 if (activate_selection_automatically_)
488 return;
489 activate_selection_automatically_ = true;
490 ForceNextUpdateIfInactive();
491 }
492
493 bool TouchSelectionController::WillHandleTapOrLongPress(
494 const gfx::PointF& location) {
495 // If there is an active selection that was not triggered by a user gesture,
496 // allow showing the handles for that selection if a gesture occurs within
497 // the selection rect. Note that this hit test is at best a crude
498 // approximation, and may swallow taps that actually fall outside the
499 // real selection.
500 if (active_status_ == INACTIVE &&
501 GetStartPosition() != GetEndPosition() &&
502 RectFBetweenSelectionBounds(start_, end_).Contains(location)) {
503 AllowShowingFromCurrentSelection();
504 return true;
505 }
506 return false;
507 }
508
421 void TouchSelectionController::OnInsertionChanged() { 509 void TouchSelectionController::OnInsertionChanged() {
422 DeactivateSelection(); 510 DeactivateSelection();
423 511
512 if ((response_pending_input_event_ == TAP ||
513 response_pending_input_event_ == REPEATED_TAP) &&
514 selection_empty_) {
515 HideAndDisallowShowingAutomatically();
516 return;
517 }
518
519 if (!activate_insertion_automatically_)
520 return;
521
424 const bool activated = ActivateInsertionIfNecessary(); 522 const bool activated = ActivateInsertionIfNecessary();
425 523
426 const TouchHandle::AnimationStyle animation = GetAnimationStyle(!activated); 524 const TouchHandle::AnimationStyle animation = GetAnimationStyle(!activated);
427 insertion_handle_->SetFocus(start_.edge_top(), start_.edge_bottom()); 525 insertion_handle_->SetFocus(start_.edge_top(), start_.edge_bottom());
428 insertion_handle_->SetVisible(GetStartVisible(), animation); 526 insertion_handle_->SetVisible(GetStartVisible(), animation);
429 527
430 UpdateHandleLayoutIfNecessary(); 528 UpdateHandleLayoutIfNecessary();
431 529
432 client_->OnSelectionEvent(activated ? INSERTION_HANDLE_SHOWN 530 client_->OnSelectionEvent(activated ? INSERTION_HANDLE_SHOWN
433 : INSERTION_HANDLE_MOVED); 531 : INSERTION_HANDLE_MOVED);
434 } 532 }
435 533
436 void TouchSelectionController::OnSelectionChanged() { 534 void TouchSelectionController::OnSelectionChanged() {
437 DeactivateInsertion(); 535 DeactivateInsertion();
438 536
537 if (!activate_selection_automatically_)
538 return;
539
439 const bool activated = ActivateSelectionIfNecessary(); 540 const bool activated = ActivateSelectionIfNecessary();
440 541
441 const TouchHandle::AnimationStyle animation = GetAnimationStyle(!activated); 542 const TouchHandle::AnimationStyle animation = GetAnimationStyle(!activated);
442 543
443 start_selection_handle_->SetFocus(start_.edge_top(), start_.edge_bottom()); 544 start_selection_handle_->SetFocus(start_.edge_top(), start_.edge_bottom());
444 end_selection_handle_->SetFocus(end_.edge_top(), end_.edge_bottom()); 545 end_selection_handle_->SetFocus(end_.edge_top(), end_.edge_bottom());
445 546
446 start_selection_handle_->SetOrientation(start_orientation_); 547 start_selection_handle_->SetOrientation(start_orientation_);
447 end_selection_handle_->SetOrientation(end_orientation_); 548 end_selection_handle_->SetOrientation(end_orientation_);
448 549
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 DCHECK(start_selection_handle_); 628 DCHECK(start_selection_handle_);
528 DCHECK(end_selection_handle_); 629 DCHECK(end_selection_handle_);
529 LogSelectionEnd(); 630 LogSelectionEnd();
530 longpress_drag_selector_.OnSelectionDeactivated(); 631 longpress_drag_selector_.OnSelectionDeactivated();
531 start_selection_handle_->SetEnabled(false); 632 start_selection_handle_->SetEnabled(false);
532 end_selection_handle_->SetEnabled(false); 633 end_selection_handle_->SetEnabled(false);
533 active_status_ = INACTIVE; 634 active_status_ = INACTIVE;
534 client_->OnSelectionEvent(SELECTION_HANDLES_CLEARED); 635 client_->OnSelectionEvent(SELECTION_HANDLES_CLEARED);
535 } 636 }
536 637
638 void TouchSelectionController::ForceNextUpdateIfInactive() {
639 // Only force the update if the reported selection is non-empty but still
640 // considered "inactive", i.e., it wasn't preceded by a user gesture or
641 // the handles have since been explicitly hidden.
642 if (active_status_ == INACTIVE &&
643 start_.type() != gfx::SelectionBound::EMPTY &&
644 end_.type() != gfx::SelectionBound::EMPTY) {
645 force_next_update_ = true;
646 }
647 }
648
537 void TouchSelectionController::UpdateHandleLayoutIfNecessary() { 649 void TouchSelectionController::UpdateHandleLayoutIfNecessary() {
538 if (active_status_ == INSERTION_ACTIVE) { 650 if (active_status_ == INSERTION_ACTIVE) {
539 DCHECK(insertion_handle_); 651 DCHECK(insertion_handle_);
540 insertion_handle_->UpdateHandleLayout(); 652 insertion_handle_->UpdateHandleLayout();
541 } else if (active_status_ == SELECTION_ACTIVE) { 653 } else if (active_status_ == SELECTION_ACTIVE) {
542 DCHECK(start_selection_handle_); 654 DCHECK(start_selection_handle_);
543 DCHECK(end_selection_handle_); 655 DCHECK(end_selection_handle_);
544 start_selection_handle_->UpdateHandleLayout(); 656 start_selection_handle_->UpdateHandleLayout();
545 end_selection_handle_->UpdateHandleLayout(); 657 end_selection_handle_->UpdateHandleLayout();
546 } 658 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 base::TimeDelta duration = base::TimeTicks::Now() - selection_start_time_; 709 base::TimeDelta duration = base::TimeTicks::Now() - selection_start_time_;
598 UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelection.WasDraggedDuration", 710 UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelection.WasDraggedDuration",
599 duration, 711 duration,
600 base::TimeDelta::FromMilliseconds(500), 712 base::TimeDelta::FromMilliseconds(500),
601 base::TimeDelta::FromSeconds(60), 713 base::TimeDelta::FromSeconds(60),
602 60); 714 60);
603 } 715 }
604 } 716 }
605 717
606 } // namespace ui 718 } // namespace ui
OLDNEW
« no previous file with comments | « ui/touch_selection/touch_selection_controller.h ('k') | ui/touch_selection/touch_selection_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698