OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cc/input/scrollbar_animation_controller_thinning.h" | 5 #include "cc/input/scrollbar_animation_controller_thinning.h" |
6 | 6 |
| 7 #include "base/memory/ptr_util.h" |
7 #include "base/time/time.h" | 8 #include "base/time/time.h" |
8 #include "cc/layers/layer_impl.h" | 9 #include "cc/layers/layer_impl.h" |
9 #include "cc/layers/scrollbar_layer_impl_base.h" | 10 #include "cc/layers/scrollbar_layer_impl_base.h" |
10 #include "cc/trees/layer_tree_impl.h" | 11 #include "cc/trees/layer_tree_impl.h" |
11 | 12 |
12 namespace { | 13 namespace { |
13 const float kIdleThicknessScale = 0.4f; | 14 const float kIdleThicknessScale = 0.4f; |
14 const float kIdleOpacity = 0.7f; | 15 const float kIdleOpacity = 0.7f; |
15 const float kDefaultMouseMoveDistanceToTriggerAnimation = 25.f; | 16 const float kDefaultMouseMoveDistanceToTriggerAnimation = 25.f; |
16 } | 17 } |
17 | 18 |
18 namespace cc { | 19 namespace cc { |
19 | 20 |
20 scoped_ptr<ScrollbarAnimationControllerThinning> | 21 std::unique_ptr<ScrollbarAnimationControllerThinning> |
21 ScrollbarAnimationControllerThinning::Create( | 22 ScrollbarAnimationControllerThinning::Create( |
22 int scroll_layer_id, | 23 int scroll_layer_id, |
23 ScrollbarAnimationControllerClient* client, | 24 ScrollbarAnimationControllerClient* client, |
24 base::TimeDelta delay_before_starting, | 25 base::TimeDelta delay_before_starting, |
25 base::TimeDelta resize_delay_before_starting, | 26 base::TimeDelta resize_delay_before_starting, |
26 base::TimeDelta duration) { | 27 base::TimeDelta duration) { |
27 return make_scoped_ptr(new ScrollbarAnimationControllerThinning( | 28 return base::WrapUnique(new ScrollbarAnimationControllerThinning( |
28 scroll_layer_id, client, delay_before_starting, | 29 scroll_layer_id, client, delay_before_starting, |
29 resize_delay_before_starting, duration)); | 30 resize_delay_before_starting, duration)); |
30 } | 31 } |
31 | 32 |
32 ScrollbarAnimationControllerThinning::ScrollbarAnimationControllerThinning( | 33 ScrollbarAnimationControllerThinning::ScrollbarAnimationControllerThinning( |
33 int scroll_layer_id, | 34 int scroll_layer_id, |
34 ScrollbarAnimationControllerClient* client, | 35 ScrollbarAnimationControllerClient* client, |
35 base::TimeDelta delay_before_starting, | 36 base::TimeDelta delay_before_starting, |
36 base::TimeDelta resize_delay_before_starting, | 37 base::TimeDelta resize_delay_before_starting, |
37 base::TimeDelta duration) | 38 base::TimeDelta duration) |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 : 0; | 144 : 0; |
144 | 145 |
145 scrollbar->OnOpacityAnimated(effective_opacity); | 146 scrollbar->OnOpacityAnimated(effective_opacity); |
146 scrollbar->SetThumbThicknessScaleFactor(AdjustScale( | 147 scrollbar->SetThumbThicknessScaleFactor(AdjustScale( |
147 thumb_thickness_scale, scrollbar->thumb_thickness_scale_factor(), | 148 thumb_thickness_scale, scrollbar->thumb_thickness_scale_factor(), |
148 thickness_change_)); | 149 thickness_change_)); |
149 } | 150 } |
150 } | 151 } |
151 | 152 |
152 } // namespace cc | 153 } // namespace cc |
OLD | NEW |