diff options
author | bshe@chromium.org <bshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-04 17:12:15 +0000 |
---|---|---|
committer | bshe@chromium.org <bshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-04 17:12:15 +0000 |
commit | 2384eae998e1fe9d2a95ffd0005e5df2de2bd3b9 (patch) | |
tree | b0608d1ecdb8217ba251b8e1757578205936bb75 /ash | |
parent | 0e8949526deeb30f20bf3fdaee1e010281f7504b (diff) | |
download | chromium_src-2384eae998e1fe9d2a95ffd0005e5df2de2bd3b9.zip chromium_src-2384eae998e1fe9d2a95ffd0005e5df2de2bd3b9.tar.gz chromium_src-2384eae998e1fe9d2a95ffd0005e5df2de2bd3b9.tar.bz2 |
Load user custom wallpaper after browser crash.
BUG=129810
TEST=
1. Login
2. Set custom wallpaper for desktop background
3. Trigger a chrome crash (about://inducebrowsercrashforrealz)
4. Observe the desktop wallpaper
5. Go to "Set wallpaper" settings dialog and look for the custom added wallpaper thumbnail
Verify that custom wallpaper restored after chrome crash.
Review URL: https://chromiumcodereview.appspot.com/10459003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140312 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/accelerators/accelerator_controller.cc | 8 | ||||
-rw-r--r-- | ash/desktop_background/desktop_background_controller.cc | 20 | ||||
-rw-r--r-- | ash/desktop_background/desktop_background_controller.h | 9 | ||||
-rw-r--r-- | ash/shell.cc | 5 |
4 files changed, 17 insertions, 25 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index 72a43ec..c4f21ba 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -155,10 +155,12 @@ bool HandleToggleDesktopBackgroundMode() { ash::DesktopBackgroundController* desktop_background_controller = ash::Shell::GetInstance()->desktop_background_controller(); if (desktop_background_controller->desktop_background_mode() == - ash::DesktopBackgroundController::BACKGROUND_IMAGE) + ash::DesktopBackgroundController::BACKGROUND_IMAGE) { desktop_background_controller->SetDesktopBackgroundSolidColorMode(); - else - desktop_background_controller->SetLoggedInUserWallpaper(); + } else { + ash::Shell::GetInstance()->user_wallpaper_delegate()-> + SetLoggedInUserWallpaper(); + } return true; } diff --git a/ash/desktop_background/desktop_background_controller.cc b/ash/desktop_background/desktop_background_controller.cc index 5994bf2..31be9c8 100644 --- a/ash/desktop_background/desktop_background_controller.cc +++ b/ash/desktop_background/desktop_background_controller.cc @@ -102,6 +102,13 @@ void DesktopBackgroundController::SetDefaultWallpaper(int index) { if (previous_index_ == index) return; + // We should not change background when index is invalid. For instance, at + // login screen or stub_user login. + if (index == ash::GetInvalidWallpaperIndex()) { + CreateEmptyWallpaper(); + return; + } + CancelPendingWallpaperOperation(); wallpaper_op_ = new WallpaperOperation(index); @@ -131,19 +138,6 @@ void DesktopBackgroundController::CancelPendingWallpaperOperation() { weak_ptr_factory_.InvalidateWeakPtrs(); } -void DesktopBackgroundController::SetLoggedInUserWallpaper() { - int index = Shell::GetInstance()->user_wallpaper_delegate()-> - GetUserWallpaperIndex(); - // We should not change background when index is invalid. For instance, at - // login screen or stub_user login. - if (index == ash::GetInvalidWallpaperIndex()) { - CreateEmptyWallpaper(); - return; - } - - SetDefaultWallpaper(index); -} - void DesktopBackgroundController::SetDesktopBackgroundSolidColorMode() { // Set a solid black background. // TODO(derat): Remove this in favor of having the compositor only clear the diff --git a/ash/desktop_background/desktop_background_controller.h b/ash/desktop_background/desktop_background_controller.h index b0ae8cf..7e8620b 100644 --- a/ash/desktop_background/desktop_background_controller.h +++ b/ash/desktop_background/desktop_background_controller.h @@ -25,8 +25,9 @@ class UserWallpaperDelegate { public: virtual ~UserWallpaperDelegate() {} - // Gets the index of user selected wallpaper. - virtual const int GetUserWallpaperIndex() = 0; + // Loads logged in user wallpaper asynchronously and sets to current wallpaper + // after loaded. + virtual void SetLoggedInUserWallpaper() = 0; // Opens the set wallpaper page in the browser. virtual void OpenSetWallpaperPage() = 0; @@ -65,10 +66,6 @@ class ASH_EXPORT DesktopBackgroundController { // Cancels the current wallpaper loading operation. void CancelPendingWallpaperOperation(); - // Loads logged in user wallpaper asynchronously and sets to current wallpaper - // after loaded. - void SetLoggedInUserWallpaper(); - // Sets the desktop background to solid color mode and creates a solid color // layout. void SetDesktopBackgroundSolidColorMode(); diff --git a/ash/shell.cc b/ash/shell.cc index 9d667d8..db7d6e6 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -244,8 +244,7 @@ class DummyUserWallpaperDelegate : public UserWallpaperDelegate { virtual ~DummyUserWallpaperDelegate() {} - virtual const int GetUserWallpaperIndex() OVERRIDE { - return -1; + virtual void SetLoggedInUserWallpaper() OVERRIDE { } virtual void OpenSetWallpaperPage() OVERRIDE { @@ -806,7 +805,7 @@ void Shell::Init() { // It needs to be created after OnWindowResized has been called, otherwise the // widget will not paint when restoring after a browser crash. - desktop_background_controller_->SetLoggedInUserWallpaper(); + user_wallpaper_delegate_->SetLoggedInUserWallpaper(); window_modality_controller_.reset(new internal::WindowModalityController); AddRootWindowEventFilter(window_modality_controller_.get()); |