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

Side by Side Diff: chrome/browser/signin/ubertoken_fetcher.cc

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing to include the update to ProfileSyncService: r224220 Created 7 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/signin/ubertoken_fetcher.h" 5 #include "chrome/browser/signin/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 "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 10 matching lines...) Expand all
21 DCHECK(profile); 21 DCHECK(profile);
22 DCHECK(consumer); 22 DCHECK(consumer);
23 } 23 }
24 24
25 UbertokenFetcher::~UbertokenFetcher() { 25 UbertokenFetcher::~UbertokenFetcher() {
26 } 26 }
27 27
28 void UbertokenFetcher::StartFetchingToken() { 28 void UbertokenFetcher::StartFetchingToken() {
29 OAuth2TokenService::ScopeSet scopes; 29 OAuth2TokenService::ScopeSet scopes;
30 scopes.insert(GaiaUrls::GetInstance()->oauth1_login_scope()); 30 scopes.insert(GaiaUrls::GetInstance()->oauth1_login_scope());
31 access_token_request_ = 31 ProfileOAuth2TokenService* token_service =
32 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> 32 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
33 StartRequest(scopes, this); 33 access_token_request_ = token_service->StartRequest(
34 token_service->GetPrimaryAccountId(), scopes, this);
34 } 35 }
35 36
36 void UbertokenFetcher::OnUberAuthTokenSuccess(const std::string& token) { 37 void UbertokenFetcher::OnUberAuthTokenSuccess(const std::string& token) {
37 consumer_->OnUbertokenSuccess(token); 38 consumer_->OnUbertokenSuccess(token);
38 } 39 }
39 40
40 void UbertokenFetcher::OnUberAuthTokenFailure( 41 void UbertokenFetcher::OnUberAuthTokenFailure(
41 const GoogleServiceAuthError& error) { 42 const GoogleServiceAuthError& error) {
42 consumer_->OnUbertokenFailure(error); 43 consumer_->OnUbertokenFailure(error);
43 } 44 }
44 45
45 void UbertokenFetcher::OnGetTokenSuccess( 46 void UbertokenFetcher::OnGetTokenSuccess(
46 const OAuth2TokenService::Request* request, 47 const OAuth2TokenService::Request* request,
47 const std::string& access_token, 48 const std::string& access_token,
48 const base::Time& expiration_time) { 49 const base::Time& expiration_time) {
49 access_token_request_.reset(); 50 access_token_request_.reset();
50 gaia_auth_fetcher_.reset(new GaiaAuthFetcher(this, 51 gaia_auth_fetcher_.reset(new GaiaAuthFetcher(this,
51 GaiaConstants::kChromeSource, 52 GaiaConstants::kChromeSource,
52 profile_->GetRequestContext())); 53 profile_->GetRequestContext()));
53 gaia_auth_fetcher_->StartTokenFetchForUberAuthExchange(access_token); 54 gaia_auth_fetcher_->StartTokenFetchForUberAuthExchange(access_token);
54 } 55 }
55 56
56 void UbertokenFetcher::OnGetTokenFailure( 57 void UbertokenFetcher::OnGetTokenFailure(
57 const OAuth2TokenService::Request* request, 58 const OAuth2TokenService::Request* request,
58 const GoogleServiceAuthError& error) { 59 const GoogleServiceAuthError& error) {
59 access_token_request_.reset(); 60 access_token_request_.reset();
60 consumer_->OnUbertokenFailure(error); 61 consumer_->OnUbertokenFailure(error);
61 } 62 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/profile_oauth2_token_service_unittest.cc ('k') | chrome/browser/signin/ubertoken_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698