Index: ash/wm/session_state_animator.cc |
diff --git a/ash/wm/session_state_animator.cc b/ash/wm/session_state_animator.cc |
index b082c986f6e0d847dfd8fc39c5718999b06bb683..373e4c971f1e1691ef14012d8437ffe438d90201 100644 |
--- a/ash/wm/session_state_animator.cc |
+++ b/ash/wm/session_state_animator.cc |
@@ -12,6 +12,7 @@ |
#include "ui/aura/root_window.h" |
#include "ui/compositor/layer_animation_observer.h" |
#include "ui/compositor/layer_animation_sequence.h" |
+#include "ui/compositor/scoped_layer_animation_settings.h" |
#include "ui/views/widget/widget.h" |
namespace ash { |
@@ -155,13 +156,30 @@ void HideWindow(aura::Window* window, |
base::TimeDelta duration, |
WorkspaceAnimationDirection direction, |
ui::LayerAnimationObserver* observer) { |
+ ui::LayerAnimator* animator = window->layer()->GetAnimator(); |
+ |
WorkspaceAnimationDetails details; |
details.direction = direction; |
details.animate = true; |
details.animate_scale = true; |
details.animate_opacity = true; |
details.duration = duration; |
- HideWorkspace(window, details); |
+ |
+ const bool noforce = false; |
+ const bool hide = false; |
+ |
+ ui::ScopedLayerAnimationSettings settings(animator); |
+ settings.SetTransitionDuration(duration); |
+ |
+ SetWorkspaceAnimationTargetParameters(window, details, hide, noforce); |
+ |
+ // After the animation completes snap the transform back to the identity, |
+ // otherwise any one that asks for screen bounds gets a slightly scaled |
+ // version. |
+ settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION); |
+ settings.SetTransitionDuration(base::TimeDelta()); |
+ window->layer()->SetTransform(gfx::Transform()); |
+ |
// A bit of a dirty trick: we need to catch the end of the animation we don't |
// control. So we use two facts we know: which animator will be used and the |
// target opacity to add "Do nothing" animation sequence. |
@@ -172,20 +190,30 @@ void HideWindow(aura::Window* window, |
0.0, base::TimeDelta())); |
if (observer) |
sequence->AddObserver(observer); |
- window->layer()->GetAnimator()->ScheduleAnimation(sequence); |
+ animator->ScheduleAnimation(sequence); |
} |
void ShowWindow(aura::Window* window, |
- base::TimeDelta length, |
+ base::TimeDelta duration, |
WorkspaceAnimationDirection direction, |
ui::LayerAnimationObserver* observer) { |
+ ui::LayerAnimator* animator = window->layer()->GetAnimator(); |
+ |
WorkspaceAnimationDetails details; |
details.direction = direction; |
details.animate = true; |
details.animate_scale = true; |
details.animate_opacity = true; |
- details.duration = length; |
- ShowWorkspace(window, details); |
+ details.duration = duration; |
+ |
+ const bool noforce = false; |
+ const bool show = true; |
+ |
+ ui::ScopedLayerAnimationSettings settings(animator); |
+ settings.SetTransitionDuration(duration); |
+ |
+ SetWorkspaceAnimationTargetParameters(window, details, show, noforce); |
+ |
// A bit of a dirty trick: we need to catch the end of the animation we don't |
// control. So we use two facts we know: which animator will be used and the |
// target opacity to add "Do nothing" animation sequence. |
@@ -196,7 +224,7 @@ void ShowWindow(aura::Window* window, |
1.0, base::TimeDelta())); |
if (observer) |
sequence->AddObserver(observer); |
- window->layer()->GetAnimator()->ScheduleAnimation(sequence); |
+ animator->ScheduleAnimation(sequence); |
} |
// Starts grayscale/brightness animation for |window| over |duration|. Target |