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

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 Windows specific build issue caused by using SEVERITY_ERROR for SyncError::Severity 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
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 cd24db0e80278c188cf754857b136e9bfc390a6c..a6783fa3660e46f9923113811d25b285ec16eb60 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -955,17 +955,11 @@ 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) {
+ 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);
-
std::map<syncer::ModelType, syncer::SyncError> errors;
errors[type] = error;
@@ -1371,9 +1365,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(syncer::HISTORY_DELETE_DIRECTIVES, error);
}
}
@@ -1779,9 +1776,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(syncer::HISTORY_DELETE_DIRECTIVES, error);
}
ChangePreferredDataTypes(chosen_types);
AcknowledgeSyncedTypes();
@@ -2026,10 +2026,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));

Powered by Google App Engine
This is Rietveld 408576698