OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/panels/panel_slide_animation.h" | 5 #include "chrome/browser/ui/panels/panel_slide_animation.h" |
6 | 6 |
7 #include "chrome/browser/ui/panels/panel.h" | 7 #include "chrome/browser/ui/panels/panel.h" |
| 8 #include "chrome/browser/ui/panels/panel_manager.h" |
8 | 9 |
9 namespace { | 10 namespace { |
10 | 11 |
11 // These values are experimental and subjective. | 12 // These values are experimental and subjective. |
12 const int kSetBoundsAnimationMs = 180; | 13 const int kSetBoundsAnimationMs = 180; |
13 const int kSetBoundsAnimationBigMinimizeMs = 1500; | 14 const int kSetBoundsAnimationBigMinimizeMs = 1500; |
14 | 15 |
15 } | 16 } |
16 | 17 |
17 PanelSlideAnimation::PanelSlideAnimation(ui::AnimationDelegate* target, | 18 PanelSlideAnimation::PanelSlideAnimation(ui::AnimationDelegate* target, |
(...skipping 12 matching lines...) Expand all Loading... |
30 if (panel_->expansion_state() == Panel::MINIMIZED) { | 31 if (panel_->expansion_state() == Panel::MINIMIZED) { |
31 double hidden_title_height = | 32 double hidden_title_height = |
32 panel_->TitleOnlyHeight() - final_bounds.height(); | 33 panel_->TitleOnlyHeight() - final_bounds.height(); |
33 double distance_y = initial_bounds.height() - final_bounds.height(); | 34 double distance_y = initial_bounds.height() - final_bounds.height(); |
34 animation_stop_to_show_titlebar_ = 1.0 - hidden_title_height / distance_y; | 35 animation_stop_to_show_titlebar_ = 1.0 - hidden_title_height / distance_y; |
35 if (animation_stop_to_show_titlebar_ > 0.7) { // Relatively big movement. | 36 if (animation_stop_to_show_titlebar_ > 0.7) { // Relatively big movement. |
36 for_big_minimize_ = true; | 37 for_big_minimize_ = true; |
37 duration = kSetBoundsAnimationBigMinimizeMs; | 38 duration = kSetBoundsAnimationBigMinimizeMs; |
38 } | 39 } |
39 } | 40 } |
40 SetSlideDuration(duration); | 41 SetSlideDuration(PanelManager::AdjustTimeInterval(duration)); |
41 } | 42 } |
42 | 43 |
43 PanelSlideAnimation::~PanelSlideAnimation() { | 44 PanelSlideAnimation::~PanelSlideAnimation() { |
44 } | 45 } |
45 | 46 |
46 double PanelSlideAnimation::GetCurrentValue() const { | 47 double PanelSlideAnimation::GetCurrentValue() const { |
47 double progress = ui::SlideAnimation::GetCurrentValue(); | 48 double progress = ui::SlideAnimation::GetCurrentValue(); |
48 return ComputeAnimationValue(progress, | 49 return ComputeAnimationValue(progress, |
49 for_big_minimize_, | 50 for_big_minimize_, |
50 animation_stop_to_show_titlebar_); | 51 animation_stop_to_show_titlebar_); |
(...skipping 20 matching lines...) Expand all Loading... |
71 } else if (progress <= kProgressAtFreezeEnd) { | 72 } else if (progress <= kProgressAtFreezeEnd) { |
72 value = animation_stop_to_show_titlebar; | 73 value = animation_stop_to_show_titlebar; |
73 } else { | 74 } else { |
74 value = animation_stop_to_show_titlebar + | 75 value = animation_stop_to_show_titlebar + |
75 (1.0 - animation_stop_to_show_titlebar) * | 76 (1.0 - animation_stop_to_show_titlebar) * |
76 ((progress - kProgressAtFreezeEnd) / (1.0 - kProgressAtFreezeEnd)); | 77 ((progress - kProgressAtFreezeEnd) / (1.0 - kProgressAtFreezeEnd)); |
77 } | 78 } |
78 return value; | 79 return value; |
79 } | 80 } |
80 | 81 |
OLD | NEW |