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..92f4b705fdda8df0e937f1a98a2bf35339ff49b0 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,18 @@ void DesktopBackgroundController::OnDisplayConfigurationChanged() { |
} |
} |
+// Do not forget to update DefaultWallpaperIsAlreadyLoadingOrLoaded on change! |
+bool DesktopBackgroundController::DefaultWallpaperFileIsAlreadyLoadingOrLoaded( |
Daniel Erat
2014/03/25 18:32:54
i'm sorry, but i still don't understand why you ne
Alexander Alekseev
2014/03/25 19:09:33
It will work with existing method, but I will have
|
+ const base::FilePath& image_file) const { |
+ return (default_wallpaper_loader_.get() && |
+ !default_wallpaper_loader_->IsCanceled() && |
+ default_wallpaper_loader_->file_path() == image_file) || |
+ (current_wallpaper_.get() && |
+ current_default_wallpaper_path_ == image_file); |
+} |
+ |
+// Do not forget to update DefaultWallpaperFileIsAlreadyLoadingOrLoaded |
+// on change! |
bool DesktopBackgroundController::DefaultWallpaperIsAlreadyLoadingOrLoaded( |
const base::FilePath& image_file, |
int image_resource_id) const { |