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

Side by Side Diff: chrome/browser/signin/chrome_signin_client.cc

Issue 1117453002: Add gaia_id to ProfileInfoCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments Created 5 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/signin/chrome_signin_client.h" 5 #include "chrome/browser/signin/chrome_signin_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 ProfileInfoCache& cache = 130 ProfileInfoCache& cache =
131 g_browser_process->profile_manager()->GetProfileInfoCache(); 131 g_browser_process->profile_manager()->GetProfileInfoCache();
132 size_t index = cache.GetIndexOfProfileWithPath(profile_->GetPath()); 132 size_t index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
133 133
134 // If sign out occurs because Sync setup was in progress and the Profile got 134 // If sign out occurs because Sync setup was in progress and the Profile got
135 // deleted, then the profile's no longer in the ProfileInfoCache. 135 // deleted, then the profile's no longer in the ProfileInfoCache.
136 if (index == std::string::npos) 136 if (index == std::string::npos)
137 return; 137 return;
138 138
139 cache.SetLocalAuthCredentialsOfProfileAtIndex(index, std::string()); 139 cache.SetLocalAuthCredentialsOfProfileAtIndex(index, std::string());
140 cache.SetUserNameOfProfileAtIndex(index, base::string16()); 140 cache.SetAuthInfoOfProfileAtIndex(index, std::string(), base::string16());
141 cache.SetProfileSigninRequiredAtIndex(index, false); 141 cache.SetProfileSigninRequiredAtIndex(index, false);
142 } 142 }
143 143
144 net::URLRequestContextGetter* ChromeSigninClient::GetURLRequestContext() { 144 net::URLRequestContextGetter* ChromeSigninClient::GetURLRequestContext() {
145 return profile_->GetRequestContext(); 145 return profile_->GetRequestContext();
146 } 146 }
147 147
148 bool ChromeSigninClient::ShouldMergeSigninCredentialsIntoCookieJar() { 148 bool ChromeSigninClient::ShouldMergeSigninCredentialsIntoCookieJar() {
149 return !switches::IsEnableAccountConsistency(); 149 return !switches::IsEnableAccountConsistency();
150 } 150 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 const net::CookieStore::CookieChangedCallback& callback) { 188 const net::CookieStore::CookieChangedCallback& callback) {
189 scoped_refptr<net::URLRequestContextGetter> context_getter = 189 scoped_refptr<net::URLRequestContextGetter> context_getter =
190 profile_->GetRequestContext(); 190 profile_->GetRequestContext();
191 DCHECK(context_getter.get()); 191 DCHECK(context_getter.get());
192 scoped_ptr<SigninCookieChangedSubscription> subscription( 192 scoped_ptr<SigninCookieChangedSubscription> subscription(
193 new SigninCookieChangedSubscription(context_getter, url, name, callback)); 193 new SigninCookieChangedSubscription(context_getter, url, name, callback));
194 return subscription.Pass(); 194 return subscription.Pass();
195 } 195 }
196 196
197 void ChromeSigninClient::OnSignedIn(const std::string& account_id, 197 void ChromeSigninClient::OnSignedIn(const std::string& account_id,
198 const std::string& gaia_id,
198 const std::string& username, 199 const std::string& username,
199 const std::string& password) { 200 const std::string& password) {
200 ProfileManager* profile_manager = g_browser_process->profile_manager(); 201 ProfileManager* profile_manager = g_browser_process->profile_manager();
201 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); 202 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
202 size_t index = cache.GetIndexOfProfileWithPath(profile_->GetPath()); 203 size_t index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
203 if (index != std::string::npos) { 204 if (index != std::string::npos) {
204 cache.SetUserNameOfProfileAtIndex(index, base::UTF8ToUTF16(username)); 205 cache.SetAuthInfoOfProfileAtIndex(index, gaia_id,
206 base::UTF8ToUTF16(username));
205 ProfileMetrics::UpdateReportedProfilesStatistics(profile_manager); 207 ProfileMetrics::UpdateReportedProfilesStatistics(profile_manager);
206 } 208 }
207 } 209 }
208 210
209 void ChromeSigninClient::PostSignedIn(const std::string& account_id, 211 void ChromeSigninClient::PostSignedIn(const std::string& account_id,
210 const std::string& username, 212 const std::string& username,
211 const std::string& password) { 213 const std::string& password) {
212 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS) 214 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
213 // Don't store password hash except when lock is available for the user. 215 // Don't store password hash except when lock is available for the user.
214 if (!password.empty() && profiles::IsLockAvailable(profile_)) 216 if (!password.empty() && profiles::IsLockAvailable(profile_))
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 return; 259 return;
258 #else 260 #else
259 // Don't bother if we don't have any kind of network connection. 261 // Don't bother if we don't have any kind of network connection.
260 if (net::NetworkChangeNotifier::IsOffline()) { 262 if (net::NetworkChangeNotifier::IsOffline()) {
261 delayed_callbacks_.push_back(callback); 263 delayed_callbacks_.push_back(callback);
262 } else { 264 } else {
263 callback.Run(); 265 callback.Run();
264 } 266 }
265 #endif 267 #endif
266 } 268 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/chrome_signin_client.h ('k') | chrome/browser/signin/signin_global_error_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698