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

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

Issue 9839098: Fix wallpaper change to a random one when user first click "set wallpaper". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix linux_chromeos crash Created 8 years, 9 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_handler2.cc
diff --git a/chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler2.cc
index d3c27f0126302437cb4c97de97779c0c6c744374..2beabb0de8f910fe3372d36dccec9b3f72e22604 100644
--- a/chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler2.cc
@@ -4,7 +4,9 @@
#include "chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handler2.h"
+#include "ash/desktop_background/desktop_background_controller.h"
#include "ash/desktop_background/desktop_background_resources.h"
+#include "ash/shell.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/metrics/histogram.h"
@@ -86,11 +88,7 @@ void SetWallpaperOptionsHandler::HandlePageInitialized(
void SetWallpaperOptionsHandler::HandlePageShown(const base::ListValue* args) {
DCHECK(args && args->empty());
- chromeos::UserManager* user_manager = chromeos::UserManager::Get();
- const chromeos::User& user = user_manager->GetLoggedInUser();
- DCHECK(!user.email().empty());
- int index = user_manager->GetUserWallpaper(user.email());
- DCHECK(index >=0 && index < ash::GetWallpaperCount());
+ int index = chromeos::UserManager::Get()->GetUserWallpaperIndex();
base::FundamentalValue index_value(index);
web_ui()->CallJavascriptFunction("SetWallpaperOptions.setSelectedImage",
index_value);
@@ -106,10 +104,9 @@ void SetWallpaperOptionsHandler::HandleSelectImage(const ListValue* args) {
image_index < 0 || image_index >= ash::GetWallpaperCount())
NOTREACHED();
- UserManager* user_manager = UserManager::Get();
- const User& user = user_manager->GetLoggedInUser();
- DCHECK(!user.email().empty());
- user_manager->SaveWallpaperDefaultIndex(user.email(), image_index);
+ UserManager::Get()->SaveUserWallpaperIndex(image_index);
+ ash::Shell::GetInstance()->desktop_background_controller()->
+ OnDesktopBackgroundChanged();
}
gfx::NativeWindow SetWallpaperOptionsHandler::GetBrowserWindow() const {

Powered by Google App Engine
This is Rietveld 408576698