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

Unified Diff: chrome/browser/sync/profile_sync_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: Adding the AndroidPO2TS update 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/sync/profile_sync_service.cc
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index 4c0426bd2bbcfd64a9762f1cf67137f172ab87ba..09e5d381ed49833cd3a3e2e074fdbd322b27089a 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -215,7 +215,8 @@ bool ProfileSyncService::IsOAuthRefreshTokenAvailable() {
ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
if (!token_service)
return false;
- return token_service->RefreshTokenIsAvailable();
+ return token_service->RefreshTokenIsAvailable(
+ token_service->GetPrimaryAccountId());
} else {
TokenService* token_service = TokenServiceFactory::GetForProfile(profile_);
if (!token_service)
@@ -697,6 +698,7 @@ void ProfileSyncService::OnRefreshTokenAvailable(
void ProfileSyncService::OnRefreshTokenRevoked(
const std::string& account_id) {
if (!IsOAuthRefreshTokenAvailable()) {
+ access_token_.clear();
// The additional check around IsOAuthRefreshTokenAvailable() above
// prevents us sounding the alarm if we actually have a valid token but
// a refresh attempt by TokenService failed for any variety of reasons
@@ -721,10 +723,6 @@ void ProfileSyncService::OnRefreshTokensLoaded() {
}
}
-void ProfileSyncService::OnRefreshTokensCleared() {
- access_token_.clear();
-}
-
void ProfileSyncService::Shutdown() {
UnregisterAuthNotifications();
@@ -1862,14 +1860,15 @@ void ProfileSyncService::RequestAccessToken() {
oauth2_scopes.insert(GaiaConstants::kChromeSyncOAuth2Scope);
}
- OAuth2TokenService* token_service =
+ ProfileOAuth2TokenService* token_service =
ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
// Invalidate previous token, otherwise token service will return the same
// token again.
if (!access_token_.empty())
token_service->InvalidateToken(oauth2_scopes, access_token_);
access_token_.clear();
- access_token_request_ = token_service->StartRequest(oauth2_scopes, this);
+ access_token_request_ = token_service->StartRequest(
+ token_service->GetPrimaryAccountId(), oauth2_scopes, this);
}
void ProfileSyncService::SetEncryptionPassphrase(const std::string& passphrase,

Powered by Google App Engine
This is Rietveld 408576698