OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/sync/sync_ui_util.h" | 5 #include "chrome/browser/sync/sync_ui_util.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/i18n/number_formatting.h" | 8 #include "base/i18n/number_formatting.h" |
9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 strings->Set("authenticated", | 337 strings->Set("authenticated", |
338 new FundamentalValue(full_status.authenticated)); | 338 new FundamentalValue(full_status.authenticated)); |
339 strings->SetString("auth_problem", | 339 strings->SetString("auth_problem", |
340 sync_ui_util::MakeSyncAuthErrorText( | 340 sync_ui_util::MakeSyncAuthErrorText( |
341 service->GetAuthError().state())); | 341 service->GetAuthError().state())); |
342 | 342 |
343 strings->SetString("time_since_sync", service->GetLastSyncedTimeString()); | 343 strings->SetString("time_since_sync", service->GetLastSyncedTimeString()); |
344 | 344 |
345 ListValue* details = new ListValue(); | 345 ListValue* details = new ListValue(); |
346 strings->Set("details", details); | 346 strings->Set("details", details); |
| 347 sync_ui_util::AddBoolSyncDetail(details, "Sync Initialized", |
| 348 service->sync_initialized()); |
347 sync_ui_util::AddBoolSyncDetail(details, "Sync Setup Has Completed", | 349 sync_ui_util::AddBoolSyncDetail(details, "Sync Setup Has Completed", |
348 service->HasSyncSetupCompleted()); | 350 service->HasSyncSetupCompleted()); |
349 sync_ui_util::AddBoolSyncDetail(details, | 351 sync_ui_util::AddBoolSyncDetail(details, |
350 "Server Up", | 352 "Server Up", |
351 full_status.server_up); | 353 full_status.server_up); |
352 sync_ui_util::AddBoolSyncDetail(details, | 354 sync_ui_util::AddBoolSyncDetail(details, |
353 "Server Reachable", | 355 "Server Reachable", |
354 full_status.server_reachable); | 356 full_status.server_reachable); |
355 sync_ui_util::AddBoolSyncDetail(details, | 357 sync_ui_util::AddBoolSyncDetail(details, |
356 "Server Broken", | 358 "Server Broken", |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 full_status.tombstone_updates_received); | 396 full_status.tombstone_updates_received); |
395 sync_ui_util::AddBoolSyncDetail(details, | 397 sync_ui_util::AddBoolSyncDetail(details, |
396 "Disk Full", | 398 "Disk Full", |
397 full_status.disk_full); | 399 full_status.disk_full); |
398 sync_ui_util::AddIntSyncDetail(details, | 400 sync_ui_util::AddIntSyncDetail(details, |
399 "Max Consecutive Errors", | 401 "Max Consecutive Errors", |
400 full_status.max_consecutive_errors); | 402 full_status.max_consecutive_errors); |
401 | 403 |
402 if (service->unrecoverable_error_detected()) { | 404 if (service->unrecoverable_error_detected()) { |
403 strings->Set("unrecoverable_error_detected", new FundamentalValue(true)); | 405 strings->Set("unrecoverable_error_detected", new FundamentalValue(true)); |
404 strings->SetString("unrecoverable_error_message", | |
405 service->unrecoverable_error_message()); | |
406 tracked_objects::Location loc(service->unrecoverable_error_location()); | 406 tracked_objects::Location loc(service->unrecoverable_error_location()); |
407 std::string location_str; | 407 std::string location_str; |
408 loc.Write(true, true, &location_str); | 408 loc.Write(true, true, &location_str); |
409 strings->SetString("unrecoverable_error_location", location_str); | 409 std::string unrecoverable_error_message = |
410 } else if (!service->sync_initialized()) { | 410 "Unrecoverable error detected at " + location_str + |
411 strings->SetString("summary", "Sync not yet initialized"); | 411 ": " + service->unrecoverable_error_message(); |
412 } else { | 412 strings->SetString("unrecoverable_error_message", |
| 413 unrecoverable_error_message); |
| 414 } else if (service->sync_initialized()) { |
413 browser_sync::ModelSafeRoutingInfo routes; | 415 browser_sync::ModelSafeRoutingInfo routes; |
414 service->GetModelSafeRoutingInfo(&routes); | 416 service->GetModelSafeRoutingInfo(&routes); |
415 ListValue* routing_info = new ListValue(); | 417 ListValue* routing_info = new ListValue(); |
416 strings->Set("routing_info", routing_info); | 418 strings->Set("routing_info", routing_info); |
417 browser_sync::ModelSafeRoutingInfo::const_iterator it = routes.begin(); | 419 browser_sync::ModelSafeRoutingInfo::const_iterator it = routes.begin(); |
418 for (; it != routes.end(); ++it) { | 420 for (; it != routes.end(); ++it) { |
419 DictionaryValue* val = new DictionaryValue; | 421 DictionaryValue* val = new DictionaryValue; |
420 val->SetString("model_type", ModelTypeToString(it->first)); | 422 val->SetString("model_type", ModelTypeToString(it->first)); |
421 val->SetString("group", ModelSafeGroupToString(it->second)); | 423 val->SetString("group", ModelSafeGroupToString(it->second)); |
422 routing_info->Append(val); | 424 routing_info->Append(val); |
(...skipping 18 matching lines...) Expand all Loading... |
441 | 443 |
442 DictionaryValue* val = new DictionaryValue; | 444 DictionaryValue* val = new DictionaryValue; |
443 val->SetString("stat_name", "Autofill Migration Time"); | 445 val->SetString("stat_name", "Autofill Migration Time"); |
444 val->SetString("stat_value", ConstructTime(info.autofill_migration_time)); | 446 val->SetString("stat_value", ConstructTime(info.autofill_migration_time)); |
445 details->Append(val); | 447 details->Append(val); |
446 } | 448 } |
447 } | 449 } |
448 } | 450 } |
449 | 451 |
450 } // namespace sync_ui_util | 452 } // namespace sync_ui_util |
OLD | NEW |