| Index: components/user_manager/user_manager_base.cc
|
| diff --git a/components/user_manager/user_manager_base.cc b/components/user_manager/user_manager_base.cc
|
| index 67215eec3753c2831a3eabb05eb2ab8a04f0c4d8..dead416c0290f7ce0a7edf7f51492bd4f098d679 100644
|
| --- a/components/user_manager/user_manager_base.cc
|
| +++ b/components/user_manager/user_manager_base.cc
|
| @@ -538,6 +538,12 @@ bool UserManagerBase::IsCurrentUserNonCryptohomeDataEphemeral() const {
|
| IsUserNonCryptohomeDataEphemeral(GetLoggedInUser()->GetAccountId());
|
| }
|
|
|
| +bool UserManagerBase::IsCurrentUserCryptohomeDataEphemeral() const {
|
| + DCHECK(task_runner_->RunsTasksOnCurrentThread());
|
| + return IsUserLoggedIn() &&
|
| + IsUserCryptohomeDataEphemeral(GetActiveUser()->GetAccountId());
|
| +}
|
| +
|
| bool UserManagerBase::CanCurrentUserLock() const {
|
| DCHECK(task_runner_->RunsTasksOnCurrentThread());
|
| return IsUserLoggedIn() && active_user_->can_lock();
|
| @@ -621,6 +627,30 @@ bool UserManagerBase::IsUserNonCryptohomeDataEphemeral(
|
| return AreEphemeralUsersEnabled() || HasBrowserRestarted();
|
| }
|
|
|
| +bool UserManagerBase::IsUserCryptohomeDataEphemeral(
|
| + const AccountId& account_id) const {
|
| + // Don't consider stub users data as ephemeral.
|
| + if (IsStubAccountId(account_id))
|
| + return false;
|
| +
|
| + // Data belonging to the guest and demo users is always ephemeral.
|
| + if (IsGuestAccountId(account_id) || IsDemoApp(account_id))
|
| + return true;
|
| +
|
| + // Data belonging to the public accounts is always ephemeral.
|
| + const User* user = FindUser(account_id);
|
| + if (user && user->GetType() == USER_TYPE_PUBLIC_ACCOUNT)
|
| + return true;
|
| +
|
| + // Ephemeral users.
|
| + if (user && user->GetType() == USER_TYPE_REGULAR &&
|
| + FindUserInList(account_id) == nullptr) {
|
| + return true;
|
| + }
|
| +
|
| + return false;
|
| +}
|
| +
|
| void UserManagerBase::AddObserver(UserManager::Observer* obs) {
|
| DCHECK(task_runner_->RunsTasksOnCurrentThread());
|
| observer_list_.AddObserver(obs);
|
|
|