Chromium Code Reviews| Index: google_apis/gaia/ubertoken_fetcher.cc |
| diff --git a/chrome/browser/signin/ubertoken_fetcher.cc b/google_apis/gaia/ubertoken_fetcher.cc |
| similarity index 70% |
| rename from chrome/browser/signin/ubertoken_fetcher.cc |
| rename to google_apis/gaia/ubertoken_fetcher.cc |
| index ef195915c58267be52d6bc338710891be2d7fe6d..9c1e67eceba612f60602617973374763c1e32616 100644 |
| --- a/chrome/browser/signin/ubertoken_fetcher.cc |
| +++ b/google_apis/gaia/ubertoken_fetcher.cc |
| @@ -2,26 +2,28 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome/browser/signin/ubertoken_fetcher.h" |
| +#include "google_apis/gaia/ubertoken_fetcher.h" |
| #include <vector> |
| #include "base/logging.h" |
| -#include "chrome/browser/profiles/profile.h" |
| -#include "chrome/browser/signin/profile_oauth2_token_service.h" |
| -#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| #include "google_apis/gaia/gaia_auth_fetcher.h" |
| #include "google_apis/gaia/gaia_constants.h" |
| #include "google_apis/gaia/gaia_urls.h" |
| #include "google_apis/gaia/google_service_auth_error.h" |
| #include "google_apis/gaia/oauth2_token_service.h" |
| -UbertokenFetcher::UbertokenFetcher(Profile* profile, |
| - UbertokenConsumer* consumer) |
| +UbertokenFetcher::UbertokenFetcher( |
| + OAuth2TokenService* token_service, |
| + UbertokenConsumer* consumer, |
| + net::URLRequestContextGetter* request_context) |
| : OAuth2TokenService::Consumer("uber_token_fetcher"), |
| - profile_(profile), consumer_(consumer) { |
| - DCHECK(profile); |
| + token_service_(token_service), |
| + consumer_(consumer), |
| + request_context_(request_context) { |
| + DCHECK(token_service); |
| DCHECK(consumer); |
| + DCHECK(request_context); |
| } |
| UbertokenFetcher::~UbertokenFetcher() { |
| @@ -30,9 +32,9 @@ UbertokenFetcher::~UbertokenFetcher() { |
| void UbertokenFetcher::StartFetchingToken(const std::string& account_id) { |
| OAuth2TokenService::ScopeSet scopes; |
| scopes.insert(GaiaUrls::GetInstance()->oauth1_login_scope()); |
| - OAuth2TokenService* token_service = |
| - ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); |
| - access_token_request_ = token_service->StartRequest(account_id, scopes, this); |
| + DCHECK(&account_id); |
|
Roger Tawa OOO till Jul 10th
2014/01/15 14:41:19
Did you mean: DCHECK(!account_id.empty()) ?
blundell
2014/01/15 14:46:00
Oops, this is just crud that can go away.
On 2014
blundell
2014/01/16 16:01:37
Done.
|
| + access_token_request_ = |
| + token_service_->StartRequest(account_id, scopes, this); |
| } |
| void UbertokenFetcher::OnUberAuthTokenSuccess(const std::string& token) { |
| @@ -51,7 +53,7 @@ void UbertokenFetcher::OnGetTokenSuccess( |
| access_token_request_.reset(); |
| gaia_auth_fetcher_.reset(new GaiaAuthFetcher(this, |
| GaiaConstants::kChromeSource, |
| - profile_->GetRequestContext())); |
| + request_context_)); |
| gaia_auth_fetcher_->StartTokenFetchForUberAuthExchange(access_token); |
| } |