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

Unified Diff: chrome/browser/chromeos/login/profile_image_downloader.cc

Issue 8399005: [cros] Don't succeed if user has default profile picturewq (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/login/profile_image_downloader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/profile_image_downloader.cc
diff --git a/chrome/browser/chromeos/login/profile_image_downloader.cc b/chrome/browser/chromeos/login/profile_image_downloader.cc
index 6093feff6c24ffb0280d73dfe0fbf0b355b5b0db..5a292d5041218c7d7c1071a9ee16f43b961c2396 100644
--- a/chrome/browser/chromeos/login/profile_image_downloader.cc
+++ b/chrome/browser/chromeos/login/profile_image_downloader.cc
@@ -44,6 +44,12 @@ const char kThumbnailSizeFormat[] = "s%d-c";
// Default Picasa thumbnail size.
const int kDefaultThumbnailSize = 64;
+// Path components that identify the default profile picture.
+const char* kDefaultProfileImagePathComponents[] = {
+ "/AAAAAAAAAAI/AAAAAAAAAAA/",
+ "/AAAAAAAAAA/"
+};
+
} // namespace
std::string ProfileImageDownloader::GetProfileImageURL(
@@ -105,6 +111,21 @@ std::string ProfileImageDownloader::GetProfileImageURL(
return thumbnail_url.spec();
}
+bool ProfileImageDownloader::IsDefaultProfileImageURL(
+ const std::string& url) const {
+ GURL image_url_object(url);
+ DCHECK(image_url_object.is_valid());
+ for (size_t i = 0;
+ i < arraysize(kDefaultProfileImagePathComponents);
+ ++i) {
+ const char* component =
+ kDefaultProfileImagePathComponents[i];
+ if (image_url_object.path().find(component) != std::string::npos)
Ivan Korotkov 2011/10/26 20:43:57 This will match /AAAAAAAAAA/ anywhere in the path.
whywhat 2011/10/27 13:28:10 Done.
+ return true;
+ }
+ return false;
+}
+
ProfileImageDownloader::ProfileImageDownloader(Delegate* delegate)
: delegate_(delegate) {
}
@@ -175,6 +196,11 @@ void ProfileImageDownloader::OnURLFetchComplete(
delegate_->OnDownloadFailure();
return;
}
+ if (IsDefaultProfileImageURL(image_url)) {
+ if (delegate_)
+ delegate_->OnDownloadDefaultImage();
+ return;
+ }
VLOG(1) << "Fetching profile image from " << image_url;
profile_image_fetcher_.reset(content::URLFetcher::Create(
GURL(image_url), content::URLFetcher::GET, this));
« no previous file with comments | « chrome/browser/chromeos/login/profile_image_downloader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698