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

Unified Diff: chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler.cc

Issue 10832019: Speed up custom wallpaper switching time and wallpaper manager code refactor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ivan's review 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/ui/webui/options2/chromeos/set_wallpaper_options_handler.cc
diff --git a/chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler.cc b/chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler.cc
index 47ec5ae0db9e551f3d65edaa6efa8f829fde4683..f7be46b675b259b4150393802689b09cfecb4917 100644
--- a/chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler.cc
@@ -14,6 +14,7 @@
#include "base/string_util.h"
#include "base/values.h"
#include "chrome/browser/chromeos/login/user_manager.h"
+#include "chrome/browser/chromeos/login/wallpaper_manager.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_select_file_policy.h"
@@ -101,7 +102,7 @@ void SetWallpaperOptionsHandler::FileSelected(const FilePath& path,
UserManager* user_manager = UserManager::Get();
// Default wallpaper layout is CENTER_CROPPED.
- user_manager->SaveUserWallpaperFromFile(
+ WallpaperManager::Get()->SetUserWallpaperFromFile(
user_manager->GetLoggedInUser().email(), path, ash::CENTER_CROPPED,
weak_factory_.GetWeakPtr());
web_ui()->CallJavascriptFunction("SetWallpaperOptions.didSelectFile");
@@ -161,7 +162,8 @@ void SetWallpaperOptionsHandler::HandlePageShown(const base::ListValue* args) {
User::WallpaperType type;
int index;
base::Time date;
- UserManager::Get()->GetLoggedInUserWallpaperProperties(&type, &index, &date);
+ WallpaperManager::Get()->GetLoggedInUserWallpaperProperties(&type, &index,
Ivan Korotkov 2012/07/31 21:18:16 Maybe move all arguments to the next line?
bshe 2012/08/01 15:07:35 Done.
+ &date);
if (type == User::DAILY && date != base::Time::Now().LocalMidnight()) {
index = ash::GetNextWallpaperIndex(index);
UserManager::Get()->SaveLoggedInUserWallpaperProperties(User::DAILY,
@@ -235,7 +237,8 @@ void SetWallpaperOptionsHandler::HandleDailyWallpaper(const ListValue* args) {
User::WallpaperType type;
int index;
base::Time date;
- UserManager::Get()->GetLoggedInUserWallpaperProperties(&type, &index, &date);
+ WallpaperManager::Get()->GetLoggedInUserWallpaperProperties(&type, &index,
+ &date);
Ivan Korotkov 2012/07/31 21:18:16 Ditto
bshe 2012/08/01 15:07:35 Done.
if (date != base::Time::Now().LocalMidnight())
index = ash::GetNextWallpaperIndex(index);
UserManager::Get()->SaveLoggedInUserWallpaperProperties(User::DAILY, index);

Powered by Google App Engine
This is Rietveld 408576698