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

Side by Side Diff: chrome/browser/managed_mode/managed_user_service.cc

Issue 23653007: Avatar syncing for supervised users (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ... Created 7 years, 3 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 (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/managed_mode/managed_user_service.h" 5 #include "chrome/browser/managed_mode/managed_user_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 void ManagedUserService::RegisterAndInitSync( 630 void ManagedUserService::RegisterAndInitSync(
631 ManagedUserRegistrationUtility* registration_utility, 631 ManagedUserRegistrationUtility* registration_utility,
632 Profile* custodian_profile, 632 Profile* custodian_profile,
633 const std::string& managed_user_id, 633 const std::string& managed_user_id,
634 const AuthErrorCallback& callback) { 634 const AuthErrorCallback& callback) {
635 DCHECK(ProfileIsManaged()); 635 DCHECK(ProfileIsManaged());
636 DCHECK(!custodian_profile->IsManaged()); 636 DCHECK(!custodian_profile->IsManaged());
637 637
638 string16 name = UTF8ToUTF16( 638 string16 name = UTF8ToUTF16(
639 profile_->GetPrefs()->GetString(prefs::kProfileName)); 639 profile_->GetPrefs()->GetString(prefs::kProfileName));
640 ManagedUserRegistrationInfo info(name); 640 int avatar_index = profile_->GetPrefs()->GetInteger(
641 prefs::kProfileAvatarIndex);
642 ManagedUserRegistrationInfo info(name, avatar_index);
641 registration_utility->Register( 643 registration_utility->Register(
642 managed_user_id, 644 managed_user_id,
643 info, 645 info,
644 base::Bind(&ManagedUserService::OnManagedUserRegistered, 646 base::Bind(&ManagedUserService::OnManagedUserRegistered,
645 weak_ptr_factory_.GetWeakPtr(), callback, custodian_profile)); 647 weak_ptr_factory_.GetWeakPtr(), callback, custodian_profile));
646 648
647 // Fetch the custodian's profile information, to store the name. 649 // Fetch the custodian's profile information, to store the name.
648 // TODO(pamg): If --gaia-profile-info (keyword: switches::kGaiaProfileInfo) 650 // TODO(pamg): If --gaia-profile-info (keyword: switches::kGaiaProfileInfo)
649 // is ever enabled, take the name from the ProfileInfoCache instead. 651 // is ever enabled, take the name from the ProfileInfoCache instead.
650 CustodianProfileDownloaderService* profile_downloader_service = 652 CustodianProfileDownloaderService* profile_downloader_service =
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 scoped_ptr<DictionaryValue> dict(new DictionaryValue); 726 scoped_ptr<DictionaryValue> dict(new DictionaryValue);
725 727
726 // TODO(bauerb): Use sane time when ready. 728 // TODO(bauerb): Use sane time when ready.
727 dict->SetDouble(kEventTimestamp, base::Time::Now().ToJsTime()); 729 dict->SetDouble(kEventTimestamp, base::Time::Now().ToJsTime());
728 730
729 ManagedModePolicyProvider* provider = GetPolicyProvider(); 731 ManagedModePolicyProvider* provider = GetPolicyProvider();
730 // It is NULL in tests. 732 // It is NULL in tests.
731 if (provider) 733 if (provider)
732 provider->UploadItem(key, dict.PassAs<Value>()); 734 provider->UploadItem(key, dict.PassAs<Value>());
733 } 735 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698