| 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/events/gestures/blink/web_gesture_curve_impl.h" | 5 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 using blink::WebGestureCurve; | 25 using blink::WebGestureCurve; |
| 26 | 26 |
| 27 namespace ui { | 27 namespace ui { |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 std::unique_ptr<GestureCurve> CreateDefaultPlatformCurve( | 30 std::unique_ptr<GestureCurve> CreateDefaultPlatformCurve( |
| 31 const gfx::Vector2dF& initial_velocity) { | 31 const gfx::Vector2dF& initial_velocity) { |
| 32 DCHECK(!initial_velocity.IsZero()); | 32 DCHECK(!initial_velocity.IsZero()); |
| 33 #if defined(OS_ANDROID) | 33 #if defined(OS_ANDROID) |
| 34 auto scroller = base::WrapUnique(new Scroller(Scroller::Config())); | 34 auto scroller = base::MakeUnique<Scroller>(Scroller::Config()); |
| 35 scroller->Fling(0, | 35 scroller->Fling(0, |
| 36 0, | 36 0, |
| 37 initial_velocity.x(), | 37 initial_velocity.x(), |
| 38 initial_velocity.y(), | 38 initial_velocity.y(), |
| 39 INT_MIN, | 39 INT_MIN, |
| 40 INT_MAX, | 40 INT_MAX, |
| 41 INT_MIN, | 41 INT_MIN, |
| 42 INT_MAX, | 42 INT_MAX, |
| 43 base::TimeTicks()); | 43 base::TimeTicks()); |
| 44 return std::move(scroller); | 44 return std::move(scroller); |
| 45 #else | 45 #else |
| 46 return base::WrapUnique(new FlingCurve(initial_velocity, base::TimeTicks())); | 46 return base::MakeUnique<FlingCurve>(initial_velocity, base::TimeTicks()); |
| 47 #endif | 47 #endif |
| 48 } | 48 } |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 // static | 52 // static |
| 53 std::unique_ptr<WebGestureCurve> | 53 std::unique_ptr<WebGestureCurve> |
| 54 WebGestureCurveImpl::CreateFromDefaultPlatformCurve( | 54 WebGestureCurveImpl::CreateFromDefaultPlatformCurve( |
| 55 const gfx::Vector2dF& initial_velocity, | 55 const gfx::Vector2dF& initial_velocity, |
| 56 const gfx::Vector2dF& initial_offset, | 56 const gfx::Vector2dF& initial_offset, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 return still_active; | 138 return still_active; |
| 139 | 139 |
| 140 // scrollBy() could delete this curve if the animation is over, so don't touch | 140 // scrollBy() could delete this curve if the animation is over, so don't touch |
| 141 // any member variables after making that call. | 141 // any member variables after making that call. |
| 142 bool did_scroll = target->scrollBy(blink::WebFloatSize(delta), | 142 bool did_scroll = target->scrollBy(blink::WebFloatSize(delta), |
| 143 blink::WebFloatSize(velocity)); | 143 blink::WebFloatSize(velocity)); |
| 144 return did_scroll && still_active; | 144 return did_scroll && still_active; |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace ui | 147 } // namespace ui |
| OLD | NEW |