Index: chrome/browser/chromeos/login/wallpaper_manager.cc |
diff --git a/chrome/browser/chromeos/login/wallpaper_manager.cc b/chrome/browser/chromeos/login/wallpaper_manager.cc |
index a036ca9064fdbf43a1a63d07eba4e94046c9fc0f..2e73b6d9e4d77b7f960063c0c12c738c01df6bb8 100644 |
--- a/chrome/browser/chromeos/login/wallpaper_manager.cc |
+++ b/chrome/browser/chromeos/login/wallpaper_manager.cc |
@@ -7,6 +7,8 @@ |
#include <numeric> |
#include <vector> |
+#include "ash/ash_switches.h" |
+#include "ash/desktop_background/desktop_background_controller.h" |
#include "ash/shell.h" |
#include "base/command_line.h" |
#include "base/debug/trace_event.h" |
@@ -46,6 +48,8 @@ |
using content::BrowserThread; |
+namespace chromeos { |
+ |
namespace { |
// The amount of delay before starts to move custom wallpapers to the new place. |
@@ -112,9 +116,19 @@ bool MoveCustomWallpaperDirectory(const char* sub_dir, |
return false; |
} |
-} // namespace |
+void CheckCustomizedWallpaperFilesExist( |
+ const base::FilePath& downloaded_file, |
+ const WallpaperManager::CustomizedWallpaperRescaledFiles* rescaled_files, |
+ WallpaperManager::CustomizedWallpaperFilesExist* exist) { |
+ DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
+ DCHECK(rescaled_files); |
+ DCHECK(exist); |
+ exist->downloaded = base::PathExists(downloaded_file); |
+ exist->rescaled_small = base::PathExists(rescaled_files->path_rescaled_small); |
+ exist->rescaled_large = base::PathExists(rescaled_files->path_rescaled_large); |
+} |
-namespace chromeos { |
+} // namespace |
const char kWallpaperSequenceTokenName[] = "wallpaper-sequence"; |
@@ -208,9 +222,8 @@ void WallpaperManager::PendingWallpaper::ProcessRequest() { |
if (default_) { |
manager->DoSetDefaultWallpaper(user_id_, on_finish_.Pass()); |
} else if (!user_wallpaper_.isNull()) { |
- ash::Shell::GetInstance()-> |
- desktop_background_controller()-> |
- SetCustomWallpaper(user_wallpaper_, info_.layout); |
+ ash::Shell::GetInstance()->desktop_background_controller()->SetWallpaper( |
+ user_wallpaper_, info_.layout); |
} else if (!wallpaper_path_.empty()) { |
manager->task_runner_->PostTask( |
FROM_HERE, |
@@ -266,6 +279,21 @@ void WallpaperManager::PendingWallpaper::OnWallpaperSet() { |
// WallpaperManager, public: --------------------------------------------------- |
+WallpaperManager::CustomizedWallpaperRescaledFiles:: |
+ CustomizedWallpaperRescaledFiles(const base::FilePath& path_rescaled_small, |
+ const base::FilePath& path_rescaled_large) |
+ : path_rescaled_small(path_rescaled_small), |
+ path_rescaled_large(path_rescaled_large) { |
+} |
+ |
+WallpaperManager::CustomizedWallpaperFilesExist::CustomizedWallpaperFilesExist() |
+ : downloaded(false), rescaled_small(false), rescaled_large(false) { |
+} |
+ |
+bool WallpaperManager::CustomizedWallpaperFilesExist::AllRescaledExist() const { |
+ return rescaled_small && rescaled_large; |
+} |
+ |
// TestApi. For testing purpose |
WallpaperManager::TestApi::TestApi(WallpaperManager* wallpaper_manager) |
: wallpaper_manager_(wallpaper_manager) { |
@@ -306,6 +334,8 @@ WallpaperManager::WallpaperManager() |
should_cache_wallpaper_(false), |
weak_factory_(this), |
pending_inactive_(NULL) { |
+ SetDefaultWallpaperPathFromCommandLine( |
+ base::CommandLine::ForCurrentProcess()); |
registrar_.Add(this, |
chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
content::NotificationService::AllSources()); |
@@ -432,6 +462,15 @@ void WallpaperManager::InitializeWallpaper() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
UserManager* user_manager = UserManager::Get(); |
+ // Apply device customization. |
+ if (ShouldUseCustomizedDefaultWallpaper()) { |
+ SetDefaultWallpaperPath( |
+ GetCustomizedWallpaperDefaultRescaledFileName(kSmallWallpaperSuffix), |
+ scoped_ptr<gfx::ImageSkia>().Pass(), |
+ GetCustomizedWallpaperDefaultRescaledFileName(kLargeWallpaperSuffix), |
+ scoped_ptr<gfx::ImageSkia>().Pass()); |
+ } |
+ |
CommandLine* command_line = GetComandLine(); |
if (command_line->HasSwitch(chromeos::switches::kGuestSession)) { |
// Guest wallpaper should be initialized when guest login. |
@@ -520,7 +559,8 @@ bool WallpaperManager::ResizeWallpaper( |
ash::WallpaperLayout layout, |
int preferred_width, |
int preferred_height, |
- scoped_refptr<base::RefCountedBytes>* output) const { |
+ scoped_refptr<base::RefCountedBytes>* output, |
+ gfx::ImageSkia* output_skia) const { |
DCHECK(BrowserThread::GetBlockingPool()-> |
IsRunningSequenceOnCurrentThread(sequence_token_)); |
int width = wallpaper.image().width(); |
@@ -567,27 +607,38 @@ bool WallpaperManager::ResizeWallpaper( |
image.height(), |
image.width() * image.bytesPerPixel(), |
kDefaultEncodingQuality, &(*output)->data()); |
+ |
+ if (output_skia) { |
+ resized_image.MakeThreadSafe(); |
+ *output_skia = resized_image; |
+ } |
+ |
return true; |
} |
-void WallpaperManager::ResizeAndSaveWallpaper(const UserImage& wallpaper, |
+bool WallpaperManager::ResizeAndSaveWallpaper(const UserImage& wallpaper, |
const base::FilePath& path, |
ash::WallpaperLayout layout, |
int preferred_width, |
- int preferred_height) const { |
+ int preferred_height, |
+ gfx::ImageSkia* result) const { |
if (layout == ash::WALLPAPER_LAYOUT_CENTER) { |
// TODO(bshe): Generates cropped custom wallpaper for CENTER layout. |
if (base::PathExists(path)) |
base::DeleteFile(path, false); |
- return; |
+ return false; |
} |
scoped_refptr<base::RefCountedBytes> data; |
- if (ResizeWallpaper(wallpaper, layout, preferred_width, preferred_height, |
- &data)) { |
- SaveWallpaperInternal(path, |
- reinterpret_cast<const char*>(data->front()), |
- data->size()); |
+ if (ResizeWallpaper(wallpaper, |
+ layout, |
+ preferred_width, |
+ preferred_height, |
+ &data, |
+ result)) { |
+ return SaveWallpaperInternal( |
+ path, reinterpret_cast<const char*>(data->front()), data->size()); |
} |
+ return false; |
} |
bool WallpaperManager::IsPolicyControlled(const std::string& user_id) const { |
@@ -729,6 +780,31 @@ void WallpaperManager::SetDefaultWallpaperDelayed(const std::string& user_id) { |
GetPendingWallpaper(user_id, true)->ResetSetDefaultWallpaper(); |
} |
+void WallpaperManager::OnDefaultWallpaperDecoded( |
+ const base::FilePath& path, |
+ scoped_ptr<gfx::ImageSkia>* result, |
+ MovableOnDestroyCallbackHolder on_finish, |
+ const UserImage& wallpaper) { |
+ result->reset(new gfx::ImageSkia); |
+ (**result) = wallpaper.image(); |
+ ash::Shell::GetInstance()->desktop_background_controller()->SetWallpaper( |
+ wallpaper.image(), ash::WALLPAPER_LAYOUT_STRETCH); |
+} |
+ |
+void WallpaperManager::StartLoadAndSetDefaultWallpaper( |
+ const base::FilePath& path, |
+ scoped_ptr<gfx::ImageSkia>* result, |
+ MovableOnDestroyCallbackHolder on_finish) { |
+ wallpaper_loader_->Start( |
+ path.value(), |
+ 0, // Do not crop. |
+ base::Bind(&WallpaperManager::OnDefaultWallpaperDecoded, |
+ base::Unretained(this), |
+ path, |
+ base::Unretained(result), |
+ base::Passed(on_finish.Pass()))); |
+} |
+ |
void WallpaperManager::DoSetDefaultWallpaper( |
const std::string& user_id, |
MovableOnDestroyCallbackHolder on_finish) { |
@@ -742,9 +818,56 @@ void WallpaperManager::DoSetDefaultWallpaper( |
// up the tests. |
if (!ash::Shell::HasInstance()) |
return; |
- if (ash::Shell::GetInstance()->desktop_background_controller()-> |
- SetDefaultWallpaper(UserManager::Get()->IsLoggedInAsGuest())) |
- loaded_wallpapers_++; |
+ |
+ const bool is_guest = UserManager::Get()->IsLoggedInAsGuest(); |
+ |
+ gfx::ImageSkia image; |
+ |
+ ash::WallpaperResolution resolution = ash::Shell::GetInstance() |
+ ->desktop_background_controller() |
+ ->GetAppropriateResolution(); |
+ const bool use_small = (resolution == ash::WALLPAPER_RESOLUTION_SMALL); |
+ |
+ if (is_guest) { |
+ if (use_small) { |
+ if (guest_default_small_wallpaper_image_.get() == NULL) { |
+ StartLoadAndSetDefaultWallpaper(guest_default_small_wallpaper_file_, |
+ &guest_default_small_wallpaper_image_, |
+ on_finish.Pass()); |
+ return; |
+ } |
+ image = *guest_default_small_wallpaper_image_; |
+ } else { |
+ if (guest_default_large_wallpaper_image_.get() == NULL) { |
+ StartLoadAndSetDefaultWallpaper(guest_default_large_wallpaper_file_, |
+ &guest_default_large_wallpaper_image_, |
+ on_finish.Pass()); |
+ return; |
+ } |
+ image = *guest_default_large_wallpaper_image_; |
+ } |
+ } else { |
+ // not guest |
+ if (use_small) { |
+ if (default_small_wallpaper_image_.get() == NULL) { |
+ StartLoadAndSetDefaultWallpaper(default_small_wallpaper_file_, |
+ &default_small_wallpaper_image_, |
+ on_finish.Pass()); |
+ return; |
+ } |
+ image = *default_small_wallpaper_image_; |
+ } else { |
+ if (default_large_wallpaper_image_.get() == NULL) { |
+ StartLoadAndSetDefaultWallpaper(default_large_wallpaper_file_, |
+ &default_large_wallpaper_image_, |
+ on_finish.Pass()); |
+ return; |
+ } |
+ image = *default_large_wallpaper_image_; |
+ } |
+ } |
+ ash::Shell::GetInstance()->desktop_background_controller()->SetWallpaper( |
+ image, ash::WALLPAPER_LAYOUT_STRETCH); |
} |
void WallpaperManager::InitInitialUserWallpaper(const std::string& user_id, |
@@ -1070,6 +1193,12 @@ void WallpaperManager::EnsureCustomWallpaperDirectories( |
base::CreateDirectory(dir); |
} |
+void WallpaperManager::set_command_line_for_testing( |
+ base::CommandLine* command_line) { |
+ command_line_for_testing_ = command_line; |
+ SetDefaultWallpaperPathFromCommandLine(command_line); |
+} |
+ |
CommandLine* WallpaperManager::GetComandLine() { |
CommandLine* command_line = command_line_for_testing_ ? |
command_line_for_testing_ : CommandLine::ForCurrentProcess(); |
@@ -1321,8 +1450,8 @@ void WallpaperManager::OnWallpaperDecoded( |
} |
if (update_wallpaper) { |
- ash::Shell::GetInstance()->desktop_background_controller()-> |
- SetCustomWallpaper(wallpaper.image(), layout); |
+ ash::Shell::GetInstance()->desktop_background_controller()->SetWallpaper( |
+ wallpaper.image(), layout); |
} |
} |
@@ -1357,19 +1486,27 @@ void WallpaperManager::SaveCustomWallpaper(const std::string& user_id_hash, |
// Re-encode orginal file to jpeg format and saves the result in case that |
// resized wallpaper is not generated (i.e. chrome shutdown before resized |
// wallpaper is saved). |
- ResizeAndSaveWallpaper(wallpaper, original_path, |
+ ResizeAndSaveWallpaper(wallpaper, |
+ original_path, |
ash::WALLPAPER_LAYOUT_STRETCH, |
wallpaper.image().width(), |
- wallpaper.image().height()); |
+ wallpaper.image().height(), |
+ NULL); |
DeleteAllExcept(original_path); |
- ResizeAndSaveWallpaper(wallpaper, small_wallpaper_path, layout, |
+ ResizeAndSaveWallpaper(wallpaper, |
+ small_wallpaper_path, |
+ layout, |
ash::kSmallWallpaperMaxWidth, |
- ash::kSmallWallpaperMaxHeight); |
+ ash::kSmallWallpaperMaxHeight, |
+ NULL); |
DeleteAllExcept(small_wallpaper_path); |
- ResizeAndSaveWallpaper(wallpaper, large_wallpaper_path, layout, |
+ ResizeAndSaveWallpaper(wallpaper, |
+ large_wallpaper_path, |
+ layout, |
ash::kLargeWallpaperMaxWidth, |
- ash::kLargeWallpaperMaxHeight); |
+ ash::kLargeWallpaperMaxHeight, |
+ NULL); |
DeleteAllExcept(large_wallpaper_path); |
} |
@@ -1378,11 +1515,11 @@ void WallpaperManager::RecordUma(User::WallpaperType type, int index) const { |
User::WALLPAPER_TYPE_COUNT); |
} |
-void WallpaperManager::SaveWallpaperInternal(const base::FilePath& path, |
+bool WallpaperManager::SaveWallpaperInternal(const base::FilePath& path, |
const char* data, |
int size) const { |
int written_bytes = base::WriteFile(path, data, size); |
- DCHECK(written_bytes == size); |
+ return written_bytes == size; |
} |
void WallpaperManager::StartLoad(const std::string& user_id, |
@@ -1455,4 +1592,221 @@ WallpaperManager::PendingWallpaper* WallpaperManager::GetPendingWallpaper( |
return pending_inactive_; |
} |
+// static |
+base::FilePath WallpaperManager::GetCustomizedWallpaperDefaultRescaledFileName( |
+ const char* suffix) { |
+ const base::FilePath default_downloaded_file_name = |
+ ServicesCustomizationDocument::GetCustomizedWallpaperDownloadedFileName(); |
+ const base::FilePath default_cache_dir = |
+ ServicesCustomizationDocument::GetCustomizedWallpaperCacheDir(); |
+ if (default_downloaded_file_name.empty() || default_cache_dir.empty()) |
+ return base::FilePath(); |
+ return default_cache_dir.Append( |
+ default_downloaded_file_name.BaseName().value() + suffix); |
+} |
+ |
+void WallpaperManager::SetCustomizedDefaultWallpaper( |
+ const GURL& wallpaper_url, |
+ const base::FilePath& downloaded_file, |
+ const base::FilePath& resized_directory) { |
+ // Should fail if this ever happens in tests. |
+ DCHECK(wallpaper_url.is_valid() || wallpaper_url.is_empty()); |
+ if (!wallpaper_url.is_valid()) { |
+ if (!wallpaper_url.is_empty()) { |
+ LOG(WARNING) << "Invalid Customized Wallpaper URL."; |
+ } |
+ return; |
+ } |
+ std::string downloaded_file_name = downloaded_file.BaseName().value(); |
+ scoped_ptr<CustomizedWallpaperRescaledFiles> rescaled_files( |
+ new CustomizedWallpaperRescaledFiles( |
+ resized_directory.Append(downloaded_file_name + |
+ kSmallWallpaperSuffix), |
+ resized_directory.Append(downloaded_file_name + |
+ kLargeWallpaperSuffix))); |
+ scoped_ptr<CustomizedWallpaperFilesExist> exist( |
+ new CustomizedWallpaperFilesExist); |
+ |
+ base::Closure check_file_exists = |
+ base::Bind(&CheckCustomizedWallpaperFilesExist, |
+ downloaded_file, |
+ base::Unretained(rescaled_files.get()), |
+ base::Unretained(exist.get())); |
+ base::Closure on_checked_closure = |
+ base::Bind(&WallpaperManager::SetCustomizedDefaultWallpaperAfterCheck, |
+ weak_factory_.GetWeakPtr(), |
+ wallpaper_url, |
+ downloaded_file, |
+ base::Passed(rescaled_files.Pass()), |
+ base::Passed(exist.Pass())); |
+ if (!BrowserThread::PostBlockingPoolTaskAndReply( |
+ FROM_HERE, check_file_exists, on_checked_closure)) { |
+ LOG(WARNING) << "Failed to start check CheckCustomizedWallpaperFilesExist."; |
+ } |
+} |
+ |
+void WallpaperManager::ResizeCustomizedDefaultWallpaper( |
+ scoped_ptr<gfx::ImageSkia> image, |
+ const UserImage::RawImage& raw_image, |
+ const CustomizedWallpaperRescaledFiles* rescaled_files, |
+ bool* success, |
+ gfx::ImageSkia* small_wallpaper_image, |
+ gfx::ImageSkia* large_wallpaper_image) { |
+ DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread( |
+ sequence_token_)); |
+ UserImage wallpaper(*image.get(), raw_image); |
+ |
+ *success = true; |
+ |
+ *success &= ResizeAndSaveWallpaper(wallpaper, |
+ rescaled_files->path_rescaled_small, |
+ ash::WALLPAPER_LAYOUT_STRETCH, |
+ ash::kSmallWallpaperMaxWidth, |
+ ash::kSmallWallpaperMaxHeight, |
+ small_wallpaper_image); |
+ |
+ *success &= ResizeAndSaveWallpaper(wallpaper, |
+ rescaled_files->path_rescaled_large, |
+ ash::WALLPAPER_LAYOUT_STRETCH, |
+ ash::kLargeWallpaperMaxWidth, |
+ ash::kLargeWallpaperMaxHeight, |
+ large_wallpaper_image); |
+} |
+ |
+void WallpaperManager::OnCustomizedDefaultWallpaperResized( |
+ const GURL& wallpaper_url, |
+ scoped_ptr<CustomizedWallpaperRescaledFiles> rescaled_files, |
+ scoped_ptr<bool> success, |
+ scoped_ptr<gfx::ImageSkia> small_wallpaper_image, |
+ scoped_ptr<gfx::ImageSkia> large_wallpaper_image) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ DCHECK(rescaled_files.get()); |
+ DCHECK(success.get()); |
+ if (!*success) { |
+ LOG(WARNING) << "Failed to save Resized Customized Default Wallpaper"; |
+ return; |
+ } |
+ PrefService* pref_service = g_browser_process->local_state(); |
+ pref_service->SetString(prefs::kCustomizationDefaultWallpaperURL, |
+ wallpaper_url.spec()); |
+ SetDefaultWallpaperPath(rescaled_files->path_rescaled_small, |
+ small_wallpaper_image.Pass(), |
+ rescaled_files->path_rescaled_large, |
+ large_wallpaper_image.Pass()); |
+ VLOG(1) << "Customized Default Wallpaper applied."; |
+} |
+ |
+void WallpaperManager::OnCustomizedDefaultWallpaperDecoded( |
+ const GURL& wallpaper_url, |
+ scoped_ptr<CustomizedWallpaperRescaledFiles> rescaled_files, |
+ const UserImage& wallpaper) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ |
+ // If decoded wallpaper is empty, we have probably failed to decode the file. |
+ if (wallpaper.image().isNull()) { |
+ LOG(WARNING) << "Failed to decode customized wallpaper."; |
+ return; |
+ } |
+ |
+ wallpaper.image().EnsureRepsForSupportedScales(); |
+ scoped_ptr<gfx::ImageSkia> deep_copy(wallpaper.image().DeepCopy()); |
+ |
+ scoped_ptr<bool> success(new bool(false)); |
+ scoped_ptr<gfx::ImageSkia> small_wallpaper_image(new gfx::ImageSkia); |
+ scoped_ptr<gfx::ImageSkia> large_wallpaper_image(new gfx::ImageSkia); |
+ |
+ // TODO(bshe): This may break if RawImage becomes RefCountedMemory. |
+ base::Closure resize_closure = |
+ base::Bind(&WallpaperManager::ResizeCustomizedDefaultWallpaper, |
+ base::Unretained(this), |
+ base::Passed(&deep_copy), |
+ wallpaper.raw_image(), |
+ base::Unretained(rescaled_files.get()), |
+ base::Unretained(success.get()), |
+ base::Unretained(small_wallpaper_image.get()), |
+ base::Unretained(large_wallpaper_image.get())); |
+ base::Closure on_resized_closure = |
+ base::Bind(&WallpaperManager::OnCustomizedDefaultWallpaperResized, |
+ weak_factory_.GetWeakPtr(), |
+ wallpaper_url, |
+ base::Passed(rescaled_files.Pass()), |
+ base::Passed(success.Pass()), |
+ base::Passed(small_wallpaper_image.Pass()), |
+ base::Passed(large_wallpaper_image.Pass())); |
+ |
+ if (!task_runner_->PostTaskAndReply( |
+ FROM_HERE, resize_closure, on_resized_closure)) { |
+ LOG(WARNING) << "Failed to start Customized Wallpaper resize."; |
+ } |
+} |
+ |
+void WallpaperManager::SetCustomizedDefaultWallpaperAfterCheck( |
+ const GURL& wallpaper_url, |
+ const base::FilePath& downloaded_file, |
+ scoped_ptr<CustomizedWallpaperRescaledFiles> rescaled_files, |
+ scoped_ptr<CustomizedWallpaperFilesExist> exist) { |
+ PrefService* pref_service = g_browser_process->local_state(); |
+ |
+ std::string current_url = |
+ pref_service->GetString(prefs::kCustomizationDefaultWallpaperURL); |
+ if (current_url != wallpaper_url.spec() || !exist->AllRescaledExist()) { |
+ DCHECK(exist->downloaded); |
+ // Need rescale |
+ wallpaper_loader_->Start( |
+ downloaded_file.value(), |
+ 0, // Do not crop. |
+ base::Bind(&WallpaperManager::OnCustomizedDefaultWallpaperDecoded, |
+ weak_factory_.GetWeakPtr(), |
+ wallpaper_url, |
+ base::Passed(rescaled_files.Pass()))); |
+ } else { |
+ SetDefaultWallpaperPath(rescaled_files->path_rescaled_small, |
+ scoped_ptr<gfx::ImageSkia>().Pass(), |
+ rescaled_files->path_rescaled_large, |
+ scoped_ptr<gfx::ImageSkia>().Pass()); |
+ } |
+} |
+ |
+// static |
+bool WallpaperManager::ShouldUseCustomizedDefaultWallpaper() { |
+ PrefService* pref_service = g_browser_process->local_state(); |
+ |
+ return !(pref_service->FindPreference( |
+ prefs::kCustomizationDefaultWallpaperURL) |
+ ->IsDefaultValue()); |
+} |
+ |
+void WallpaperManager::SetDefaultWallpaperPathFromCommandLine( |
+ base::CommandLine* command_line) { |
+ default_small_wallpaper_file_ = command_line->GetSwitchValuePath( |
+ ash::switches::kAshDefaultWallpaperSmall); |
+ default_large_wallpaper_file_ = command_line->GetSwitchValuePath( |
+ ash::switches::kAshDefaultWallpaperLarge); |
+ guest_default_small_wallpaper_file_ = |
+ command_line->GetSwitchValuePath(ash::switches::kAshGuestWallpaperSmall); |
+ guest_default_large_wallpaper_file_ = |
+ command_line->GetSwitchValuePath(ash::switches::kAshGuestWallpaperLarge); |
+} |
+ |
+void WallpaperManager::SetDefaultWallpaperPath( |
+ const base::FilePath& default_small_wallpaper_file, |
+ scoped_ptr<gfx::ImageSkia> small_wallpaper_image, |
+ const base::FilePath& default_large_wallpaper_file, |
+ scoped_ptr<gfx::ImageSkia> large_wallpaper_image) { |
+ default_small_wallpaper_file_ = default_small_wallpaper_file; |
+ default_large_wallpaper_file_ = default_large_wallpaper_file; |
+ default_small_wallpaper_image_.swap(small_wallpaper_image); |
+ default_large_wallpaper_image_.swap(large_wallpaper_image); |
+ |
+ ash::DesktopBackgroundController* dbc = |
+ ash::Shell::GetInstance()->desktop_background_controller(); |
+ if ((small_wallpaper_image.get() && |
+ dbc->WallpaperIsAlreadyLoaded(*small_wallpaper_image)) || |
+ (large_wallpaper_image.get() && |
+ dbc->WallpaperIsAlreadyLoaded(*large_wallpaper_image))) { |
+ DoSetDefaultWallpaper(std::string(), |
+ MovableOnDestroyCallbackHolder().Pass()); |
+ } |
+} |
+ |
} // namespace chromeos |