summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorivankr@chromium.org <ivankr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-25 11:13:45 +0000
committerivankr@chromium.org <ivankr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-25 11:13:45 +0000
commite0851ba4db3cd44cf024048a979dac1e07584925 (patch)
tree6b5223e6013dc0ca25a92ad169e6fd6cd1d7a853 /chrome
parentc4b74f1ab67a21fee79a8f60b4ab667755304e7e (diff)
downloadchromium_src-e0851ba4db3cd44cf024048a979dac1e07584925.zip
chromium_src-e0851ba4db3cd44cf024048a979dac1e07584925.tar.gz
chromium_src-e0851ba4db3cd44cf024048a979dac1e07584925.tar.bz2
[cros] Profile image loaded from file is re-used if subsequent download fails.
BUG=chromium-os:23237 TEST=Manual Review URL: http://codereview.chromium.org/8698002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111587 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/login/user_manager.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/chrome/browser/chromeos/login/user_manager.cc b/chrome/browser/chromeos/login/user_manager.cc
index d507f95..7ff58ea 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,