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

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

Issue 534733002: Revert "[Sync] Move DataTypeStatusTable ownership into DataTypeManager." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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 6375c3448ddd62828392a5a0aca4d5e7f39352de..1adc3685d695d704642f51b2b03176edfa506c7f 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -962,9 +962,7 @@ void ProfileSyncService::ClearStaleErrors() {
ClearUnrecoverableError();
last_actionable_error_ = SyncProtocolError();
// Clear the data type errors as well.
- if (directory_data_type_manager_.get())
- directory_data_type_manager_->ResetDataTypeErrors();
-
+ data_type_status_table_.Reset();
}
void ProfileSyncService::ClearUnrecoverableError() {
@@ -1412,7 +1410,20 @@ void ProfileSyncService::OnEncryptedTypesChanged(
<< (encrypt_everything_ ? "true" : "false") << ")";
DCHECK(encrypted_types_.Has(syncer::PASSWORDS));
- NotifyObservers();
+ // If sessions are encrypted, full history sync is not possible, and
+ // delete directives are unnecessary.
+ if (GetActiveDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES) &&
+ encrypted_types_.Has(syncer::SESSIONS)) {
+ syncer::SyncError error(
+ FROM_HERE,
+ syncer::SyncError::DATATYPE_POLICY_ERROR,
+ "Delete directives not supported with encryption.",
+ syncer::HISTORY_DELETE_DIRECTIVES);
+ DataTypeStatusTable::TypeErrorMap error_map;
+ error_map[error.model_type()] = error;
+ data_type_status_table_.UpdateFailedDataTypes(error_map);
+ ReconfigureDatatypeManager();
+ }
}
void ProfileSyncService::OnEncryptionComplete() {
@@ -1500,7 +1511,6 @@ void ProfileSyncService::OnActionableError(const SyncProtocolError& error) {
void ProfileSyncService::OnConfigureDone(
const DataTypeManager::ConfigureResult& result) {
configure_status_ = result.status;
- data_type_status_table_ = result.data_type_status_table;
if (backend_mode_ != SYNC) {
if (configure_status_ == DataTypeManager::OK) {
@@ -1830,8 +1840,18 @@ void ProfileSyncService::OnUserChoseDatatypes(
UpdateSelectedTypesHistogram(sync_everything, chosen_types);
sync_prefs_.SetKeepEverythingSynced(sync_everything);
- if (directory_data_type_manager_.get())
- directory_data_type_manager_->ResetDataTypeErrors();
+ data_type_status_table_.Reset();
+ if (GetActiveDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES) &&
+ encrypted_types_.Has(syncer::SESSIONS)) {
+ syncer::SyncError error(
+ FROM_HERE,
+ syncer::SyncError::DATATYPE_POLICY_ERROR,
+ "Delete directives not supported with encryption.",
+ syncer::HISTORY_DELETE_DIRECTIVES);
+ DataTypeStatusTable::TypeErrorMap error_map;
+ error_map[error.model_type()] = error;
+ data_type_status_table_.UpdateFailedDataTypes(error_map);
+ }
ChangePreferredDataTypes(chosen_types);
AcknowledgeSyncedTypes();
NotifyObservers();
@@ -1966,7 +1986,8 @@ void ProfileSyncService::ConfigureDataTypeManager() {
&directory_data_type_controllers_,
this,
backend_.get(),
- this));
+ this,
+ &data_type_status_table_));
// We create the migrator at the same time.
migrator_.reset(

Powered by Google App Engine
This is Rietveld 408576698