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/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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 it != init_callbacks_.end(); | 618 it != init_callbacks_.end(); |
619 ++it) { | 619 ++it) { |
620 it->Run(); | 620 it->Run(); |
621 } | 621 } |
622 } | 622 } |
623 | 623 |
624 void ManagedUserService::RegisterAndInitSync( | 624 void ManagedUserService::RegisterAndInitSync( |
625 ManagedUserRegistrationUtility* registration_utility, | 625 ManagedUserRegistrationUtility* registration_utility, |
626 Profile* custodian_profile, | 626 Profile* custodian_profile, |
627 const std::string& managed_user_id, | 627 const std::string& managed_user_id, |
| 628 bool update_avatar, |
628 const AuthErrorCallback& callback) { | 629 const AuthErrorCallback& callback) { |
629 DCHECK(ProfileIsManaged()); | 630 DCHECK(ProfileIsManaged()); |
630 DCHECK(!custodian_profile->IsManaged()); | 631 DCHECK(!custodian_profile->IsManaged()); |
631 | 632 |
632 string16 name = UTF8ToUTF16( | 633 string16 name = UTF8ToUTF16( |
633 profile_->GetPrefs()->GetString(prefs::kProfileName)); | 634 profile_->GetPrefs()->GetString(prefs::kProfileName)); |
634 int avatar_index = profile_->GetPrefs()->GetInteger( | 635 int avatar_index = profile_->GetPrefs()->GetInteger( |
635 prefs::kProfileAvatarIndex); | 636 prefs::kProfileAvatarIndex); |
636 ManagedUserRegistrationInfo info(name, avatar_index); | 637 ManagedUserRegistrationInfo info(name, avatar_index); |
637 registration_utility->Register( | 638 registration_utility->Register( |
638 managed_user_id, | 639 managed_user_id, |
| 640 update_avatar, |
639 info, | 641 info, |
640 base::Bind(&ManagedUserService::OnManagedUserRegistered, | 642 base::Bind(&ManagedUserService::OnManagedUserRegistered, |
641 weak_ptr_factory_.GetWeakPtr(), callback, custodian_profile)); | 643 weak_ptr_factory_.GetWeakPtr(), callback, custodian_profile)); |
642 | 644 |
643 // Fetch the custodian's profile information, to store the name. | 645 // Fetch the custodian's profile information, to store the name. |
644 // TODO(pamg): If --gaia-profile-info (keyword: switches::kGaiaProfileInfo) | 646 // TODO(pamg): If --gaia-profile-info (keyword: switches::kGaiaProfileInfo) |
645 // is ever enabled, take the name from the ProfileInfoCache instead. | 647 // is ever enabled, take the name from the ProfileInfoCache instead. |
646 CustodianProfileDownloaderService* profile_downloader_service = | 648 CustodianProfileDownloaderService* profile_downloader_service = |
647 CustodianProfileDownloaderServiceFactory::GetForProfile( | 649 CustodianProfileDownloaderServiceFactory::GetForProfile( |
648 custodian_profile); | 650 custodian_profile); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 key_prefix, | 720 key_prefix, |
719 base::Int64ToString(base::TimeTicks::Now().ToInternalValue())); | 721 base::Int64ToString(base::TimeTicks::Now().ToInternalValue())); |
720 | 722 |
721 scoped_ptr<DictionaryValue> dict(new DictionaryValue); | 723 scoped_ptr<DictionaryValue> dict(new DictionaryValue); |
722 | 724 |
723 // TODO(bauerb): Use sane time when ready. | 725 // TODO(bauerb): Use sane time when ready. |
724 dict->SetDouble(kEventTimestamp, base::Time::Now().ToJsTime()); | 726 dict->SetDouble(kEventTimestamp, base::Time::Now().ToJsTime()); |
725 | 727 |
726 GetSettingsService()->UploadItem(key, dict.PassAs<Value>()); | 728 GetSettingsService()->UploadItem(key, dict.PassAs<Value>()); |
727 } | 729 } |
OLD | NEW |