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

Unified Diff: components/user_manager/user_manager_base.cc

Issue 2798343003: Merge "cros: Fix flaky owner detection" (Closed)
Patch Set: Created 3 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 054949fff927c1e80d7ccd714883c56c1a785c83..5805a9ca35b09e547c9c47458120a9de59498fab 100644
--- a/components/user_manager/user_manager_base.cc
+++ b/components/user_manager/user_manager_base.cc
@@ -242,6 +242,7 @@ void UserManagerBase::SwitchActiveUser(const AccountId& account_id) {
NotifyActiveUserHashChanged(active_user_->username_hash());
NotifyActiveUserChanged(active_user_);
+ CallUpdateLoginState();
}
void UserManagerBase::SwitchToLastActiveUser() {
@@ -508,17 +509,8 @@ void UserManagerBase::ParseUserList(const base::ListValue& users_list,
bool UserManagerBase::IsCurrentUserOwner() const {
DCHECK(task_runner_->RunsTasksOnCurrentThread());
- base::AutoLock lk(is_current_user_owner_lock_);
- return is_current_user_owner_;
-}
-
-void UserManagerBase::SetCurrentUserIsOwner(bool is_current_user_owner) {
- DCHECK(task_runner_->RunsTasksOnCurrentThread());
- {
- base::AutoLock lk(is_current_user_owner_lock_);
- is_current_user_owner_ = is_current_user_owner;
- }
- CallUpdateLoginState();
+ return !owner_account_id_.empty() && active_user_ &&
+ active_user_->GetAccountId() == owner_account_id_;
}
bool UserManagerBase::IsCurrentUserNew() const {
@@ -739,6 +731,7 @@ bool UserManagerBase::HasPendingBootstrap(const AccountId& account_id) const {
void UserManagerBase::SetOwnerId(const AccountId& owner_account_id) {
owner_account_id_ = owner_account_id;
+ CallUpdateLoginState();
}
const AccountId& UserManagerBase::GetPendingUserSwitchID() const {
@@ -1028,7 +1021,7 @@ void UserManagerBase::Initialize() {
}
void UserManagerBase::CallUpdateLoginState() {
- UpdateLoginState(active_user_, primary_user_, is_current_user_owner_);
+ UpdateLoginState(active_user_, primary_user_, IsCurrentUserOwner());
}
void UserManagerBase::SetLRUUser(User* user) {
« 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