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

Side by Side Diff: chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc

Issue 594163002: Restore last used user session after crash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: special case in ChromeUserManagerImpl Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/users/chrome_user_manager_impl.h" 5 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <set> 8 #include <set>
9 9
10 #include "ash/multi_profile_uma.h" 10 #include "ash/multi_profile_uma.h"
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 void ChromeUserManagerImpl::NotifyUserListChanged() { 998 void ChromeUserManagerImpl::NotifyUserListChanged() {
999 content::NotificationService::current()->Notify( 999 content::NotificationService::current()->Notify(
1000 chrome::NOTIFICATION_USER_LIST_CHANGED, 1000 chrome::NOTIFICATION_USER_LIST_CHANGED,
1001 content::Source<UserManager>(this), 1001 content::Source<UserManager>(this),
1002 content::NotificationService::NoDetails()); 1002 content::NotificationService::NoDetails());
1003 } 1003 }
1004 1004
1005 void ChromeUserManagerImpl::NotifyUserAddedToSession( 1005 void ChromeUserManagerImpl::NotifyUserAddedToSession(
1006 const user_manager::User* added_user, 1006 const user_manager::User* added_user,
1007 bool user_switch_pending) { 1007 bool user_switch_pending) {
1008 if (user_switch_pending) 1008 // Special case for user session restoration after browser crash.
1009 // We don't switch to each user session that has been restored as once all
1010 // session will be restored we'll switch to the session that has been used
1011 // before the crash.
1012 if (user_switch_pending &&
1013 !UserSessionManager::GetInstance()->UserSessionsRestoreInProgress()) {
1009 SetPendingUserSwitchID(added_user->email()); 1014 SetPendingUserSwitchID(added_user->email());
1015 }
1010 1016
1011 UpdateNumberOfUsers(); 1017 UpdateNumberOfUsers();
1012 ChromeUserManager::NotifyUserAddedToSession(added_user, user_switch_pending); 1018 ChromeUserManager::NotifyUserAddedToSession(added_user, user_switch_pending);
1013 } 1019 }
1014 1020
1015 void ChromeUserManagerImpl::OnUserNotAllowed(const std::string& user_email) { 1021 void ChromeUserManagerImpl::OnUserNotAllowed(const std::string& user_email) {
1016 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the " 1022 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the "
1017 "current session"; 1023 "current session";
1018 chromeos::ShowMultiprofilesSessionAbortedDialog(user_email); 1024 chromeos::ShowMultiprofilesSessionAbortedDialog(user_email);
1019 } 1025 }
1020 1026
1021 void ChromeUserManagerImpl::UpdateNumberOfUsers() { 1027 void ChromeUserManagerImpl::UpdateNumberOfUsers() {
1022 size_t users = GetLoggedInUsers().size(); 1028 size_t users = GetLoggedInUsers().size();
1023 if (users) { 1029 if (users) {
1024 // Write the user number as UMA stat when a multi user session is possible. 1030 // Write the user number as UMA stat when a multi user session is possible.
1025 if ((users + GetUsersAdmittedForMultiProfile().size()) > 1) 1031 if ((users + GetUsersAdmittedForMultiProfile().size()) > 1)
1026 ash::MultiProfileUMA::RecordUserCount(users); 1032 ash::MultiProfileUMA::RecordUserCount(users);
1027 } 1033 }
1028 1034
1029 base::debug::SetCrashKeyValue( 1035 base::debug::SetCrashKeyValue(
1030 crash_keys::kNumberOfUsers, 1036 crash_keys::kNumberOfUsers,
1031 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); 1037 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size()));
1032 } 1038 }
1033 1039
1034 } // namespace chromeos 1040 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/session/user_session_manager.cc ('k') | chrome/browser/chromeos/profiles/profile_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698