Move pending_user_switch to SessionManager.
Moving session management out from UserManager for better grouping of code structure. Preparation to remove UserManager::SwitchActiveUser() family. BUG=278643115 TEST=Tryjob Change-Id: Iab2104027b4426642b5f053b858701bd61bc3f19 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6218325 Commit-Queue: Hidehiko Abe <hidehiko@chromium.org> Reviewed-by: Xiyuan Xia <xiyuan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1415754}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
c8ef31fd03
commit
ea4742f221
chrome/browser
ash
accessibility
child_accounts
file_manager
login
lock
session
users
system
download
notification
net
ssl
ui
ash
assistant
new_window
session
views
relaunch_notification
web_applications
chromeos/ash/services/bluetooth_config
components
@ -23,10 +23,6 @@ void FakeUserManagerDelegate::OverrideDirHome(const User& primary_user) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
bool FakeUserManagerDelegate::IsUserSessionRestoreInProgress() {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<UserType> FakeUserManagerDelegate::GetDeviceLocalAccountUserType(
|
||||
std::string_view email) {
|
||||
NOTIMPLEMENTED();
|
||||
|
@ -22,7 +22,6 @@ class USER_MANAGER_EXPORT FakeUserManagerDelegate
|
||||
// UserManagerImpl::Delegate:
|
||||
const std::string& GetApplicationLocale() override;
|
||||
void OverrideDirHome(const User& primary_user) override;
|
||||
bool IsUserSessionRestoreInProgress() override;
|
||||
std::optional<UserType> GetDeviceLocalAccountUserType(
|
||||
std::string_view email) override;
|
||||
void CheckProfileOnLogin(const User& user) override;
|
||||
|
@ -287,13 +287,6 @@ void UserManagerImpl::UserLoggedIn(const AccountId& account_id,
|
||||
SetIsCurrentUserNew(false);
|
||||
SendMultiUserSignInMetrics();
|
||||
|
||||
// Special case for user session restoration after browser crash.
|
||||
// We don't switch to each user session that has been restored as once all
|
||||
// session will be restored we'll switch to the session that has been used
|
||||
// before the crash.
|
||||
if (!delegate_->IsUserSessionRestoreInProgress()) {
|
||||
pending_user_switch_ = account_id;
|
||||
}
|
||||
NotifyUserAddedToSession(user);
|
||||
|
||||
return;
|
||||
@ -1291,12 +1284,6 @@ void UserManagerImpl::SetOwnerId(const AccountId& owner_account_id) {
|
||||
NotifyLoginStateUpdated();
|
||||
}
|
||||
|
||||
void UserManagerImpl::ProcessPendingUserSwitchId() {
|
||||
if (pending_user_switch_.is_valid()) {
|
||||
SwitchActiveUser(std::exchange(pending_user_switch_, EmptyAccountId()));
|
||||
}
|
||||
}
|
||||
|
||||
void UserManagerImpl::EnsureUsersLoaded() {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
if (!local_state_) {
|
||||
@ -1537,7 +1524,6 @@ bool UserManagerImpl::OnUserProfileCreated(const AccountId& account_id,
|
||||
|
||||
observer_list_.Notify(&UserManager::Observer::OnUserProfileCreated, *user);
|
||||
|
||||
ProcessPendingUserSwitchId();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -103,9 +103,6 @@ class USER_MANAGER_EXPORT UserManagerImpl : public UserManager {
|
||||
// Overrides the home directory path for the `primary_user`.
|
||||
virtual void OverrideDirHome(const User& primary_user) = 0;
|
||||
|
||||
// Returns whether user session restore is in progress.
|
||||
virtual bool IsUserSessionRestoreInProgress() = 0;
|
||||
|
||||
// Returns UserType for the DeviceLocalAccount of the given `email`.
|
||||
virtual std::optional<UserType> GetDeviceLocalAccountUserType(
|
||||
std::string_view email) = 0;
|
||||
@ -348,9 +345,6 @@ class USER_MANAGER_EXPORT UserManagerImpl : public UserManager {
|
||||
virtual void ResetOwnerId();
|
||||
void SetOwnerId(const AccountId& owner_account_id) override;
|
||||
|
||||
// If there's pending user switch, processes it.
|
||||
void ProcessPendingUserSwitchId();
|
||||
|
||||
// TODO(b/278643115): Move to private, once we migrate fake implementation
|
||||
// closer enough to the production behavior.
|
||||
void RegularUserLoggedInAsEphemeral(const AccountId& account_id,
|
||||
@ -516,10 +510,6 @@ class USER_MANAGER_EXPORT UserManagerImpl : public UserManager {
|
||||
// Time at which this object was created.
|
||||
base::TimeTicks manager_creation_time_ = base::TimeTicks::Now();
|
||||
|
||||
// ID of the user just added to the session that needs to be activated
|
||||
// as soon as user's profile is loaded.
|
||||
AccountId pending_user_switch_ = EmptyAccountId();
|
||||
|
||||
// ID of the user that was active in the previous session.
|
||||
// Preference value is stored here before first user signs in
|
||||
// because pref will be overidden once session restore starts.
|
||||
|
Reference in New Issue
Block a user