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/window_animations.h" | 5 #include "ash/wm/window_animations.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 ui::LayerAnimationElement::CreateBrightnessElement( | 510 ui::LayerAnimationElement::CreateBrightnessElement( |
511 end_value, | 511 end_value, |
512 base::TimeDelta::FromMilliseconds( | 512 base::TimeDelta::FromMilliseconds( |
513 kBrightnessGrayscaleFadeDurationMs))); | 513 kBrightnessGrayscaleFadeDurationMs))); |
514 grayscale_sequence->AddElement( | 514 grayscale_sequence->AddElement( |
515 ui::LayerAnimationElement::CreateGrayscaleElement( | 515 ui::LayerAnimationElement::CreateGrayscaleElement( |
516 end_value, | 516 end_value, |
517 base::TimeDelta::FromMilliseconds( | 517 base::TimeDelta::FromMilliseconds( |
518 kBrightnessGrayscaleFadeDurationMs))); | 518 kBrightnessGrayscaleFadeDurationMs))); |
519 | 519 |
520 std::vector<ui::LayerAnimationSequence*> animations; | 520 std::vector<ui::LayerAnimationSequence*> animations; |
521 animations.push_back(brightness_sequence.release()); | 521 animations.push_back(brightness_sequence.release()); |
522 animations.push_back(grayscale_sequence.release()); | 522 animations.push_back(grayscale_sequence.release()); |
523 window->layer()->GetAnimator()->ScheduleTogether(animations); | 523 window->layer()->GetAnimator()->ScheduleTogether(animations); |
524 if (!show) { | 524 if (!show) { |
525 window->layer()->SetOpacity(kWindowAnimation_HideOpacity); | 525 window->layer()->SetOpacity(kWindowAnimation_HideOpacity); |
526 window->layer()->SetVisible(false); | 526 window->layer()->SetVisible(false); |
527 } | 527 } |
528 } | 528 } |
529 | 529 |
530 void AnimateShowWindow_BrightnessGrayscale(aura::Window* window) { | 530 void AnimateShowWindow_BrightnessGrayscale(aura::Window* window) { |
531 AnimateShowHideWindowCommon_BrightnessGrayscale(window, true); | 531 AnimateShowHideWindowCommon_BrightnessGrayscale(window, true); |
532 } | 532 } |
533 | 533 |
534 void AnimateHideWindow_BrightnessGrayscale(aura::Window* window) { | 534 void AnimateHideWindow_BrightnessGrayscale(aura::Window* window) { |
535 AnimateShowHideWindowCommon_BrightnessGrayscale(window, false); | 535 AnimateShowHideWindowCommon_BrightnessGrayscale(window, false); |
536 } | 536 } |
537 | 537 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 : window_(window), | 635 : window_(window), |
636 layer_(layer) { | 636 layer_(layer) { |
637 window_->AddObserver(this); | 637 window_->AddObserver(this); |
638 layer_->GetCompositor()->AddObserver(this); | 638 layer_->GetCompositor()->AddObserver(this); |
639 } | 639 } |
640 virtual ~CrossFadeObserver() { | 640 virtual ~CrossFadeObserver() { |
641 Cleanup(); | 641 Cleanup(); |
642 } | 642 } |
643 | 643 |
644 // ui::CompositorObserver overrides: | 644 // ui::CompositorObserver overrides: |
645 virtual void OnCompositingDidCommit(ui::Compositor* compositor) OVERRIDE { | |
646 } | |
647 virtual void OnCompositingWillStart(ui::Compositor* compositor) OVERRIDE { | |
648 } | |
649 virtual void OnCompositingStarted(ui::Compositor* compositor) OVERRIDE { | 645 virtual void OnCompositingStarted(ui::Compositor* compositor) OVERRIDE { |
650 } | 646 } |
651 virtual void OnCompositingEnded(ui::Compositor* compositor) OVERRIDE { | 647 virtual void OnCompositingEnded(ui::Compositor* compositor) OVERRIDE { |
652 } | 648 } |
653 virtual void OnCompositingAborted(ui::Compositor* compositor) OVERRIDE { | 649 virtual void OnCompositingAborted(ui::Compositor* compositor) OVERRIDE { |
654 // Something went wrong with compositing and our layers are now invalid. | 650 // Something went wrong with compositing and our layers are now invalid. |
655 if (layer_) | 651 if (layer_) |
656 layer_->GetAnimator()->StopAnimating(); | 652 layer_->GetAnimator()->StopAnimating(); |
657 // Delete is scheduled in OnImplicitAnimationsCompleted(). | 653 // Delete is scheduled in OnImplicitAnimationsCompleted(). |
658 Cleanup(); | 654 Cleanup(); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 AnimateHideWindow(window); | 850 AnimateHideWindow(window); |
855 } | 851 } |
856 } | 852 } |
857 | 853 |
858 void SetDelayedOldLayerDeletionInCrossFadeForTest(bool value) { | 854 void SetDelayedOldLayerDeletionInCrossFadeForTest(bool value) { |
859 delayed_old_layer_deletion_in_cross_fade_for_test_ = value; | 855 delayed_old_layer_deletion_in_cross_fade_for_test_ = value; |
860 } | 856 } |
861 | 857 |
862 } // namespace internal | 858 } // namespace internal |
863 } // namespace ash | 859 } // namespace ash |
OLD | NEW |