OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "ash/multi_profile_uma.h" | 10 #include "ash/multi_profile_uma.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 return ui->second.get(); | 185 return ui->second.get(); |
186 linked_ptr<UserImageManagerImpl> mgr(new UserImageManagerImpl(user_id, this)); | 186 linked_ptr<UserImageManagerImpl> mgr(new UserImageManagerImpl(user_id, this)); |
187 user_image_managers_[user_id] = mgr; | 187 user_image_managers_[user_id] = mgr; |
188 return mgr.get(); | 188 return mgr.get(); |
189 } | 189 } |
190 | 190 |
191 SupervisedUserManager* ChromeUserManagerImpl::GetSupervisedUserManager() { | 191 SupervisedUserManager* ChromeUserManagerImpl::GetSupervisedUserManager() { |
192 return supervised_user_manager_.get(); | 192 return supervised_user_manager_.get(); |
193 } | 193 } |
194 | 194 |
195 user_manager::UserList ChromeUserManagerImpl::GetUsersAdmittedForMultiProfile() | 195 user_manager::UserList ChromeUserManagerImpl::GetUsersAllowedForMultiProfile() |
196 const { | 196 const { |
197 // Supervised users are not allowed to use multi-profiles. | 197 // Supervised users are not allowed to use multi-profiles. |
198 if (GetLoggedInUsers().size() == 1 && | 198 if (GetLoggedInUsers().size() == 1 && |
199 GetPrimaryUser()->GetType() != user_manager::USER_TYPE_REGULAR) { | 199 GetPrimaryUser()->GetType() != user_manager::USER_TYPE_REGULAR) { |
200 return user_manager::UserList(); | 200 return user_manager::UserList(); |
201 } | 201 } |
202 | 202 |
203 user_manager::UserList result; | 203 user_manager::UserList result; |
204 const user_manager::UserList& users = GetUsers(); | 204 const user_manager::UserList& users = GetUsers(); |
205 for (user_manager::UserList::const_iterator it = users.begin(); | 205 for (user_manager::UserList::const_iterator it = users.begin(); |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 void ChromeUserManagerImpl::OnUserNotAllowed(const std::string& user_email) { | 1021 void ChromeUserManagerImpl::OnUserNotAllowed(const std::string& user_email) { |
1022 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the " | 1022 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the " |
1023 "current session"; | 1023 "current session"; |
1024 chromeos::ShowMultiprofilesSessionAbortedDialog(user_email); | 1024 chromeos::ShowMultiprofilesSessionAbortedDialog(user_email); |
1025 } | 1025 } |
1026 | 1026 |
1027 void ChromeUserManagerImpl::UpdateNumberOfUsers() { | 1027 void ChromeUserManagerImpl::UpdateNumberOfUsers() { |
1028 size_t users = GetLoggedInUsers().size(); | 1028 size_t users = GetLoggedInUsers().size(); |
1029 if (users) { | 1029 if (users) { |
1030 // Write the user number as UMA stat when a multi user session is possible. | 1030 // Write the user number as UMA stat when a multi user session is possible. |
1031 if ((users + GetUsersAdmittedForMultiProfile().size()) > 1) | 1031 if ((users + GetUsersAllowedForMultiProfile().size()) > 1) |
1032 ash::MultiProfileUMA::RecordUserCount(users); | 1032 ash::MultiProfileUMA::RecordUserCount(users); |
1033 } | 1033 } |
1034 | 1034 |
1035 base::debug::SetCrashKeyValue( | 1035 base::debug::SetCrashKeyValue( |
1036 crash_keys::kNumberOfUsers, | 1036 crash_keys::kNumberOfUsers, |
1037 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); | 1037 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); |
1038 } | 1038 } |
1039 | 1039 |
1040 } // namespace chromeos | 1040 } // namespace chromeos |
OLD | NEW |