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

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

Issue 10754014: Wallpaper manager backend APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix a crash when try to cancel previous request which had finished. Add more error message. Created 8 years, 5 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 95a3cb5f4a3498fe6ac4e9d9d5c225c94e8de110..263a4dc795016a32ae0808a5b313f814e0b83a76 100644
--- a/chrome/browser/chromeos/login/wallpaper_manager.cc
+++ b/chrome/browser/chromeos/login/wallpaper_manager.cc
@@ -4,7 +4,8 @@
#include "chrome/browser/chromeos/login/wallpaper_manager.h"
-#include "ash/desktop_background/desktop_background_resources.h"
+#include "ash/shell.h"
+#include "ash/desktop_background/desktop_background_controller.h"
flackr 2012/07/18 13:46:10 nit: Sort
bshe 2012/07/18 18:35:02 Done.
#include "base/logging.h"
#include "base/time.h"
#include "base/values.h"
@@ -25,7 +26,9 @@ namespace chromeos {
static WallpaperManager* g_wallpaper_manager = NULL;
-WallpaperManager::WallpaperManager() : last_selected_user_("") {
+WallpaperManager::WallpaperManager()
+ : ALLOW_THIS_IN_INITIALIZER_LIST(image_loader_(new UserImageLoader)),
+ last_selected_user_("") {
system::TimezoneSettings::GetInstance()->AddObserver(this);
RestartTimer();
}
@@ -60,6 +63,15 @@ void WallpaperManager::RestartTimer() {
}
}
+void WallpaperManager::SetWallpaperFromFile(std::string email,
+ const std::string& path,
+ ash::WallpaperLayout layout) {
+ image_loader_->Start(
+ path, 0, false,
+ base::Bind(&WallpaperManager::OnCustomWallpaperLoaded,
+ base::Unretained(this), email, layout));
+}
+
void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) {
RestartTimer();
}
@@ -68,6 +80,14 @@ void WallpaperManager::SystemResumed() {
BatchUpdateWallpaper();
}
+void WallpaperManager::OnCustomWallpaperLoaded(const std::string& email,
Mihai Parparita -not on Chrome 2012/07/16 23:14:25 The email parameter appears to be unused (so it ca
bshe 2012/07/18 18:28:56 This will be used in the future. I need to have th
+ ash::WallpaperLayout layout,
+ const UserImage& user_image) {
+ const SkBitmap& wallpaper = user_image.image();
+ ash::Shell::GetInstance()->desktop_background_controller()->
+ SetCustomWallpaper(wallpaper, layout);
+}
+
void WallpaperManager::BatchUpdateWallpaper() {
PrefService* local_state = g_browser_process->local_state();
UserManager* user_manager = UserManager::Get();

Powered by Google App Engine
This is Rietveld 408576698