| 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 |
| 11 namespace ui { | 11 namespace ui { |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 gfx::Vector2dF ComputeLineOffsetFromBottom(const SelectionBound& bound) { | 14 gfx::Vector2dF ComputeLineOffsetFromBottom(const SelectionBound& bound) { |
| 15 gfx::Vector2dF line_offset = | 15 gfx::Vector2dF line_offset = |
| 16 gfx::ScaleVector2d(bound.edge_top() - bound.edge_bottom(), 0.5f); | 16 gfx::ScaleVector2d(bound.edge_top() - bound.edge_bottom(), 0.5f); |
| 17 // An offset of 5 DIPs is sufficient for most line sizes. For small lines, | 17 // An offset of 8 DIPs is sufficient for most line sizes. For small lines, |
| 18 // using half the line height avoids synthesizing a point on a line above | 18 // using half the line height avoids synthesizing a point on a line above |
| 19 // (or below) the intended line. | 19 // (or below) the intended line. |
| 20 const gfx::Vector2dF kMaxLineOffset(5.f, 5.f); | 20 const gfx::Vector2dF kMaxLineOffset(8.f, 8.f); |
| 21 line_offset.SetToMin(kMaxLineOffset); | 21 line_offset.SetToMin(kMaxLineOffset); |
| 22 line_offset.SetToMax(-kMaxLineOffset); | 22 line_offset.SetToMax(-kMaxLineOffset); |
| 23 return line_offset; | 23 return line_offset; |
| 24 } | 24 } |
| 25 | 25 |
| 26 TouchHandleOrientation ToTouchHandleOrientation(SelectionBound::Type type) { | 26 TouchHandleOrientation ToTouchHandleOrientation(SelectionBound::Type type) { |
| 27 switch (type) { | 27 switch (type) { |
| 28 case SelectionBound::LEFT: | 28 case SelectionBound::LEFT: |
| 29 return TouchHandleOrientation::LEFT; | 29 return TouchHandleOrientation::LEFT; |
| 30 case SelectionBound::RIGHT: | 30 case SelectionBound::RIGHT: |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 base::TimeDelta duration = base::TimeTicks::Now() - selection_start_time_; | 588 base::TimeDelta duration = base::TimeTicks::Now() - selection_start_time_; |
| 589 UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelection.WasDraggedDuration", | 589 UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelection.WasDraggedDuration", |
| 590 duration, | 590 duration, |
| 591 base::TimeDelta::FromMilliseconds(500), | 591 base::TimeDelta::FromMilliseconds(500), |
| 592 base::TimeDelta::FromSeconds(60), | 592 base::TimeDelta::FromSeconds(60), |
| 593 60); | 593 60); |
| 594 } | 594 } |
| 595 } | 595 } |
| 596 | 596 |
| 597 } // namespace ui | 597 } // namespace ui |
| OLD | NEW |