Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: google_apis/gaia/ubertoken_fetcher.cc

Issue 1143323005: Refactor AO2TS to make it easier to componentize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address final comments Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « google_apis/gaia/oauth2_token_service_unittest.cc ('k') | google_apis/google_apis.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « google_apis/gaia/oauth2_token_service_unittest.cc ('k') | google_apis/google_apis.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698