Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2401)

Unified Diff: ash/wm/window_animations.cc

Issue 105673008: Remove unneeded ScopedLayerAnimationSettings::LockTransitionDuration() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/wm/window_animations.cc
diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc
index 71d73f353c6f987d38246090a470a38b9b5a6b19..52dae8822e167ec34c31fb4d4ae8ee7df0c1211f 100644
--- a/ash/wm/window_animations.cc
+++ b/ash/wm/window_animations.cc
@@ -71,7 +71,9 @@ int64 Round64(float f) {
const int kCrossFadeDurationMS = 200;
-void AddLayerAnimationsForMinimize(aura::Window* window, bool show) {
+void AddLayerAnimationsForMinimize(aura::Window* window,
+ const base::TimeDelta& duration,
+ bool show) {
// Recalculate the transform at restore time since the launcher item may have
// moved while the window was minimized.
gfx::Rect bounds = window->bounds();
@@ -105,9 +107,6 @@ void AddLayerAnimationsForMinimize(aura::Window* window, bool show) {
rotation_about_pivot->SetReversed(show);
- base::TimeDelta duration = window->layer()->GetAnimator()->
- GetTransitionDuration();
-
scoped_ptr<ui::LayerAnimationElement> transition(
ui::LayerAnimationElement::CreateInterpolatedTransformElement(
rotation_about_pivot.release(), duration));
@@ -137,10 +136,11 @@ void AnimateShowWindow_Minimize(aura::Window* window) {
window->layer()->set_delegate(window);
window->layer()->SetOpacity(kWindowAnimation_HideOpacity);
ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
- base::TimeDelta duration = base::TimeDelta::FromMilliseconds(
- kLayerAnimationsForMinimizeDurationMS);
+ base::TimeDelta duration = views::corewm::GetWindowShowAnimationDuration(
+ window,
+ base::TimeDelta::FromMilliseconds(kLayerAnimationsForMinimizeDurationMS));
varkha 2014/01/02 22:26:41 Shouldn't this use GetDefaultWindowVisibilityAnima
pkotwicz 2014/01/02 22:45:51 The default animation durations are different for
varkha 2014/01/03 03:47:48 Doesn't GetDefaultWindowVisibilityAnimationDuratio
pkotwicz 2014/01/03 04:15:40 But kBrightnessGrayscaleFadeDurationMs != 200
varkha 2014/01/03 04:39:19 True, but I am not suggesting changing line 187, o
varkha 2014/01/03 05:40:55 I agree that this may be an overkill at this stage
settings.SetTransitionDuration(duration);
- AddLayerAnimationsForMinimize(window, true);
+ AddLayerAnimationsForMinimize(window, duration, true);
// Now that the window has been restored, we need to clear its animation style
// to default so that normal animation applies.
@@ -153,14 +153,15 @@ void AnimateHideWindow_Minimize(aura::Window* window) {
// Property sets within this scope will be implicitly animated.
ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
- base::TimeDelta duration = base::TimeDelta::FromMilliseconds(
- kLayerAnimationsForMinimizeDurationMS);
+ base::TimeDelta duration = views::corewm::GetWindowHideAnimationDuration(
+ window,
+ base::TimeDelta::FromMilliseconds(kLayerAnimationsForMinimizeDurationMS));
varkha 2014/01/02 22:26:41 Shouldn't this use GetDefaultWindowVisibilityAnima
settings.SetTransitionDuration(duration);
settings.AddObserver(
views::corewm::CreateHidingWindowAnimationObserver(window));
window->layer()->SetVisible(false);
- AddLayerAnimationsForMinimize(window, false);
+ AddLayerAnimationsForMinimize(window, duration, false);
}
void AnimateShowHideWindowCommon_BrightnessGrayscale(aura::Window* window,
@@ -183,8 +184,11 @@ void AnimateShowHideWindowCommon_BrightnessGrayscale(aura::Window* window,
window->layer()->SetVisible(true);
}
- base::TimeDelta duration =
+ base::TimeDelta default_duration =
base::TimeDelta::FromMilliseconds(kBrightnessGrayscaleFadeDurationMs);
+ base::TimeDelta duration = show ?
+ views::corewm::GetWindowShowAnimationDuration(window, default_duration) :
+ views::corewm::GetWindowHideAnimationDuration(window, default_duration);
ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
settings.SetTransitionDuration(duration);

Powered by Google App Engine
This is Rietveld 408576698