Commit 95d7666a authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

ProfileSyncService: Get access tokens via IdentityManager

instead of talking to ProfileOAuth2TokenService directly.

Bug: 825190
Change-Id: I80f1e52857f3fd8effbb6351a22e5bd86062d326
Reviewed-on: https://chromium-review.googlesource.com/1028150
Commit-Queue: Marc Treib <treib@chromium.org>
Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556422}
parent a7e8d6a3
...@@ -1961,10 +1961,10 @@ void ProfileSyncService::RequestAccessToken() { ...@@ -1961,10 +1961,10 @@ void ProfileSyncService::RequestAccessToken() {
// Invalidate previous token, otherwise token service will return the same // Invalidate previous token, otherwise token service will return the same
// token again. // token again.
const std::string& account_id = signin_->GetAccountIdToUse();
if (!access_token_.empty()) { if (!access_token_.empty()) {
oauth2_token_service_->InvalidateAccessToken(account_id, oauth2_scopes, signin_->GetIdentityManager()->RemoveAccessTokenFromCache(
access_token_); signin_->GetIdentityManager()->GetPrimaryAccountInfo(), oauth2_scopes,
access_token_);
} }
access_token_.clear(); access_token_.clear();
...@@ -1973,9 +1973,8 @@ void ProfileSyncService::RequestAccessToken() { ...@@ -1973,9 +1973,8 @@ void ProfileSyncService::RequestAccessToken() {
token_status_.token_receive_time = base::Time(); token_status_.token_receive_time = base::Time();
token_status_.next_token_request_time = base::Time(); token_status_.next_token_request_time = base::Time();
ongoing_access_token_fetch_ = ongoing_access_token_fetch_ =
std::make_unique<identity::PrimaryAccountAccessTokenFetcher>( signin_->GetIdentityManager()->CreateAccessTokenFetcherForPrimaryAccount(
kSyncOAuthConsumerName, signin_->GetSigninManager(), kSyncOAuthConsumerName, oauth2_scopes,
oauth2_token_service_, oauth2_scopes,
base::BindOnce(&ProfileSyncService::AccessTokenFetched, base::BindOnce(&ProfileSyncService::AccessTokenFetched,
base::Unretained(this)), base::Unretained(this)),
identity::PrimaryAccountAccessTokenFetcher::Mode::kImmediate); identity::PrimaryAccountAccessTokenFetcher::Mode::kImmediate);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment