Chromium Code Reviews| 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..e536eadc1c848cf9c2d3f028549f5b6d245a0742 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; |
| + void SetLastSequence(ui::LayerAnimationSequence* sequence) { |
| + DCHECK(sequence); |
| + sequence->AddObserver(this); |
| + DetachAndRecreateLayers(); |
| } |
| // 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); |
| }; |
| @@ -481,11 +480,11 @@ void AddLayerAnimationsForRotate(aura::Window* window, bool show) { |
| rotation.release(), duration)); |
| ui::LayerAnimationSequence* last_sequence = |
| new ui::LayerAnimationSequence(transition.release()); |
| + |
| + if (observer) |
| + observer->SetLastSequence(last_sequence); |
|
sky
2014/07/09 20:32:12
If you do this here, doesn't that mean the animati
please use gerrit instead
2014/07/09 20:53:55
Hm, I think you're right. The problem I'm encounte
|
| + |
| window->layer()->GetAnimator()->ScheduleAnimation(last_sequence); |
| - if (observer) { |
| - observer->set_last_sequence(last_sequence); |
| - observer->DetachAndRecreateLayers(); |
| - } |
| } |
| void AnimateShowWindow_Rotate(aura::Window* window) { |