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

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

Issue 16173006: No longer trigger signin errors on connection_failed for sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | chrome/browser/signin/signin_tracker_unittest.cc » ('j') | 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/signin/signin_tracker.h" 5 #include "chrome/browser/signin/signin_tracker.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/signin/signin_manager.h" 8 #include "chrome/browser/signin/signin_manager.h"
9 #include "chrome/browser/signin/signin_manager_factory.h" 9 #include "chrome/browser/signin/signin_manager_factory.h"
10 #include "chrome/browser/signin/token_service.h" 10 #include "chrome/browser/signin/token_service.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 // static 165 // static
166 bool SigninTracker::AreServicesSignedIn(Profile* profile) { 166 bool SigninTracker::AreServicesSignedIn(Profile* profile) {
167 if (!AreServiceTokensLoaded(profile)) 167 if (!AreServiceTokensLoaded(profile))
168 return false; 168 return false;
169 // Don't care about the sync state if sync is disabled by policy. 169 // Don't care about the sync state if sync is disabled by policy.
170 if (!profile->IsSyncAccessible()) 170 if (!profile->IsSyncAccessible())
171 return true; 171 return true;
172 ProfileSyncService* service = 172 ProfileSyncService* service =
173 ProfileSyncServiceFactory::GetForProfile(profile); 173 ProfileSyncServiceFactory::GetForProfile(profile);
174 // Check the sync service state - we ignore CONNECTION_FAILED errors here
175 // because they are transient and do not signify a failure of the signin
176 // process.
174 return (service->IsSyncEnabledAndLoggedIn() && 177 return (service->IsSyncEnabledAndLoggedIn() &&
175 service->IsSyncTokenAvailable() && 178 service->IsSyncTokenAvailable() &&
176 service->GetAuthError().state() == GoogleServiceAuthError::NONE && 179 (service->GetAuthError().state() == GoogleServiceAuthError::NONE ||
180 service->GetAuthError().state() ==
181 GoogleServiceAuthError::CONNECTION_FAILED) &&
177 !service->HasUnrecoverableError()); 182 !service->HasUnrecoverableError());
178 } 183 }
179 184
180 // static 185 // static
181 SigninTracker::LoginState SigninTracker::GetSigninState( 186 SigninTracker::LoginState SigninTracker::GetSigninState(
182 Profile* profile, 187 Profile* profile,
183 GoogleServiceAuthError* error) { 188 GoogleServiceAuthError* error) {
184 SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile); 189 SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile);
185 if (signin->GetAuthenticatedUsername().empty()) { 190 if (signin->GetAuthenticatedUsername().empty()) {
186 // User is signed out, trigger a signin failure. 191 // User is signed out, trigger a signin failure.
(...skipping 25 matching lines...) Expand all
212 if (error) 217 if (error)
213 *error = signin->signin_global_error()->GetLastAuthError(); 218 *error = signin->signin_global_error()->GetLastAuthError();
214 return WAITING_FOR_GAIA_VALIDATION; 219 return WAITING_FOR_GAIA_VALIDATION;
215 } 220 }
216 221
217 if (!service || service->sync_initialized()) 222 if (!service || service->sync_initialized())
218 return SIGNIN_COMPLETE; 223 return SIGNIN_COMPLETE;
219 224
220 return SERVICES_INITIALIZING; 225 return SERVICES_INITIALIZING;
221 } 226 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/signin/signin_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698