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

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

Issue 10459003: Load user custom wallpaper after browser crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit Created 8 years, 6 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 NotifyOnLogin(); 348 NotifyOnLogin();
349 } 349 }
350 350
351 void UserManagerImpl::StubUserLoggedIn() { 351 void UserManagerImpl::StubUserLoggedIn() {
352 is_current_user_ephemeral_ = true; 352 is_current_user_ephemeral_ = true;
353 logged_in_user_ = new User(kStubUser, false); 353 logged_in_user_ = new User(kStubUser, false);
354 logged_in_user_->SetImage(GetDefaultImage(kStubDefaultImageIndex), 354 logged_in_user_->SetImage(GetDefaultImage(kStubDefaultImageIndex),
355 kStubDefaultImageIndex); 355 kStubDefaultImageIndex);
356 } 356 }
357 357
358 void UserManagerImpl::SetLoggedInUserWallpaper() {
359 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
360
361 if (!IsUserLoggedIn() || IsLoggedInAsStub()) {
362 ash::Shell::GetInstance()->desktop_background_controller()->
363 SetDefaultWallpaper(ash::GetInvalidWallpaperIndex());
364 return;
365 }
366 UserSelected(GetLoggedInUser().email());
367 }
368
358 void UserManagerImpl::UserSelected(const std::string& email) { 369 void UserManagerImpl::UserSelected(const std::string& email) {
359 if (IsKnownUser(email)) { 370 if (IsKnownUser(email)) {
360 User::WallpaperType type; 371 User::WallpaperType type;
361 int index; 372 int index;
362 GetUserWallpaperProperties(email, &type, &index); 373 GetUserWallpaperProperties(email, &type, &index);
363 if (type == User::RANDOM) { 374 if (type == User::RANDOM) {
364 // Generate a new random wallpaper index if the selected user chose 375 // Generate a new random wallpaper index if the selected user chose
365 // RANDOM wallpaper. 376 // RANDOM wallpaper.
366 index = ash::GetRandomWallpaperIndex(); 377 index = ash::GetRandomWallpaperIndex();
367 SaveUserWallpaperProperties(email, User::RANDOM, index); 378 SaveUserWallpaperProperties(email, User::RANDOM, index);
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 DictionaryPrefUpdate prefs_wallpapers_update(local_state, 944 DictionaryPrefUpdate prefs_wallpapers_update(local_state,
934 kUserWallpapers); 945 kUserWallpapers);
935 prefs_wallpapers_update->RemoveWithoutPathExpansion(username, NULL); 946 prefs_wallpapers_update->RemoveWithoutPathExpansion(username, NULL);
936 SaveUserWallpaperProperties(username, User::DEFAULT, index); 947 SaveUserWallpaperProperties(username, User::DEFAULT, index);
937 } 948 }
938 } 949 }
939 } 950 }
940 } 951 }
941 } 952 }
942 953
943 int UserManagerImpl::GetLoggedInUserWallpaperIndex() {
944 User::WallpaperType type;
945 int index;
946 GetLoggedInUserWallpaperProperties(&type, &index);
947 return index;
948 }
949
950 void UserManagerImpl::GetLoggedInUserWallpaperProperties( 954 void UserManagerImpl::GetLoggedInUserWallpaperProperties(
951 User::WallpaperType* type, 955 User::WallpaperType* type,
952 int* index) { 956 int* index) {
953 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 957 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
954 958
955 if (!IsUserLoggedIn() || IsLoggedInAsStub()) { 959 if (!IsUserLoggedIn() || IsLoggedInAsStub()) {
956 *type = current_user_wallpaper_type_ = User::DEFAULT; 960 *type = current_user_wallpaper_type_ = User::DEFAULT;
957 *index = current_user_wallpaper_index_ = ash::GetInvalidWallpaperIndex(); 961 *index = current_user_wallpaper_index_ = ash::GetInvalidWallpaperIndex();
958 return; 962 return;
959 } 963 }
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 BrowserThread::PostTask( 1447 BrowserThread::PostTask(
1444 BrowserThread::FILE, 1448 BrowserThread::FILE,
1445 FROM_HERE, 1449 FROM_HERE,
1446 base::Bind(&UserManagerImpl::DeleteUserImage, 1450 base::Bind(&UserManagerImpl::DeleteUserImage,
1447 base::Unretained(this), 1451 base::Unretained(this),
1448 image_path)); 1452 image_path));
1449 } 1453 }
1450 } 1454 }
1451 1455
1452 } // namespace chromeos 1456 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698