| Index: ui/wm/core/window_animations.cc
|
| diff --git a/ui/wm/core/window_animations.cc b/ui/wm/core/window_animations.cc
|
| index a79db3a15d6c45a76d6cdb78a8e3e7dc2db5035a..22fd43d387406c69d776c7c2344b5a7a895541ef 100644
|
| --- a/ui/wm/core/window_animations.cc
|
| +++ b/ui/wm/core/window_animations.cc
|
| @@ -58,7 +58,8 @@ const float kWindowAnimation_Vertical_TranslateY = 15.f;
|
| // The subclass will determine when the animation is completed.
|
| class HidingWindowAnimationObserverBase : public aura::WindowObserver {
|
| public:
|
| - HidingWindowAnimationObserverBase(aura::Window* window) : window_(window) {
|
| + explicit HidingWindowAnimationObserverBase(aura::Window* window)
|
| + : window_(window) {
|
| window_->AddObserver(this);
|
| }
|
| virtual ~HidingWindowAnimationObserverBase() {
|
| @@ -396,31 +397,29 @@ class RotateHidingWindowAnimationObserver
|
| : public HidingWindowAnimationObserverBase,
|
| public ui::LayerAnimationObserver {
|
| public:
|
| - RotateHidingWindowAnimationObserver(aura::Window* window)
|
| - : HidingWindowAnimationObserverBase(window), last_sequence_(NULL) {}
|
| + explicit RotateHidingWindowAnimationObserver(aura::Window* window)
|
| + : HidingWindowAnimationObserverBase(window) {}
|
| virtual ~RotateHidingWindowAnimationObserver() {}
|
|
|
| - void set_last_sequence(ui::LayerAnimationSequence* last_sequence) {
|
| - last_sequence_ = last_sequence;
|
| + // Destroys itself after |last_sequence| ends or is aborted. Does not take
|
| + // ownership of |last_sequence|, which should not be NULL.
|
| + void SetLastSequence(ui::LayerAnimationSequence* last_sequence) {
|
| + last_sequence->AddObserver(this);
|
| }
|
|
|
| // ui::LayerAnimationObserver:
|
| virtual void OnLayerAnimationEnded(
|
| ui::LayerAnimationSequence* sequence) OVERRIDE {
|
| - if (last_sequence_ == sequence)
|
| - OnAnimationCompleted();
|
| + OnAnimationCompleted();
|
| }
|
| virtual void OnLayerAnimationAborted(
|
| ui::LayerAnimationSequence* sequence) OVERRIDE {
|
| - if (last_sequence_ == sequence)
|
| - OnAnimationCompleted();
|
| + OnAnimationCompleted();
|
| }
|
| virtual void OnLayerAnimationScheduled(
|
| ui::LayerAnimationSequence* sequence) OVERRIDE {}
|
|
|
| private:
|
| - ui::LayerAnimationSequence* last_sequence_;
|
| -
|
| DISALLOW_COPY_AND_ASSIGN(RotateHidingWindowAnimationObserver);
|
| };
|
|
|
| @@ -482,8 +481,9 @@ void AddLayerAnimationsForRotate(aura::Window* window, bool show) {
|
| ui::LayerAnimationSequence* last_sequence =
|
| new ui::LayerAnimationSequence(transition.release());
|
| window->layer()->GetAnimator()->ScheduleAnimation(last_sequence);
|
| +
|
| if (observer) {
|
| - observer->set_last_sequence(last_sequence);
|
| + observer->SetLastSequence(last_sequence);
|
| observer->DetachAndRecreateLayers();
|
| }
|
| }
|
|
|