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

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

Issue 8698002: [cros] Profile image loaded from file is re-used if subsequent download fails. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/user_manager.cc
diff --git a/chrome/browser/chromeos/login/user_manager.cc b/chrome/browser/chromeos/login/user_manager.cc
index d507f95f05ce9278faa8298bccb1b74632e64dc3..7ff58ea45503774b0222ad5434dcd8300f84ead1 100644
--- a/chrome/browser/chromeos/login/user_manager.cc
+++ b/chrome/browser/chromeos/login/user_manager.cc
@@ -697,6 +697,13 @@ void UserManager::SetUserImage(const std::string& username,
current_user_is_new_);
bool image_changed = user->image_index() != User::kInvalidImageIndex;
user->SetImage(image, image_index);
+ // If it is the profile image of the current user, save it to
+ // |downloaded_profile_image_| so that it can be reused if the started
+ // download attempt fails.
+ if (image_index == User::kProfileImageIndex && user == logged_in_user_) {
+ downloaded_profile_image_ = image;
+ downloaded_profile_image_data_url_ = web_ui_util::GetImageDataUrl(image);
+ }
if (image_changed) {
// Unless this is first-time setting with |SetInitialUserImage|,
// send a notification about image change.
@@ -868,11 +875,6 @@ void UserManager::OnDownloadComplete(ProfileDownloader* downloader,
downloaded_profile_image_ = downloader->GetProfilePicture();
if (logged_in_user().image_index() == User::kProfileImageIndex) {
- std::string current_image_data_url =
- web_ui_util::GetImageDataUrl(logged_in_user().image());
- if (current_image_data_url == new_image_data_url)
- return;
-
VLOG(1) << "Updating profile image for logged-in user";
UMA_HISTOGRAM_ENUMERATION("UserImage.ProfileDownloadResult",
kDownloadSuccessChanged,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698