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

Side by Side 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: After-review. 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/desktop_background/desktop_background_controller.h" 5 #include "ash/desktop_background/desktop_background_controller.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/desktop_background/desktop_background_controller_observer.h" 8 #include "ash/desktop_background/desktop_background_controller_observer.h"
9 #include "ash/desktop_background/desktop_background_view.h" 9 #include "ash/desktop_background/desktop_background_view.h"
10 #include "ash/desktop_background/desktop_background_widget_controller.h" 10 #include "ash/desktop_background/desktop_background_widget_controller.h"
(...skipping 25 matching lines...) Expand all
36 36
37 namespace ash { 37 namespace ash {
38 namespace { 38 namespace {
39 39
40 // How long to wait reloading the wallpaper after the max display has 40 // How long to wait reloading the wallpaper after the max display has
41 // changed? 41 // changed?
42 const int kWallpaperReloadDelayMs = 2000; 42 const int kWallpaperReloadDelayMs = 2000;
43 43
44 } // namespace 44 } // namespace
45 45
46 const int kInvalidResourceID = -1;
47
46 DesktopBackgroundController::DesktopBackgroundController() 48 DesktopBackgroundController::DesktopBackgroundController()
47 : locked_(false), 49 : locked_(false),
48 desktop_background_mode_(BACKGROUND_NONE), 50 desktop_background_mode_(BACKGROUND_NONE),
49 wallpaper_reload_delay_(kWallpaperReloadDelayMs) { 51 wallpaper_reload_delay_(kWallpaperReloadDelayMs) {
50 Shell::GetInstance()->display_controller()->AddObserver(this); 52 Shell::GetInstance()->display_controller()->AddObserver(this);
51 } 53 }
52 54
53 DesktopBackgroundController::~DesktopBackgroundController() { 55 DesktopBackgroundController::~DesktopBackgroundController() {
54 Shell::GetInstance()->display_controller()->RemoveObserver(this); 56 Shell::GetInstance()->display_controller()->RemoveObserver(this);
55 } 57 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 return gfx::Size(width, height); 193 return gfx::Size(width, height);
192 } 194 }
193 195
194 bool DesktopBackgroundController::WallpaperIsAlreadyLoaded( 196 bool DesktopBackgroundController::WallpaperIsAlreadyLoaded(
195 const gfx::ImageSkia* image, 197 const gfx::ImageSkia* image,
196 int resource_id, 198 int resource_id,
197 WallpaperLayout layout) const { 199 WallpaperLayout layout) const {
198 if (!current_wallpaper_.get()) 200 if (!current_wallpaper_.get())
199 return false; 201 return false;
200 202
201 if (layout != current_wallpaper_->layout()) 203 // Do not compare layouts if WALLPAPER_LAYOUT_UNKNOWN passed.
204 if (WALLPAPER_LAYOUT_UNKNOWN != layout &&
Daniel Erat 2014/04/14 15:26:15 please put the variable first and the constant sec
Alexander Alekseev 2014/04/15 01:57:16 Done.
205 layout != current_wallpaper_->layout())
202 return false; 206 return false;
203 207
204 if (image) { 208 if (image) {
205 return WallpaperResizer::GetImageId(*image) == 209 return WallpaperResizer::GetImageId(*image) ==
206 current_wallpaper_->original_image_id(); 210 current_wallpaper_->original_image_id();
207 } 211 }
208 212
209 return current_wallpaper_->resource_id() == resource_id; 213 return current_wallpaper_->resource_id() == resource_id;
210 } 214 }
211 215
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 : kShellWindowId_DesktopBackgroundContainer; 292 : kShellWindowId_DesktopBackgroundContainer;
289 } 293 }
290 294
291 void DesktopBackgroundController::UpdateWallpaper() { 295 void DesktopBackgroundController::UpdateWallpaper() {
292 current_wallpaper_.reset(NULL); 296 current_wallpaper_.reset(NULL);
293 ash::Shell::GetInstance()->user_wallpaper_delegate()-> 297 ash::Shell::GetInstance()->user_wallpaper_delegate()->
294 UpdateWallpaper(true /* clear cache */); 298 UpdateWallpaper(true /* clear cache */);
295 } 299 }
296 300
297 } // namespace ash 301 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698