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 fe111c05e098aabce876793c002f18a606ee2336..ba0c86b2adf31eeb0ca0e5ee8aec21b697654a12 100644 |
--- a/ash/desktop_background/desktop_background_controller.cc |
+++ b/ash/desktop_background/desktop_background_controller.cc |
@@ -43,6 +43,8 @@ const int kWallpaperReloadDelayMs = 2000; |
} // namespace |
+const int DesktopBackgroundController::kInvalidResourceID = -1; |
+ |
DesktopBackgroundController::DesktopBackgroundController() |
: locked_(false), |
desktop_background_mode_(BACKGROUND_NONE), |
@@ -98,7 +100,8 @@ bool DesktopBackgroundController::SetWallpaperImage(const gfx::ImageSkia& image, |
VLOG(1) << "SetWallpaper: image_id=" << WallpaperResizer::GetImageId(image) |
<< " layout=" << layout; |
- if (WallpaperIsAlreadyLoaded(&image, kInvalidResourceID, layout)) { |
+ if (WallpaperIsAlreadyLoaded( |
+ &image, kInvalidResourceID, true /* compare_layouts */, layout)) { |
VLOG(1) << "Wallpaper is already loaded"; |
return false; |
} |
@@ -119,7 +122,8 @@ bool DesktopBackgroundController::SetWallpaperResource(int resource_id, |
VLOG(1) << "SetWallpaper: resource_id=" << resource_id |
<< " layout=" << layout; |
- if (WallpaperIsAlreadyLoaded(NULL, resource_id, layout)) { |
+ if (WallpaperIsAlreadyLoaded( |
+ NULL, resource_id, true /* compare_layouts */, layout)) { |
VLOG(1) << "Wallpaper is already loaded"; |
return false; |
} |
@@ -194,11 +198,13 @@ gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() { |
bool DesktopBackgroundController::WallpaperIsAlreadyLoaded( |
const gfx::ImageSkia* image, |
int resource_id, |
+ bool compare_layouts, |
WallpaperLayout layout) const { |
if (!current_wallpaper_.get()) |
return false; |
- if (layout != current_wallpaper_->layout()) |
+ // Compare layouts only if necessary. |
+ if (compare_layouts && layout != current_wallpaper_->layout()) |
return false; |
if (image) { |