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/rand_util.h" | 10 #include "base/rand_util.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 retry_timer_.Start(FROM_HERE, | 62 retry_timer_.Start(FROM_HERE, |
63 base::TimeDelta::FromSecondsD(backoff), | 63 base::TimeDelta::FromSecondsD(backoff), |
64 this, | 64 this, |
65 &UbertokenFetcher::ExchangeTokens); | 65 &UbertokenFetcher::ExchangeTokens); |
66 return; | 66 return; |
67 } | 67 } |
68 } else { | 68 } else { |
69 // The access token is invalid. Tell the token service. | 69 // The access token is invalid. Tell the token service. |
70 OAuth2TokenService::ScopeSet scopes; | 70 OAuth2TokenService::ScopeSet scopes; |
71 scopes.insert(GaiaConstants::kOAuth1LoginScope); | 71 scopes.insert(GaiaConstants::kOAuth1LoginScope); |
72 token_service_->InvalidateToken(account_id_, scopes, access_token_); | 72 token_service_->InvalidateAccessToken(account_id_, scopes, access_token_); |
73 | 73 |
74 // In case the access was just stale, try one more time. | 74 // In case the access was just stale, try one more time. |
75 if (!second_access_token_request_) { | 75 if (!second_access_token_request_) { |
76 second_access_token_request_ = true; | 76 second_access_token_request_ = true; |
77 RequestAccessToken(); | 77 RequestAccessToken(); |
78 return; | 78 return; |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 consumer_->OnUbertokenFailure(error); | 82 consumer_->OnUbertokenFailure(error); |
(...skipping 26 matching lines...) Expand all Loading... |
109 access_token_request_ = | 109 access_token_request_ = |
110 token_service_->StartRequest(account_id_, scopes, this); | 110 token_service_->StartRequest(account_id_, scopes, this); |
111 } | 111 } |
112 | 112 |
113 void UbertokenFetcher::ExchangeTokens() { | 113 void UbertokenFetcher::ExchangeTokens() { |
114 gaia_auth_fetcher_.reset(new GaiaAuthFetcher(this, | 114 gaia_auth_fetcher_.reset(new GaiaAuthFetcher(this, |
115 source_, | 115 source_, |
116 request_context_)); | 116 request_context_)); |
117 gaia_auth_fetcher_->StartTokenFetchForUberAuthExchange(access_token_); | 117 gaia_auth_fetcher_->StartTokenFetchForUberAuthExchange(access_token_); |
118 } | 118 } |
OLD | NEW |