| OLD | NEW |
| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return (service->IsSyncEnabledAndLoggedIn() && | 174 return (service->IsSyncEnabledAndLoggedIn() && |
| 175 service->IsSyncTokenAvailable() && | 175 service->IsSyncTokenAvailable() && |
| 176 service->GetAuthError().state() == GoogleServiceAuthError::NONE && | 176 service->GetAuthError().state() == GoogleServiceAuthError::NONE && |
| 177 !service->HasUnrecoverableError()); | 177 !service->HasUnrecoverableError()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 // static | 180 // static |
| 181 SigninTracker::LoginState SigninTracker::GetSigninState( | 181 SigninTracker::LoginState SigninTracker::GetSigninState( |
| 182 Profile* profile, | 182 Profile* profile, |
| 183 GoogleServiceAuthError* error) { | 183 GoogleServiceAuthError* error) { |
| 184 SigninManager* signin = SigninManagerFactory::GetForProfile(profile); | 184 SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile); |
| 185 if (signin->GetAuthenticatedUsername().empty()) { | 185 if (signin->GetAuthenticatedUsername().empty()) { |
| 186 // User is signed out, trigger a signin failure. | 186 // User is signed out, trigger a signin failure. |
| 187 if (error) | 187 if (error) |
| 188 *error = GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED); | 188 *error = GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED); |
| 189 return WAITING_FOR_GAIA_VALIDATION; | 189 return WAITING_FOR_GAIA_VALIDATION; |
| 190 } | 190 } |
| 191 | 191 |
| 192 // Wait until all of our services are logged in. For now this just means sync. | 192 // Wait until all of our services are logged in. For now this just means sync. |
| 193 // Long term, we should separate out service auth failures from the signin | 193 // Long term, we should separate out service auth failures from the signin |
| 194 // process, but for the current UI flow we'll validate service signin status | 194 // process, but for the current UI flow we'll validate service signin status |
| (...skipping 17 matching lines...) Expand all Loading... |
| 212 if (error) | 212 if (error) |
| 213 *error = signin->signin_global_error()->GetLastAuthError(); | 213 *error = signin->signin_global_error()->GetLastAuthError(); |
| 214 return WAITING_FOR_GAIA_VALIDATION; | 214 return WAITING_FOR_GAIA_VALIDATION; |
| 215 } | 215 } |
| 216 | 216 |
| 217 if (!service || service->sync_initialized()) | 217 if (!service || service->sync_initialized()) |
| 218 return SIGNIN_COMPLETE; | 218 return SIGNIN_COMPLETE; |
| 219 | 219 |
| 220 return SERVICES_INITIALIZING; | 220 return SERVICES_INITIALIZING; |
| 221 } | 221 } |
| OLD | NEW |