Commit 5abf3d89 authored by zea's avatar zea Committed by Commit bot

[Sync] Fix sync backup for supervised users

sync_initialized() does not account for backup/rollback modes. For now we
just manually check the backend mode. In the future the PSS will expose
a better method for denoting when its safe to reconfigure.

BUG=417400

Review URL: https://codereview.chromium.org/605483002

Cr-Commit-Position: refs/heads/master@{#296968}
parent 62a52e75
...@@ -413,7 +413,8 @@ syncer::ModelTypeSet SupervisedUserService::GetPreferredDataTypes() const { ...@@ -413,7 +413,8 @@ syncer::ModelTypeSet SupervisedUserService::GetPreferredDataTypes() const {
void SupervisedUserService::OnStateChanged() { void SupervisedUserService::OnStateChanged() {
ProfileSyncService* service = ProfileSyncService* service =
ProfileSyncServiceFactory::GetForProfile(profile_); ProfileSyncServiceFactory::GetForProfile(profile_);
if (waiting_for_sync_initialization_ && service->sync_initialized()) { if (waiting_for_sync_initialization_ && service->sync_initialized() &&
service->backend_mode() == ProfileSyncService::SYNC) {
waiting_for_sync_initialization_ = false; waiting_for_sync_initialization_ = false;
service->RemoveObserver(this); service->RemoveObserver(this);
FinishSetupSync(); FinishSetupSync();
...@@ -444,7 +445,8 @@ void SupervisedUserService::FinishSetupSyncWhenReady() { ...@@ -444,7 +445,8 @@ void SupervisedUserService::FinishSetupSyncWhenReady() {
// Continue in FinishSetupSync() once the Sync backend has been initialized. // Continue in FinishSetupSync() once the Sync backend has been initialized.
ProfileSyncService* service = ProfileSyncService* service =
ProfileSyncServiceFactory::GetForProfile(profile_); ProfileSyncServiceFactory::GetForProfile(profile_);
if (service->sync_initialized()) { if (service->sync_initialized() &&
service->backend_mode() == ProfileSyncService::SYNC) {
FinishSetupSync(); FinishSetupSync();
} else { } else {
service->AddObserver(this); service->AddObserver(this);
...@@ -455,7 +457,8 @@ void SupervisedUserService::FinishSetupSyncWhenReady() { ...@@ -455,7 +457,8 @@ void SupervisedUserService::FinishSetupSyncWhenReady() {
void SupervisedUserService::FinishSetupSync() { void SupervisedUserService::FinishSetupSync() {
ProfileSyncService* service = ProfileSyncService* service =
ProfileSyncServiceFactory::GetForProfile(profile_); ProfileSyncServiceFactory::GetForProfile(profile_);
DCHECK(service->sync_initialized()); DCHECK(service->sync_initialized() &&
service->backend_mode() == ProfileSyncService::SYNC);
// Sync nothing (except types which are set via GetPreferredDataTypes). // Sync nothing (except types which are set via GetPreferredDataTypes).
bool sync_everything = false; bool sync_everything = false;
......
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