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

Unified Diff: chrome/browser/profiles/gaia_info_update_service.cc

Issue 8879036: Clear GAIA profile picture URL when signing out (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tests Created 9 years 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 | chrome/browser/profiles/gaia_info_update_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/gaia_info_update_service.cc
diff --git a/chrome/browser/profiles/gaia_info_update_service.cc b/chrome/browser/profiles/gaia_info_update_service.cc
index 2c2d06576f99d2a5389119473945d9e91f60fec0..af19e1d991b1d364c7067f17e58ca7d0604ba7b2 100644
--- a/chrome/browser/profiles/gaia_info_update_service.cc
+++ b/chrome/browser/profiles/gaia_info_update_service.cc
@@ -113,6 +113,10 @@ void GAIAInfoUpdateService::OnDownloadComplete(ProfileDownloader* downloader,
return;
cache.SetGAIANameOfProfileAtIndex(profile_index, full_name);
+ // The profile index may have changed.
+ profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
+ if (profile_index == std::string::npos)
+ return;
if (picture_status == ProfileDownloader::PICTURE_SUCCESS) {
profile_->GetPrefs()->SetString(prefs::kProfileGAIAInfoPictureURL,
picture_url);
@@ -157,7 +161,13 @@ void GAIAInfoUpdateService::OnUsernameChanged() {
if (username.empty()) {
// Unset the old user's GAIA info.
cache.SetGAIANameOfProfileAtIndex(profile_index, string16());
+ // The profile index may have changed.
+ profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
+ if (profile_index == std::string::npos)
+ return;
cache.SetGAIAPictureOfProfileAtIndex(profile_index, NULL);
+ // Unset the cached URL.
+ profile_->GetPrefs()->ClearPref(prefs::kProfileGAIAInfoPictureURL);
} else {
// Update the new user's GAIA info.
Update();
« no previous file with comments | « no previous file | chrome/browser/profiles/gaia_info_update_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698