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

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

Issue 130983007: Creating multi profile animations for switching users and teleporting of windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Created 6 years, 10 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) 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
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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 // crosbug.com/38429. 1029 // crosbug.com/38429.
1027 LOG(ERROR) << "Wallpaper reverts to default unexpected."; 1030 LOG(ERROR) << "Wallpaper reverts to default unexpected.";
1028 DoSetDefaultWallpaper(on_finish.Pass()); 1031 DoSetDefaultWallpaper(on_finish.Pass());
1029 } 1032 }
1030 } 1033 }
1031 1034
1032 bool WallpaperManager::GetUserWallpaperInfo(const std::string& email, 1035 bool WallpaperManager::GetUserWallpaperInfo(const std::string& email,
1033 WallpaperInfo* info){ 1036 WallpaperInfo* info){
1034 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1037 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1035 1038
1036 if (UserManager::Get()->IsUserNonCryptohomeDataEphemeral(email)) { 1039 // Some unit tests come here with no browser local state attached.
1040 if (UserManager::Get()->IsUserNonCryptohomeDataEphemeral(email) ||
1041 !g_browser_process->local_state()) {
1037 // Default to the values cached in memory. 1042 // Default to the values cached in memory.
1038 *info = current_user_wallpaper_info_; 1043 *info = current_user_wallpaper_info_;
1039 1044
1040 // Ephemeral users do not save anything to local state. But we have got 1045 // Ephemeral users do not save anything to local state. But we have got
1041 // wallpaper info from memory. Returns true. 1046 // wallpaper info from memory. Returns true.
1042 return true; 1047 return true;
1043 } 1048 }
1044 1049
1045 const base::DictionaryValue* user_wallpapers = 1050 const base::DictionaryValue* user_wallpapers =
1046 g_browser_process->local_state()-> 1051 g_browser_process->local_state()->
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 User::DEFAULT, 1191 User::DEFAULT,
1187 base::Time::Now().LocalMidnight() 1192 base::Time::Now().LocalMidnight()
1188 }; 1193 };
1189 SetUserWallpaperInfo(email, info, true); 1194 SetUserWallpaperInfo(email, info, true);
1190 1195
1191 if (update_wallpaper) 1196 if (update_wallpaper)
1192 DoSetDefaultWallpaper(on_finish.Pass()); 1197 DoSetDefaultWallpaper(on_finish.Pass());
1193 return; 1198 return;
1194 } 1199 }
1195 1200
1196 // Only cache user wallpaper at login screen. 1201 // Only cache the user wallpaper at login screen and for multi profile users.
1197 if (!UserManager::Get()->IsUserLoggedIn()) { 1202 if (!UserManager::Get()->IsUserLoggedIn() ||
1198 wallpaper_cache_.insert(std::make_pair(email, wallpaper.image())); 1203 (UserManager::Get()->GetLoggedInUsers().size() > 1)) {
Nikita (slow) 2014/01/30 14:03:40 I've found that this doesn't quite work. 1. Add c
1204 wallpaper_cache_[email] = wallpaper.image();
1199 } 1205 }
1206
1200 if (update_wallpaper) { 1207 if (update_wallpaper) {
1201 ash::Shell::GetInstance()->desktop_background_controller()-> 1208 ash::Shell::GetInstance()->desktop_background_controller()->
1202 SetCustomWallpaper(wallpaper.image(), layout); 1209 SetCustomWallpaper(wallpaper.image(), layout);
1203 } 1210 }
1204 } 1211 }
1205 1212
1206 void WallpaperManager::ProcessCustomWallpaper( 1213 void WallpaperManager::ProcessCustomWallpaper(
1207 const std::string& user_id_hash, 1214 const std::string& user_id_hash,
1208 bool persistent, 1215 bool persistent,
1209 const WallpaperInfo& info, 1216 const WallpaperInfo& info,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 loading_.push_back(new WallpaperManager::PendingWallpaper( 1333 loading_.push_back(new WallpaperManager::PendingWallpaper(
1327 (delayed ? GetWallpaperLoadDelay() 1334 (delayed ? GetWallpaperLoadDelay()
1328 : base::TimeDelta::FromMilliseconds(0)), 1335 : base::TimeDelta::FromMilliseconds(0)),
1329 username)); 1336 username));
1330 pending_inactive_ = loading_.back(); 1337 pending_inactive_ = loading_.back();
1331 } 1338 }
1332 return pending_inactive_; 1339 return pending_inactive_;
1333 } 1340 }
1334 1341
1335 } // namespace chromeos 1342 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698