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 dc71f4c7c9f1c6f9a1086376f6bfa8209b111dd3..fa456d7cd8e0e821bf86f8a03f5265fcd235e59a 100644 |
--- a/chrome/browser/sync/profile_sync_service.cc |
+++ b/chrome/browser/sync/profile_sync_service.cc |
@@ -942,7 +942,7 @@ void ProfileSyncService::OnUnrecoverableErrorImpl( |
} |
// TODO(zea): Move this logic into the DataTypeController/DataTypeManager. |
-void ProfileSyncService::DisableBrokenDatatype( |
+void ProfileSyncService::DisableDatatype( |
syncer::ModelType type, |
const tracked_objects::Location& from_here, |
std::string message) { |
@@ -967,6 +967,24 @@ void ProfileSyncService::DisableBrokenDatatype( |
weak_factory_.GetWeakPtr())); |
} |
+void ProfileSyncService::ReenableDatatype(syncer::ModelType type) { |
+ // Only reconfigure if the type actually had a data type or unready error. |
+ if (!failed_data_types_handler_.ResetDataTypeErrorFor(type) && |
+ !failed_data_types_handler_.ResetUnreadyErrorFor(type)) { |
+ return; |
+ } |
+ |
+ // If the type is no longer enabled, don't bother reconfiguring. |
+ // TODO(zea): something else should encapsulate the notion of "whether a type |
+ // should be enabled". |
+ if (!syncer::CoreTypes().Has(type) && !GetPreferredDataTypes().Has(type)) |
+ return; |
+ |
+ base::MessageLoop::current()->PostTask(FROM_HERE, |
+ base::Bind(&ProfileSyncService::ReconfigureDatatypeManager, |
+ weak_factory_.GetWeakPtr())); |
+} |
+ |
void ProfileSyncService::UpdateBackendInitUMA(bool success) { |
if (backend_mode_ != SYNC) |
return; |
@@ -1342,9 +1360,9 @@ void ProfileSyncService::OnEncryptedTypesChanged( |
// delete directives are unnecessary. |
if (GetActiveDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES) && |
encrypted_types_.Has(syncer::SESSIONS)) { |
- DisableBrokenDatatype(syncer::HISTORY_DELETE_DIRECTIVES, |
- FROM_HERE, |
- "Delete directives not supported with encryption."); |
+ DisableDatatype(syncer::HISTORY_DELETE_DIRECTIVES, |
+ FROM_HERE, |
+ "Delete directives not supported with encryption."); |
} |
} |
@@ -1748,9 +1766,9 @@ void ProfileSyncService::OnUserChoseDatatypes( |
failed_data_types_handler_.Reset(); |
if (GetActiveDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES) && |
encrypted_types_.Has(syncer::SESSIONS)) { |
- DisableBrokenDatatype(syncer::HISTORY_DELETE_DIRECTIVES, |
- FROM_HERE, |
- "Delete directives not supported with encryption."); |
+ DisableDatatype(syncer::HISTORY_DELETE_DIRECTIVES, |
+ FROM_HERE, |
+ "Delete directives not supported with encryption."); |
} |
ChangePreferredDataTypes(chosen_types); |
AcknowledgeSyncedTypes(); |