Chromium Code Reviews| Index: components/browser_sync/profile_sync_service.cc |
| diff --git a/components/browser_sync/profile_sync_service.cc b/components/browser_sync/profile_sync_service.cc |
| index 5eb7949df19312fb33f3f7d137fa9432ae7ff581..44ae830f5710e4e7c4a20d825f62596a8aabc624 100644 |
| --- a/components/browser_sync/profile_sync_service.cc |
| +++ b/components/browser_sync/profile_sync_service.cc |
| @@ -1785,18 +1785,8 @@ std::unique_ptr<base::Value> ProfileSyncService::GetTypeStatusMap() { |
| DataTypeStatusTable::TypeErrorMap error_map = |
| data_type_status_table_.GetAllErrors(); |
| - ModelTypeSet active_types; |
| - ModelTypeSet passive_types; |
| ModelSafeRoutingInfo routing_info; |
|
pavely
2017/04/21 20:30:06
With the code around this line gone you can move r
skym
2017/04/21 20:44:15
Done.
|
| engine_->GetModelSafeRoutingInfo(&routing_info); |
| - for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); |
| - it != routing_info.end(); ++it) { |
| - if (it->second == syncer::GROUP_PASSIVE) { |
| - passive_types.Put(it->first); |
| - } else { |
| - active_types.Put(it->first); |
| - } |
| - } |
| SyncEngine::Status detailed_status = engine_->GetDetailedStatus(); |
| ModelTypeSet& throttled_types(detailed_status.throttled_types); |
| @@ -1805,11 +1795,14 @@ std::unique_ptr<base::Value> ProfileSyncService::GetTypeStatusMap() { |
| std::unique_ptr<base::DictionaryValue> type_status_header( |
| new base::DictionaryValue()); |
| - type_status_header->SetString("name", "Model Type"); |
| type_status_header->SetString("status", "header"); |
| - type_status_header->SetString("value", "Group Type"); |
| + type_status_header->SetString("name", "Model Type"); |
| type_status_header->SetString("num_entries", "Total Entries"); |
| type_status_header->SetString("num_live", "Live Entries"); |
| + type_status_header->SetString("message", "Message"); |
| + type_status_header->SetString("state", "State"); |
| + type_status_header->SetString("group_type", "Group Type"); |
| + |
| result->Append(std::move(type_status_header)); |
| std::unique_ptr<base::DictionaryValue> type_status; |
| @@ -1818,6 +1811,8 @@ std::unique_ptr<base::Value> ProfileSyncService::GetTypeStatusMap() { |
| type_status = base::MakeUnique<base::DictionaryValue>(); |
| type_status->SetString("name", ModelTypeToString(type)); |
| + type_status->SetString("group_type", |
| + ModelSafeGroupToString(routing_info[type])); |
| if (error_map.find(type) != error_map.end()) { |
| const syncer::SyncError& error = error_map.find(type)->second; |
| @@ -1826,44 +1821,29 @@ std::unique_ptr<base::Value> ProfileSyncService::GetTypeStatusMap() { |
| case syncer::SyncError::SYNC_ERROR_SEVERITY_ERROR: |
| type_status->SetString("status", "error"); |
| type_status->SetString( |
| - "value", "Error: " + error.location().ToString() + ", " + |
| - error.GetMessagePrefix() + error.message()); |
| + "message", "Error: " + error.location().ToString() + ", " + |
| + error.GetMessagePrefix() + error.message()); |
| break; |
| case syncer::SyncError::SYNC_ERROR_SEVERITY_INFO: |
| type_status->SetString("status", "disabled"); |
| - type_status->SetString("value", error.message()); |
| + type_status->SetString("message", 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)); |
| - type_status->SetString("status", "ok"); |
| - type_status->SetString("value", "Passive"); |
| - } else if (throttled_types.Has(type) && passive_types.Has(type)) { |
| - type_status->SetString("status", "warning"); |
| - type_status->SetString("value", "Passive, Throttled"); |
| - } else if (backed_off_types.Has(type) && passive_types.Has(type)) { |
| - type_status->SetString("status", "warning"); |
| - type_status->SetString("value", "Passive, Backed off"); |
| - } else if (passive_types.Has(type)) { |
| - type_status->SetString("status", "warning"); |
| - type_status->SetString("value", "Passive"); |
| } else if (throttled_types.Has(type)) { |
| type_status->SetString("status", "warning"); |
| - type_status->SetString("value", "Throttled"); |
| + type_status->SetString("message", " Throttled"); |
| } else if (backed_off_types.Has(type)) { |
| type_status->SetString("status", "warning"); |
| - type_status->SetString("value", "Backed off"); |
| - } else if (active_types.Has(type)) { |
| + type_status->SetString("message", "Backed off"); |
| + } else if (routing_info.find(type) != routing_info.end()) { |
| type_status->SetString("status", "ok"); |
| - type_status->SetString( |
| - "value", "Active: " + ModelSafeGroupToString(routing_info[type])); |
| + type_status->SetString("message", ""); |
| } else { |
| type_status->SetString("status", "warning"); |
| - type_status->SetString("value", "Disabled by User"); |
| + type_status->SetString("message", "Disabled by User"); |
| } |
| const auto& dtc_iter = data_type_controllers_.find(type); |
| @@ -1874,6 +1854,8 @@ std::unique_ptr<base::Value> ProfileSyncService::GetTypeStatusMap() { |
| dtc_iter->second->GetStatusCounters(BindToCurrentThread( |
| base::Bind(&ProfileSyncService::OnDatatypeStatusCounterUpdated, |
| base::Unretained(this)))); |
| + type_status->SetString("state", DataTypeController::StateToString( |
| + dtc_iter->second->state())); |
| } |
| result->Append(std::move(type_status)); |