OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/wallpaper_manager.h" | 5 #include "chrome/browser/chromeos/login/wallpaper_manager.h" |
6 | 6 |
7 #include <numeric> | 7 #include <numeric> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
695 ScheduleSetUserWallpaper(email, true); | 695 ScheduleSetUserWallpaper(email, true); |
696 } | 696 } |
697 | 697 |
698 void WallpaperManager::SetUserWallpaperNow(const std::string& email) { | 698 void WallpaperManager::SetUserWallpaperNow(const std::string& email) { |
699 ScheduleSetUserWallpaper(email, false); | 699 ScheduleSetUserWallpaper(email, false); |
700 } | 700 } |
701 | 701 |
702 void WallpaperManager::ScheduleSetUserWallpaper(const std::string& email, | 702 void WallpaperManager::ScheduleSetUserWallpaper(const std::string& email, |
703 bool delayed) { | 703 bool delayed) { |
704 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 704 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
705 // Some unit tests come here without a UserManager. | |
706 if (!UserManager::IsInitialized()) | |
707 return; | |
705 // There is no visible background in kiosk mode. | 708 // There is no visible background in kiosk mode. |
706 if (UserManager::Get()->IsLoggedInAsKioskApp()) | 709 if (UserManager::Get()->IsLoggedInAsKioskApp()) |
707 return; | 710 return; |
708 // Guest user, regular user in ephemeral mode, or kiosk app. | 711 // Guest user, regular user in ephemeral mode, or kiosk app. |
709 const User* user = UserManager::Get()->FindUser(email); | 712 const User* user = UserManager::Get()->FindUser(email); |
710 if (UserManager::Get()->IsUserNonCryptohomeDataEphemeral(email) || | 713 if (UserManager::Get()->IsUserNonCryptohomeDataEphemeral(email) || |
711 (user != NULL && user->GetType() == User::USER_TYPE_KIOSK_APP)) { | 714 (user != NULL && user->GetType() == User::USER_TYPE_KIOSK_APP)) { |
712 InitInitialUserWallpaper(email, false); | 715 InitInitialUserWallpaper(email, false); |
713 GetPendingWallpaper(email, delayed)->ResetSetDefaultWallpaper(); | 716 GetPendingWallpaper(email, delayed)->ResetSetDefaultWallpaper(); |
714 return; | 717 return; |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1186 User::DEFAULT, | 1189 User::DEFAULT, |
1187 base::Time::Now().LocalMidnight() | 1190 base::Time::Now().LocalMidnight() |
1188 }; | 1191 }; |
1189 SetUserWallpaperInfo(email, info, true); | 1192 SetUserWallpaperInfo(email, info, true); |
1190 | 1193 |
1191 if (update_wallpaper) | 1194 if (update_wallpaper) |
1192 DoSetDefaultWallpaper(on_finish.Pass()); | 1195 DoSetDefaultWallpaper(on_finish.Pass()); |
1193 return; | 1196 return; |
1194 } | 1197 } |
1195 | 1198 |
1196 // Only cache user wallpaper at login screen. | 1199 // Only cache the user wallpaper at login screen and for multi profile users. |
1197 if (!UserManager::Get()->IsUserLoggedIn()) { | 1200 if (!UserManager::Get()->IsUserLoggedIn() || |
1201 (UserManager::Get()->GetLoggedInUsers().size() > 1)) { | |
1198 wallpaper_cache_.insert(std::make_pair(email, wallpaper.image())); | 1202 wallpaper_cache_.insert(std::make_pair(email, wallpaper.image())); |
bshe
2014/01/27 16:00:15
If a user changes wallpaper during multi profile s
Mr4D (OOO till 08-26)
2014/01/27 18:44:18
Done.
| |
1199 } | 1203 } |
1204 | |
1200 if (update_wallpaper) { | 1205 if (update_wallpaper) { |
1201 ash::Shell::GetInstance()->desktop_background_controller()-> | 1206 ash::Shell::GetInstance()->desktop_background_controller()-> |
1202 SetCustomWallpaper(wallpaper.image(), layout); | 1207 SetCustomWallpaper(wallpaper.image(), layout); |
1203 } | 1208 } |
1204 } | 1209 } |
1205 | 1210 |
1206 void WallpaperManager::ProcessCustomWallpaper( | 1211 void WallpaperManager::ProcessCustomWallpaper( |
1207 const std::string& user_id_hash, | 1212 const std::string& user_id_hash, |
1208 bool persistent, | 1213 bool persistent, |
1209 const WallpaperInfo& info, | 1214 const WallpaperInfo& info, |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1326 loading_.push_back(new WallpaperManager::PendingWallpaper( | 1331 loading_.push_back(new WallpaperManager::PendingWallpaper( |
1327 (delayed ? GetWallpaperLoadDelay() | 1332 (delayed ? GetWallpaperLoadDelay() |
1328 : base::TimeDelta::FromMilliseconds(0)), | 1333 : base::TimeDelta::FromMilliseconds(0)), |
1329 username)); | 1334 username)); |
1330 pending_inactive_ = loading_.back(); | 1335 pending_inactive_ = loading_.back(); |
1331 } | 1336 } |
1332 return pending_inactive_; | 1337 return pending_inactive_; |
1333 } | 1338 } |
1334 | 1339 |
1335 } // namespace chromeos | 1340 } // namespace chromeos |
OLD | NEW |