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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cstddef> | 9 #include <cstddef> |
10 #include <set> | 10 #include <set> |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 SetIsCurrentUserNew(true); | 795 SetIsCurrentUserNew(true); |
796 WallpaperManager::Get()->SetUserWallpaperNow(account_id); | 796 WallpaperManager::Get()->SetUserWallpaperNow(account_id); |
797 } else { | 797 } else { |
798 SetIsCurrentUserNew(false); | 798 SetIsCurrentUserNew(false); |
799 } | 799 } |
800 } | 800 } |
801 | 801 |
802 // Add the user to the front of the user list. | 802 // Add the user to the front of the user list. |
803 ListPrefUpdate prefs_users_update(GetLocalState(), kRegularUsers); | 803 ListPrefUpdate prefs_users_update(GetLocalState(), kRegularUsers); |
804 prefs_users_update->Insert( | 804 prefs_users_update->Insert( |
805 0, base::MakeUnique<base::StringValue>(account_id.GetUserEmail())); | 805 0, base::MakeUnique<base::Value>(account_id.GetUserEmail())); |
806 users_.insert(users_.begin(), active_user_); | 806 users_.insert(users_.begin(), active_user_); |
807 | 807 |
808 // Now that user is in the list, save display name. | 808 // Now that user is in the list, save display name. |
809 if (IsCurrentUserNew()) { | 809 if (IsCurrentUserNew()) { |
810 SaveUserDisplayName(GetActiveUser()->GetAccountId(), | 810 SaveUserDisplayName(GetActiveUser()->GetAccountId(), |
811 GetActiveUser()->GetDisplayName()); | 811 GetActiveUser()->GetDisplayName()); |
812 } | 812 } |
813 | 813 |
814 GetUserImageManager(account_id)->UserLoggedIn(IsCurrentUserNew(), true); | 814 GetUserImageManager(account_id)->UserLoggedIn(IsCurrentUserNew(), true); |
815 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); | 815 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 } else { | 1253 } else { |
1254 RemoveReportingUser(account_id); | 1254 RemoveReportingUser(account_id); |
1255 } | 1255 } |
1256 } | 1256 } |
1257 } | 1257 } |
1258 } | 1258 } |
1259 | 1259 |
1260 bool ChromeUserManagerImpl::ShouldReportUser(const std::string& user_id) const { | 1260 bool ChromeUserManagerImpl::ShouldReportUser(const std::string& user_id) const { |
1261 const base::ListValue& reporting_users = | 1261 const base::ListValue& reporting_users = |
1262 *(GetLocalState()->GetList(kReportingUsers)); | 1262 *(GetLocalState()->GetList(kReportingUsers)); |
1263 base::StringValue user_id_value(FullyCanonicalize(user_id)); | 1263 base::Value user_id_value(FullyCanonicalize(user_id)); |
1264 return !(reporting_users.Find(user_id_value) == reporting_users.end()); | 1264 return !(reporting_users.Find(user_id_value) == reporting_users.end()); |
1265 } | 1265 } |
1266 | 1266 |
1267 void ChromeUserManagerImpl::AddReportingUser(const AccountId& account_id) { | 1267 void ChromeUserManagerImpl::AddReportingUser(const AccountId& account_id) { |
1268 ListPrefUpdate users_update(GetLocalState(), kReportingUsers); | 1268 ListPrefUpdate users_update(GetLocalState(), kReportingUsers); |
1269 users_update->AppendIfNotPresent( | 1269 users_update->AppendIfNotPresent( |
1270 base::MakeUnique<base::StringValue>(account_id.GetUserEmail())); | 1270 base::MakeUnique<base::Value>(account_id.GetUserEmail())); |
1271 } | 1271 } |
1272 | 1272 |
1273 void ChromeUserManagerImpl::RemoveReportingUser(const AccountId& account_id) { | 1273 void ChromeUserManagerImpl::RemoveReportingUser(const AccountId& account_id) { |
1274 ListPrefUpdate users_update(GetLocalState(), kReportingUsers); | 1274 ListPrefUpdate users_update(GetLocalState(), kReportingUsers); |
1275 users_update->Remove( | 1275 users_update->Remove( |
1276 base::StringValue(FullyCanonicalize(account_id.GetUserEmail())), NULL); | 1276 base::Value(FullyCanonicalize(account_id.GetUserEmail())), NULL); |
1277 } | 1277 } |
1278 | 1278 |
1279 void ChromeUserManagerImpl::UpdateLoginState( | 1279 void ChromeUserManagerImpl::UpdateLoginState( |
1280 const user_manager::User* active_user, | 1280 const user_manager::User* active_user, |
1281 const user_manager::User* primary_user, | 1281 const user_manager::User* primary_user, |
1282 bool is_current_user_owner) const { | 1282 bool is_current_user_owner) const { |
1283 chrome_user_manager_util::UpdateLoginState(active_user, primary_user, | 1283 chrome_user_manager_util::UpdateLoginState(active_user, primary_user, |
1284 is_current_user_owner); | 1284 is_current_user_owner); |
1285 } | 1285 } |
1286 | 1286 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 break; | 1372 break; |
1373 default: | 1373 default: |
1374 NOTREACHED(); | 1374 NOTREACHED(); |
1375 break; | 1375 break; |
1376 } | 1376 } |
1377 | 1377 |
1378 return user; | 1378 return user; |
1379 } | 1379 } |
1380 | 1380 |
1381 } // namespace chromeos | 1381 } // namespace chromeos |
OLD | NEW |