| 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 DCHECK(start_selection_handle_); | 484 DCHECK(start_selection_handle_); |
| 485 DCHECK(end_selection_handle_); | 485 DCHECK(end_selection_handle_); |
| 486 LogSelectionEnd(); | 486 LogSelectionEnd(); |
| 487 start_selection_handle_->SetEnabled(false); | 487 start_selection_handle_->SetEnabled(false); |
| 488 end_selection_handle_->SetEnabled(false); | 488 end_selection_handle_->SetEnabled(false); |
| 489 active_status_ = INACTIVE; | 489 active_status_ = INACTIVE; |
| 490 client_->OnSelectionEvent(SELECTION_CLEARED); | 490 client_->OnSelectionEvent(SELECTION_CLEARED); |
| 491 } | 491 } |
| 492 | 492 |
| 493 void TouchSelectionController::ForceNextUpdateIfInactive() { | 493 void TouchSelectionController::ForceNextUpdateIfInactive() { |
| 494 if (active_status_ == INACTIVE) | 494 // Only force the update if the reported selection is non-empty but still |
| 495 // considered "inactive", i.e., it wasn't preceded by a user gesture or |
| 496 // the handles have since been explicitly hidden. |
| 497 if (active_status_ == INACTIVE && |
| 498 start_.type() != SelectionBound::EMPTY && |
| 499 end_.type() != SelectionBound::EMPTY) { |
| 495 force_next_update_ = true; | 500 force_next_update_ = true; |
| 501 } |
| 496 } | 502 } |
| 497 | 503 |
| 498 gfx::Vector2dF TouchSelectionController::GetStartLineOffset() const { | 504 gfx::Vector2dF TouchSelectionController::GetStartLineOffset() const { |
| 499 return ComputeLineOffsetFromBottom(start_); | 505 return ComputeLineOffsetFromBottom(start_); |
| 500 } | 506 } |
| 501 | 507 |
| 502 gfx::Vector2dF TouchSelectionController::GetEndLineOffset() const { | 508 gfx::Vector2dF TouchSelectionController::GetEndLineOffset() const { |
| 503 return ComputeLineOffsetFromBottom(end_); | 509 return ComputeLineOffsetFromBottom(end_); |
| 504 } | 510 } |
| 505 | 511 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 527 base::TimeDelta duration = base::TimeTicks::Now() - selection_start_time_; | 533 base::TimeDelta duration = base::TimeTicks::Now() - selection_start_time_; |
| 528 UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelection.WasDraggedDuration", | 534 UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelection.WasDraggedDuration", |
| 529 duration, | 535 duration, |
| 530 base::TimeDelta::FromMilliseconds(500), | 536 base::TimeDelta::FromMilliseconds(500), |
| 531 base::TimeDelta::FromSeconds(60), | 537 base::TimeDelta::FromSeconds(60), |
| 532 60); | 538 60); |
| 533 } | 539 } |
| 534 } | 540 } |
| 535 | 541 |
| 536 } // namespace ui | 542 } // namespace ui |
| OLD | NEW |