Index: chrome/browser/managed_mode/managed_user_registration_service.cc |
=================================================================== |
--- chrome/browser/managed_mode/managed_user_registration_service.cc (revision 207746) |
+++ chrome/browser/managed_mode/managed_user_registration_service.cc (working copy) |
@@ -74,7 +74,8 @@ |
: weak_ptr_factory_(this), |
prefs_(prefs), |
token_fetcher_(token_fetcher.Pass()), |
- pending_managed_user_acknowledged_(false) { |
+ pending_managed_user_acknowledged_(false), |
+ download_profile_(NULL) { |
pref_change_registrar_.Init(prefs); |
pref_change_registrar_.Add( |
prefs::kGoogleServicesLastUsername, |
@@ -143,6 +144,18 @@ |
weak_ptr_factory_.GetWeakPtr(), info.name)); |
} |
+void ManagedUserRegistrationService::DownloadProfile( |
+ Profile* profile, |
+ const DownloadProfileCallback& callback) { |
+ if (profile_downloader_) |
Bernhard Bauer
2013/06/21 15:52:07
Should it be a DCHECK to try to download a profile
Pam (message me for reviews)
2013/06/21 16:19:09
Well, since the downloader isn't guaranteed to eve
Bernhard Bauer
2013/06/21 16:46:57
But I don't think silently returning is the correc
Pam (message me for reviews)
2013/06/21 19:20:25
Fair enough. On a second look, as far as I can tel
|
+ return; |
+ |
+ download_callback_ = callback; |
+ download_profile_ = profile; |
+ profile_downloader_.reset(new ProfileDownloader(this)); |
+ profile_downloader_->Start(); |
+} |
+ |
void ManagedUserRegistrationService::CancelPendingRegistration() { |
AbortPendingRegistration( |
false, // Don't run the callback. The error will be ignored. |
@@ -399,3 +412,39 @@ |
pending_managed_user_id_.clear(); |
pending_managed_user_acknowledged_ = false; |
} |
+ |
+bool ManagedUserRegistrationService::NeedsProfilePicture() const { |
+ return false; |
+} |
+ |
+int ManagedUserRegistrationService::GetDesiredImageSideLength() const { |
+ return 0; |
+} |
+ |
+std::string ManagedUserRegistrationService::GetCachedPictureURL() const { |
+ return std::string(); |
+} |
+ |
+Profile* ManagedUserRegistrationService::GetBrowserProfile() { |
+ DCHECK(download_profile_); |
+ return download_profile_; |
+} |
+ |
+void ManagedUserRegistrationService::OnProfileDownloadComplete() { |
+ download_callback_.Reset(); |
+ download_profile_ = NULL; |
+ profile_downloader_.reset(); |
+} |
+ |
+void ManagedUserRegistrationService::OnProfileDownloadSuccess( |
+ ProfileDownloader* downloader) { |
+ download_callback_.Run(downloader->GetProfileFullName()); |
+ OnProfileDownloadComplete(); |
+} |
+ |
+void ManagedUserRegistrationService::OnProfileDownloadFailure( |
+ ProfileDownloader* downloader, |
+ ProfileDownloaderDelegate::FailureReason reason) { |
+ // Ignore failures; proceed without the custodian's name. |
+ OnProfileDownloadComplete(); |
+} |