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

Unified Diff: components/user_manager/user_manager_base.cc

Issue 1922143002: Disabled ARC for ephemeral users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 4 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
« no previous file with comments | « components/user_manager/user_manager_base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « components/user_manager/user_manager_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698