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

Side by Side Diff: chrome/browser/chromeos/login/user_manager_impl.cc

Issue 9764012: Restore to user selected wallpaper after browser crash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review and fix a segfault when starting chrome after saving data to local state. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/user_manager_impl.h" 5 #include "chrome/browser/chromeos/login/user_manager_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/desktop_background/desktop_background_controller.h" 10 #include "ash/desktop_background/desktop_background_controller.h"
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 void UserManagerImpl::SaveWallpaperDefaultIndex(const std::string& username, 904 void UserManagerImpl::SaveWallpaperDefaultIndex(const std::string& username,
905 int wallpaper_index) { 905 int wallpaper_index) {
906 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 906 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
907 907
908 PrefService* local_state = g_browser_process->local_state(); 908 PrefService* local_state = g_browser_process->local_state();
909 DictionaryPrefUpdate wallpapers_update(local_state, 909 DictionaryPrefUpdate wallpapers_update(local_state,
910 UserManager::kUserWallpapers); 910 UserManager::kUserWallpapers);
911 wallpapers_update->SetWithoutPathExpansion(username, 911 wallpapers_update->SetWithoutPathExpansion(username,
912 new base::FundamentalValue(wallpaper_index)); 912 new base::FundamentalValue(wallpaper_index));
913 ash::Shell::GetInstance()->desktop_background_controller()-> 913 ash::Shell::GetInstance()->desktop_background_controller()->
914 OnDesktopBackgroundChanged(wallpaper_index); 914 OnDesktopBackgroundChanged();
915 } 915 }
916 916
917 void UserManagerImpl::SetUserImage(const std::string& username, 917 void UserManagerImpl::SetUserImage(const std::string& username,
918 int image_index, 918 int image_index,
919 const SkBitmap& image) { 919 const SkBitmap& image) {
920 User* user = const_cast<User*>(FindUser(username)); 920 User* user = const_cast<User*>(FindUser(username));
921 // User may have been removed by now. 921 // User may have been removed by now.
922 if (user) { 922 if (user) {
923 // For existing users, a valid image index should have been set upon loading 923 // For existing users, a valid image index should have been set upon loading
924 // them from Local State. 924 // them from Local State.
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 BrowserThread::PostTask( 1200 BrowserThread::PostTask(
1201 BrowserThread::FILE, 1201 BrowserThread::FILE,
1202 FROM_HERE, 1202 FROM_HERE,
1203 base::Bind(&UserManagerImpl::DeleteUserImage, 1203 base::Bind(&UserManagerImpl::DeleteUserImage,
1204 base::Unretained(this), 1204 base::Unretained(this),
1205 image_path)); 1205 image_path));
1206 } 1206 }
1207 } 1207 }
1208 1208
1209 } // namespace chromeos 1209 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698