| OLD | NEW |
| 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 NotifyOnLogin(); | 351 NotifyOnLogin(); |
| 352 } | 352 } |
| 353 | 353 |
| 354 void UserManagerImpl::StubUserLoggedIn() { | 354 void UserManagerImpl::StubUserLoggedIn() { |
| 355 is_current_user_ephemeral_ = true; | 355 is_current_user_ephemeral_ = true; |
| 356 logged_in_user_ = new User(kStubUser, false); | 356 logged_in_user_ = new User(kStubUser, false); |
| 357 logged_in_user_->SetImage(GetDefaultImage(kStubDefaultImageIndex), | 357 logged_in_user_->SetImage(GetDefaultImage(kStubDefaultImageIndex), |
| 358 kStubDefaultImageIndex); | 358 kStubDefaultImageIndex); |
| 359 } | 359 } |
| 360 | 360 |
| 361 void UserManagerImpl::SetLoggedInUserWallpaper() { |
| 362 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 363 |
| 364 if (!IsUserLoggedIn() || IsLoggedInAsStub()) { |
| 365 ash::Shell::GetInstance()->desktop_background_controller()-> |
| 366 SetDefaultWallpaper(ash::GetInvalidWallpaperIndex()); |
| 367 return; |
| 368 } |
| 369 UserSelected(GetLoggedInUser().email()); |
| 370 } |
| 371 |
| 361 void UserManagerImpl::UserSelected(const std::string& email) { | 372 void UserManagerImpl::UserSelected(const std::string& email) { |
| 362 if (IsKnownUser(email)) { | 373 if (IsKnownUser(email)) { |
| 363 User::WallpaperType type; | 374 User::WallpaperType type; |
| 364 int index; | 375 int index; |
| 365 GetUserWallpaperProperties(email, &type, &index); | 376 GetUserWallpaperProperties(email, &type, &index); |
| 366 if (type == User::RANDOM) { | 377 if (type == User::RANDOM) { |
| 367 // Generate a new random wallpaper index if the selected user chose | 378 // Generate a new random wallpaper index if the selected user chose |
| 368 // RANDOM wallpaper. | 379 // RANDOM wallpaper. |
| 369 index = ash::GetRandomWallpaperIndex(); | 380 index = ash::GetRandomWallpaperIndex(); |
| 370 SaveUserWallpaperProperties(email, User::RANDOM, index); | 381 SaveUserWallpaperProperties(email, User::RANDOM, index); |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 DictionaryPrefUpdate prefs_wallpapers_update(local_state, | 961 DictionaryPrefUpdate prefs_wallpapers_update(local_state, |
| 951 kUserWallpapers); | 962 kUserWallpapers); |
| 952 prefs_wallpapers_update->RemoveWithoutPathExpansion(username, NULL); | 963 prefs_wallpapers_update->RemoveWithoutPathExpansion(username, NULL); |
| 953 SaveUserWallpaperProperties(username, User::DEFAULT, index); | 964 SaveUserWallpaperProperties(username, User::DEFAULT, index); |
| 954 } | 965 } |
| 955 } | 966 } |
| 956 } | 967 } |
| 957 } | 968 } |
| 958 } | 969 } |
| 959 | 970 |
| 960 int UserManagerImpl::GetLoggedInUserWallpaperIndex() { | |
| 961 User::WallpaperType type; | |
| 962 int index; | |
| 963 GetLoggedInUserWallpaperProperties(&type, &index); | |
| 964 return index; | |
| 965 } | |
| 966 | |
| 967 void UserManagerImpl::GetLoggedInUserWallpaperProperties( | 971 void UserManagerImpl::GetLoggedInUserWallpaperProperties( |
| 968 User::WallpaperType* type, | 972 User::WallpaperType* type, |
| 969 int* index) { | 973 int* index) { |
| 970 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 974 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 971 | 975 |
| 972 if (!IsUserLoggedIn() || IsLoggedInAsStub()) { | 976 if (!IsUserLoggedIn() || IsLoggedInAsStub()) { |
| 973 *type = current_user_wallpaper_type_ = User::DEFAULT; | 977 *type = current_user_wallpaper_type_ = User::DEFAULT; |
| 974 *index = current_user_wallpaper_index_ = ash::GetInvalidWallpaperIndex(); | 978 *index = current_user_wallpaper_index_ = ash::GetInvalidWallpaperIndex(); |
| 975 return; | 979 return; |
| 976 } | 980 } |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1461 BrowserThread::PostTask( | 1465 BrowserThread::PostTask( |
| 1462 BrowserThread::FILE, | 1466 BrowserThread::FILE, |
| 1463 FROM_HERE, | 1467 FROM_HERE, |
| 1464 base::Bind(&UserManagerImpl::DeleteUserImage, | 1468 base::Bind(&UserManagerImpl::DeleteUserImage, |
| 1465 base::Unretained(this), | 1469 base::Unretained(this), |
| 1466 image_path)); | 1470 image_path)); |
| 1467 } | 1471 } |
| 1468 } | 1472 } |
| 1469 | 1473 |
| 1470 } // namespace chromeos | 1474 } // namespace chromeos |
| OLD | NEW |