Chromium Code Reviews| 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..5ea8d469192280be9ee2c2adb9e09057c5fa2d48 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,7 @@ 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, layout)) { |
|
Nikita (slow)
2014/04/15 12:39:24
nit: /* compare layouts */
Alexander Alekseev
2014/04/15 22:47:31
Done.
|
| VLOG(1) << "Wallpaper is already loaded"; |
| return false; |
| } |
| @@ -119,7 +121,7 @@ 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, layout)) { |
|
Nikita (slow)
2014/04/15 12:39:24
nit: /* compare layouts */
Alexander Alekseev
2014/04/15 22:47:31
Done.
|
| VLOG(1) << "Wallpaper is already loaded"; |
| return false; |
| } |
| @@ -194,11 +196,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) { |