diff options
author | avayvod@chromium.org <avayvod@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-15 13:21:48 +0000 |
---|---|---|
committer | avayvod@chromium.org <avayvod@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-15 13:21:48 +0000 |
commit | c78886e2e27cadaf4585838034c1fdc20300725c (patch) | |
tree | c773261acb778b49e66fbeb24a75d892bfb54b79 /chrome | |
parent | 8c17b4d8c161e10774a6fdac23c2eedac7c75208 (diff) | |
download | chromium_src-c78886e2e27cadaf4585838034c1fdc20300725c.zip chromium_src-c78886e2e27cadaf4585838034c1fdc20300725c.tar.gz chromium_src-c78886e2e27cadaf4585838034c1fdc20300725c.tar.bz2 |
Adding fake param to picture URL to avoid caching it on cros settings page.
BUG=chromium-os:2348
TEST=Change user picture on personal settings page and verify that the image is immediately redrawn.
R=altimofeev@chromium.org
Review URL: http://codereview.chromium.org/6693018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78202 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/chromeos/webui/user_image_source.cc | 5 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/personal_options_handler.cc | 14 |
2 files changed, 16 insertions, 3 deletions
diff --git a/chrome/browser/chromeos/webui/user_image_source.cc b/chrome/browser/chromeos/webui/user_image_source.cc index bcdaad97..9421699 100644 --- a/chrome/browser/chromeos/webui/user_image_source.cc +++ b/chrome/browser/chromeos/webui/user_image_source.cc @@ -40,7 +40,10 @@ UserImageSource::~UserImageSource() {} void UserImageSource::StartDataRequest(const std::string& path, bool is_off_the_record, int request_id) { - SendResponse(request_id, new RefCountedBytes(GetUserImage(path))); + // Strip the query param value - we only use it as a hack to ensure our + // image gets reloaded instead of being pulled from the browser cache + std::string email = path.substr(0, path.find_first_of("?")); + SendResponse(request_id, new RefCountedBytes(GetUserImage(email))); } std::string UserImageSource::GetMimeType(const std::string&) const { diff --git a/chrome/browser/ui/webui/options/personal_options_handler.cc b/chrome/browser/ui/webui/options/personal_options_handler.cc index a665d17..307092f 100644 --- a/chrome/browser/ui/webui/options/personal_options_handler.cc +++ b/chrome/browser/ui/webui/options/personal_options_handler.cc @@ -10,6 +10,8 @@ #include "base/callback.h" #include "base/path_service.h" #include "base/stl_util-inl.h" +#include "base/stringprintf.h" +#include "base/time.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "build/build_config.h" @@ -402,9 +404,17 @@ void PersonalOptionsHandler::OnPreferredDataTypesUpdated( #if defined(OS_CHROMEOS) void PersonalOptionsHandler::LoadAccountPicture(const ListValue* args) { - std::string email = chromeos::UserManager::Get()->logged_in_user().email(); + const chromeos::UserManager::User& user = + chromeos::UserManager::Get()->logged_in_user(); + std::string email = user.email(); if (!email.empty()) { - StringValue image_url(chrome::kChromeUIUserImageURL + email); + // int64 is either long or long long, but we need a certain format specifier. + long long timestamp = base::TimeTicks::Now().ToInternalValue(); + StringValue image_url( + StringPrintf("%s%s?id=%lld", + chrome::kChromeUIUserImageURL, + email.c_str(), + timestamp)); web_ui_->CallJavascriptFunction("PersonalOptions.setAccountPicture", image_url); } |