| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/test/test_session_state_animator.h" | 5 #include "ash/test/test_session_state_animator.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 class TestSessionStateAnimator::AnimationSequence | 34 class TestSessionStateAnimator::AnimationSequence |
| 35 : public SessionStateAnimator::AnimationSequence { | 35 : public SessionStateAnimator::AnimationSequence { |
| 36 public: | 36 public: |
| 37 AnimationSequence(base::Closure callback, TestSessionStateAnimator* animator) | 37 AnimationSequence(base::Closure callback, TestSessionStateAnimator* animator) |
| 38 : SessionStateAnimator::AnimationSequence(callback), | 38 : SessionStateAnimator::AnimationSequence(callback), |
| 39 sequence_count_(0), | 39 sequence_count_(0), |
| 40 sequence_aborted_(false), | 40 sequence_aborted_(false), |
| 41 animator_(animator) { | 41 animator_(animator) { |
| 42 } | 42 } |
| 43 | 43 |
| 44 virtual ~AnimationSequence() {} | 44 ~AnimationSequence() override {} |
| 45 | 45 |
| 46 virtual void SequenceAttached() { | 46 virtual void SequenceAttached() { |
| 47 ++sequence_count_; | 47 ++sequence_count_; |
| 48 } | 48 } |
| 49 | 49 |
| 50 // Notify the sequence that is has completed. | 50 // Notify the sequence that is has completed. |
| 51 virtual void SequenceFinished(bool successfully) { | 51 virtual void SequenceFinished(bool successfully) { |
| 52 DCHECK_GT(sequence_count_, 0); | 52 DCHECK_GT(sequence_count_, 0); |
| 53 --sequence_count_; | 53 --sequence_count_; |
| 54 sequence_aborted_ |= !successfully; | 54 sequence_aborted_ |= !successfully; |
| 55 if (sequence_count_ == 0) { | 55 if (sequence_count_ == 0) { |
| 56 if (sequence_aborted_) | 56 if (sequence_aborted_) |
| 57 OnAnimationAborted(); | 57 OnAnimationAborted(); |
| 58 else | 58 else |
| 59 OnAnimationCompleted(); | 59 OnAnimationCompleted(); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 // ash::SessionStateAnimator::AnimationSequence: | 63 // ash::SessionStateAnimator::AnimationSequence: |
| 64 virtual void StartAnimation(int container_mask, | 64 void StartAnimation(int container_mask, |
| 65 AnimationType type, | 65 AnimationType type, |
| 66 AnimationSpeed speed) override { | 66 AnimationSpeed speed) override { |
| 67 animator_->StartAnimationInSequence(container_mask, type, speed, this); | 67 animator_->StartAnimationInSequence(container_mask, type, speed, this); |
| 68 } | 68 } |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 // Tracks the number of contained animations. | 71 // Tracks the number of contained animations. |
| 72 int sequence_count_; | 72 int sequence_count_; |
| 73 | 73 |
| 74 // True if the sequence was aborted. | 74 // True if the sequence was aborted. |
| 75 bool sequence_aborted_; | 75 bool sequence_aborted_; |
| 76 | 76 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 while (animation_iter != (*container_iter).second.end()) { | 295 while (animation_iter != (*container_iter).second.end()) { |
| 296 ActiveAnimation active_animation = *animation_iter; | 296 ActiveAnimation active_animation = *animation_iter; |
| 297 active_animation.failed_callback.Run(); | 297 active_animation.failed_callback.Run(); |
| 298 animation_iter = (*container_iter).second.erase(animation_iter); | 298 animation_iter = (*container_iter).second.erase(animation_iter); |
| 299 } | 299 } |
| 300 } | 300 } |
| 301 } | 301 } |
| 302 | 302 |
| 303 } // namespace test | 303 } // namespace test |
| 304 } // namespace ash | 304 } // namespace ash |
| OLD | NEW |