Commit 9fc857e8 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

ProfileSyncService: merge OnCredentialsRejectedByClient into OnRefreshTokenRevoked

Before, OnRefreshTokenRevoked triggered a notification to observers, and
OnCredentialsRejectedByClient caused us to invalidate the credentials in the
SyncEngine.
In both cases, it actually seems better to do both of these things, so this CL
merges the two.

Bug: 842697
Change-Id: I81fd4578731c282284fa40cbbb0be0e1cd102656
Reviewed-on: https://chromium-review.googlesource.com/1068880
Commit-Queue: Marc Treib <treib@chromium.org>
Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#561419}
parent e3aac921
...@@ -629,18 +629,10 @@ void ProfileSyncService::OnRefreshTokenAvailable() { ...@@ -629,18 +629,10 @@ void ProfileSyncService::OnRefreshTokenAvailable() {
void ProfileSyncService::OnRefreshTokenRevoked() { void ProfileSyncService::OnRefreshTokenRevoked() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
// TODO(treib): Should we also propagate this to the engine? It's not strictly
// necessary (the server will reject the token anyway), but it shoudln't hurt
// either, and it would let us merge this with OnCredentialsRejectedByClient.
NotifyObservers();
}
void ProfileSyncService::OnCredentialsRejectedByClient() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (HasSyncingEngine()) if (HasSyncingEngine())
engine_->InvalidateCredentials(); engine_->InvalidateCredentials();
NotifyObservers();
} }
void ProfileSyncService::Shutdown() { void ProfileSyncService::Shutdown() {
......
...@@ -488,7 +488,6 @@ class ProfileSyncService : public syncer::SyncService, ...@@ -488,7 +488,6 @@ class ProfileSyncService : public syncer::SyncService,
// SyncAuthManager. // SyncAuthManager.
void OnRefreshTokenAvailable(); void OnRefreshTokenAvailable();
void OnRefreshTokenRevoked(); void OnRefreshTokenRevoked();
void OnCredentialsRejectedByClient();
// Called by SyncAuthManager when an access token fetch attempt finishes // Called by SyncAuthManager when an access token fetch attempt finishes
// (successfully or not). // (successfully or not).
......
...@@ -245,8 +245,9 @@ void SyncAuthManager::OnRefreshTokenAvailable(const std::string& account_id) { ...@@ -245,8 +245,9 @@ void SyncAuthManager::OnRefreshTokenAvailable(const std::string& account_id) {
// CREDENTIALS_REJECTED_BY_CLIENT is only set by the signin component when // CREDENTIALS_REJECTED_BY_CLIENT is only set by the signin component when
// the refresh token is created. // the refresh token is created.
ClearAccessTokenAndRequest(); ClearAccessTokenAndRequest();
// TODO(treib): Should we also set our auth error state?
sync_service_->OnCredentialsRejectedByClient(); sync_service_->OnRefreshTokenRevoked();
// TODO(treib): We can probably early-out here - no point in also calling // TODO(treib): We can probably early-out here - no point in also calling
// OnRefreshTokenAvailable on the ProfileSyncService. // OnRefreshTokenAvailable on the ProfileSyncService.
} }
......
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