OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/wm/session_state_animator_impl.h" | 5 #include "ash/wm/session_state_animator_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 animator->StartTogether(animations); | 288 animator->StartTogether(animations); |
289 } | 289 } |
290 | 290 |
291 // Animation observer that will drop animated foreground once animation is | 291 // Animation observer that will drop animated foreground once animation is |
292 // finished. It is used in when undoing shutdown animation. | 292 // finished. It is used in when undoing shutdown animation. |
293 class CallbackAnimationObserver : public ui::LayerAnimationObserver { | 293 class CallbackAnimationObserver : public ui::LayerAnimationObserver { |
294 public: | 294 public: |
295 explicit CallbackAnimationObserver(base::Closure callback) | 295 explicit CallbackAnimationObserver(base::Closure callback) |
296 : callback_(callback) { | 296 : callback_(callback) { |
297 } | 297 } |
298 virtual ~CallbackAnimationObserver() { | 298 ~CallbackAnimationObserver() override {} |
299 } | |
300 | 299 |
301 private: | 300 private: |
302 // Overridden from ui::LayerAnimationObserver: | 301 // Overridden from ui::LayerAnimationObserver: |
303 virtual void OnLayerAnimationEnded(ui::LayerAnimationSequence* seq) | 302 void OnLayerAnimationEnded(ui::LayerAnimationSequence* seq) override { |
304 override { | |
305 // Drop foreground once animation is over. | 303 // Drop foreground once animation is over. |
306 callback_.Run(); | 304 callback_.Run(); |
307 delete this; | 305 delete this; |
308 } | 306 } |
309 | 307 |
310 virtual void OnLayerAnimationAborted(ui::LayerAnimationSequence* seq) | 308 void OnLayerAnimationAborted(ui::LayerAnimationSequence* seq) override { |
311 override { | |
312 // Drop foreground once animation is over. | 309 // Drop foreground once animation is over. |
313 callback_.Run(); | 310 callback_.Run(); |
314 delete this; | 311 delete this; |
315 } | 312 } |
316 | 313 |
317 virtual void OnLayerAnimationScheduled(ui::LayerAnimationSequence* seq) | 314 void OnLayerAnimationScheduled(ui::LayerAnimationSequence* seq) override {} |
318 override {} | |
319 | 315 |
320 base::Closure callback_; | 316 base::Closure callback_; |
321 | 317 |
322 DISALLOW_COPY_AND_ASSIGN(CallbackAnimationObserver); | 318 DISALLOW_COPY_AND_ASSIGN(CallbackAnimationObserver); |
323 }; | 319 }; |
324 | 320 |
325 | 321 |
326 bool IsLayerAnimated(ui::Layer* layer, | 322 bool IsLayerAnimated(ui::Layer* layer, |
327 SessionStateAnimator::AnimationType type) { | 323 SessionStateAnimator::AnimationType type) { |
328 switch (type) { | 324 switch (type) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 explicit AnimationSequence( | 407 explicit AnimationSequence( |
412 SessionStateAnimatorImpl* animator, | 408 SessionStateAnimatorImpl* animator, |
413 base::Closure callback) | 409 base::Closure callback) |
414 : SessionStateAnimator::AnimationSequence(callback), | 410 : SessionStateAnimator::AnimationSequence(callback), |
415 animator_(animator), | 411 animator_(animator), |
416 sequences_attached_(0), | 412 sequences_attached_(0), |
417 sequences_completed_(0) { | 413 sequences_completed_(0) { |
418 } | 414 } |
419 | 415 |
420 // SessionStateAnimator::AnimationSequence: | 416 // SessionStateAnimator::AnimationSequence: |
421 virtual void StartAnimation( | 417 void StartAnimation(int container_mask, |
422 int container_mask, | 418 SessionStateAnimator::AnimationType type, |
423 SessionStateAnimator::AnimationType type, | 419 SessionStateAnimator::AnimationSpeed speed) override { |
424 SessionStateAnimator::AnimationSpeed speed) override { | |
425 animator_->StartAnimationInSequence(container_mask, type, speed, this); | 420 animator_->StartAnimationInSequence(container_mask, type, speed, this); |
426 } | 421 } |
427 | 422 |
428 private: | 423 private: |
429 virtual ~AnimationSequence() {} | 424 ~AnimationSequence() override {} |
430 | 425 |
431 // ui::LayerAnimationObserver: | 426 // ui::LayerAnimationObserver: |
432 virtual void OnLayerAnimationEnded( | 427 void OnLayerAnimationEnded(ui::LayerAnimationSequence* sequence) override { |
433 ui::LayerAnimationSequence* sequence) override { | |
434 sequences_completed_++; | 428 sequences_completed_++; |
435 if (sequences_completed_ == sequences_attached_) | 429 if (sequences_completed_ == sequences_attached_) |
436 OnAnimationCompleted(); | 430 OnAnimationCompleted(); |
437 } | 431 } |
438 | 432 |
439 virtual void OnLayerAnimationAborted( | 433 void OnLayerAnimationAborted(ui::LayerAnimationSequence* sequence) override { |
440 ui::LayerAnimationSequence* sequence) override { | |
441 sequences_completed_++; | 434 sequences_completed_++; |
442 if (sequences_completed_ == sequences_attached_) | 435 if (sequences_completed_ == sequences_attached_) |
443 OnAnimationAborted(); | 436 OnAnimationAborted(); |
444 } | 437 } |
445 | 438 |
446 virtual void OnLayerAnimationScheduled( | 439 void OnLayerAnimationScheduled( |
447 ui::LayerAnimationSequence* sequence) override {} | 440 ui::LayerAnimationSequence* sequence) override {} |
448 | 441 |
449 virtual void OnAttachedToSequence( | 442 void OnAttachedToSequence(ui::LayerAnimationSequence* sequence) override { |
450 ui::LayerAnimationSequence* sequence) override { | |
451 LayerAnimationObserver::OnAttachedToSequence(sequence); | 443 LayerAnimationObserver::OnAttachedToSequence(sequence); |
452 sequences_attached_++; | 444 sequences_attached_++; |
453 } | 445 } |
454 | 446 |
455 SessionStateAnimatorImpl* animator_; // not owned | 447 SessionStateAnimatorImpl* animator_; // not owned |
456 | 448 |
457 // Number of sequences this observer was attached to. | 449 // Number of sequences this observer was attached to. |
458 int sequences_attached_; | 450 int sequences_attached_; |
459 | 451 |
460 // Number of sequences either ended or aborted. | 452 // Number of sequences either ended or aborted. |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 window, 1.0, duration, gfx::Tween::EASE_IN, observer); | 652 window, 1.0, duration, gfx::Tween::EASE_IN, observer); |
661 break; | 653 break; |
662 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS: | 654 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS: |
663 StartGrayscaleBrightnessAnimationForWindow( | 655 StartGrayscaleBrightnessAnimationForWindow( |
664 window, 0.0, duration, gfx::Tween::EASE_IN_OUT, observer); | 656 window, 0.0, duration, gfx::Tween::EASE_IN_OUT, observer); |
665 break; | 657 break; |
666 } | 658 } |
667 } | 659 } |
668 | 660 |
669 } // namespace ash | 661 } // namespace ash |
OLD | NEW |