summaryrefslogtreecommitdiffstats
path: root/components/signin
diff options
context:
space:
mode:
authormsarda <msarda@chromium.org>2015-02-03 13:46:32 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-03 21:48:01 +0000
commit4555495af33c594ec5b8e3d8340116978c4287cc (patch)
tree01c1ecbb08d02cf48bfb7faa3e5a9fe52e13ef34 /components/signin
parent12564e898915dd71a082b1082d72a5f9521e778c (diff)
downloadchromium_src-4555495af33c594ec5b8e3d8340116978c4287cc.zip
chromium_src-4555495af33c594ec5b8e3d8340116978c4287cc.tar.gz
chromium_src-4555495af33c594ec5b8e3d8340116978c4287cc.tar.bz2
Avoid double registration with content settings in account reconcilor.
This CL avoids a double registration for content settings in account rconcilor as this leads to a DCHECK being fired during a reauthentication operation. BUG=454507 Review URL: https://codereview.chromium.org/896723006 Cr-Commit-Position: refs/heads/master@{#314409}
Diffstat (limited to 'components/signin')
-rw-r--r--components/signin/core/browser/account_reconcilor.cc14
-rw-r--r--components/signin/core/browser/account_reconcilor.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/components/signin/core/browser/account_reconcilor.cc b/components/signin/core/browser/account_reconcilor.cc
index 3103479..b39062b 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() {
diff --git a/components/signin/core/browser/account_reconcilor.h b/components/signin/core/browser/account_reconcilor.h
index 1b903aa..1d7adcf 100644
--- a/components/signin/core/browser/account_reconcilor.h
+++ b/components/signin/core/browser/account_reconcilor.h
@@ -193,6 +193,7 @@ class AccountReconcilor : public KeyedService,
scoped_ptr<GaiaAuthFetcher> gaia_fetcher_;
bool registered_with_token_service_;
bool registered_with_merge_session_helper_;
+ bool registered_with_content_settings_;
// True while the reconcilor is busy checking or managing the accounts in
// this profile.