OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "google_apis/gaia/ubertoken_fetcher.h" | 5 #include "google_apis/gaia/ubertoken_fetcher.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 retry_timer_.Start(FROM_HERE, | 98 retry_timer_.Start(FROM_HERE, |
99 base::TimeDelta::FromSecondsD(backoff), | 99 base::TimeDelta::FromSecondsD(backoff), |
100 this, | 100 this, |
101 &UbertokenFetcher::ExchangeTokens); | 101 &UbertokenFetcher::ExchangeTokens); |
102 return; | 102 return; |
103 } | 103 } |
104 } else { | 104 } else { |
105 // The access token is invalid. Tell the token service. | 105 // The access token is invalid. Tell the token service. |
106 OAuth2TokenService::ScopeSet scopes; | 106 OAuth2TokenService::ScopeSet scopes; |
107 scopes.insert(GaiaConstants::kOAuth1LoginScope); | 107 scopes.insert(GaiaConstants::kOAuth1LoginScope); |
108 token_service_->InvalidateToken(account_id_, scopes, access_token_); | 108 token_service_->InvalidateAccessToken(account_id_, scopes, access_token_); |
109 | 109 |
110 // In case the access was just stale, try one more time. | 110 // In case the access was just stale, try one more time. |
111 if (!second_access_token_request_) { | 111 if (!second_access_token_request_) { |
112 second_access_token_request_ = true; | 112 second_access_token_request_ = true; |
113 RequestAccessToken(); | 113 RequestAccessToken(); |
114 return; | 114 return; |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 UMA_HISTOGRAM_ENUMERATION("Signin.UberTokenFailure", | 118 UMA_HISTOGRAM_ENUMERATION("Signin.UberTokenFailure", |
(...skipping 27 matching lines...) Expand all Loading... |
146 scopes.insert(GaiaConstants::kOAuth1LoginScope); | 146 scopes.insert(GaiaConstants::kOAuth1LoginScope); |
147 access_token_request_ = | 147 access_token_request_ = |
148 token_service_->StartRequest(account_id_, scopes, this); | 148 token_service_->StartRequest(account_id_, scopes, this); |
149 } | 149 } |
150 | 150 |
151 void UbertokenFetcher::ExchangeTokens() { | 151 void UbertokenFetcher::ExchangeTokens() { |
152 gaia_auth_fetcher_.reset( | 152 gaia_auth_fetcher_.reset( |
153 gaia_auth_fetcher_factory_.Run(this, source_, request_context_)); | 153 gaia_auth_fetcher_factory_.Run(this, source_, request_context_)); |
154 gaia_auth_fetcher_->StartTokenFetchForUberAuthExchange(access_token_); | 154 gaia_auth_fetcher_->StartTokenFetchForUberAuthExchange(access_token_); |
155 } | 155 } |
OLD | NEW |