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

Unified Diff: chrome/browser/chromeos/login/wallpaper_manager.cc

Issue 221873005: Some cleanup of WallpaperManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Compilation fix. 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: 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 ae98e2fe096912e5f3696bef700d0536290644b3..12d945cd4d46460d85e9414bae02d08b63bb00d4 100644
--- a/chrome/browser/chromeos/login/wallpaper_manager.cc
+++ b/chrome/browser/chromeos/login/wallpaper_manager.cc
@@ -35,6 +35,7 @@
#include "chrome/browser/chromeos/login/login_display_host_impl.h"
#include "chrome/browser/chromeos/login/startup_utils.h"
#include "chrome/browser/chromeos/login/user.h"
+#include "chrome/browser/chromeos/login/user_image.h"
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
@@ -82,9 +83,6 @@ const char kNewWallpaperLayoutNodeName[] = "layout";
const char kNewWallpaperFileNodeName[] = "file";
const char kNewWallpaperTypeNodeName[] = "type";
-// File path suffix of the original custom wallpaper.
-const char kOriginalCustomWallpaperSuffix[] = "_wallpaper";
-
// Maximum number of wallpapers cached by CacheUsersWallpapers().
const int kMaxWallpapersToCache = 3;
@@ -148,6 +146,63 @@ bool ShouldUseCustomizedDefaultWallpaper() {
->IsDefaultValue());
}
+// Deletes everything else except |path| in the same directory.
+void DeleteAllExcept(const base::FilePath& path) {
+ base::FilePath dir = path.DirName();
+ if (base::DirectoryExists(dir)) {
+ base::FileEnumerator files(dir, false, base::FileEnumerator::FILES);
+ for (base::FilePath current = files.Next(); !current.empty();
+ current = files.Next()) {
+ if (current != path)
+ base::DeleteFile(current, false);
+ }
+ }
+}
+
+// Deletes a list of wallpaper files in |file_list|.
+void DeleteWallpaperInList(const std::vector<base::FilePath>& file_list) {
+ for (std::vector<base::FilePath>::const_iterator it = file_list.begin();
+ it != file_list.end(); ++it) {
+ base::FilePath path = *it;
+ // Some users may still have legacy wallpapers with png extension. We need
+ // to delete these wallpapers too.
+ if (!base::DeleteFile(path, true) &&
+ !base::DeleteFile(path.AddExtension(".png"), false)) {
+ LOG(ERROR) << "Failed to remove user wallpaper at " << path.value();
+ }
+ }
+}
+
+// Creates all new custom wallpaper directories for |user_id_hash| if not exist.
+void EnsureCustomWallpaperDirectories(const std::string& user_id_hash) {
+ base::FilePath dir;
+ dir = GetCustomWallpaperDir(kSmallWallpaperSubDir);
+ dir = dir.Append(user_id_hash);
+ if (!base::PathExists(dir))
+ base::CreateDirectory(dir);
+ dir = GetCustomWallpaperDir(kLargeWallpaperSubDir);
+ dir = dir.Append(user_id_hash);
+ if (!base::PathExists(dir))
+ base::CreateDirectory(dir);
+ dir = GetCustomWallpaperDir(kOriginalWallpaperSubDir);
+ dir = dir.Append(user_id_hash);
+ if (!base::PathExists(dir))
+ base::CreateDirectory(dir);
+ dir = GetCustomWallpaperDir(kThumbnailWallpaperSubDir);
+ dir = dir.Append(user_id_hash);
+ if (!base::PathExists(dir))
+ base::CreateDirectory(dir);
+}
+
+// Saves wallpaper image raw |data| to |path| (absolute path) in file system.
+// Returns true on success.
+bool SaveWallpaperInternal(const base::FilePath& path,
+ const char* data,
+ int size) {
+ int written_bytes = base::WriteFile(path, data, size);
+ return written_bytes == size;
+}
+
} // namespace
const char kWallpaperSequenceTokenName[] = "wallpaper-sequence";
@@ -275,9 +330,9 @@ WallpaperManager::PendingWallpaper::PendingWallpaper(
WallpaperManager::PendingWallpaper::~PendingWallpaper() {}
void WallpaperManager::PendingWallpaper::ResetSetWallpaperImage(
- const gfx::ImageSkia& user_wallpaper,
+ const gfx::ImageSkia& image,
const WallpaperInfo& info) {
- SetMode(user_wallpaper, info, base::FilePath(), false);
+ SetMode(image, info, base::FilePath(), false);
}
void WallpaperManager::PendingWallpaper::ResetLoadWallpaper(
@@ -296,11 +351,11 @@ void WallpaperManager::PendingWallpaper::ResetSetDefaultWallpaper() {
}
void WallpaperManager::PendingWallpaper::SetMode(
- const gfx::ImageSkia& user_wallpaper,
+ const gfx::ImageSkia& image,
const WallpaperInfo& info,
const base::FilePath& wallpaper_path,
const bool is_default) {
- user_wallpaper_ = user_wallpaper;
+ user_wallpaper_ = image;
info_ = info;
wallpaper_path_ = wallpaper_path;
default_ = is_default;
@@ -519,14 +574,6 @@ base::FilePath WallpaperManager::GetCustomWallpaperPath(
return custom_wallpaper_path.Append(user_id_hash).Append(file);
}
-base::FilePath WallpaperManager::GetOriginalWallpaperPathForUser(
- const std::string& user_id) {
- std::string filename = user_id + kOriginalCustomWallpaperSuffix;
- base::FilePath user_data_dir;
- PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
- return user_data_dir.AppendASCII(filename);
-}
-
bool WallpaperManager::GetLoggedInUserWallpaperInfo(WallpaperInfo* info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -535,6 +582,8 @@ bool WallpaperManager::GetLoggedInUserWallpaperInfo(WallpaperInfo* info) {
info->layout = current_user_wallpaper_info_.layout =
ash::WALLPAPER_LAYOUT_CENTER_CROPPED;
info->type = current_user_wallpaper_info_.type = User::DEFAULT;
+ info->date = current_user_wallpaper_info_.date =
+ base::Time::Now().LocalMidnight();
return true;
}
@@ -638,17 +687,16 @@ void WallpaperManager::RemoveUserWallpaperInfo(const std::string& user_id) {
DeleteUserWallpapers(user_id, info.file);
}
-bool WallpaperManager::ResizeWallpaper(
- const UserImage& wallpaper,
- ash::WallpaperLayout layout,
- int preferred_width,
- int preferred_height,
- scoped_refptr<base::RefCountedBytes>* output,
- gfx::ImageSkia* output_skia) const {
- DCHECK(BrowserThread::GetBlockingPool()->
- IsRunningSequenceOnCurrentThread(sequence_token_));
- int width = wallpaper.image().width();
- int height = wallpaper.image().height();
+// static
+bool WallpaperManager::ResizeImage(const gfx::ImageSkia& image,
+ ash::WallpaperLayout layout,
+ int preferred_width,
+ int preferred_height,
+ scoped_refptr<base::RefCountedBytes>* output,
+ gfx::ImageSkia* output_skia) {
+ DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI));
+ int width = image.width();
+ int height = image.height();
int resized_width;
int resized_height;
*output = new base::RefCountedBytes();
@@ -678,19 +726,20 @@ bool WallpaperManager::ResizeWallpaper(
}
gfx::ImageSkia resized_image = gfx::ImageSkiaOperations::CreateResizedImage(
- wallpaper.image(),
+ image,
skia::ImageOperations::RESIZE_LANCZOS3,
gfx::Size(resized_width, resized_height));
- SkBitmap image = *(resized_image.bitmap());
- SkAutoLockPixels lock_input(image);
+ SkBitmap bitmap = *(resized_image.bitmap());
+ SkAutoLockPixels lock_input(bitmap);
gfx::JPEGCodec::Encode(
- reinterpret_cast<unsigned char*>(image.getAddr32(0, 0)),
+ reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)),
gfx::JPEGCodec::FORMAT_SkBitmap,
- image.width(),
- image.height(),
- image.width() * image.bytesPerPixel(),
- kDefaultEncodingQuality, &(*output)->data());
+ bitmap.width(),
+ bitmap.height(),
+ bitmap.width() * bitmap.bytesPerPixel(),
+ kDefaultEncodingQuality,
+ &(*output)->data());
if (output_skia) {
resized_image.MakeThreadSafe();
@@ -700,13 +749,13 @@ bool WallpaperManager::ResizeWallpaper(
return true;
}
-bool WallpaperManager::ResizeAndSaveWallpaper(
- const UserImage& wallpaper,
- const base::FilePath& path,
- ash::WallpaperLayout layout,
- int preferred_width,
- int preferred_height,
- gfx::ImageSkia* result_out) const {
+// static
+bool WallpaperManager::ResizeAndSaveWallpaper(const gfx::ImageSkia& image,
+ const base::FilePath& path,
+ ash::WallpaperLayout layout,
+ int preferred_width,
+ int preferred_height,
+ gfx::ImageSkia* output_skia) {
if (layout == ash::WALLPAPER_LAYOUT_CENTER) {
// TODO(bshe): Generates cropped custom wallpaper for CENTER layout.
if (base::PathExists(path))
@@ -714,12 +763,12 @@ bool WallpaperManager::ResizeAndSaveWallpaper(
return false;
}
scoped_refptr<base::RefCountedBytes> data;
- if (ResizeWallpaper(wallpaper,
- layout,
- preferred_width,
- preferred_height,
- &data,
- result_out)) {
+ if (ResizeImage(image,
+ layout,
+ preferred_width,
+ preferred_height,
+ &data,
+ output_skia)) {
return SaveWallpaperInternal(
path, reinterpret_cast<const char*>(data->front()), data->size());
}
@@ -778,7 +827,7 @@ WallpaperManager::GetAppropriateResolution() {
void WallpaperManager::SetPolicyControlledWallpaper(
const std::string& user_id,
- const UserImage& wallpaper) {
+ const UserImage& user_image) {
const User *user = chromeos::UserManager::Get()->FindUser(user_id);
if (!user) {
NOTREACHED() << "Unknown user.";
@@ -789,7 +838,7 @@ void WallpaperManager::SetPolicyControlledWallpaper(
"policy-controlled.jpeg",
ash::WALLPAPER_LAYOUT_CENTER_CROPPED,
User::POLICY,
- wallpaper,
+ user_image.image(),
true /* update wallpaper */);
}
@@ -798,7 +847,7 @@ void WallpaperManager::SetCustomWallpaper(const std::string& user_id,
const std::string& file,
ash::WallpaperLayout layout,
User::WallpaperType type,
- const UserImage& wallpaper,
+ const gfx::ImageSkia& image,
bool update_wallpaper) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(UserManager::Get()->IsUserLoggedIn());
@@ -816,7 +865,7 @@ void WallpaperManager::SetCustomWallpaper(const std::string& user_id,
// If decoded wallpaper is empty, we have probably failed to decode the file.
// Use default wallpaper in this case.
- if (wallpaper.image().isNull()) {
+ if (image.isNull()) {
SetDefaultWallpaperDelayed(user_id);
return;
}
@@ -824,9 +873,6 @@ void WallpaperManager::SetCustomWallpaper(const std::string& user_id,
bool is_persistent =
!UserManager::Get()->IsUserNonCryptohomeDataEphemeral(user_id);
- wallpaper.image().EnsureRepsForSupportedScales();
- scoped_ptr<gfx::ImageSkia> deep_copy(wallpaper.image().DeepCopy());
-
WallpaperInfo wallpaper_info = {
wallpaper_path.value(),
layout,
@@ -834,21 +880,25 @@ void WallpaperManager::SetCustomWallpaper(const std::string& user_id,
// Date field is not used.
base::Time::Now().LocalMidnight()
};
- // Block shutdown on this task. Otherwise, we may lose the custom wallpaper
- // that the user selected.
- scoped_refptr<base::SequencedTaskRunner> blocking_task_runner =
- BrowserThread::GetBlockingPool()->
- GetSequencedTaskRunnerWithShutdownBehavior(sequence_token_,
- base::SequencedWorkerPool::BLOCK_SHUTDOWN);
- // TODO(bshe): This may break if RawImage becomes RefCountedMemory.
- blocking_task_runner->PostTask(FROM_HERE,
- base::Bind(&WallpaperManager::ProcessCustomWallpaper,
- base::Unretained(this),
- user_id_hash,
- is_persistent,
- wallpaper_info,
- base::Passed(&deep_copy),
- wallpaper.raw_image()));
+ if (is_persistent) {
+ image.EnsureRepsForSupportedScales();
+ scoped_ptr<gfx::ImageSkia> deep_copy(image.DeepCopy());
+ // Block shutdown on this task. Otherwise, we may lose the custom wallpaper
+ // that the user selected.
+ scoped_refptr<base::SequencedTaskRunner> blocking_task_runner =
+ BrowserThread::GetBlockingPool()
+ ->GetSequencedTaskRunnerWithShutdownBehavior(
+ sequence_token_, base::SequencedWorkerPool::BLOCK_SHUTDOWN);
+ // TODO(bshe): This may break if RawImage becomes RefCountedMemory.
+ blocking_task_runner->PostTask(
+ FROM_HERE,
+ base::Bind(&WallpaperManager::SaveCustomWallpaper,
+ base::Unretained(this),
+ user_id_hash,
+ base::FilePath(wallpaper_info.file),
+ wallpaper_info.layout,
+ base::Passed(deep_copy.Pass())));
+ }
std::string relative_path = base::FilePath(user_id_hash).Append(file).value();
// User's custom wallpaper path is determined by relative path and the
@@ -861,12 +911,11 @@ void WallpaperManager::SetCustomWallpaper(const std::string& user_id,
};
SetUserWallpaperInfo(user_id, info, is_persistent);
if (update_wallpaper) {
- GetPendingWallpaper(user_id, false)
- ->ResetSetWallpaperImage(wallpaper.image(), info);
+ GetPendingWallpaper(user_id, false)->ResetSetWallpaperImage(image, info);
}
if (UserManager::IsMultipleProfilesAllowed())
- wallpaper_cache_[user_id] = wallpaper.image();
+ wallpaper_cache_[user_id] = image;
}
void WallpaperManager::SetDefaultWallpaperNow(const std::string& user_id) {
@@ -961,11 +1010,6 @@ void WallpaperManager::SetUserWallpaperInfo(const std::string& user_id,
wallpaper_update->SetWithoutPathExpansion(user_id, wallpaper_info_dict);
}
-void WallpaperManager::SetLastSelectedUser(
- const std::string& last_selected_user) {
- last_selected_user_ = last_selected_user;
-}
-
void WallpaperManager::SetUserWallpaperDelayed(const std::string& user_id) {
ScheduleSetUserWallpaper(user_id, true);
}
@@ -995,7 +1039,7 @@ void WallpaperManager::ScheduleSetUserWallpaper(const std::string& user_id,
if (!UserManager::Get()->IsKnownUser(user_id))
return;
- SetLastSelectedUser(user_id);
+ last_selected_user_ = user_id;
WallpaperInfo info;
@@ -1041,11 +1085,10 @@ void WallpaperManager::ScheduleSetUserWallpaper(const std::string& user_id,
}
}
-void WallpaperManager::SetWallpaperFromImageSkia(
- const std::string& user_id,
- const gfx::ImageSkia& wallpaper,
- ash::WallpaperLayout layout,
- bool update_wallpaper) {
+void WallpaperManager::SetWallpaperFromImageSkia(const std::string& user_id,
+ const gfx::ImageSkia& image,
+ ash::WallpaperLayout layout,
+ bool update_wallpaper) {
DCHECK(UserManager::Get()->IsUserLoggedIn());
// There is no visible background in kiosk mode.
@@ -1054,11 +1097,11 @@ void WallpaperManager::SetWallpaperFromImageSkia(
WallpaperInfo info;
info.layout = layout;
if (UserManager::IsMultipleProfilesAllowed())
- wallpaper_cache_[user_id] = wallpaper;
+ wallpaper_cache_[user_id] = image;
if (update_wallpaper) {
GetPendingWallpaper(last_selected_user_, false /* Not delayed */)
- ->ResetSetWallpaperImage(wallpaper, info);
+ ->ResetSetWallpaperImage(image, info);
}
}
@@ -1108,11 +1151,11 @@ void WallpaperManager::NotifyAnimationFinished() {
// WallpaperManager, private: --------------------------------------------------
bool WallpaperManager::GetWallpaperFromCache(const std::string& user_id,
- gfx::ImageSkia* wallpaper) {
+ gfx::ImageSkia* image) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
CustomWallpaperMap::const_iterator it = wallpaper_cache_.find(user_id);
if (it != wallpaper_cache_.end()) {
- *wallpaper = (*it).second;
+ *image = (*it).second;
return true;
}
return false;
@@ -1173,32 +1216,6 @@ void WallpaperManager::ClearObsoleteWallpaperPrefs() {
wallpapers_pref->Clear();
}
-void WallpaperManager::DeleteAllExcept(const base::FilePath& path) {
- base::FilePath dir = path.DirName();
- if (base::DirectoryExists(dir)) {
- base::FileEnumerator files(dir, false, base::FileEnumerator::FILES);
- for (base::FilePath current = files.Next(); !current.empty();
- current = files.Next()) {
- if (current != path)
- base::DeleteFile(current, false);
- }
- }
-}
-
-void WallpaperManager::DeleteWallpaperInList(
- const std::vector<base::FilePath>& file_list) {
- for (std::vector<base::FilePath>::const_iterator it = file_list.begin();
- it != file_list.end(); ++it) {
- base::FilePath path = *it;
- // Some users may still have legacy wallpapers with png extension. We need
- // to delete these wallpapers too.
- if (!base::DeleteFile(path, true) &&
- !base::DeleteFile(path.AddExtension(".png"), false)) {
- LOG(ERROR) << "Failed to remove user wallpaper at " << path.value();
- }
- }
-}
-
void WallpaperManager::DeleteUserWallpapers(const std::string& user_id,
const std::string& path_to_file) {
std::vector<base::FilePath> file_to_remove;
@@ -1230,33 +1247,10 @@ void WallpaperManager::DeleteUserWallpapers(const std::string& user_id,
base::WorkerPool::PostTask(
FROM_HERE,
- base::Bind(&WallpaperManager::DeleteWallpaperInList,
- base::Unretained(this),
- file_to_remove),
+ base::Bind(&DeleteWallpaperInList, file_to_remove),
false);
}
-void WallpaperManager::EnsureCustomWallpaperDirectories(
- const std::string& user_id_hash) {
- base::FilePath dir;
- dir = GetCustomWallpaperDir(kSmallWallpaperSubDir);
- dir = dir.Append(user_id_hash);
- if (!base::PathExists(dir))
- base::CreateDirectory(dir);
- dir = GetCustomWallpaperDir(kLargeWallpaperSubDir);
- dir = dir.Append(user_id_hash);
- if (!base::PathExists(dir))
- base::CreateDirectory(dir);
- dir = GetCustomWallpaperDir(kOriginalWallpaperSubDir);
- dir = dir.Append(user_id_hash);
- if (!base::PathExists(dir))
- base::CreateDirectory(dir);
- dir = GetCustomWallpaperDir(kThumbnailWallpaperSubDir);
- dir = dir.Append(user_id_hash);
- if (!base::PathExists(dir))
- base::CreateDirectory(dir);
-}
-
void WallpaperManager::SetCommandLineForTesting(
base::CommandLine* command_line) {
command_line_for_testing_ = command_line;
@@ -1487,13 +1481,13 @@ void WallpaperManager::OnWallpaperDecoded(
ash::WallpaperLayout layout,
bool update_wallpaper,
MovableOnDestroyCallbackHolder on_finish,
- const UserImage& wallpaper) {
+ const UserImage& user_image) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
TRACE_EVENT_ASYNC_END0("ui", "LoadAndDecodeWallpaper", this);
// If decoded wallpaper is empty, we have probably failed to decode the file.
// Use default wallpaper in this case.
- if (wallpaper.image().isNull()) {
+ if (user_image.image().isNull()) {
// Updates user pref to default wallpaper.
WallpaperInfo info = {
"",
@@ -1511,35 +1505,21 @@ void WallpaperManager::OnWallpaperDecoded(
// Only cache the user wallpaper at login screen and for multi profile users.
if (!UserManager::Get()->IsUserLoggedIn() ||
UserManager::IsMultipleProfilesAllowed()) {
- wallpaper_cache_[user_id] = wallpaper.image();
+ wallpaper_cache_[user_id] = user_image.image();
}
if (update_wallpaper) {
ash::Shell::GetInstance()
->desktop_background_controller()
- ->SetWallpaperImage(wallpaper.image(), layout);
+ ->SetWallpaperImage(user_image.image(), layout);
}
}
-void WallpaperManager::ProcessCustomWallpaper(
+void WallpaperManager::SaveCustomWallpaper(
const std::string& user_id_hash,
- bool persistent,
- const WallpaperInfo& info,
- scoped_ptr<gfx::ImageSkia> image,
- const UserImage::RawImage& raw_image) {
- DCHECK(BrowserThread::GetBlockingPool()->
- IsRunningSequenceOnCurrentThread(sequence_token_));
- UserImage wallpaper(*image.get(), raw_image);
- if (persistent) {
- SaveCustomWallpaper(user_id_hash, base::FilePath(info.file), info.layout,
- wallpaper);
- }
-}
-
-void WallpaperManager::SaveCustomWallpaper(const std::string& user_id_hash,
- const base::FilePath& original_path,
- ash::WallpaperLayout layout,
- const UserImage& wallpaper) {
+ const base::FilePath& original_path,
+ ash::WallpaperLayout layout,
+ scoped_ptr<gfx::ImageSkia> image) const {
DCHECK(BrowserThread::GetBlockingPool()->
IsRunningSequenceOnCurrentThread(sequence_token_));
EnsureCustomWallpaperDirectories(user_id_hash);
@@ -1552,22 +1532,22 @@ 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,
+ ResizeAndSaveWallpaper(*image,
original_path,
ash::WALLPAPER_LAYOUT_STRETCH,
- wallpaper.image().width(),
- wallpaper.image().height(),
+ image->width(),
+ image->height(),
NULL);
DeleteAllExcept(original_path);
- ResizeAndSaveWallpaper(wallpaper,
+ ResizeAndSaveWallpaper(*image,
small_wallpaper_path,
layout,
kSmallWallpaperMaxWidth,
kSmallWallpaperMaxHeight,
NULL);
DeleteAllExcept(small_wallpaper_path);
- ResizeAndSaveWallpaper(wallpaper,
+ ResizeAndSaveWallpaper(*image,
large_wallpaper_path,
layout,
kLargeWallpaperMaxWidth,
@@ -1581,13 +1561,6 @@ void WallpaperManager::RecordUma(User::WallpaperType type, int index) const {
User::WALLPAPER_TYPE_COUNT);
}
-bool WallpaperManager::SaveWallpaperInternal(const base::FilePath& path,
- const char* data,
- int size) const {
- int written_bytes = base::WriteFile(path, data, size);
- return written_bytes == size;
-}
-
void WallpaperManager::StartLoad(const std::string& user_id,
const WallpaperInfo& info,
bool update_wallpaper,
@@ -1726,18 +1699,17 @@ void WallpaperManager::ResizeCustomizedDefaultWallpaper(
gfx::ImageSkia* large_wallpaper_image) {
DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread(
sequence_token_));
- UserImage wallpaper(*image.get(), raw_image);
*success = true;
- *success &= ResizeAndSaveWallpaper(wallpaper,
+ *success &= ResizeAndSaveWallpaper(*image,
rescaled_files->path_rescaled_small(),
ash::WALLPAPER_LAYOUT_STRETCH,
kSmallWallpaperMaxWidth,
kSmallWallpaperMaxHeight,
small_wallpaper_image);
- *success &= ResizeAndSaveWallpaper(wallpaper,
+ *success &= ResizeAndSaveWallpaper(*image,
rescaled_files->path_rescaled_large(),
ash::WALLPAPER_LAYOUT_STRETCH,
kLargeWallpaperMaxWidth,
@@ -1834,10 +1806,10 @@ void WallpaperManager::OnDefaultWallpaperDecoded(
const ash::WallpaperLayout layout,
scoped_ptr<chromeos::UserImage>* result_out,
MovableOnDestroyCallbackHolder on_finish,
- const UserImage& wallpaper) {
- result_out->reset(new UserImage(wallpaper));
+ const UserImage& user_image) {
+ result_out->reset(new UserImage(user_image));
ash::Shell::GetInstance()->desktop_background_controller()->SetWallpaperImage(
- wallpaper.image(), layout);
+ user_image.image(), layout);
}
void WallpaperManager::StartLoadAndSetDefaultWallpaper(
« no previous file with comments | « chrome/browser/chromeos/login/wallpaper_manager.h ('k') | chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698