Index: ash/desktop_background/desktop_background_controller.cc |
diff --git a/ash/desktop_background/desktop_background_controller.cc b/ash/desktop_background/desktop_background_controller.cc |
index bada38371e7d24c52bdf292121dc56793af23acb..8b54cb5b295ca7155edd9c679965b07114d6a07a 100644 |
--- a/ash/desktop_background/desktop_background_controller.cc |
+++ b/ash/desktop_background/desktop_background_controller.cc |
@@ -48,10 +48,12 @@ DesktopBackgroundController::DesktopBackgroundController() |
desktop_background_mode_(BACKGROUND_NONE), |
wallpaper_reload_delay_(kWallpaperReloadDelayMs) { |
Shell::GetInstance()->display_controller()->AddObserver(this); |
+ Shell::GetInstance()->AddShellObserver(this); |
} |
DesktopBackgroundController::~DesktopBackgroundController() { |
Shell::GetInstance()->display_controller()->RemoveObserver(this); |
+ Shell::GetInstance()->RemoveShellObserver(this); |
} |
gfx::ImageSkia DesktopBackgroundController::GetWallpaper() const { |
@@ -76,23 +78,6 @@ WallpaperLayout DesktopBackgroundController::GetWallpaperLayout() const { |
return WALLPAPER_LAYOUT_CENTER_CROPPED; |
} |
-void DesktopBackgroundController::OnRootWindowAdded(aura::Window* root_window) { |
- // The background hasn't been set yet. |
- if (desktop_background_mode_ == BACKGROUND_NONE) |
- return; |
- |
- // Handle resolution change for "built-in" images. |
- gfx::Size max_display_size = GetMaxDisplaySizeInNative(); |
- if (current_max_display_size_ != max_display_size) { |
- current_max_display_size_ = max_display_size; |
- if (desktop_background_mode_ == BACKGROUND_IMAGE && |
- current_wallpaper_.get()) |
- UpdateWallpaper(); |
- } |
- |
- InstallDesktopController(root_window); |
-} |
- |
bool DesktopBackgroundController::SetWallpaperImage(const gfx::ImageSkia& image, |
WallpaperLayout layout) { |
VLOG(1) << "SetWallpaper: image_id=" << WallpaperResizer::GetImageId(image) |
@@ -169,6 +154,23 @@ void DesktopBackgroundController::OnDisplayConfigurationChanged() { |
} |
} |
+void DesktopBackgroundController::OnRootWindowAdded(aura::Window* root_window) { |
+ // The background hasn't been set yet. |
+ if (desktop_background_mode_ == BACKGROUND_NONE) |
+ return; |
+ |
+ // Handle resolution change for "built-in" images. |
+ gfx::Size max_display_size = GetMaxDisplaySizeInNative(); |
+ if (current_max_display_size_ != max_display_size) { |
+ current_max_display_size_ = max_display_size; |
+ if (desktop_background_mode_ == BACKGROUND_IMAGE && |
+ current_wallpaper_.get()) |
+ UpdateWallpaper(); |
+ } |
+ |
+ InstallDesktopController(root_window); |
+} |
+ |
// static |
gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() { |
int width = 0; |