Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: ash/wm/session_state_animator_impl.cc

Issue 2290473004: Rename ash desktop_background to wallpaper. (Closed)
Patch Set: Address comments. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/wm/session_state_animator_impl.h ('k') | ash/wm/session_state_animator_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/shell_window_ids.h" 9 #include "ash/common/shell_window_ids.h"
10 #include "ash/common/wm/wm_window_animations.h" 10 #include "ash/common/wm/wm_window_animations.h"
(...skipping 12 matching lines...) Expand all
23 // pre-shutdown states. 23 // pre-shutdown states.
24 const float kSlowCloseSizeRatio = 0.95f; 24 const float kSlowCloseSizeRatio = 0.95f;
25 25
26 // Maximum opacity of white layer when animating pre-shutdown state. 26 // Maximum opacity of white layer when animating pre-shutdown state.
27 const float kPartialFadeRatio = 0.3f; 27 const float kPartialFadeRatio = 0.3f;
28 28
29 // Minimum size. Not zero as it causes numeric issues. 29 // Minimum size. Not zero as it causes numeric issues.
30 const float kMinimumScale = 1e-4f; 30 const float kMinimumScale = 1e-4f;
31 31
32 // Returns the primary root window's container. 32 // Returns the primary root window's container.
33 aura::Window* GetBackground() { 33 aura::Window* GetWallpaper() {
34 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 34 aura::Window* root_window = Shell::GetPrimaryRootWindow();
35 return Shell::GetContainer(root_window, 35 return Shell::GetContainer(root_window, kShellWindowId_WallpaperContainer);
36 kShellWindowId_DesktopBackgroundContainer);
37 } 36 }
38 37
39 // Returns the transform that should be applied to containers for the slow-close 38 // Returns the transform that should be applied to containers for the slow-close
40 // animation. 39 // animation.
41 gfx::Transform GetSlowCloseTransform() { 40 gfx::Transform GetSlowCloseTransform() {
42 gfx::Size root_size = Shell::GetPrimaryRootWindow()->bounds().size(); 41 gfx::Size root_size = Shell::GetPrimaryRootWindow()->bounds().size();
43 gfx::Transform transform; 42 gfx::Transform transform;
44 transform.Translate( 43 transform.Translate(
45 floor(0.5 * (1.0 - kSlowCloseSizeRatio) * root_size.width() + 0.5), 44 floor(0.5 * (1.0 - kSlowCloseSizeRatio) * root_size.width() + 0.5),
46 floor(0.5 * (1.0 - kSlowCloseSizeRatio) * root_size.height() + 0.5)); 45 floor(0.5 * (1.0 - kSlowCloseSizeRatio) * root_size.height() + 0.5));
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 return true; 381 return true;
383 } 382 }
384 383
385 void GetContainersInRootWindow(int container_mask, 384 void GetContainersInRootWindow(int container_mask,
386 aura::Window* root_window, 385 aura::Window* root_window,
387 aura::Window::Windows* containers) { 386 aura::Window::Windows* containers) {
388 if (container_mask & SessionStateAnimator::ROOT_CONTAINER) { 387 if (container_mask & SessionStateAnimator::ROOT_CONTAINER) {
389 containers->push_back(root_window); 388 containers->push_back(root_window);
390 } 389 }
391 390
392 if (container_mask & SessionStateAnimator::DESKTOP_BACKGROUND) { 391 if (container_mask & SessionStateAnimator::WALLPAPER) {
393 containers->push_back(Shell::GetContainer( 392 containers->push_back(
394 root_window, kShellWindowId_DesktopBackgroundContainer)); 393 Shell::GetContainer(root_window, kShellWindowId_WallpaperContainer));
395 } 394 }
396 if (container_mask & SessionStateAnimator::LAUNCHER) { 395 if (container_mask & SessionStateAnimator::LAUNCHER) {
397 containers->push_back( 396 containers->push_back(
398 Shell::GetContainer(root_window, kShellWindowId_ShelfContainer)); 397 Shell::GetContainer(root_window, kShellWindowId_ShelfContainer));
399 } 398 }
400 if (container_mask & SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS) { 399 if (container_mask & SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS) {
401 // TODO(antrim): Figure out a way to eliminate a need to exclude launcher 400 // TODO(antrim): Figure out a way to eliminate a need to exclude launcher
402 // in such way. 401 // in such way.
403 aura::Window* non_lock_screen_containers = Shell::GetContainer( 402 aura::Window* non_lock_screen_containers = Shell::GetContainer(
404 root_window, kShellWindowId_NonLockScreenContainersContainer); 403 root_window, kShellWindowId_NonLockScreenContainersContainer);
405 // |non_lock_screen_containers| may already be removed in some tests. 404 // |non_lock_screen_containers| may already be removed in some tests.
406 if (non_lock_screen_containers) { 405 if (non_lock_screen_containers) {
407 for (aura::Window* window : non_lock_screen_containers->children()) { 406 for (aura::Window* window : non_lock_screen_containers->children()) {
408 if (window->id() == kShellWindowId_ShelfContainer) 407 if (window->id() == kShellWindowId_ShelfContainer)
409 continue; 408 continue;
410 containers->push_back(window); 409 containers->push_back(window);
411 } 410 }
412 } 411 }
413 } 412 }
414 if (container_mask & SessionStateAnimator::LOCK_SCREEN_BACKGROUND) { 413 if (container_mask & SessionStateAnimator::LOCK_SCREEN_WALLPAPER) {
415 containers->push_back(Shell::GetContainer( 414 containers->push_back(Shell::GetContainer(
416 root_window, kShellWindowId_LockScreenBackgroundContainer)); 415 root_window, kShellWindowId_LockScreenWallpaperContainer));
417 } 416 }
418 if (container_mask & SessionStateAnimator::LOCK_SCREEN_CONTAINERS) { 417 if (container_mask & SessionStateAnimator::LOCK_SCREEN_CONTAINERS) {
419 containers->push_back(Shell::GetContainer( 418 containers->push_back(Shell::GetContainer(
420 root_window, kShellWindowId_LockScreenContainersContainer)); 419 root_window, kShellWindowId_LockScreenContainersContainer));
421 } 420 }
422 if (container_mask & SessionStateAnimator::LOCK_SCREEN_RELATED_CONTAINERS) { 421 if (container_mask & SessionStateAnimator::LOCK_SCREEN_RELATED_CONTAINERS) {
423 containers->push_back(Shell::GetContainer( 422 containers->push_back(Shell::GetContainer(
424 root_window, kShellWindowId_LockScreenRelatedContainersContainer)); 423 root_window, kShellWindowId_LockScreenRelatedContainersContainer));
425 } 424 }
426 } 425 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 new CallbackAnimationObserver(callback); 553 new CallbackAnimationObserver(callback);
555 RunAnimationForWindow(*it, type, speed, observer); 554 RunAnimationForWindow(*it, type, speed, observer);
556 } 555 }
557 } 556 }
558 557
559 SessionStateAnimator::AnimationSequence* 558 SessionStateAnimator::AnimationSequence*
560 SessionStateAnimatorImpl::BeginAnimationSequence(base::Closure callback) { 559 SessionStateAnimatorImpl::BeginAnimationSequence(base::Closure callback) {
561 return new AnimationSequence(this, callback); 560 return new AnimationSequence(this, callback);
562 } 561 }
563 562
564 bool SessionStateAnimatorImpl::IsBackgroundHidden() const { 563 bool SessionStateAnimatorImpl::IsWallpaperHidden() const {
565 return !GetBackground()->IsVisible(); 564 return !GetWallpaper()->IsVisible();
566 } 565 }
567 566
568 void SessionStateAnimatorImpl::ShowBackground() { 567 void SessionStateAnimatorImpl::ShowWallpaper() {
569 ui::ScopedLayerAnimationSettings settings( 568 ui::ScopedLayerAnimationSettings settings(
570 GetBackground()->layer()->GetAnimator()); 569 GetWallpaper()->layer()->GetAnimator());
571 settings.SetTransitionDuration(base::TimeDelta()); 570 settings.SetTransitionDuration(base::TimeDelta());
572 GetBackground()->Show(); 571 GetWallpaper()->Show();
573 } 572 }
574 573
575 void SessionStateAnimatorImpl::HideBackground() { 574 void SessionStateAnimatorImpl::HideWallpaper() {
576 ui::ScopedLayerAnimationSettings settings( 575 ui::ScopedLayerAnimationSettings settings(
577 GetBackground()->layer()->GetAnimator()); 576 GetWallpaper()->layer()->GetAnimator());
578 settings.SetTransitionDuration(base::TimeDelta()); 577 settings.SetTransitionDuration(base::TimeDelta());
579 GetBackground()->Hide(); 578 GetWallpaper()->Hide();
580 } 579 }
581 580
582 void SessionStateAnimatorImpl::StartAnimationInSequence( 581 void SessionStateAnimatorImpl::StartAnimationInSequence(
583 int container_mask, 582 int container_mask,
584 AnimationType type, 583 AnimationType type,
585 AnimationSpeed speed, 584 AnimationSpeed speed,
586 AnimationSequence* observer) { 585 AnimationSequence* observer) {
587 aura::Window::Windows containers; 586 aura::Window::Windows containers;
588 GetContainers(container_mask, &containers); 587 GetContainers(container_mask, &containers);
589 for (aura::Window::Windows::const_iterator it = containers.begin(); 588 for (aura::Window::Windows::const_iterator it = containers.begin();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 gfx::Tween::EASE_IN, observer); 651 gfx::Tween::EASE_IN, observer);
653 break; 652 break;
654 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS: 653 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS:
655 StartGrayscaleBrightnessAnimationForWindow( 654 StartGrayscaleBrightnessAnimationForWindow(
656 window, 0.0, duration, gfx::Tween::EASE_IN_OUT, observer); 655 window, 0.0, duration, gfx::Tween::EASE_IN_OUT, observer);
657 break; 656 break;
658 } 657 }
659 } 658 }
660 659
661 } // namespace ash 660 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/session_state_animator_impl.h ('k') | ash/wm/session_state_animator_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698