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

Unified Diff: components/user_manager/fake_user_manager.cc

Issue 1922143002: Disabled ARC for ephemeral users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: same 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
Index: components/user_manager/fake_user_manager.cc
diff --git a/components/user_manager/fake_user_manager.cc b/components/user_manager/fake_user_manager.cc
index 0a9689101185da3e27d7e1b2491956242703e9bd..2f310fc20359ddfe2bf9fd46e1b7118630b4d594 100644
--- a/components/user_manager/fake_user_manager.cc
+++ b/components/user_manager/fake_user_manager.cc
@@ -59,7 +59,8 @@ void FakeUserManager::RemoveUserFromList(const AccountId& account_id) {
while (it != users_.end() && (*it)->GetEmail() != account_id.GetUserEmail())
++it;
if (it != users_.end()) {
- delete *it;
+ if (active_user_ != *it)
+ delete *it;
users_.erase(it);
}
}
@@ -101,6 +102,9 @@ void FakeUserManager::UserLoggedIn(const AccountId& account_id,
}
user_manager::User* FakeUserManager::GetActiveUserInternal() const {
+ if (active_user_ != nullptr)
+ return active_user_;
+
if (!users_.empty()) {
if (active_account_id_.is_valid()) {
for (user_manager::UserList::const_iterator it = users_.begin();
@@ -155,14 +159,16 @@ bool FakeUserManager::IsKnownUser(const AccountId& account_id) const {
const user_manager::User* FakeUserManager::FindUser(
const AccountId& account_id) const {
+ if (active_user_ != nullptr && active_user_->GetAccountId() == account_id)
+ return active_user_;
+
const user_manager::UserList& users = GetUsers();
for (user_manager::UserList::const_iterator it = users.begin();
it != users.end(); ++it) {
- // TODO (alemate): Chenge this to GetAccountId(), once a real AccountId is
- // passed. crbug.com/546876
- if ((*it)->GetEmail() == account_id.GetUserEmail())
+ if ((*it)->GetAccountId() == account_id)
return *it;
}
+
return nullptr;
}
@@ -271,7 +277,7 @@ bool FakeUserManager::IsEnterpriseManaged() const {
}
bool FakeUserManager::IsDemoApp(const AccountId& account_id) const {
- return false;
+ return account_id == chromeos::login::DemoAccountId();
}
bool FakeUserManager::IsDeviceLocalAccountMarkedForRemoval(

Powered by Google App Engine
This is Rietveld 408576698