diff options
author | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-29 19:22:19 +0000 |
---|---|---|
committer | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-29 19:22:19 +0000 |
commit | e6e41d2f4f03a1dbb669c92c1e5152fd3e04e12b (patch) | |
tree | e74cad87eb8a9529154a6239e7d89e2d20be788a /ash | |
parent | 42cbf6082756c2a03ef4c13ac334045d8b574bc2 (diff) | |
download | chromium_src-e6e41d2f4f03a1dbb669c92c1e5152fd3e04e12b.zip chromium_src-e6e41d2f4f03a1dbb669c92c1e5152fd3e04e12b.tar.gz chromium_src-e6e41d2f4f03a1dbb669c92c1e5152fd3e04e12b.tar.bz2 |
ash: Clean up system background layer.
This adds a SystemBackgroundController class that's
responsible for a ui::Layer that's stacked underneath all
other layers.
I'm also adding an --ash-copy-host-background-at-boot flag
that can be set to instruct the controller to copy the host
window's content into the system background layer at
startup; otherwise, we display the same background color
used by Chrome OS's boot splash screen.
I suspect that there's a small performance hit from copying
(I've seen the XGetImage() take between 25 and 170 ms
depending on hardware), although it seems to be hidden in
the noise of our total boot times. Regardless, I figure
that we should only turn this on right now for systems that
need it (to hide an even-longer delay where the compositor
is drawing but the login background images hasn't been
loaded).
In any case, once the login background is visible, the
system background layer is reset to display the black
background that's needed for fullscreen animations that
manipulate the desktop background (for the workspace or
power button).
BUG=152309
Review URL: https://chromiumcodereview.appspot.com/11273059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164704 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/ash.gyp | 2 | ||||
-rw-r--r-- | ash/ash_switches.cc | 6 | ||||
-rw-r--r-- | ash/ash_switches.h | 1 | ||||
-rw-r--r-- | ash/root_window_controller.cc | 47 | ||||
-rw-r--r-- | ash/root_window_controller.h | 11 | ||||
-rw-r--r-- | ash/shell_unittest.cc | 41 | ||||
-rw-r--r-- | ash/shell_window_ids.h | 45 | ||||
-rw-r--r-- | ash/wm/power_button_controller_unittest.cc | 67 | ||||
-rw-r--r-- | ash/wm/session_state_animator.cc | 51 | ||||
-rw-r--r-- | ash/wm/session_state_animator.h | 41 | ||||
-rw-r--r-- | ash/wm/session_state_controller_impl.cc | 16 | ||||
-rw-r--r-- | ash/wm/system_background_controller.cc | 133 | ||||
-rw-r--r-- | ash/wm/system_background_controller.h | 97 | ||||
-rw-r--r-- | ash/wm/workspace/colored_window_controller.h | 3 |
14 files changed, 287 insertions, 274 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index e8f97b0..9a16531 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -351,6 +351,8 @@ 'wm/stacking_controller.h', 'wm/status_area_layout_manager.cc', 'wm/status_area_layout_manager.h', + 'wm/system_background_controller.cc', + 'wm/system_background_controller.h', 'wm/system_gesture_event_filter.cc', 'wm/system_gesture_event_filter.h', 'wm/system_modal_container_event_filter.cc', diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc index f9980e8..6094cf0 100644 --- a/ash/ash_switches.cc +++ b/ash/ash_switches.cc @@ -16,6 +16,12 @@ const char kAshBootAnimationFunction3[] = "ash-boot-animation-function3"; // Constrains the pointer movement within a root window on desktop. const char kAshConstrainPointerToRoot[] = "ash-constrain-pointer-to-root"; +// Copies the host window's content to the system background layer at startup. +// Can make boot slightly slower, but also hides an even-longer awkward period +// where we display a white background if the login wallpaper takes a long time +// to load. +const char kAshCopyHostBackgroundAtBoot[] = "ash-copy-host-background-at-boot"; + // Enable keyboard shortcuts useful for debugging. const char kAshDebugShortcuts[] = "ash-debug-shortcuts"; diff --git a/ash/ash_switches.h b/ash/ash_switches.h index 240bdc5..5ed521f 100644 --- a/ash/ash_switches.h +++ b/ash/ash_switches.h @@ -18,6 +18,7 @@ namespace switches { ASH_EXPORT extern const char kAshBootAnimationFunction2[]; ASH_EXPORT extern const char kAshBootAnimationFunction3[]; ASH_EXPORT extern const char kAshConstrainPointerToRoot[]; +ASH_EXPORT extern const char kAshCopyHostBackgroundAtBoot[]; ASH_EXPORT extern const char kAshDebugShortcuts[]; ASH_EXPORT extern const char kAshDisableAutoWindowPlacement[]; ASH_EXPORT extern const char kAshDisablePanelFitting[]; diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index 0634ec9..2c00a5b 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc @@ -6,6 +6,7 @@ #include <vector> +#include "ash/ash_switches.h" #include "ash/desktop_background/desktop_background_widget_controller.h" #include "ash/display/display_controller.h" #include "ash/display/multi_display_manager.h" @@ -25,12 +26,13 @@ #include "ash/wm/shelf_layout_manager.h" #include "ash/wm/shelf_types.h" #include "ash/wm/status_area_layout_manager.h" +#include "ash/wm/system_background_controller.h" #include "ash/wm/system_modal_container_layout_manager.h" #include "ash/wm/toplevel_window_event_handler.h" #include "ash/wm/visibility_controller.h" #include "ash/wm/window_properties.h" -#include "ash/wm/workspace/colored_window_controller.h" #include "ash/wm/workspace_controller.h" +#include "base/command_line.h" #include "ui/aura/client/activation_client.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/capture_client.h" @@ -51,12 +53,6 @@ namespace ash { namespace { -#if defined(OS_CHROMEOS) -// Color initially used for the system background after the system has first -// booted. -const SkColor kBootSystemBackgroundColor = 0xFFFEFEFE; -#endif - // Creates a new window for use as a container. aura::Window* CreateContainer(int window_id, const char* name, @@ -293,16 +289,21 @@ void RootWindowController::CreateContainers() { void RootWindowController::CreateSystemBackground( bool is_first_run_after_boot) { - SkColor color = SK_ColorBLACK; + SystemBackgroundController::Content initial_content = + SystemBackgroundController::CONTENT_BLACK; #if defined(OS_CHROMEOS) - if (is_first_run_after_boot) - color = kBootSystemBackgroundColor; + if (is_first_run_after_boot) { + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kAshCopyHostBackgroundAtBoot)) { + initial_content = SystemBackgroundController::CONTENT_COPY_FROM_HOST; + } else { + initial_content = + SystemBackgroundController::CONTENT_CHROME_OS_BOOT_COLOR; + } + } #endif - background_.reset(new ColoredWindowController( - root_window_->GetChildById(kShellWindowId_SystemBackgroundContainer), - "SystemBackground")); - background_->SetColor(color); - background_->GetWidget()->Show(); + system_background_.reset( + new SystemBackgroundController(root_window_.get(), initial_content)); } void RootWindowController::CreateLauncher() { @@ -345,8 +346,7 @@ void RootWindowController::UpdateAfterLoginStatusChange( } void RootWindowController::HandleDesktopBackgroundVisible() { - if (background_.get()) - background_->SetColor(SK_ColorBLACK); + system_background_->SetContent(SystemBackgroundController::CONTENT_BLACK); } void RootWindowController::CloseChildWindows() { @@ -472,20 +472,17 @@ void RootWindowController::CreateContainersInRootWindow( // of containers simultaneously without messing up the current transformations // on those containers. These are direct children of the root window; all of // the other containers are their children. - // Desktop and lock screen background containers are not part of the - // lock animation so they are not included in those animate groups. + + // The desktop background container is not part of the lock animation, so it + // is not included in those animate groups. // When screen is locked desktop background is moved to lock screen background // container (moved back on unlock). We want to make sure that there's an // opaque layer occluding the non-lock-screen layers. - - CreateContainer(kShellWindowId_SystemBackgroundContainer, - "SystemBackgroundContainer", root_window); - - aura::Window* desktop_background_containers = CreateContainer( + aura::Window* desktop_background_container = CreateContainer( kShellWindowId_DesktopBackgroundContainer, "DesktopBackgroundContainer", root_window); - SetChildWindowVisibilityChangesAnimated(desktop_background_containers); + SetChildWindowVisibilityChangesAnimated(desktop_background_container); aura::Window* non_lock_screen_containers = CreateContainer( kShellWindowId_NonLockScreenContainersContainer, diff --git a/ash/root_window_controller.h b/ash/root_window_controller.h index e264b3c..50f4351 100644 --- a/ash/root_window_controller.h +++ b/ash/root_window_controller.h @@ -33,7 +33,6 @@ class ToplevelWindowEventHandler; namespace internal { -class ColoredWindowController; class PanelLayoutManager; class RootWindowLayoutManager; class ScreenDimmer; @@ -100,8 +99,8 @@ class ASH_EXPORT RootWindowController { // creates void InitForPrimaryDisplay(); - // Initializes |background_|. |is_first_run_after_boot| determines the - // background's initial color. + // Initializes |system_background_|. |is_first_run_after_boot| determines the + // background's initial content. void CreateSystemBackground(bool is_first_run_after_boot); // Initializes |launcher_|. Does nothing if it's already initialized. @@ -168,11 +167,7 @@ class ASH_EXPORT RootWindowController { scoped_ptr<Launcher> launcher_; - // A background layer that's displayed beneath all other layers. Without - // this, portions of the root window that aren't covered by layers will be - // painted white; this can show up if e.g. it takes a long time to decode the - // desktop background image when displaying the login screen. - scoped_ptr<ColoredWindowController> background_; + scoped_ptr<SystemBackgroundController> system_background_; scoped_ptr<ScreenDimmer> screen_dimmer_; scoped_ptr<WorkspaceController> workspace_controller_; diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc index 1d0811b..0502741 100644 --- a/ash/shell_unittest.cc +++ b/ash/shell_unittest.cc @@ -55,8 +55,6 @@ void ExpectAllContainers() { EXPECT_TRUE(Shell::GetContainer( root_window, internal::kShellWindowId_DesktopBackgroundContainer)); EXPECT_TRUE(Shell::GetContainer( - root_window, internal::kShellWindowId_SystemBackgroundContainer)); - EXPECT_TRUE(Shell::GetContainer( root_window, internal::kShellWindowId_DefaultContainer)); EXPECT_TRUE(Shell::GetContainer( root_window, internal::kShellWindowId_AlwaysOnTopContainer)); @@ -354,45 +352,6 @@ std::vector<aura::Window*> BuildPathToRoot(aura::Window* window) { } // namespace -// The SystemBackgroundContainer needs to be behind the -// DesktopBackgroundContainer, otherwise workspace animations don't line up. -TEST_F(ShellTest, SystemBackgroundBehindDesktopBackground) { - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); - aura::Window* desktop = Shell::GetContainer( - root_window, internal::kShellWindowId_DesktopBackgroundContainer); - ASSERT_TRUE(desktop != NULL); - aura::Window* system_bg = Shell::GetContainer( - root_window, internal::kShellWindowId_SystemBackgroundContainer); - ASSERT_TRUE(system_bg != NULL); - - std::vector<aura::Window*> desktop_parents(BuildPathToRoot(desktop)); - std::vector<aura::Window*> system_bg_parents(BuildPathToRoot(system_bg)); - - for (size_t i = 0; i < system_bg_parents.size(); ++i) { - std::vector<aura::Window*>::iterator desktop_i = - std::find(desktop_parents.begin(), desktop_parents.end(), - system_bg_parents[i]); - if (desktop_i != desktop_parents.end()) { - // Found the common parent. - ASSERT_NE(0u, i); - ASSERT_TRUE(desktop_i != desktop_parents.begin()); - aura::Window* common_parent = system_bg_parents[i]; - int system_child = static_cast<int>(std::find( - common_parent->children().begin(), - common_parent->children().end(), system_bg_parents[i - 1]) - - common_parent->children().begin()); - int desktop_child = static_cast<int>(std::find( - common_parent->children().begin(), - common_parent->children().end(), *(desktop_i - 1)) - - common_parent->children().begin()); - EXPECT_LT(system_child, desktop_child); - return; - } - } - EXPECT_TRUE(false) << - "system background and desktop background need to have a common parent"; -} - // Various assertions around IsAutoHideMenuHideChecked() and // ToggleAutoHideMenu(). TEST_F(ShellTest, ToggleAutoHide) { diff --git a/ash/shell_window_ids.h b/ash/shell_window_ids.h index c508c16..2d73152 100644 --- a/ash/shell_window_ids.h +++ b/ash/shell_window_ids.h @@ -33,15 +33,8 @@ const int kShellWindowId_LockScreenRelatedContainersContainer = 2; // This container is not visible. const int kShellWindowId_UnparentedControlContainer = 3; -// System level background. Sits beneach the desktop background and is only -// visible when the desktop background has not yet been loaded or a workspace -// other than the desktop is being displayed. When switching from the desktop -// workspace to to another workspace the desktop background scales slightly. -// This exposes the system level background beneath it. -const int kShellWindowId_SystemBackgroundContainer = 4; - // The desktop background window. -const int kShellWindowId_DesktopBackgroundContainer = 5; +const int kShellWindowId_DesktopBackgroundContainer = 4; // TODO(sky): rename kShellWindowId_DefaultContainer when Workspace2 is the // default. @@ -49,63 +42,63 @@ const int kShellWindowId_DesktopBackgroundContainer = 5; // The container for standard top-level windows. // WARNING: when Workspace2 is enabled the only children of // kShellWindowId_DefaultContainer are kShellWindowId_WorkspaceContainer. -const int kShellWindowId_DefaultContainer = 6; +const int kShellWindowId_DefaultContainer = 5; // Used by Worskpace2 for each workspace. Contains standard top-level windows. // WARNING: there may be more than one container with this id. -const int kShellWindowId_WorkspaceContainer = 7; +const int kShellWindowId_WorkspaceContainer = 6; // The container for top-level windows with the 'always-on-top' flag set. -const int kShellWindowId_AlwaysOnTopContainer = 8; +const int kShellWindowId_AlwaysOnTopContainer = 7; // The container for panel windows. -const int kShellWindowId_PanelContainer = 9; +const int kShellWindowId_PanelContainer = 8; // The container for the launcher. -const int kShellWindowId_LauncherContainer = 10; +const int kShellWindowId_LauncherContainer = 9; // The container for the app list. -const int kShellWindowId_AppListContainer = 11; +const int kShellWindowId_AppListContainer = 10; // The container for user-specific modal windows. -const int kShellWindowId_SystemModalContainer = 12; +const int kShellWindowId_SystemModalContainer = 11; // The container for input method components such like candidate windows. They // are almost panels but have no activations/focus, and they should appear over // the AppList and SystemModal dialogs. -const int kShellWindowId_InputMethodContainer = 13; +const int kShellWindowId_InputMethodContainer = 12; // The container for the lock screen background. -const int kShellWindowId_LockScreenBackgroundContainer = 14; +const int kShellWindowId_LockScreenBackgroundContainer = 13; // The container for the lock screen. -const int kShellWindowId_LockScreenContainer = 15; +const int kShellWindowId_LockScreenContainer = 14; // The container for the lock screen modal windows. -const int kShellWindowId_LockSystemModalContainer = 16; +const int kShellWindowId_LockSystemModalContainer = 15; // The container for the status area. -const int kShellWindowId_StatusContainer = 17; +const int kShellWindowId_StatusContainer = 16; // The container for menus. -const int kShellWindowId_MenuContainer = 18; +const int kShellWindowId_MenuContainer = 17; // The container for drag/drop images and tooltips. -const int kShellWindowId_DragImageAndTooltipContainer = 19; +const int kShellWindowId_DragImageAndTooltipContainer = 18; // The container for bubbles briefly overlaid onscreen to show settings changes // (volume, brightness, etc.). -const int kShellWindowId_SettingBubbleContainer = 20; +const int kShellWindowId_SettingBubbleContainer = 19; // The container for special components overlaid onscreen, such as the // region selector for partial screenshots. -const int kShellWindowId_OverlayContainer = 21; +const int kShellWindowId_OverlayContainer = 20; // ID of the window created by PhantomWindowController. -const int kShellWindowId_PhantomWindow = 22; +const int kShellWindowId_PhantomWindow = 21; // The topmost container, used for power off animation. -const int kShellWindowId_PowerButtonAnimationContainer = 23; +const int kShellWindowId_PowerButtonAnimationContainer = 22; } // namespace internal diff --git a/ash/wm/power_button_controller_unittest.cc b/ash/wm/power_button_controller_unittest.cc index 222a467..6449a6e 100644 --- a/ash/wm/power_button_controller_unittest.cc +++ b/ash/wm/power_button_controller_unittest.cc @@ -116,8 +116,6 @@ TEST_F(PowerButtonControllerTest, LegacyLockAndShutDown) { animator_api_->ContainersAreAnimated( internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, internal::SessionStateAnimator::ANIMATION_PARTIAL_CLOSE)); - EXPECT_TRUE(animator_api_->BlackLayerIsVisible()); - EXPECT_FALSE(animator_api_->hide_black_layer_timer_is_running()); EXPECT_FALSE(test_api_->lock_timer_is_running()); EXPECT_EQ(1, delegate_->num_lock_requests()); @@ -199,7 +197,6 @@ TEST_F(PowerButtonControllerTest, ShutdownWhenNotLoggedIn) { controller_->set_has_legacy_power_button_for_test(false); state_controller_->OnLoginStateChanged(user::LOGGED_IN_NONE); state_controller_->OnLockStateChanged(false); - EXPECT_FALSE(animator_api_->BlackLayerIsVisible()); // Press the power button and check that we start the shutdown timer. controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); @@ -209,7 +206,6 @@ TEST_F(PowerButtonControllerTest, ShutdownWhenNotLoggedIn) { animator_api_->ContainersAreAnimated( internal::SessionStateAnimator::kAllContainersMask, internal::SessionStateAnimator::ANIMATION_PARTIAL_CLOSE)); - EXPECT_TRUE(animator_api_->BlackLayerIsVisible()); // Release the power button before the shutdown timer fires. controller_->OnPowerButtonEvent(false, base::TimeTicks::Now()); @@ -218,13 +214,6 @@ TEST_F(PowerButtonControllerTest, ShutdownWhenNotLoggedIn) { animator_api_->ContainersAreAnimated( internal::SessionStateAnimator::kAllContainersMask, internal::SessionStateAnimator::ANIMATION_UNDO_PARTIAL_CLOSE)); - EXPECT_TRUE(animator_api_->BlackLayerIsVisible()); - - // We should re-hide the black layer after waiting long enough for - // the animation to finish. - EXPECT_TRUE(animator_api_->hide_black_layer_timer_is_running()); - animator_api_->TriggerHideBlackLayerTimeout(); - EXPECT_FALSE(animator_api_->BlackLayerIsVisible()); // Press the button again and make the shutdown timeout fire this time. // Check that we start the timer for actually requesting the shutdown. @@ -253,7 +242,6 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) { controller_->set_has_legacy_power_button_for_test(false); state_controller_->OnLoginStateChanged(user::LOGGED_IN_USER); state_controller_->OnLockStateChanged(false); - EXPECT_FALSE(animator_api_->BlackLayerIsVisible()); // We should initially be showing the screen locker containers, since they // also contain login-related windows that we want to show during the @@ -272,7 +260,6 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) { animator_api_->ContainersAreAnimated( internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, internal::SessionStateAnimator::ANIMATION_PARTIAL_CLOSE)); - EXPECT_TRUE(animator_api_->BlackLayerIsVisible()); // Release the button before the lock timer fires. controller_->OnPowerButtonEvent(false, base::TimeTicks::Now()); @@ -281,10 +268,6 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) { animator_api_->ContainersAreAnimated( internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, internal::SessionStateAnimator::ANIMATION_UNDO_PARTIAL_CLOSE)); - EXPECT_TRUE(animator_api_->BlackLayerIsVisible()); - EXPECT_TRUE(animator_api_->hide_black_layer_timer_is_running()); - animator_api_->TriggerHideBlackLayerTimeout(); - EXPECT_FALSE(animator_api_->BlackLayerIsVisible()); // Press the button and fire the lock timer. We should request that the // screen be locked, but we should still be in the slow-close animation. @@ -297,7 +280,6 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) { animator_api_->ContainersAreAnimated( internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, internal::SessionStateAnimator::ANIMATION_PARTIAL_CLOSE)); - EXPECT_TRUE(animator_api_->BlackLayerIsVisible()); // Notify that we locked successfully. state_controller_->OnStartingLock(); @@ -328,7 +310,7 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) { EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running()); // Notify that the screen has been unlocked. We should show the - // non-screen-locker windows and hide the black layer. + // non-screen-locker windows. state_controller_->OnLockStateChanged(false); EXPECT_TRUE( animator_api_->ContainersAreAnimated( @@ -336,7 +318,6 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) { internal::SessionStateAnimator::LAUNCHER | internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, internal::SessionStateAnimator::ANIMATION_RESTORE)); - EXPECT_FALSE(animator_api_->BlackLayerIsVisible()); } // Hold the power button down from the unlocked state to eventual shutdown. @@ -351,7 +332,6 @@ TEST_F(PowerButtonControllerTest, LockToShutdown) { test_api_->trigger_lock_timeout(); state_controller_->OnStartingLock(); state_controller_->OnLockStateChanged(true); - EXPECT_TRUE(animator_api_->BlackLayerIsVisible()); // When the lock-to-shutdown timeout fires, we should start the shutdown // timer. @@ -369,7 +349,6 @@ TEST_F(PowerButtonControllerTest, LockToShutdown) { EXPECT_EQ(0, NumShutdownRequests()); test_api_->trigger_real_shutdown_timeout(); EXPECT_EQ(1, NumShutdownRequests()); - EXPECT_TRUE(animator_api_->BlackLayerIsVisible()); } @@ -414,7 +393,6 @@ TEST_F(PowerButtonControllerTest, LockFail) { internal::SessionStateAnimator::LAUNCHER | internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, internal::SessionStateAnimator::ANIMATION_RESTORE)); - EXPECT_TRUE(animator_api_->BlackLayerIsVisible()); test_api_->trigger_lock_timeout(); EXPECT_EQ(1, delegate_->num_lock_requests()); EXPECT_TRUE(test_api_->lock_fail_timer_is_running()); @@ -429,24 +407,6 @@ TEST_F(PowerButtonControllerTest, LockFail) { animator_api_->ContainersAreAnimated( internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, internal::SessionStateAnimator::ANIMATION_RESTORE)); - EXPECT_FALSE(animator_api_->BlackLayerIsVisible()); -} - -// Test that we start the timer to hide the black layer when the power -// button is released, but that we cancel the timer if the button is pressed -// again before the timer has fired. -TEST_F(PowerButtonControllerTest, CancelHideBackground) { - controller_->set_has_legacy_power_button_for_test(false); - state_controller_->OnLoginStateChanged(user::LOGGED_IN_NONE); - state_controller_->OnLockStateChanged(false); - - controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); - controller_->OnPowerButtonEvent(false, base::TimeTicks::Now()); - EXPECT_TRUE(animator_api_->hide_black_layer_timer_is_running()); - - // We should cancel the timer if we get another button-down event. - controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); - EXPECT_FALSE(animator_api_->hide_black_layer_timer_is_running()); } // Test the basic operation of the lock button. @@ -476,7 +436,6 @@ TEST_F(PowerButtonControllerTest, LockButtonBasic) { animator_api_->ContainersAreAnimated( internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, internal::SessionStateAnimator::ANIMATION_PARTIAL_CLOSE)); - EXPECT_TRUE(animator_api_->BlackLayerIsVisible()); // If the button is released immediately, we shouldn't lock the screen. controller_->OnLockButtonEvent(false, base::TimeTicks::Now()); @@ -485,10 +444,6 @@ TEST_F(PowerButtonControllerTest, LockButtonBasic) { animator_api_->ContainersAreAnimated( internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, internal::SessionStateAnimator::ANIMATION_UNDO_PARTIAL_CLOSE)); - EXPECT_TRUE(animator_api_->BlackLayerIsVisible()); - EXPECT_TRUE(animator_api_->hide_black_layer_timer_is_running()); - animator_api_->TriggerHideBlackLayerTimeout(); - EXPECT_FALSE(animator_api_->BlackLayerIsVisible()); EXPECT_EQ(0, delegate_->num_lock_requests()); // Press the button again and let the lock timeout fire. We should request @@ -546,7 +501,7 @@ TEST_F(PowerButtonControllerTest, PowerButtonPreemptsLockButton) { // When the screen is locked without going through the usual power-button // slow-close path (e.g. via the wrench menu), test that we still show the -// fast-close animation and display the black layer. +// fast-close animation. TEST_F(PowerButtonControllerTest, LockWithoutButton) { state_controller_->OnLoginStateChanged(user::LOGGED_IN_USER); state_controller_->OnStartingLock(); @@ -554,7 +509,6 @@ TEST_F(PowerButtonControllerTest, LockWithoutButton) { animator_api_->ContainersAreAnimated( internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, internal::SessionStateAnimator::ANIMATION_FULL_CLOSE)); - EXPECT_TRUE(animator_api_->BlackLayerIsVisible()); } // When we hear that the process is exiting but we haven't had a chance to @@ -566,7 +520,6 @@ TEST_F(PowerButtonControllerTest, ShutdownWithoutButton) { animator_api_->ContainersAreAnimated( internal::SessionStateAnimator::kAllContainersMask, internal::SessionStateAnimator::ANIMATION_HIDE)); - EXPECT_TRUE(animator_api_->BlackLayerIsVisible()); GenerateMouseMoveEvent(); EXPECT_FALSE(cursor_visible()); } @@ -584,7 +537,6 @@ TEST_F(PowerButtonControllerTest, RequestShutdownFromLoginScreen) { animator_api_->ContainersAreAnimated( internal::SessionStateAnimator::kAllLockScreenContainersMask, internal::SessionStateAnimator::ANIMATION_FULL_CLOSE)); - EXPECT_TRUE(animator_api_->BlackLayerIsVisible()); GenerateMouseMoveEvent(); EXPECT_FALSE(cursor_visible()); @@ -606,7 +558,6 @@ TEST_F(PowerButtonControllerTest, RequestShutdownFromLockScreen) { animator_api_->ContainersAreAnimated( internal::SessionStateAnimator::kAllLockScreenContainersMask, internal::SessionStateAnimator::ANIMATION_FULL_CLOSE)); - EXPECT_TRUE(animator_api_->BlackLayerIsVisible()); GenerateMouseMoveEvent(); EXPECT_FALSE(cursor_visible()); @@ -628,7 +579,6 @@ TEST_F(PowerButtonControllerTest, RequestAndCancelShutdownFromLockScreen) { animator_api_->ContainersAreAnimated( internal::SessionStateAnimator::kAllContainersMask, internal::SessionStateAnimator::ANIMATION_PARTIAL_CLOSE)); - EXPECT_TRUE(animator_api_->BlackLayerIsVisible()); // Release the power button before the shutdown timer fires. controller_->OnPowerButtonEvent(false, base::TimeTicks::Now()); @@ -641,19 +591,6 @@ TEST_F(PowerButtonControllerTest, RequestAndCancelShutdownFromLockScreen) { animator_api_->ContainersAreAnimated( internal::SessionStateAnimator::DESKTOP_BACKGROUND, internal::SessionStateAnimator::ANIMATION_RESTORE)); - EXPECT_TRUE(animator_api_->BlackLayerIsVisible()); -} - -// Test that the black layer is resized in response to root window resizes. -TEST_F(PowerButtonControllerTest, ResizeBlackLayer) { - controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); - EXPECT_EQ(Shell::GetPrimaryRootWindow()->bounds().ToString(), - animator_api_->GetBlackLayerBounds().ToString()); - - const gfx::Size kNewSize(400, 300); - Shell::GetPrimaryRootWindow()->SetHostSize(kNewSize); - EXPECT_EQ(gfx::Rect(kNewSize).ToString(), - animator_api_->GetBlackLayerBounds().ToString()); } // Test that we ignore power button presses when the screen is turned off. diff --git a/ash/wm/session_state_animator.cc b/ash/wm/session_state_animator.cc index d695997..fcc78e5 100644 --- a/ash/wm/session_state_animator.cc +++ b/ash/wm/session_state_animator.cc @@ -245,11 +245,6 @@ class CallbackAnimationObserver : public ui::LayerAnimationObserver { } // namespace -void SessionStateAnimator::TestApi::TriggerHideBlackLayerTimeout() { - animator_->DropBlackLayer(); - animator_->hide_black_layer_timer_.Stop(); -} - bool SessionStateAnimator::TestApi::ContainersAreAnimated( int container_mask, AnimationType type) const { aura::Window::Windows containers; @@ -293,16 +288,6 @@ bool SessionStateAnimator::TestApi::ContainersAreAnimated( return true; } -bool SessionStateAnimator::TestApi::BlackLayerIsVisible() const { - return animator_->black_layer_.get() && - animator_->black_layer_->visible(); -} - -gfx::Rect SessionStateAnimator::TestApi::GetBlackLayerBounds() const { - ui::Layer* layer = animator_->black_layer_.get(); - return layer ? layer->bounds() : gfx::Rect(); -} - const int SessionStateAnimator::kAllLockScreenContainersMask = SessionStateAnimator::LOCK_SCREEN_BACKGROUND | SessionStateAnimator::LOCK_SCREEN_CONTAINERS | @@ -315,11 +300,9 @@ const int SessionStateAnimator::kAllContainersMask = SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS; SessionStateAnimator::SessionStateAnimator() { - Shell::GetPrimaryRootWindow()->AddRootWindowObserver(this); } SessionStateAnimator::~SessionStateAnimator() { - Shell::GetPrimaryRootWindow()->RemoveRootWindowObserver(this); } // Fills |containers| with the containers described by |container_mask|. @@ -454,40 +437,6 @@ void SessionStateAnimator::RunAnimationForWindow( } } -void SessionStateAnimator::OnRootWindowResized(const aura::RootWindow* root, - const gfx::Size& new_size) { - if (black_layer_.get()) - black_layer_->SetBounds(gfx::Rect(root->bounds().size())); -} - -void SessionStateAnimator::ShowBlackLayer() { - if (hide_black_layer_timer_.IsRunning()) - hide_black_layer_timer_.Stop(); - - if (!black_layer_.get()) { - black_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); - black_layer_->SetColor(SK_ColorBLACK); - - ui::Layer* root_layer = Shell::GetPrimaryRootWindow()->layer(); - black_layer_->SetBounds(root_layer->bounds()); - root_layer->Add(black_layer_.get()); - root_layer->StackAtBottom(black_layer_.get()); - } - black_layer_->SetVisible(true); -} - -void SessionStateAnimator::DropBlackLayer() { - black_layer_.reset(); -} - -void SessionStateAnimator::ScheduleDropBlackLayer() { - hide_black_layer_timer_.Stop(); - hide_black_layer_timer_.Start( - FROM_HERE, - base::TimeDelta::FromMilliseconds(kUndoSlowCloseAnimMs), - this, &SessionStateAnimator::DropBlackLayer); -} - void SessionStateAnimator::CreateForeground() { if (foreground_.get()) return; diff --git a/ash/wm/session_state_animator.h b/ash/wm/session_state_animator.h index 032a92e..e332301 100644 --- a/ash/wm/session_state_animator.h +++ b/ash/wm/session_state_animator.h @@ -10,7 +10,6 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/timer.h" -#include "ui/aura/root_window_observer.h" #include "ui/aura/window.h" namespace gfx { @@ -27,7 +26,7 @@ namespace internal { // Displays onscreen animations for session state changes (lock/unlock, sign // out, shut down). -class ASH_EXPORT SessionStateAnimator : public aura::RootWindowObserver { +class ASH_EXPORT SessionStateAnimator { public: // Animations that can be applied to groups of containers. enum AnimationType { @@ -75,24 +74,11 @@ class ASH_EXPORT SessionStateAnimator : public aura::RootWindowObserver { explicit TestApi(SessionStateAnimator* animator) : animator_(animator) {} - bool hide_black_layer_timer_is_running() const { - return animator_->hide_black_layer_timer_.IsRunning(); - } - - void TriggerHideBlackLayerTimeout(); - // Returns true if containers of a given |container_mask| // were last animated with |type| (probably; the analysis is fairly ad-hoc). // |container_mask| is a bitfield of a Container. bool ContainersAreAnimated(int container_mask, AnimationType type) const; - // Returns true if |black_layer_| is non-NULL and visible. - bool BlackLayerIsVisible() const; - - // Returns |black_layer_|'s bounds, or an empty rect if the layer is - // NULL. - gfx::Rect GetBlackLayerBounds() const; - private: SessionStateAnimator* animator_; // not owned @@ -109,20 +95,12 @@ class ASH_EXPORT SessionStateAnimator : public aura::RootWindowObserver { SessionStateAnimator(); virtual ~SessionStateAnimator(); - // Shows or hides |black_layer_|. The show method creates and - // initializes the layer if it doesn't already exist. - void ShowBlackLayer(); - void DropBlackLayer(); - // Create |foreground_| layer if it doesn't already exist, but makes it // completely transparent. void CreateForeground(); // Destroy |foreground_| when it is not needed anymore. void DropForeground(); - // Drops back layer after |UNDO_SLOW_CLOSE| animation delay. - void ScheduleDropBlackLayer(); - // Apply animation |type| to all containers included in |container_mask|. void StartAnimation(int container_mask, AnimationType type); @@ -137,33 +115,16 @@ class ASH_EXPORT SessionStateAnimator : public aura::RootWindowObserver { void GetContainers(int container_mask, aura::Window::Windows* containers); - // aura::RootWindowObserver overrides: - virtual void OnRootWindowResized(const aura::RootWindow* root, - const gfx::Size& old_size) OVERRIDE; - - private: // Apply animation |type| to window |window| and add |observer| if it is not // NULL to the last animation sequence. void RunAnimationForWindow(aura::Window* window, AnimationType type, ui::LayerAnimationObserver* observer); - // Layer that's stacked under all of the root window's children to provide a - // black background when we're scaling all of the other windows down. - // TODO(derat): Remove this in favor of having the compositor only clear the - // viewport when there are regions not covered by a layer: - // http://crbug.com/113445 - scoped_ptr<ui::Layer> black_layer_; - // White foreground that is used during shutdown animation to "fade // everything into white". scoped_ptr<ColoredWindowController> foreground_; - // Started when we abort the pre-lock state. When it fires, we hide - // |black_layer_|, as the desktop background is now covering the whole - // screen. - base::OneShotTimer<SessionStateAnimator> hide_black_layer_timer_; - DISALLOW_COPY_AND_ASSIGN(SessionStateAnimator); }; diff --git a/ash/wm/session_state_controller_impl.cc b/ash/wm/session_state_controller_impl.cc index 551429f..c615a6f 100644 --- a/ash/wm/session_state_controller_impl.cc +++ b/ash/wm/session_state_controller_impl.cc @@ -53,7 +53,6 @@ void SessionStateControllerImpl::OnAppTerminating() { Shell* shell = ash::Shell::GetInstance(); shell->env_filter()->set_cursor_hidden_by_filter(false); shell->cursor_manager()->ShowCursor(false); - animator_->ShowBlackLayer(); animator_->StartAnimation( internal::SessionStateAnimator::kAllContainersMask, internal::SessionStateAnimator::ANIMATION_HIDE); @@ -83,7 +82,6 @@ void SessionStateControllerImpl::OnLockStateChanged(bool locked) { internal::SessionStateAnimator::LAUNCHER | internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, internal::SessionStateAnimator::ANIMATION_RESTORE); - animator_->DropBlackLayer(); } } @@ -91,11 +89,6 @@ void SessionStateControllerImpl::OnStartingLock() { if (shutting_down_ || system_is_locked_) return; - // Ensure that the black layer is visible -- if the screen was locked via - // the wrench menu, we won't have already shown the black background - // as part of the slow-close animation. - animator_->ShowBlackLayer(); - animator_->StartAnimation( internal::SessionStateAnimator::LAUNCHER, internal::SessionStateAnimator::ANIMATION_HIDE); @@ -111,7 +104,6 @@ void SessionStateControllerImpl::OnStartingLock() { } void SessionStateControllerImpl::StartLockAnimationAndLockImmediately() { - animator_->ShowBlackLayer(); animator_->StartAnimation( internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, internal::SessionStateAnimator::ANIMATION_PARTIAL_CLOSE); @@ -121,7 +113,6 @@ void SessionStateControllerImpl::StartLockAnimationAndLockImmediately() { void SessionStateControllerImpl::StartLockAnimation(bool shutdown_after_lock) { shutdown_after_lock_ = shutdown_after_lock; - animator_->ShowBlackLayer(); animator_->StartAnimation( internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, internal::SessionStateAnimator::ANIMATION_PARTIAL_CLOSE); @@ -129,7 +120,6 @@ void SessionStateControllerImpl::StartLockAnimation(bool shutdown_after_lock) { } void SessionStateControllerImpl::StartShutdownAnimation() { - animator_->ShowBlackLayer(); animator_->StartAnimation( internal::SessionStateAnimator::kAllContainersMask, internal::SessionStateAnimator::ANIMATION_PARTIAL_CLOSE); @@ -164,7 +154,6 @@ void SessionStateControllerImpl::CancelLockAnimation() { animator_->StartAnimation( internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, internal::SessionStateAnimator::ANIMATION_UNDO_PARTIAL_CLOSE); - animator_->ScheduleDropBlackLayer(); lock_timer_.Stop(); } @@ -195,19 +184,16 @@ void SessionStateControllerImpl::CancelShutdownAnimation() { animator_->StartAnimation( internal::SessionStateAnimator::kAllLockScreenContainersMask, internal::SessionStateAnimator::ANIMATION_UNDO_PARTIAL_CLOSE); - animator_->ScheduleDropBlackLayer(); } else { animator_->StartAnimation( internal::SessionStateAnimator::kAllContainersMask, internal::SessionStateAnimator::ANIMATION_UNDO_PARTIAL_CLOSE); - animator_->ScheduleDropBlackLayer(); } pre_shutdown_timer_.Stop(); } void SessionStateControllerImpl::RequestShutdown() { if (!shutting_down_) - animator_->ShowBlackLayer(); RequestShutdownImpl(); } @@ -219,7 +205,6 @@ void SessionStateControllerImpl::RequestShutdownImpl() { shell->env_filter()->set_cursor_hidden_by_filter(false); shell->cursor_manager()->ShowCursor(false); - animator_->ShowBlackLayer(); if (login_status_ != user::LOGGED_IN_NONE) { // Hide the other containers before starting the animation. // ANIMATION_FULL_CLOSE will make the screen locker windows partially @@ -273,7 +258,6 @@ void SessionStateControllerImpl::OnLockFailTimeout() { internal::SessionStateAnimator::LAUNCHER | internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, internal::SessionStateAnimator::ANIMATION_RESTORE); - animator_->DropBlackLayer(); } void SessionStateControllerImpl::StartLockToShutdownTimer() { diff --git a/ash/wm/system_background_controller.cc b/ash/wm/system_background_controller.cc new file mode 100644 index 0000000..f01642c --- /dev/null +++ b/ash/wm/system_background_controller.cc @@ -0,0 +1,133 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/wm/system_background_controller.h" +#include "third_party/skia/include/core/SkBitmap.h" +#include "third_party/skia/include/core/SkColor.h" +#include "ui/aura/root_window.h" +#include "ui/base/layout.h" +#include "ui/compositor/layer.h" +#include "ui/compositor/layer_type.h" +#include "ui/gfx/canvas.h" +#include "ui/gfx/image/image_skia.h" +#include "ui/gfx/image/image_skia_rep.h" + +namespace ash { +namespace internal { + +namespace { + +#if defined(OS_CHROMEOS) +// Background color used for the Chrome OS boot splash screen. +const SkColor kChromeOsBootColor = SkColorSetARGB(0xff, 0xfe, 0xfe, 0xfe); +#endif + +} // namespace + +// ui::LayerDelegate that copies the aura host window's content to a ui::Layer. +class SystemBackgroundController::HostContentLayerDelegate + : public ui::LayerDelegate { + public: + explicit HostContentLayerDelegate(aura::RootWindow* root_window) + : root_window_(root_window) { + } + + virtual ~HostContentLayerDelegate() {} + + // ui::LayerDelegate overrides: + virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { + // It'd be safer to copy the area to a canvas in the constructor and then + // copy from that canvas to this one here, but this appears to work (i.e. we + // only call this before we draw our first frame) and it saves us an extra + // copy. + root_window_->CopyAreaToSkCanvas( + gfx::Rect(root_window_->GetHostOrigin(), root_window_->GetHostSize()), + gfx::Point(), canvas->sk_canvas()); + } + + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {} + + virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE { + return base::Closure(); + } + + private: + aura::RootWindow* root_window_; // not owned + + DISALLOW_COPY_AND_ASSIGN(HostContentLayerDelegate); +}; + +SystemBackgroundController::SystemBackgroundController( + aura::RootWindow* root_window, + Content initial_content) + : root_window_(root_window), + content_(CONTENT_INVALID) { + root_window_->AddRootWindowObserver(this); + SetContent(initial_content); +} + +SystemBackgroundController::~SystemBackgroundController() { + root_window_->RemoveRootWindowObserver(this); +} + +void SystemBackgroundController::SetContent(Content new_content) { + if (new_content == content_) + return; + + content_ = new_content; + switch (new_content) { + case CONTENT_COPY_FROM_HOST: + CreateTexturedLayerWithHostContent(); + break; + case CONTENT_BLACK: + CreateColoredLayer(SK_ColorBLACK); + break; +#if defined(OS_CHROMEOS) + case CONTENT_CHROME_OS_BOOT_COLOR: + CreateColoredLayer(kChromeOsBootColor); + break; +#endif + case CONTENT_INVALID: + DCHECK(false) << "Invalid background layer content"; + } +} + +void SystemBackgroundController::OnRootWindowResized( + const aura::RootWindow* root, + const gfx::Size& old_size) { + DCHECK_EQ(root_window_, root); + if (layer_.get()) + UpdateLayerBounds(layer_.get()); +} + +void SystemBackgroundController::CreateTexturedLayerWithHostContent() { + layer_.reset(); + layer_delegate_.reset(new HostContentLayerDelegate(root_window_)); + layer_.reset(new ui::Layer(ui::LAYER_TEXTURED)); + layer_->set_delegate(layer_delegate_.get()); + UpdateLayerBounds(layer_.get()); + AddLayerToRootLayer(layer_.get()); +} + +void SystemBackgroundController::CreateColoredLayer(SkColor color) { + layer_.reset(); + layer_delegate_.reset(); + layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); + layer_->SetColor(color); + UpdateLayerBounds(layer_.get()); + AddLayerToRootLayer(layer_.get()); +} + +void SystemBackgroundController::UpdateLayerBounds(ui::Layer* layer) { + layer->SetBounds(gfx::Rect(root_window_->layer()->bounds().size())); +} + +void SystemBackgroundController::AddLayerToRootLayer(ui::Layer* layer) { + ui::Layer* root_layer = root_window_->layer(); + root_layer->Add(layer); + root_layer->StackAtBottom(layer); +} + +} // namespace internal +} // namespace ash diff --git a/ash/wm/system_background_controller.h b/ash/wm/system_background_controller.h new file mode 100644 index 0000000..8534b56 --- /dev/null +++ b/ash/wm/system_background_controller.h @@ -0,0 +1,97 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_WM_SYSTEM_BACKGROUND_CONTROLLER_H_ +#define ASH_WM_SYSTEM_BACKGROUND_CONTROLLER_H_ + +#include <string> + +#include "ash/ash_export.h" +#include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" +#include "third_party/skia/include/core/SkColor.h" +#include "ui/aura/root_window_observer.h" + +namespace aura { +class RootWindow; +} + +namespace ui { +class Layer; +} + +namespace ash { +namespace internal { + +// SystemBackgroundController manages a ui::Layer that's stacked at the bottom +// of an aura::RootWindow's children. It exists solely to obscure portions of +// the root layer that aren't covered by any other layers (e.g. before the +// desktop background image is loaded at startup, or when we scale down all of +// the other layers as part of a power-button or window-management animation). +// It should never be transformed or restacked. +class ASH_EXPORT SystemBackgroundController : public aura::RootWindowObserver { + public: + enum Content { + CONTENT_INVALID, + + // Copy the contents of the host window. Useful when starting on X, where + // the host window can inherit content from the X root window -- with this, + // the compositor can continue drawing whatever was previously onscreen even + // while we're e.g. waiting for images to be loaded from disk. + CONTENT_COPY_FROM_HOST, + + // Display a black screen. + CONTENT_BLACK, + +#if defined(OS_CHROMEOS) + // Display a solid-color screen matching the background color used for the + // Chrome OS boot splash screen. + CONTENT_CHROME_OS_BOOT_COLOR, +#endif + }; + + SystemBackgroundController(aura::RootWindow* root_window, + Content initial_content); + virtual ~SystemBackgroundController(); + + void SetContent(Content new_content); + + // aura::RootWindowObserver overrides: + virtual void OnRootWindowResized(const aura::RootWindow* root, + const gfx::Size& old_size) OVERRIDE; + + private: + class HostContentLayerDelegate; + + // Initializes |layer_| as a textured layer containing a copy of the host + // window's content. + void CreateTexturedLayerWithHostContent(); + + // Initializes |layer_| as a solid-color layer containing |color|. + void CreateColoredLayer(SkColor color); + + // Updates |layer|'s bounds to match those of |root_window_|'s layer. + void UpdateLayerBounds(ui::Layer* layer); + + // Adds |layer| to |root_window_|'s layer and stacks it at the bottom of all + // its children. + void AddLayerToRootLayer(ui::Layer* layer); + + aura::RootWindow* root_window_; // not owned + + // Type of content currently displayed in |layer_|. + Content content_; + + // Paints |layer_| when |content_| is CONTENT_COPY_FROM_HOST. + scoped_ptr<HostContentLayerDelegate> layer_delegate_; + + scoped_ptr<ui::Layer> layer_; + + DISALLOW_COPY_AND_ASSIGN(SystemBackgroundController); +}; + +} // namespace internal +} // namespace ash + +#endif // ASH_WM_SYSTEM_BACKGROUND_CONTROLLER_H_ diff --git a/ash/wm/workspace/colored_window_controller.h b/ash/wm/workspace/colored_window_controller.h index 082b2c7..d70a83b 100644 --- a/ash/wm/workspace/colored_window_controller.h +++ b/ash/wm/workspace/colored_window_controller.h @@ -25,8 +25,7 @@ namespace internal { // ColoredWindowController creates a Widget whose layer is LAYER_SOLID_COLOR. // The Widget is sized to the supplied Window and parented to the specified -// Window. It is used for animations and the system level background. See -// kShellWindowId_SystemBackgroundContainer for one use case. +// Window. It is used for animations. class ASH_EXPORT ColoredWindowController { public: ColoredWindowController(aura::Window* parent, const std::string& window_name); |