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

Side by Side Diff: chrome/browser/profiles/gaia_info_update_service.cc

Issue 496853002: Reset gaia given name upon signout (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/profiles/gaia_info_update_service.h" 5 #include "chrome/browser/profiles/gaia_info_update_service.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 void GAIAInfoUpdateService::OnUsernameChanged(const std::string& username) { 152 void GAIAInfoUpdateService::OnUsernameChanged(const std::string& username) {
153 ProfileInfoCache& cache = 153 ProfileInfoCache& cache =
154 g_browser_process->profile_manager()->GetProfileInfoCache(); 154 g_browser_process->profile_manager()->GetProfileInfoCache();
155 size_t profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath()); 155 size_t profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
156 if (profile_index == std::string::npos) 156 if (profile_index == std::string::npos)
157 return; 157 return;
158 158
159 if (username.empty()) { 159 if (username.empty()) {
160 // Unset the old user's GAIA info. 160 // Unset the old user's GAIA info.
161 cache.SetGAIANameOfProfileAtIndex(profile_index, base::string16()); 161 cache.SetGAIANameOfProfileAtIndex(profile_index, base::string16());
162 cache.SetGAIAGivenNameOfProfileAtIndex(profile_index, base::string16());
162 // The profile index may have changed. 163 // The profile index may have changed.
163 profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath()); 164 profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
164 if (profile_index == std::string::npos) 165 if (profile_index == std::string::npos)
165 return; 166 return;
166 cache.SetGAIAPictureOfProfileAtIndex(profile_index, NULL); 167 cache.SetGAIAPictureOfProfileAtIndex(profile_index, NULL);
167 // Unset the cached URL. 168 // Unset the cached URL.
168 profile_->GetPrefs()->ClearPref(prefs::kProfileGAIAInfoPictureURL); 169 profile_->GetPrefs()->ClearPref(prefs::kProfileGAIAInfoPictureURL);
169 } else { 170 } else {
170 // Update the new user's GAIA info. 171 // Update the new user's GAIA info.
171 Update(); 172 Update();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 205
205 void GAIAInfoUpdateService::GoogleSigninSucceeded( 206 void GAIAInfoUpdateService::GoogleSigninSucceeded(
206 const std::string& username, 207 const std::string& username,
207 const std::string& password) { 208 const std::string& password) {
208 OnUsernameChanged(username); 209 OnUsernameChanged(username);
209 } 210 }
210 211
211 void GAIAInfoUpdateService::GoogleSignedOut(const std::string& username) { 212 void GAIAInfoUpdateService::GoogleSignedOut(const std::string& username) {
212 OnUsernameChanged(std::string()); 213 OnUsernameChanged(std::string());
213 } 214 }
OLDNEW
« 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