OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/oauth2_token_service.h" | 5 #include "chrome/browser/signin/oauth2_token_service.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 if (type == chrome::NOTIFICATION_TOKEN_AVAILABLE) { | 513 if (type == chrome::NOTIFICATION_TOKEN_AVAILABLE) { |
514 TokenService::TokenAvailableDetails* tok_details = | 514 TokenService::TokenAvailableDetails* tok_details = |
515 content::Details<TokenService::TokenAvailableDetails>(details).ptr(); | 515 content::Details<TokenService::TokenAvailableDetails>(details).ptr(); |
516 if (tok_details->service() != GaiaConstants::kGaiaOAuth2LoginRefreshToken) | 516 if (tok_details->service() != GaiaConstants::kGaiaOAuth2LoginRefreshToken) |
517 return; | 517 return; |
518 } | 518 } |
519 // The GaiaConstants::kGaiaOAuth2LoginRefreshToken token is used to create | 519 // The GaiaConstants::kGaiaOAuth2LoginRefreshToken token is used to create |
520 // OAuth2 access tokens. If this token either changes or is cleared, any | 520 // OAuth2 access tokens. If this token either changes or is cleared, any |
521 // available tokens must be invalidated. | 521 // available tokens must be invalidated. |
522 token_cache_.clear(); | 522 token_cache_.clear(); |
523 UpdateAuthError(GoogleServiceAuthError::None()); | 523 UpdateAuthError(GoogleServiceAuthError::AuthErrorNone()); |
524 } | 524 } |
525 | 525 |
526 void OAuth2TokenService::UpdateAuthError(const GoogleServiceAuthError& error) { | 526 void OAuth2TokenService::UpdateAuthError(const GoogleServiceAuthError& error) { |
527 // Do not report connection errors as these are not actually auth errors. | 527 // Do not report connection errors as these are not actually auth errors. |
528 // We also want to avoid masking a "real" auth error just because we | 528 // We also want to avoid masking a "real" auth error just because we |
529 // subsequently get a transient network error. | 529 // subsequently get a transient network error. |
530 if (error.state() == GoogleServiceAuthError::CONNECTION_FAILED) | 530 if (error.state() == GoogleServiceAuthError::CONNECTION_FAILED) |
531 return; | 531 return; |
532 | 532 |
533 if (error.state() != last_auth_error_.state()) { | 533 if (error.state() != last_auth_error_.state()) { |
534 last_auth_error_ = error; | 534 last_auth_error_ = error; |
535 SigninManagerFactory::GetForProfile(profile_)->signin_global_error()-> | 535 SigninManagerFactory::GetForProfile(profile_)->signin_global_error()-> |
536 AuthStatusChanged(); | 536 AuthStatusChanged(); |
537 } | 537 } |
538 } | 538 } |
539 | 539 |
540 GoogleServiceAuthError OAuth2TokenService::GetAuthStatus() const { | 540 GoogleServiceAuthError OAuth2TokenService::GetAuthStatus() const { |
541 return last_auth_error_; | 541 return last_auth_error_; |
542 } | 542 } |
OLD | NEW |