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 <utility> |
7 #include <vector> | 8 #include <vector> |
8 | 9 |
9 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
10 #include "ash/shell.h" | 11 #include "ash/shell.h" |
11 #include "ash/wm/wm_window_animations.h" | 12 #include "ash/wm/wm_window_animations.h" |
12 #include "base/barrier_closure.h" | 13 #include "base/barrier_closure.h" |
13 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
14 #include "ui/aura/client/aura_constants.h" | 15 #include "ui/aura/client/aura_constants.h" |
15 #include "ui/aura/window_event_dispatcher.h" | 16 #include "ui/aura/window_event_dispatcher.h" |
16 #include "ui/compositor/layer_animation_observer.h" | 17 #include "ui/compositor/layer_animation_observer.h" |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 // equal, observer will delete itself, calling callback passed to constructor if | 436 // equal, observer will delete itself, calling callback passed to constructor if |
436 // there were no aborted animations. | 437 // there were no aborted animations. |
437 // This way it can be either used to wait for some animation to be finished in | 438 // This way it can be either used to wait for some animation to be finished in |
438 // multiple layers, to wait once a sequence of animations is finished in one | 439 // multiple layers, to wait once a sequence of animations is finished in one |
439 // layer or the mixture of both. | 440 // layer or the mixture of both. |
440 class SessionStateAnimatorImpl::AnimationSequence | 441 class SessionStateAnimatorImpl::AnimationSequence |
441 : public SessionStateAnimator::AnimationSequence, | 442 : public SessionStateAnimator::AnimationSequence, |
442 public ui::LayerAnimationObserver { | 443 public ui::LayerAnimationObserver { |
443 public: | 444 public: |
444 explicit AnimationSequence(SessionStateAnimatorImpl* animator, | 445 explicit AnimationSequence(SessionStateAnimatorImpl* animator, |
445 base::Closure callback) | 446 base::OnceClosure callback) |
446 : SessionStateAnimator::AnimationSequence(callback), | 447 : SessionStateAnimator::AnimationSequence(std::move(callback)), |
447 animator_(animator), | 448 animator_(animator), |
448 sequences_attached_(0), | 449 sequences_attached_(0), |
449 sequences_completed_(0) {} | 450 sequences_completed_(0) {} |
450 | 451 |
451 // SessionStateAnimator::AnimationSequence: | 452 // SessionStateAnimator::AnimationSequence: |
452 void StartAnimation(int container_mask, | 453 void StartAnimation(int container_mask, |
453 SessionStateAnimator::AnimationType type, | 454 SessionStateAnimator::AnimationType type, |
454 SessionStateAnimator::AnimationSpeed speed) override { | 455 SessionStateAnimator::AnimationSpeed speed) override { |
455 animator_->StartAnimationInSequence(container_mask, type, speed, this); | 456 animator_->StartAnimationInSequence(container_mask, type, speed, this); |
456 } | 457 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 for (aura::Window::Windows::const_iterator it = containers.begin(); | 540 for (aura::Window::Windows::const_iterator it = containers.begin(); |
540 it != containers.end(); ++it) { | 541 it != containers.end(); ++it) { |
541 RunAnimationForWindow(*it, type, speed, NULL); | 542 RunAnimationForWindow(*it, type, speed, NULL); |
542 } | 543 } |
543 } | 544 } |
544 | 545 |
545 void SessionStateAnimatorImpl::StartAnimationWithCallback( | 546 void SessionStateAnimatorImpl::StartAnimationWithCallback( |
546 int container_mask, | 547 int container_mask, |
547 AnimationType type, | 548 AnimationType type, |
548 AnimationSpeed speed, | 549 AnimationSpeed speed, |
549 base::Closure callback) { | 550 base::OnceClosure callback) { |
550 aura::Window::Windows containers; | 551 aura::Window::Windows containers; |
551 GetContainers(container_mask, &containers); | 552 GetContainers(container_mask, &containers); |
552 base::Closure animation_done_closure = | 553 base::Closure animation_done_closure = |
553 base::BarrierClosure(containers.size(), callback); | 554 base::BarrierClosure(containers.size(), std::move(callback)); |
554 for (aura::Window::Windows::const_iterator it = containers.begin(); | 555 for (aura::Window::Windows::const_iterator it = containers.begin(); |
555 it != containers.end(); ++it) { | 556 it != containers.end(); ++it) { |
556 ui::LayerAnimationObserver* observer = | 557 ui::LayerAnimationObserver* observer = |
557 new CallbackAnimationObserver(animation_done_closure); | 558 new CallbackAnimationObserver(animation_done_closure); |
558 RunAnimationForWindow(*it, type, speed, observer); | 559 RunAnimationForWindow(*it, type, speed, observer); |
559 } | 560 } |
560 } | 561 } |
561 | 562 |
562 SessionStateAnimator::AnimationSequence* | 563 SessionStateAnimator::AnimationSequence* |
563 SessionStateAnimatorImpl::BeginAnimationSequence(base::Closure callback) { | 564 SessionStateAnimatorImpl::BeginAnimationSequence(base::OnceClosure callback) { |
564 return new AnimationSequence(this, callback); | 565 return new AnimationSequence(this, std::move(callback)); |
565 } | 566 } |
566 | 567 |
567 bool SessionStateAnimatorImpl::IsWallpaperHidden() const { | 568 bool SessionStateAnimatorImpl::IsWallpaperHidden() const { |
568 return !GetWallpaper()->IsVisible(); | 569 return !GetWallpaper()->IsVisible(); |
569 } | 570 } |
570 | 571 |
571 void SessionStateAnimatorImpl::ShowWallpaper() { | 572 void SessionStateAnimatorImpl::ShowWallpaper() { |
572 ui::ScopedLayerAnimationSettings settings( | 573 ui::ScopedLayerAnimationSettings settings( |
573 GetWallpaper()->layer()->GetAnimator()); | 574 GetWallpaper()->layer()->GetAnimator()); |
574 settings.SetTransitionDuration(base::TimeDelta()); | 575 settings.SetTransitionDuration(base::TimeDelta()); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 gfx::Tween::EASE_IN, observer); | 656 gfx::Tween::EASE_IN, observer); |
656 break; | 657 break; |
657 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS: | 658 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS: |
658 StartGrayscaleBrightnessAnimationForWindow( | 659 StartGrayscaleBrightnessAnimationForWindow( |
659 window, 0.0, duration, gfx::Tween::EASE_IN_OUT, observer); | 660 window, 0.0, duration, gfx::Tween::EASE_IN_OUT, observer); |
660 break; | 661 break; |
661 } | 662 } |
662 } | 663 } |
663 | 664 |
664 } // namespace ash | 665 } // namespace ash |
OLD | NEW |