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

Unified Diff: chrome/browser/sync/profile_sync_service.cc

Issue 11043012: [Sync] Notify invalidation handlers when sync is disabled/enabled (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 2 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 | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/profile_sync_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 31385719335a3aacaa54ec10849783ad7ac2a408..8f07f316c2689c5366bd9fc46f0e00d10f60e7f6 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -145,7 +145,8 @@ ProfileSyncService::ProfileSyncService(ProfileSyncComponentsFactory* factory,
auto_start_enabled_(start_behavior == AUTO_START),
failed_datatypes_handler_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
configure_status_(DataTypeManager::UNKNOWN),
- setup_in_progress_(false) {
+ setup_in_progress_(false),
+ invalidator_state_(syncer::DEFAULT_INVALIDATION_ERROR) {
#if defined(OS_ANDROID)
chrome::VersionInfo version_info;
if (version_info.IsOfficialBuild()) {
@@ -554,6 +555,9 @@ void ProfileSyncService::ShutdownImpl(bool sync_disabled) {
expect_sync_configuration_aborted_ = false;
is_auth_in_progress_ = false;
backend_initialized_ = false;
+ // NULL if we're called from Shutdown().
+ if (invalidator_registrar_.get())
+ UpdateInvalidatorRegistrarState();
cached_passphrase_.clear();
encryption_pending_ = false;
encrypt_everything_ = false;
@@ -697,7 +701,8 @@ void ProfileSyncService::DisableBrokenDatatype(
void ProfileSyncService::OnInvalidatorStateChange(
syncer::InvalidatorState state) {
- invalidator_registrar_->UpdateInvalidatorState(state);
+ invalidator_state_ = state;
+ UpdateInvalidatorRegistrarState();
}
void ProfileSyncService::OnIncomingInvalidation(
@@ -749,6 +754,7 @@ void ProfileSyncService::OnBackendInitialized(
}
backend_initialized_ = true;
+ UpdateInvalidatorRegistrarState();
sync_js_controller_.AttachJsBackend(js_backend);
@@ -1828,6 +1834,13 @@ void ProfileSyncService::OnInternalUnrecoverableError(
OnUnrecoverableErrorImpl(from_here, message, delete_sync_database);
}
+void ProfileSyncService::UpdateInvalidatorRegistrarState() {
+ const syncer::InvalidatorState effective_state =
+ backend_initialized_ ?
+ invalidator_state_ : syncer::TRANSIENT_INVALIDATION_ERROR;
+ invalidator_registrar_->UpdateInvalidatorState(effective_state);
+}
+
void ProfileSyncService::ResetForTest() {
Profile* profile = profile_;
SigninManager* signin = SigninManagerFactory::GetForProfile(profile);
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/profile_sync_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698