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

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

Issue 388003002: Sync: Display non-severe errors on about:sync in gray color rather than red. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed failing unit test, added extra test case, addressed CR feedback. Created 6 years, 5 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_mock.h » ('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 9102c4a62d51312741e7a309db759d630d387df7..bb6d595c4c432cd0fec2173f18654909c4d3ef95 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -957,21 +957,13 @@ void ProfileSyncService::OnUnrecoverableErrorImpl(
}
// TODO(zea): Move this logic into the DataTypeController/DataTypeManager.
-void ProfileSyncService::DisableDatatype(
- syncer::ModelType type,
- const tracked_objects::Location& from_here,
- std::string message) {
+void ProfileSyncService::DisableDatatype(const syncer::SyncError& error) {
// First deactivate the type so that no further server changes are
// passed onto the change processor.
- DeactivateDataType(type);
-
- syncer::SyncError error(from_here,
- syncer::SyncError::DATATYPE_ERROR,
- message,
- type);
+ DeactivateDataType(error.model_type());
std::map<syncer::ModelType, syncer::SyncError> errors;
- errors[type] = error;
+ errors[error.model_type()] = error;
// Update this before posting a task. So if a configure happens before
// the task that we are going to post, this type would still be disabled.
@@ -1382,9 +1374,12 @@ void ProfileSyncService::OnEncryptedTypesChanged(
// delete directives are unnecessary.
if (GetActiveDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES) &&
encrypted_types_.Has(syncer::SESSIONS)) {
- DisableDatatype(syncer::HISTORY_DELETE_DIRECTIVES,
- FROM_HERE,
- "Delete directives not supported with encryption.");
+ syncer::SyncError error(
+ FROM_HERE,
+ syncer::SyncError::DATATYPE_POLICY_ERROR,
+ "Delete directives not supported with encryption.",
+ syncer::HISTORY_DELETE_DIRECTIVES);
+ DisableDatatype(error);
}
}
@@ -1790,9 +1785,12 @@ void ProfileSyncService::OnUserChoseDatatypes(
failed_data_types_handler_.Reset();
if (GetActiveDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES) &&
encrypted_types_.Has(syncer::SESSIONS)) {
- DisableDatatype(syncer::HISTORY_DELETE_DIRECTIVES,
- FROM_HERE,
- "Delete directives not supported with encryption.");
+ syncer::SyncError error(
+ FROM_HERE,
+ syncer::SyncError::DATATYPE_POLICY_ERROR,
+ "Delete directives not supported with encryption.",
+ syncer::HISTORY_DELETE_DIRECTIVES);
+ DisableDatatype(error);
}
ChangePreferredDataTypes(chosen_types);
AcknowledgeSyncedTypes();
@@ -2037,10 +2035,22 @@ base::Value* ProfileSyncService::GetTypeStatusMap() const {
if (error_map.find(type) != error_map.end()) {
const syncer::SyncError &error = error_map.find(type)->second;
DCHECK(error.IsSet());
- std::string error_text = "Error: " + error.location().ToString() +
- ", " + error.message();
- type_status->SetString("status", "error");
- type_status->SetString("value", error_text);
+ switch (error.GetSeverity()) {
+ case syncer::SyncError::SYNC_ERROR_SEVERITY_ERROR: {
+ std::string error_text = "Error: " + error.location().ToString() +
+ ", " + error.GetMessagePrefix() + error.message();
+ type_status->SetString("status", "error");
+ type_status->SetString("value", error_text);
+ }
+ break;
+ case syncer::SyncError::SYNC_ERROR_SEVERITY_INFO:
+ type_status->SetString("status", "disabled");
+ type_status->SetString("value", error.message());
+ break;
+ default:
+ NOTREACHED() << "Unexpected error severity.";
+ break;
+ }
} else if (syncer::IsProxyType(type) && passive_types.Has(type)) {
// Show a proxy type in "ok" state unless it is disabled by user.
DCHECK(!throttled_types.Has(type));
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/profile_sync_service_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698