| 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.h" | 5 #include "ash/wm/session_state_animator.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
| 9 #include "ash/wm/window_animations.h" | 9 #include "ash/wm/window_animations.h" |
| 10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| 11 #include "ui/aura/window_event_dispatcher.h" | 11 #include "ui/aura/window_event_dispatcher.h" |
| 12 #include "ui/compositor/layer_animation_observer.h" | 12 #include "ui/compositor/layer_animation_observer.h" |
| 13 #include "ui/compositor/layer_animation_sequence.h" | 13 #include "ui/compositor/layer_animation_sequence.h" |
| 14 #include "ui/compositor/scoped_layer_animation_settings.h" | 14 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 15 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
| 16 | 16 |
| 17 namespace ash { | 17 namespace ash { |
| 18 namespace internal { | |
| 19 | |
| 20 namespace { | 18 namespace { |
| 21 | 19 |
| 22 // Slightly-smaller size that we scale the screen down to for the pre-lock and | 20 // Slightly-smaller size that we scale the screen down to for the pre-lock and |
| 23 // pre-shutdown states. | 21 // pre-shutdown states. |
| 24 const float kSlowCloseSizeRatio = 0.95f; | 22 const float kSlowCloseSizeRatio = 0.95f; |
| 25 | 23 |
| 26 // Maximum opacity of white layer when animating pre-shutdown state. | 24 // Maximum opacity of white layer when animating pre-shutdown state. |
| 27 const float kPartialFadeRatio = 0.3f; | 25 const float kPartialFadeRatio = 0.3f; |
| 28 | 26 |
| 29 // Minimum size. Not zero as it causes numeric issues. | 27 // Minimum size. Not zero as it causes numeric issues. |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 } | 451 } |
| 454 | 452 |
| 455 // Fills |containers| with the containers described by |container_mask|. | 453 // Fills |containers| with the containers described by |container_mask|. |
| 456 void SessionStateAnimator::GetContainers(int container_mask, | 454 void SessionStateAnimator::GetContainers(int container_mask, |
| 457 aura::Window::Windows* containers) { | 455 aura::Window::Windows* containers) { |
| 458 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 456 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
| 459 containers->clear(); | 457 containers->clear(); |
| 460 | 458 |
| 461 if (container_mask & DESKTOP_BACKGROUND) { | 459 if (container_mask & DESKTOP_BACKGROUND) { |
| 462 containers->push_back(Shell::GetContainer( | 460 containers->push_back(Shell::GetContainer( |
| 463 root_window, | 461 root_window, kShellWindowId_DesktopBackgroundContainer)); |
| 464 internal::kShellWindowId_DesktopBackgroundContainer)); | |
| 465 } | 462 } |
| 466 if (container_mask & LAUNCHER) { | 463 if (container_mask & LAUNCHER) { |
| 467 containers->push_back(Shell::GetContainer( | 464 containers->push_back( |
| 468 root_window, | 465 Shell::GetContainer(root_window, kShellWindowId_ShelfContainer)); |
| 469 internal::kShellWindowId_ShelfContainer)); | |
| 470 } | 466 } |
| 471 if (container_mask & NON_LOCK_SCREEN_CONTAINERS) { | 467 if (container_mask & NON_LOCK_SCREEN_CONTAINERS) { |
| 472 // TODO(antrim): Figure out a way to eliminate a need to exclude launcher | 468 // TODO(antrim): Figure out a way to eliminate a need to exclude launcher |
| 473 // in such way. | 469 // in such way. |
| 474 aura::Window* non_lock_screen_containers = Shell::GetContainer( | 470 aura::Window* non_lock_screen_containers = Shell::GetContainer( |
| 475 root_window, | 471 root_window, kShellWindowId_NonLockScreenContainersContainer); |
| 476 internal::kShellWindowId_NonLockScreenContainersContainer); | |
| 477 aura::Window::Windows children = non_lock_screen_containers->children(); | 472 aura::Window::Windows children = non_lock_screen_containers->children(); |
| 478 | 473 |
| 479 for (aura::Window::Windows::const_iterator it = children.begin(); | 474 for (aura::Window::Windows::const_iterator it = children.begin(); |
| 480 it != children.end(); ++it) { | 475 it != children.end(); ++it) { |
| 481 aura::Window* window = *it; | 476 aura::Window* window = *it; |
| 482 if (window->id() == internal::kShellWindowId_ShelfContainer) | 477 if (window->id() == kShellWindowId_ShelfContainer) |
| 483 continue; | 478 continue; |
| 484 containers->push_back(window); | 479 containers->push_back(window); |
| 485 } | 480 } |
| 486 } | 481 } |
| 487 if (container_mask & LOCK_SCREEN_BACKGROUND) { | 482 if (container_mask & LOCK_SCREEN_BACKGROUND) { |
| 488 containers->push_back(Shell::GetContainer( | 483 containers->push_back(Shell::GetContainer( |
| 489 root_window, | 484 root_window, kShellWindowId_LockScreenBackgroundContainer)); |
| 490 internal::kShellWindowId_LockScreenBackgroundContainer)); | |
| 491 } | 485 } |
| 492 if (container_mask & LOCK_SCREEN_CONTAINERS) { | 486 if (container_mask & LOCK_SCREEN_CONTAINERS) { |
| 493 containers->push_back(Shell::GetContainer( | 487 containers->push_back(Shell::GetContainer( |
| 494 root_window, | 488 root_window, kShellWindowId_LockScreenContainersContainer)); |
| 495 internal::kShellWindowId_LockScreenContainersContainer)); | |
| 496 } | 489 } |
| 497 if (container_mask & LOCK_SCREEN_RELATED_CONTAINERS) { | 490 if (container_mask & LOCK_SCREEN_RELATED_CONTAINERS) { |
| 498 containers->push_back(Shell::GetContainer( | 491 containers->push_back(Shell::GetContainer( |
| 499 root_window, | 492 root_window, kShellWindowId_LockScreenRelatedContainersContainer)); |
| 500 internal::kShellWindowId_LockScreenRelatedContainersContainer)); | |
| 501 } | 493 } |
| 502 } | 494 } |
| 503 | 495 |
| 504 void SessionStateAnimator::StartAnimation(int container_mask, | 496 void SessionStateAnimator::StartAnimation(int container_mask, |
| 505 AnimationType type, | 497 AnimationType type, |
| 506 AnimationSpeed speed) { | 498 AnimationSpeed speed) { |
| 507 aura::Window::Windows containers; | 499 aura::Window::Windows containers; |
| 508 GetContainers(container_mask, &containers); | 500 GetContainers(container_mask, &containers); |
| 509 for (aura::Window::Windows::const_iterator it = containers.begin(); | 501 for (aura::Window::Windows::const_iterator it = containers.begin(); |
| 510 it != containers.end(); ++it) { | 502 it != containers.end(); ++it) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 StartGrayscaleBrightnessAnimationForWindow( | 598 StartGrayscaleBrightnessAnimationForWindow( |
| 607 window, 1.0, duration, gfx::Tween::EASE_IN, observer); | 599 window, 1.0, duration, gfx::Tween::EASE_IN, observer); |
| 608 break; | 600 break; |
| 609 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS: | 601 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS: |
| 610 StartGrayscaleBrightnessAnimationForWindow( | 602 StartGrayscaleBrightnessAnimationForWindow( |
| 611 window, 0.0, duration, gfx::Tween::EASE_IN_OUT, observer); | 603 window, 0.0, duration, gfx::Tween::EASE_IN_OUT, observer); |
| 612 break; | 604 break; |
| 613 } | 605 } |
| 614 } | 606 } |
| 615 | 607 |
| 616 } // namespace internal | |
| 617 } // namespace ash | 608 } // namespace ash |
| OLD | NEW |