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

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

Issue 2757873002: Change SigninClient::CreateGaiaAuthFetcher return type to unique_ptr (Closed)
Patch Set: Created 3 years, 9 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/ubertoken_fetcher.h ('k') | ios/chrome/browser/signin/signin_client_impl.h » ('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/memory/ptr_util.h"
10 #include "base/metrics/histogram_macros.h" 11 #include "base/metrics/histogram_macros.h"
11 #include "base/rand_util.h" 12 #include "base/rand_util.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 #include "google_apis/gaia/gaia_auth_fetcher.h" 14 #include "google_apis/gaia/gaia_auth_fetcher.h"
14 #include "google_apis/gaia/gaia_constants.h" 15 #include "google_apis/gaia/gaia_constants.h"
15 #include "google_apis/gaia/google_service_auth_error.h" 16 #include "google_apis/gaia/google_service_auth_error.h"
16 #include "google_apis/gaia/oauth2_token_service.h" 17 #include "google_apis/gaia/oauth2_token_service.h"
17 18
18 namespace { 19 namespace {
19 GaiaAuthFetcher* CreateGaiaAuthFetcher( 20 std::unique_ptr<GaiaAuthFetcher> CreateGaiaAuthFetcher(
20 GaiaAuthConsumer* consumer, 21 GaiaAuthConsumer* consumer,
21 const std::string& source, 22 const std::string& source,
22 net::URLRequestContextGetter* request_context) { 23 net::URLRequestContextGetter* request_context) {
23 return new GaiaAuthFetcher(consumer, source, request_context); 24 return base::MakeUnique<GaiaAuthFetcher>(consumer, source, request_context);
24 } 25 }
25 } 26 }
26 27
27 const int UbertokenFetcher::kMaxRetries = 3; 28 const int UbertokenFetcher::kMaxRetries = 3;
28 29
29 UbertokenFetcher::UbertokenFetcher( 30 UbertokenFetcher::UbertokenFetcher(
30 OAuth2TokenService* token_service, 31 OAuth2TokenService* token_service,
31 UbertokenConsumer* consumer, 32 UbertokenConsumer* consumer,
32 const std::string& source, 33 const std::string& source,
33 net::URLRequestContextGetter* request_context) 34 net::URLRequestContextGetter* request_context)
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 gaia_auth_fetcher_.reset(); 143 gaia_auth_fetcher_.reset();
143 retry_timer_.Stop(); 144 retry_timer_.Stop();
144 145
145 OAuth2TokenService::ScopeSet scopes; 146 OAuth2TokenService::ScopeSet scopes;
146 scopes.insert(GaiaConstants::kOAuth1LoginScope); 147 scopes.insert(GaiaConstants::kOAuth1LoginScope);
147 access_token_request_ = 148 access_token_request_ =
148 token_service_->StartRequest(account_id_, scopes, this); 149 token_service_->StartRequest(account_id_, scopes, this);
149 } 150 }
150 151
151 void UbertokenFetcher::ExchangeTokens() { 152 void UbertokenFetcher::ExchangeTokens() {
152 gaia_auth_fetcher_.reset( 153 gaia_auth_fetcher_ =
153 gaia_auth_fetcher_factory_.Run(this, source_, request_context_)); 154 gaia_auth_fetcher_factory_.Run(this, source_, request_context_);
154 gaia_auth_fetcher_->StartTokenFetchForUberAuthExchange(access_token_); 155 gaia_auth_fetcher_->StartTokenFetchForUberAuthExchange(access_token_);
155 } 156 }
OLDNEW
« no previous file with comments | « google_apis/gaia/ubertoken_fetcher.h ('k') | ios/chrome/browser/signin/signin_client_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698