Chromium Code Reviews| Index: chrome/browser/signin/token_service.cc |
| diff --git a/chrome/browser/signin/token_service.cc b/chrome/browser/signin/token_service.cc |
| index 3fc30397b18d52ec280d6e552b5a8f12fc041b3b..d1c9f9129dba3ae63d542f1087dc2df48ce36fa6 100644 |
| --- a/chrome/browser/signin/token_service.cc |
| +++ b/chrome/browser/signin/token_service.cc |
| @@ -100,33 +100,6 @@ void TokenService::Initialize(const char* const source, |
| } |
| } |
| -// TODO(petewil) We should refactor the token_service so it does not both |
| -// store tokens and fetch them. Move the key-value storage out of |
| -// token_service, and leave the token fetching in token_service. |
| - |
| -void TokenService::AddAuthTokenManually(const std::string& service, |
|
Andrew T Wilson (Slow)
2013/03/01 17:50:54
I think we should keep this code as it's the prima
Pete Williamson
2013/03/04 18:32:53
Done.
|
| - const std::string& auth_token) { |
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| - VLOG(1) << "Got an authorization token for " << service; |
| - token_map_[service] = auth_token; |
| - FireTokenAvailableNotification(service, auth_token); |
| - SaveAuthTokenToDB(service, auth_token); |
| - |
| -// We don't ever want to fetch OAuth2 tokens from LSO service token in case |
| -// when ChromeOS is in forced OAuth2 use mode. OAuth2 token should only |
| -// arrive into token service exclusively through UpdateCredentialsWithOAuth2. |
| -#if !defined(OS_CHROMEOS) |
| - // If we got ClientLogin token for "lso" service, and we don't already have |
| - // OAuth2 tokens, start fetching OAuth2 login scoped token pair. |
| - if (service == GaiaConstants::kLSOService && !HasOAuthLoginToken()) { |
| - int index = GetServiceIndex(service); |
| - CHECK_GE(index, 0); |
| - fetchers_[index]->StartLsoForOAuthLoginTokenExchange(auth_token); |
| - } |
| -#endif |
| -} |
| - |
| - |
| void TokenService::ResetCredentialsInMemory() { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| @@ -333,7 +306,25 @@ void TokenService::OnIssueAuthTokenSuccess(const std::string& service, |
| const std::string& auth_token) { |
| FOR_DIAGNOSTICS_OBSERVERS( |
| NotifyTokenReceivedSuccess(service, auth_token, true)); |
| - AddAuthTokenManually(service, auth_token); |
| + |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| + VLOG(1) << "Got an authorization token for " << service; |
| + token_map_[service] = auth_token; |
| + FireTokenAvailableNotification(service, auth_token); |
| + SaveAuthTokenToDB(service, auth_token); |
| + |
| +// We don't ever want to fetch OAuth2 tokens from LSO service token in case |
| +// when ChromeOS is in forced OAuth2 use mode. OAuth2 token should only |
| +// arrive into token service exclusively through UpdateCredentialsWithOAuth2. |
| +#if !defined(OS_CHROMEOS) |
| + // If we got ClientLogin token for "lso" service, and we don't already have |
| + // OAuth2 tokens, start fetching OAuth2 login scoped token pair. |
| + if (service == GaiaConstants::kLSOService && !HasOAuthLoginToken()) { |
| + int index = GetServiceIndex(service); |
| + CHECK_GE(index, 0); |
| + fetchers_[index]->StartLsoForOAuthLoginTokenExchange(auth_token); |
| + } |
| +#endif |
| } |
| void TokenService::OnIssueAuthTokenFailure(const std::string& service, |
| @@ -420,10 +411,6 @@ void TokenService::LoadTokensIntoMemory( |
| GaiaConstants::kGaiaOAuth2LoginRefreshToken); |
| LoadSingleTokenIntoMemory(db_tokens, in_memory_tokens, |
| GaiaConstants::kGaiaOAuth2LoginAccessToken); |
| - // TODO(petewil): Remove next line when we refactor key-value |
| - // storage out of token_service. |
| - LoadSingleTokenIntoMemory(db_tokens, in_memory_tokens, |
| - GaiaConstants::kObfuscatedGaiaId); |
| if (credentials_.lsid.empty() && credentials_.sid.empty()) { |
| // Look for GAIA SID and LSID tokens. If we have both, and the current |