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

Unified Diff: components/signin/core/browser/account_reconcilor.cc

Issue 896723006: Avoid double registration with content settings in account reconcilor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « components/signin/core/browser/account_reconcilor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/signin/core/browser/account_reconcilor.cc
diff --git a/components/signin/core/browser/account_reconcilor.cc b/components/signin/core/browser/account_reconcilor.cc
index 3103479053d1916c000795bbe18ae140a68b14f6..b39062b6409714cd911dc065af8353293b0b9166 100644
--- a/components/signin/core/browser/account_reconcilor.cc
+++ b/components/signin/core/browser/account_reconcilor.cc
@@ -65,6 +65,7 @@ AccountReconcilor::AccountReconcilor(ProfileOAuth2TokenService* token_service,
NULL),
registered_with_token_service_(false),
registered_with_merge_session_helper_(false),
+ registered_with_content_settings_(false),
is_reconcile_started_(false),
first_execution_(true),
are_gaia_accounts_set_(false),
@@ -144,11 +145,24 @@ void AccountReconcilor::UnregisterWithSigninManager() {
}
void AccountReconcilor::RegisterWithContentSettings() {
+ VLOG(1) << "AccountReconcilor::RegisterWithContentSettings";
+ // During re-auth, the reconcilor will get a callback about successful signin
+ // even when the profile is already connected. Avoid re-registering
+ // with the token service since this will DCHECK.
+ if (registered_with_content_settings_)
+ return;
+
client_->AddContentSettingsObserver(this);
+ registered_with_content_settings_ = true;
}
void AccountReconcilor::UnregisterWithContentSettings() {
+ VLOG(1) << "AccountReconcilor::UnregisterWithContentSettings";
+ if (!registered_with_content_settings_)
+ return;
+
client_->RemoveContentSettingsObserver(this);
+ registered_with_content_settings_ = false;
}
void AccountReconcilor::RegisterWithTokenService() {
« no previous file with comments | « components/signin/core/browser/account_reconcilor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698