| 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/supervised_user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/users/supervised_user_manager_impl.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 DictionaryPrefUpdate manager_update(local_state, kSupervisedUserManagers); | 204 DictionaryPrefUpdate manager_update(local_state, kSupervisedUserManagers); |
| 205 DictionaryPrefUpdate manager_name_update(local_state, | 205 DictionaryPrefUpdate manager_name_update(local_state, |
| 206 kSupervisedUserManagerNames); | 206 kSupervisedUserManagerNames); |
| 207 DictionaryPrefUpdate manager_email_update( | 207 DictionaryPrefUpdate manager_email_update( |
| 208 local_state, | 208 local_state, |
| 209 kSupervisedUserManagerDisplayEmails); | 209 kSupervisedUserManagerDisplayEmails); |
| 210 | 210 |
| 211 prefs_new_users_update->Insert(0, | 211 prefs_new_users_update->Insert(0, |
| 212 base::MakeUnique<base::Value>(local_user_id)); | 212 base::MakeUnique<base::Value>(local_user_id)); |
| 213 | 213 |
| 214 sync_id_update->SetWithoutPathExpansion(local_user_id, | 214 sync_id_update->SetWithoutPathExpansion( |
| 215 new base::Value(sync_user_id)); | 215 local_user_id, base::MakeUnique<base::Value>(sync_user_id)); |
| 216 manager_update->SetWithoutPathExpansion( | 216 manager_update->SetWithoutPathExpansion( |
| 217 local_user_id, new base::Value(manager->GetAccountId().GetUserEmail())); | 217 local_user_id, |
| 218 base::MakeUnique<base::Value>(manager->GetAccountId().GetUserEmail())); |
| 218 manager_name_update->SetWithoutPathExpansion( | 219 manager_name_update->SetWithoutPathExpansion( |
| 219 local_user_id, new base::Value(manager->GetDisplayName())); | 220 local_user_id, base::MakeUnique<base::Value>(manager->GetDisplayName())); |
| 220 manager_email_update->SetWithoutPathExpansion( | 221 manager_email_update->SetWithoutPathExpansion( |
| 221 local_user_id, new base::Value(manager->display_email())); | 222 local_user_id, base::MakeUnique<base::Value>(manager->display_email())); |
| 222 | 223 |
| 223 owner_->SaveUserDisplayName(AccountId::FromUserEmail(local_user_id), | 224 owner_->SaveUserDisplayName(AccountId::FromUserEmail(local_user_id), |
| 224 display_name); | 225 display_name); |
| 225 | 226 |
| 226 g_browser_process->local_state()->CommitPendingWrite(); | 227 g_browser_process->local_state()->CommitPendingWrite(); |
| 227 return new_user; | 228 return new_user; |
| 228 } | 229 } |
| 229 | 230 |
| 230 std::string SupervisedUserManagerImpl::GetUserSyncId(const std::string& user_id) | 231 std::string SupervisedUserManagerImpl::GetUserSyncId(const std::string& user_id) |
| 231 const { | 232 const { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 493 |
| 493 DictionaryPrefUpdate manager_name_update(local_state, | 494 DictionaryPrefUpdate manager_name_update(local_state, |
| 494 kSupervisedUserManagerNames); | 495 kSupervisedUserManagerNames); |
| 495 for (base::DictionaryValue::Iterator it(*manager_ids); !it.IsAtEnd(); | 496 for (base::DictionaryValue::Iterator it(*manager_ids); !it.IsAtEnd(); |
| 496 it.Advance()) { | 497 it.Advance()) { |
| 497 std::string user_id; | 498 std::string user_id; |
| 498 bool has_manager_id = it.value().GetAsString(&user_id); | 499 bool has_manager_id = it.value().GetAsString(&user_id); |
| 499 DCHECK(has_manager_id); | 500 DCHECK(has_manager_id); |
| 500 if (user_id == manager_id) { | 501 if (user_id == manager_id) { |
| 501 manager_name_update->SetWithoutPathExpansion( | 502 manager_name_update->SetWithoutPathExpansion( |
| 502 it.key(), new base::Value(new_display_name)); | 503 it.key(), base::MakeUnique<base::Value>(new_display_name)); |
| 503 } | 504 } |
| 504 } | 505 } |
| 505 } | 506 } |
| 506 | 507 |
| 507 SupervisedUserAuthentication* SupervisedUserManagerImpl::GetAuthentication() { | 508 SupervisedUserAuthentication* SupervisedUserManagerImpl::GetAuthentication() { |
| 508 return authentication_.get(); | 509 return authentication_.get(); |
| 509 } | 510 } |
| 510 | 511 |
| 511 void SupervisedUserManagerImpl::LoadSupervisedUserToken( | 512 void SupervisedUserManagerImpl::LoadSupervisedUserToken( |
| 512 Profile* profile, | 513 Profile* profile, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 523 } | 524 } |
| 524 | 525 |
| 525 void SupervisedUserManagerImpl::ConfigureSyncWithToken( | 526 void SupervisedUserManagerImpl::ConfigureSyncWithToken( |
| 526 Profile* profile, | 527 Profile* profile, |
| 527 const std::string& token) { | 528 const std::string& token) { |
| 528 if (!token.empty()) | 529 if (!token.empty()) |
| 529 SupervisedUserServiceFactory::GetForProfile(profile)->InitSync(token); | 530 SupervisedUserServiceFactory::GetForProfile(profile)->InitSync(token); |
| 530 } | 531 } |
| 531 | 532 |
| 532 } // namespace chromeos | 533 } // namespace chromeos |
| OLD | NEW |