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

Unified Diff: chrome/browser/google_apis/auth_service.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: Updates to AndroidPO2TS and removing the DCHECK(signin_manager) from GetPrimaryAccountId Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/google_apis/auth_service.cc
diff --git a/chrome/browser/google_apis/auth_service.cc b/chrome/browser/google_apis/auth_service.cc
index 2534062583b6b3dde0b17d1229a5bdbe494eaec5..463e283f6d6a09022dc5cff0d8dce73ecf0c9d10 100644
--- a/chrome/browser/google_apis/auth_service.cc
+++ b/chrome/browser/google_apis/auth_service.cc
@@ -30,6 +30,7 @@ const int kSuccessRatioHistogramMaxValue = 4; // The max value is exclusive.
class AuthRequest : public OAuth2TokenService::Consumer {
public:
AuthRequest(OAuth2TokenService* oauth2_token_service,
+ const std::string& account_id,
net::URLRequestContextGetter* url_request_context_getter,
const AuthStatusCallback& callback,
const std::vector<std::string>& scopes);
@@ -52,6 +53,7 @@ class AuthRequest : public OAuth2TokenService::Consumer {
AuthRequest::AuthRequest(
OAuth2TokenService* oauth2_token_service,
+ const std::string& account_id,
net::URLRequestContextGetter* url_request_context_getter,
const AuthStatusCallback& callback,
const std::vector<std::string>& scopes)
@@ -59,6 +61,7 @@ AuthRequest::AuthRequest(
DCHECK(!callback_.is_null());
request_ = oauth2_token_service->
StartRequestWithContext(
+ account_id,
url_request_context_getter,
OAuth2TokenService::ScopeSet(scopes.begin(), scopes.end()),
this);
@@ -117,9 +120,11 @@ void AuthRequest::OnGetTokenFailure(const OAuth2TokenService::Request* request,
AuthService::AuthService(
OAuth2TokenService* oauth2_token_service,
+ const std::string& account_id,
net::URLRequestContextGetter* url_request_context_getter,
const std::vector<std::string>& scopes)
: oauth2_token_service_(oauth2_token_service),
+ account_id_(account_id),
url_request_context_getter_(url_request_context_getter),
scopes_(scopes),
weak_ptr_factory_(this) {
@@ -127,7 +132,8 @@ AuthService::AuthService(
// Get OAuth2 refresh token (if we have any) and register for its updates.
oauth2_token_service_->AddObserver(this);
- has_refresh_token_ = oauth2_token_service_->RefreshTokenIsAvailable();
+ has_refresh_token_ = oauth2_token_service_->RefreshTokenIsAvailable(
+ account_id_);
}
AuthService::~AuthService() {
@@ -146,6 +152,7 @@ void AuthService::StartAuthentication(const AuthStatusCallback& callback) {
} else if (HasRefreshToken()) {
// We have refresh token, let's get an access token.
new AuthRequest(oauth2_token_service_,
+ account_id_,
url_request_context_getter_,
base::Bind(&AuthService::OnAuthCompleted,
weak_ptr_factory_.GetWeakPtr(),

Powered by Google App Engine
This is Rietveld 408576698