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

Unified Diff: chrome/browser/chromeos/login/user_manager_impl.cc

Issue 10207030: Asynchronously load wallpapers when user pod is selected. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/user_manager_impl.cc
diff --git a/chrome/browser/chromeos/login/user_manager_impl.cc b/chrome/browser/chromeos/login/user_manager_impl.cc
index a004cc9adf88ea1ca21497bc0b12c834f340c121..e2a0e08c1337f9d7182c514483e2f359c3bdbfc5 100644
--- a/chrome/browser/chromeos/login/user_manager_impl.cc
+++ b/chrome/browser/chromeos/login/user_manager_impl.cc
@@ -448,6 +448,16 @@ void UserManagerImpl::StubUserLoggedIn() {
kStubDefaultImageIndex);
}
+void UserManagerImpl::UserSelected(const std::string& email) {
+ if (email == kGuestUser) {
Nikita (slow) 2012/04/25 16:47:48 At this point we might ignore email == kGuestUser
bshe 2012/04/25 23:54:43 Done.
+ ash::Shell::GetInstance()->desktop_background_controller()->
+ SetGuestWallpaper();
+ } else if (IsKnownUser(email)) {
+ ash::Shell::GetInstance()->desktop_background_controller()->
+ SetDefaultWallpaper(FindUserWallpaperIndex(email));
+ }
+}
+
void UserManagerImpl::RemoveUser(const std::string& email,
RemoveUserDelegate* delegate) {
if (!IsKnownUser(email))
@@ -882,6 +892,20 @@ const User* UserManagerImpl::FindUserInList(const std::string& email) const {
return NULL;
}
+int UserManagerImpl::FindUserWallpaperIndex(const std::string& email) {
+ PrefService* local_state = g_browser_process->local_state();
+ const DictionaryValue* user_wallpapers =
+ local_state->GetDictionary(UserManager::kUserWallpapers);
+ int index;
+ if (!user_wallpapers->GetIntegerWithoutPathExpansion(email, &index))
+ index = current_user_wallpaper_index_;
+ if (index < 0 || index >= ash::GetWallpaperCount()) {
+ index = ash::GetDefaultWallpaperIndex();
+ SaveUserWallpaperIndex(index);
+ }
+ return index;
+}
+
void UserManagerImpl::NotifyOnLogin() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
content::NotificationService::current()->Notify(
@@ -944,19 +968,7 @@ int UserManagerImpl::GetUserWallpaperIndex() {
const chromeos::User& user = GetLoggedInUser();
std::string username = user.email();
DCHECK(!username.empty());
-
- PrefService* local_state = g_browser_process->local_state();
- const DictionaryValue* user_wallpapers =
- local_state->GetDictionary(UserManager::kUserWallpapers);
- int index;
- if (!user_wallpapers->GetIntegerWithoutPathExpansion(username, &index))
- index = current_user_wallpaper_index_;
-
- if (index < 0 || index >= ash::GetWallpaperCount()) {
- index = ash::GetDefaultWallpaperIndex();
- SaveUserWallpaperIndex(index);
- }
- return index;
+ return FindUserWallpaperIndex(username);
}
void UserManagerImpl::SaveUserWallpaperIndex(int wallpaper_index) {

Powered by Google App Engine
This is Rietveld 408576698