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

Unified Diff: ash/desktop_background/desktop_background_controller.cc

Issue 208273005: If customization includes default wallpaper, download and apply it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add DBC::IsUsingDefaultWallpaper(); Restart wallpaper fetch on device restart. Created 6 years, 9 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 7673f29aa6a48d9439e9397c4663105e09f001b3..85f67aa0faa2038d64dc63aaa952971bff7b1c4b 100644
--- a/ash/desktop_background/desktop_background_controller.cc
+++ b/ash/desktop_background/desktop_background_controller.cc
@@ -155,8 +155,7 @@ class DesktopBackgroundController::WallpaperLoader
};
DesktopBackgroundController::DesktopBackgroundController()
- : command_line_for_testing_(NULL),
- locked_(false),
+ : locked_(false),
desktop_background_mode_(BACKGROUND_NONE),
current_default_wallpaper_resource_id_(-1),
weak_ptr_factory_(this),
@@ -208,30 +207,23 @@ void DesktopBackgroundController::OnRootWindowAdded(aura::Window* root_window) {
InstallDesktopController(root_window);
}
-bool DesktopBackgroundController::SetDefaultWallpaper(bool is_guest) {
- VLOG(1) << "SetDefaultWallpaper: is_guest=" << is_guest;
+bool DesktopBackgroundController::SetDefaultWallpaper(
+ const base::FilePath& small_resolution_path,
+ const base::FilePath& large_resolution_path) {
+ VLOG(1) << "SetDefaultWallpaper: small_resolution_path='"
+ << small_resolution_path.value() << "' large_resolution_path='"
+ << large_resolution_path.value() << "'";
const bool use_large =
GetAppropriateResolution() == WALLPAPER_RESOLUTION_LARGE;
- base::FilePath file_path;
- WallpaperLayout file_layout = use_large ? WALLPAPER_LAYOUT_CENTER_CROPPED :
- WALLPAPER_LAYOUT_CENTER;
- int resource_id = use_large ? IDR_AURA_WALLPAPER_DEFAULT_LARGE :
- IDR_AURA_WALLPAPER_DEFAULT_SMALL;
+ const base::FilePath& file_path =
+ use_large ? large_resolution_path : small_resolution_path;
+ WallpaperLayout file_layout =
+ use_large ? WALLPAPER_LAYOUT_CENTER_CROPPED : WALLPAPER_LAYOUT_CENTER;
+ int resource_id = use_large ? IDR_AURA_WALLPAPER_DEFAULT_LARGE
+ : IDR_AURA_WALLPAPER_DEFAULT_SMALL;
WallpaperLayout resource_layout = WALLPAPER_LAYOUT_TILE;
- CommandLine* command_line = command_line_for_testing_ ?
- command_line_for_testing_ : CommandLine::ForCurrentProcess();
- const char* switch_name = NULL;
- if (is_guest) {
- switch_name = use_large ? switches::kAshGuestWallpaperLarge :
- switches::kAshGuestWallpaperSmall;
- } else {
- switch_name = use_large ? switches::kAshDefaultWallpaperLarge :
- switches::kAshDefaultWallpaperSmall;
- }
- file_path = command_line->GetSwitchValuePath(switch_name);
-
if (DefaultWallpaperIsAlreadyLoadingOrLoaded(file_path, resource_id)) {
VLOG(1) << "Default wallpaper is already loading or loaded";
return false;
@@ -328,6 +320,10 @@ void DesktopBackgroundController::OnDisplayConfigurationChanged() {
}
}
+bool DesktopBackgroundController::IsUsingDefaultWallpaper() const {
+ return !current_default_wallpaper_path_.empty() || default_wallpaper_loader_;
+}
+
bool DesktopBackgroundController::DefaultWallpaperIsAlreadyLoadingOrLoaded(
const base::FilePath& image_file,
int image_resource_id) const {

Powered by Google App Engine
This is Rietveld 408576698