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

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

Issue 15421011: Use OAuth2 token for sync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add commandline switch to toggle between OAuth2 and ClientLogin token 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
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 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 175 // because they are transient and do not signify a failure of the signin
176 // process. 176 // process.
177 return (service->IsSyncEnabledAndLoggedIn() && 177 return (service->IsSyncEnabledAndLoggedIn() &&
178 service->IsSyncTokenAvailable() && 178 service->IsOAuthRefreshTokenAvailable() &&
179 (service->GetAuthError().state() == GoogleServiceAuthError::NONE || 179 (service->GetAuthError().state() == GoogleServiceAuthError::NONE ||
180 service->GetAuthError().state() == 180 service->GetAuthError().state() ==
181 GoogleServiceAuthError::CONNECTION_FAILED) && 181 GoogleServiceAuthError::CONNECTION_FAILED) &&
182 !service->HasUnrecoverableError()); 182 !service->HasUnrecoverableError());
183 } 183 }
184 184
185 // static 185 // static
186 SigninTracker::LoginState SigninTracker::GetSigninState( 186 SigninTracker::LoginState SigninTracker::GetSigninState(
187 Profile* profile, 187 Profile* profile,
188 GoogleServiceAuthError* error) { 188 GoogleServiceAuthError* error) {
(...skipping 28 matching lines...) Expand all
217 if (error) 217 if (error)
218 *error = signin->signin_global_error()->GetLastAuthError(); 218 *error = signin->signin_global_error()->GetLastAuthError();
219 return WAITING_FOR_GAIA_VALIDATION; 219 return WAITING_FOR_GAIA_VALIDATION;
220 } 220 }
221 221
222 if (!service || service->sync_initialized()) 222 if (!service || service->sync_initialized())
223 return SIGNIN_COMPLETE; 223 return SIGNIN_COMPLETE;
224 224
225 return SERVICES_INITIALIZING; 225 return SERVICES_INITIALIZING;
226 } 226 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/signin/signin_tracker_unittest.cc » ('j') | chrome/browser/sync/profile_sync_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698