Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Side by Side Diff: chrome/browser/chromeos/login/users/supervised_user_manager_impl.cc

Issue 2806283002: Revert of Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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( 214 sync_id_update->SetWithoutPathExpansion(local_user_id,
215 local_user_id, base::MakeUnique<base::Value>(sync_user_id)); 215 new base::Value(sync_user_id));
216 manager_update->SetWithoutPathExpansion( 216 manager_update->SetWithoutPathExpansion(
217 local_user_id, 217 local_user_id, new base::Value(manager->GetAccountId().GetUserEmail()));
218 base::MakeUnique<base::Value>(manager->GetAccountId().GetUserEmail()));
219 manager_name_update->SetWithoutPathExpansion( 218 manager_name_update->SetWithoutPathExpansion(
220 local_user_id, base::MakeUnique<base::Value>(manager->GetDisplayName())); 219 local_user_id, new base::Value(manager->GetDisplayName()));
221 manager_email_update->SetWithoutPathExpansion( 220 manager_email_update->SetWithoutPathExpansion(
222 local_user_id, base::MakeUnique<base::Value>(manager->display_email())); 221 local_user_id, new base::Value(manager->display_email()));
223 222
224 owner_->SaveUserDisplayName(AccountId::FromUserEmail(local_user_id), 223 owner_->SaveUserDisplayName(AccountId::FromUserEmail(local_user_id),
225 display_name); 224 display_name);
226 225
227 g_browser_process->local_state()->CommitPendingWrite(); 226 g_browser_process->local_state()->CommitPendingWrite();
228 return new_user; 227 return new_user;
229 } 228 }
230 229
231 std::string SupervisedUserManagerImpl::GetUserSyncId(const std::string& user_id) 230 std::string SupervisedUserManagerImpl::GetUserSyncId(const std::string& user_id)
232 const { 231 const {
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 492
494 DictionaryPrefUpdate manager_name_update(local_state, 493 DictionaryPrefUpdate manager_name_update(local_state,
495 kSupervisedUserManagerNames); 494 kSupervisedUserManagerNames);
496 for (base::DictionaryValue::Iterator it(*manager_ids); !it.IsAtEnd(); 495 for (base::DictionaryValue::Iterator it(*manager_ids); !it.IsAtEnd();
497 it.Advance()) { 496 it.Advance()) {
498 std::string user_id; 497 std::string user_id;
499 bool has_manager_id = it.value().GetAsString(&user_id); 498 bool has_manager_id = it.value().GetAsString(&user_id);
500 DCHECK(has_manager_id); 499 DCHECK(has_manager_id);
501 if (user_id == manager_id) { 500 if (user_id == manager_id) {
502 manager_name_update->SetWithoutPathExpansion( 501 manager_name_update->SetWithoutPathExpansion(
503 it.key(), base::MakeUnique<base::Value>(new_display_name)); 502 it.key(), new base::Value(new_display_name));
504 } 503 }
505 } 504 }
506 } 505 }
507 506
508 SupervisedUserAuthentication* SupervisedUserManagerImpl::GetAuthentication() { 507 SupervisedUserAuthentication* SupervisedUserManagerImpl::GetAuthentication() {
509 return authentication_.get(); 508 return authentication_.get();
510 } 509 }
511 510
512 void SupervisedUserManagerImpl::LoadSupervisedUserToken( 511 void SupervisedUserManagerImpl::LoadSupervisedUserToken(
513 Profile* profile, 512 Profile* profile,
(...skipping 10 matching lines...) Expand all
524 } 523 }
525 524
526 void SupervisedUserManagerImpl::ConfigureSyncWithToken( 525 void SupervisedUserManagerImpl::ConfigureSyncWithToken(
527 Profile* profile, 526 Profile* profile,
528 const std::string& token) { 527 const std::string& token) {
529 if (!token.empty()) 528 if (!token.empty())
530 SupervisedUserServiceFactory::GetForProfile(profile)->InitSync(token); 529 SupervisedUserServiceFactory::GetForProfile(profile)->InitSync(token);
531 } 530 }
532 531
533 } // namespace chromeos 532 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698