Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Unified Diff: ash/desktop_background/desktop_background_controller.cc

Issue 236013002: Apply default wallpaper from customization manifest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove wallpaper URL from ServicesCustomizationDocumentTest. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 8b54cb5b295ca7155edd9c679965b07114d6a07a..e75699779745cd6a4e3121c23f816b9ed21d51f5 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),
@@ -83,7 +85,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;
}
@@ -104,7 +107,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;
}
@@ -196,11 +200,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) {

Powered by Google App Engine
This is Rietveld 408576698