Index: chrome/browser/profiles/profile_downloader.cc |
diff --git a/chrome/browser/profiles/profile_downloader.cc b/chrome/browser/profiles/profile_downloader.cc |
index da6eccb92c2e55f1dee4994df7b482e33d1c512e..e22950956d72f3aa45b6b98c391941d4832c702a 100644 |
--- a/chrome/browser/profiles/profile_downloader.cc |
+++ b/chrome/browser/profiles/profile_downloader.cc |
@@ -172,7 +172,8 @@ bool ProfileDownloader::IsDefaultProfileImageURL(const std::string& url) const { |
} |
ProfileDownloader::ProfileDownloader(ProfileDownloaderDelegate* delegate) |
- : delegate_(delegate) { |
+ : delegate_(delegate), |
+ picture_result_(PICTURE_FAILED) { |
DCHECK(delegate_); |
} |
@@ -209,6 +210,15 @@ SkBitmap ProfileDownloader::GetProfilePicture() const { |
return profile_picture_; |
} |
+ProfileDownloader::PictureResult ProfileDownloader::GetProfilePictureResult() |
+ const { |
+ return picture_result_; |
+} |
+ |
+std::string ProfileDownloader::GetProfilePictureURL() const { |
+ return picture_url_; |
+} |
+ |
void ProfileDownloader::StartFetchingImage() { |
VLOG(1) << "Fetching user entry with token: " << auth_token_; |
user_entry_fetcher_.reset(content::URLFetcher::Create( |
@@ -243,10 +253,17 @@ void ProfileDownloader::OnURLFetchComplete(const content::URLFetcher* source) { |
return; |
} |
if (IsDefaultProfileImageURL(image_url)) { |
+ picture_result_ = PICTURE_DEFAULT; |
Ivan Korotkov
2011/11/30 14:35:44
Please add VLOG here and in the next if ()
sail
2011/11/30 19:00:23
Done.
|
+ delegate_->OnDownloadComplete(this, true); |
+ return; |
+ } |
+ if (image_url == delegate_->GetCachedPictureURL()) { |
Ivan Korotkov
2011/11/30 14:35:44
Since GetCachedPictureURL() has to return somethin
sail
2011/11/30 19:00:23
Done.
|
+ picture_result_ = PICTURE_CACHED; |
delegate_->OnDownloadComplete(this, true); |
return; |
} |
VLOG(1) << "Fetching profile image from " << image_url; |
+ picture_url_ = image_url; |
profile_image_fetcher_.reset(content::URLFetcher::Create( |
GURL(image_url), content::URLFetcher::GET, this)); |
profile_image_fetcher_->SetRequestContext( |
@@ -273,6 +290,7 @@ void ProfileDownloader::OnImageDecoded(const ImageDecoder* decoder, |
skia::ImageOperations::RESIZE_BEST, |
image_size, |
image_size); |
+ picture_result_ = PICTURE_SUCCESS; |
delegate_->OnDownloadComplete(this, true); |
} |