Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/user_manager_impl.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1163 local_state->GetList(kRegularUsers); | 1163 local_state->GetList(kRegularUsers); |
| 1164 const base::ListValue* prefs_public_accounts = | 1164 const base::ListValue* prefs_public_accounts = |
| 1165 local_state->GetList(kPublicAccounts); | 1165 local_state->GetList(kPublicAccounts); |
| 1166 const base::DictionaryValue* prefs_display_names = | 1166 const base::DictionaryValue* prefs_display_names = |
| 1167 local_state->GetDictionary(kUserDisplayName); | 1167 local_state->GetDictionary(kUserDisplayName); |
| 1168 const base::DictionaryValue* prefs_given_names = | 1168 const base::DictionaryValue* prefs_given_names = |
| 1169 local_state->GetDictionary(kUserGivenName); | 1169 local_state->GetDictionary(kUserGivenName); |
| 1170 const base::DictionaryValue* prefs_display_emails = | 1170 const base::DictionaryValue* prefs_display_emails = |
| 1171 local_state->GetDictionary(kUserDisplayEmail); | 1171 local_state->GetDictionary(kUserDisplayEmail); |
| 1172 | 1172 |
| 1173 // Load public accounts first. | |
|
bartfab (slow)
2014/02/19 14:24:22
Nit: We call them "public sessions" now. Could you
Nikita (slow)
2014/02/19 14:34:59
Done.
| |
| 1174 std::vector<std::string> public_accounts; | |
| 1175 std::set<std::string> public_accounts_set; | |
| 1176 ParseUserList(*prefs_public_accounts, std::set<std::string>(), | |
| 1177 &public_accounts, &public_accounts_set); | |
| 1178 for (std::vector<std::string>::const_iterator it = public_accounts.begin(); | |
| 1179 it != public_accounts.end(); ++it) { | |
| 1180 users_.push_back(User::CreatePublicAccountUser(*it)); | |
| 1181 UpdatePublicAccountDisplayName(*it); | |
| 1182 } | |
| 1183 | |
| 1173 // Load regular users and locally managed users. | 1184 // Load regular users and locally managed users. |
| 1174 std::vector<std::string> regular_users; | 1185 std::vector<std::string> regular_users; |
| 1175 std::set<std::string> regular_users_set; | 1186 std::set<std::string> regular_users_set; |
| 1176 ParseUserList(*prefs_regular_users, std::set<std::string>(), | 1187 ParseUserList(*prefs_regular_users, public_accounts_set, |
| 1177 ®ular_users, ®ular_users_set); | 1188 ®ular_users, ®ular_users_set); |
| 1178 for (std::vector<std::string>::const_iterator it = regular_users.begin(); | 1189 for (std::vector<std::string>::const_iterator it = regular_users.begin(); |
| 1179 it != regular_users.end(); ++it) { | 1190 it != regular_users.end(); ++it) { |
| 1180 User* user = NULL; | 1191 User* user = NULL; |
| 1181 const std::string domain = gaia::ExtractDomainName(*it); | 1192 const std::string domain = gaia::ExtractDomainName(*it); |
| 1182 if (domain == UserManager::kLocallyManagedUserDomain) | 1193 if (domain == UserManager::kLocallyManagedUserDomain) |
| 1183 user = User::CreateLocallyManagedUser(*it); | 1194 user = User::CreateLocallyManagedUser(*it); |
| 1184 else | 1195 else |
| 1185 user = User::CreateRegularUser(*it); | 1196 user = User::CreateRegularUser(*it); |
| 1186 user->set_oauth_token_status(LoadUserOAuthStatus(*it)); | 1197 user->set_oauth_token_status(LoadUserOAuthStatus(*it)); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1198 user->set_given_name(given_name); | 1209 user->set_given_name(given_name); |
| 1199 } | 1210 } |
| 1200 | 1211 |
| 1201 std::string display_email; | 1212 std::string display_email; |
| 1202 if (prefs_display_emails->GetStringWithoutPathExpansion(*it, | 1213 if (prefs_display_emails->GetStringWithoutPathExpansion(*it, |
| 1203 &display_email)) { | 1214 &display_email)) { |
| 1204 user->set_display_email(display_email); | 1215 user->set_display_email(display_email); |
| 1205 } | 1216 } |
| 1206 } | 1217 } |
| 1207 | 1218 |
| 1208 // Load public accounts. | |
| 1209 std::vector<std::string> public_accounts; | |
| 1210 std::set<std::string> public_accounts_set; | |
| 1211 ParseUserList(*prefs_public_accounts, regular_users_set, | |
| 1212 &public_accounts, &public_accounts_set); | |
| 1213 for (std::vector<std::string>::const_iterator it = public_accounts.begin(); | |
| 1214 it != public_accounts.end(); ++it) { | |
| 1215 users_.push_back(User::CreatePublicAccountUser(*it)); | |
| 1216 UpdatePublicAccountDisplayName(*it); | |
| 1217 } | |
| 1218 user_loading_stage_ = STAGE_LOADED; | 1219 user_loading_stage_ = STAGE_LOADED; |
| 1219 | 1220 |
| 1220 for (UserList::iterator ui = users_.begin(), ue = users_.end(); | 1221 for (UserList::iterator ui = users_.begin(), ue = users_.end(); |
| 1221 ui != ue; ++ui) { | 1222 ui != ue; ++ui) { |
| 1222 GetUserImageManager((*ui)->email())->LoadUserImage(); | 1223 GetUserImageManager((*ui)->email())->LoadUserImage(); |
| 1223 } | 1224 } |
| 1224 } | 1225 } |
| 1225 | 1226 |
| 1226 void UserManagerImpl::RetrieveTrustedDevicePolicies() { | 1227 void UserManagerImpl::RetrieveTrustedDevicePolicies() { |
| 1227 ephemeral_users_enabled_ = false; | 1228 ephemeral_users_enabled_ = false; |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2001 if (User* user = FindUserAndModify(user_id)) | 2002 if (User* user = FindUserAndModify(user_id)) |
| 2002 user->SetAccountLocale(resolved_locale); | 2003 user->SetAccountLocale(resolved_locale); |
| 2003 } | 2004 } |
| 2004 | 2005 |
| 2005 void UserManagerImpl::UpdateNumberOfUsers() { | 2006 void UserManagerImpl::UpdateNumberOfUsers() { |
| 2006 base::debug::SetCrashKeyValue(crash_keys::kNumberOfUsers, | 2007 base::debug::SetCrashKeyValue(crash_keys::kNumberOfUsers, |
| 2007 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); | 2008 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); |
| 2008 } | 2009 } |
| 2009 | 2010 |
| 2010 } // namespace chromeos | 2011 } // namespace chromeos |
| OLD | NEW |