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

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

Issue 10830111: [cros] Encode user images when set from WebUI (regression fix). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes Created 8 years, 5 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
Index: chrome/browser/chromeos/login/user.cc
diff --git a/chrome/browser/chromeos/login/user.cc b/chrome/browser/chromeos/login/user.cc
index 835b0bd0693debacec38b64899d02a3e88d79214..da797c362de6f8e9208458fed64b6148c631495d 100644
--- a/chrome/browser/chromeos/login/user.cc
+++ b/chrome/browser/chromeos/login/user.cc
@@ -47,6 +47,7 @@ void User::SetImage(const UserImage& user_image, int image_index) {
user_image_ = user_image;
image_index_ = image_index;
image_is_stub_ = false;
+ DCHECK(HasDefaultImage() || user_image.has_raw_image());
}
void User::SetImageURL(const GURL& image_url) {
@@ -70,6 +71,10 @@ std::string User::GetAccountName(bool use_display_email) const {
return GetUserName(email_);
}
+bool User::HasDefaultImage() const {
+ return image_index_ >= 0 && image_index_ < kDefaultImagesCount;
+}
+
string16 User::GetDisplayName() const {
// Fallback to the email account name in case display name haven't been set.
return display_name_.empty() ?

Powered by Google App Engine
This is Rietveld 408576698