| 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 5fa2dd4dd51e46cb3b0d08d170d5313465556f9a..06b702660f515332b24748a485f96092708640c0 100644
|
| --- a/components/user_manager/user_manager_base.cc
|
| +++ b/components/user_manager/user_manager_base.cc
|
| @@ -218,7 +218,7 @@ void UserManagerBase::UserLoggedIn(const std::string& user_id,
|
|
|
| if (!primary_user_) {
|
| primary_user_ = active_user_;
|
| - if (primary_user_->GetType() == USER_TYPE_REGULAR)
|
| + if (primary_user_->IsRegular())
|
| SendRegularUserLoginMetrics(user_id);
|
| }
|
|
|
| @@ -226,8 +226,7 @@ void UserManagerBase::UserLoggedIn(const std::string& user_id,
|
| "UserManager.LoginUserType", active_user_->GetType(), NUM_USER_TYPES);
|
|
|
| GetLocalState()->SetString(
|
| - kLastLoggedInRegularUser,
|
| - (active_user_->GetType() == USER_TYPE_REGULAR) ? user_id : "");
|
| + kLastLoggedInRegularUser, active_user_->IsRegular() ? user_id : "");
|
|
|
| NotifyOnLogin();
|
| PerformPostUserLoggedInActions(browser_restart);
|
| @@ -247,7 +246,7 @@ void UserManagerBase::SwitchActiveUser(const std::string& user_id) {
|
| NOTREACHED() << "Switching to a user that is not logged in";
|
| return;
|
| }
|
| - if (user->GetType() != USER_TYPE_REGULAR) {
|
| + if (!user->IsRegular()) {
|
| NOTREACHED() << "Switching to a non-regular user";
|
| return;
|
| }
|
| @@ -553,7 +552,13 @@ bool UserManagerBase::IsUserLoggedIn() const {
|
|
|
| bool UserManagerBase::IsLoggedInAsRegularUser() const {
|
| DCHECK(task_runner_->RunsTasksOnCurrentThread());
|
| - return IsUserLoggedIn() && active_user_->GetType() == USER_TYPE_REGULAR;
|
| + return IsUserLoggedIn() && active_user_->IsRegular();
|
| +}
|
| +
|
| +bool UserManagerBase::IsLoggedInAsRegularSupervisedUser() const {
|
| + DCHECK(task_runner_->RunsTasksOnCurrentThread());
|
| + return IsUserLoggedIn() && active_user_->GetType() ==
|
| + USER_TYPE_REGULAR_SUPERVISED;
|
| }
|
|
|
| bool UserManagerBase::IsLoggedInAsDemoUser() const {
|
| @@ -659,10 +664,8 @@ void UserManagerBase::NotifyLocalStateChanged() {
|
|
|
| bool UserManagerBase::CanUserBeRemoved(const User* user) const {
|
| // Only regular and supervised users are allowed to be manually removed.
|
| - if (!user || (user->GetType() != USER_TYPE_REGULAR &&
|
| - user->GetType() != USER_TYPE_SUPERVISED)) {
|
| + if (!user || (!user->IsRegular() && !user->IsSupervised()))
|
| return false;
|
| - }
|
|
|
| // Sanity check: we must not remove single user unless it's an enterprise
|
| // device. This check may seem redundant at a first sight because
|
| @@ -922,10 +925,8 @@ User* UserManagerBase::RemoveRegularOrSupervisedUserFromList(
|
| user = *it;
|
| it = users_.erase(it);
|
| } else {
|
| - if ((*it)->GetType() == USER_TYPE_REGULAR ||
|
| - (*it)->GetType() == USER_TYPE_SUPERVISED) {
|
| + if ((*it)->IsRegular() || (*it)->IsSupervised())
|
| prefs_users_update->Append(new base::StringValue(user_email));
|
| - }
|
| ++it;
|
| }
|
| }
|
|
|