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/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 } else { | 342 } else { |
343 sync_api::SyncManager::Status full_status( | 343 sync_api::SyncManager::Status full_status( |
344 service->QueryDetailedSyncStatus()); | 344 service->QueryDetailedSyncStatus()); |
345 | 345 |
346 strings->SetString("service_url", service->sync_service_url().spec()); | 346 strings->SetString("service_url", service->sync_service_url().spec()); |
347 strings->SetString("summary", | 347 strings->SetString("summary", |
348 ProfileSyncService::BuildSyncStatusSummaryText( | 348 ProfileSyncService::BuildSyncStatusSummaryText( |
349 full_status.summary)); | 349 full_status.summary)); |
350 | 350 |
351 strings->Set("authenticated", | 351 strings->Set("authenticated", |
352 new base::FundamentalValue(full_status.authenticated)); | 352 base::BooleanValue::New(full_status.authenticated)); |
353 strings->SetString("auth_problem", | 353 strings->SetString("auth_problem", |
354 sync_ui_util::MakeSyncAuthErrorText( | 354 sync_ui_util::MakeSyncAuthErrorText( |
355 service->GetAuthError().state())); | 355 service->GetAuthError().state())); |
356 | 356 |
357 strings->SetString("time_since_sync", service->GetLastSyncedTimeString()); | 357 strings->SetString("time_since_sync", service->GetLastSyncedTimeString()); |
358 | 358 |
359 ListValue* details = new ListValue(); | 359 ListValue* details = new ListValue(); |
360 strings->Set("details", details); | 360 strings->Set("details", details); |
361 sync_ui_util::AddBoolSyncDetail(details, "Sync Initialized", | 361 sync_ui_util::AddBoolSyncDetail(details, "Sync Initialized", |
362 service->sync_initialized()); | 362 service->sync_initialized()); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 // unsynced However if we query the latest count here we will | 461 // unsynced However if we query the latest count here we will |
462 // have to hold the transaction which means we cannot display this page | 462 // have to hold the transaction which means we cannot display this page |
463 // when syncing. | 463 // when syncing. |
464 sync_ui_util::AddIntSyncDetail(details, "Entries" , | 464 sync_ui_util::AddIntSyncDetail(details, "Entries" , |
465 snapshot->num_entries); | 465 snapshot->num_entries); |
466 sync_ui_util::AddBoolSyncDetail(details, "Throttled", | 466 sync_ui_util::AddBoolSyncDetail(details, "Throttled", |
467 snapshot->is_silenced); | 467 snapshot->is_silenced); |
468 } | 468 } |
469 | 469 |
470 if (service->unrecoverable_error_detected()) { | 470 if (service->unrecoverable_error_detected()) { |
471 strings->Set("unrecoverable_error_detected", | 471 strings->Set("unrecoverable_error_detected", base::TrueValue()); |
472 new base::FundamentalValue(true)); | |
473 tracked_objects::Location loc(service->unrecoverable_error_location()); | 472 tracked_objects::Location loc(service->unrecoverable_error_location()); |
474 std::string location_str; | 473 std::string location_str; |
475 loc.Write(true, true, &location_str); | 474 loc.Write(true, true, &location_str); |
476 std::string unrecoverable_error_message = | 475 std::string unrecoverable_error_message = |
477 "Unrecoverable error detected at " + location_str + | 476 "Unrecoverable error detected at " + location_str + |
478 ": " + service->unrecoverable_error_message(); | 477 ": " + service->unrecoverable_error_message(); |
479 strings->SetString("unrecoverable_error_message", | 478 strings->SetString("unrecoverable_error_message", |
480 unrecoverable_error_message); | 479 unrecoverable_error_message); |
481 } else if (service->sync_initialized()) { | 480 } else if (service->sync_initialized()) { |
482 browser_sync::ModelSafeRoutingInfo routes; | 481 browser_sync::ModelSafeRoutingInfo routes; |
483 service->GetModelSafeRoutingInfo(&routes); | 482 service->GetModelSafeRoutingInfo(&routes); |
484 ListValue* routing_info = new ListValue(); | 483 ListValue* routing_info = new ListValue(); |
485 strings->Set("routing_info", routing_info); | 484 strings->Set("routing_info", routing_info); |
486 browser_sync::ModelSafeRoutingInfo::const_iterator it = routes.begin(); | 485 browser_sync::ModelSafeRoutingInfo::const_iterator it = routes.begin(); |
487 for (; it != routes.end(); ++it) { | 486 for (; it != routes.end(); ++it) { |
488 DictionaryValue* val = new DictionaryValue; | 487 DictionaryValue* val = new DictionaryValue; |
489 val->SetString("model_type", ModelTypeToString(it->first)); | 488 val->SetString("model_type", ModelTypeToString(it->first)); |
490 val->SetString("group", ModelSafeGroupToString(it->second)); | 489 val->SetString("group", ModelSafeGroupToString(it->second)); |
491 routing_info->Append(val); | 490 routing_info->Append(val); |
492 } | 491 } |
493 } | 492 } |
494 } | 493 } |
495 } | 494 } |
496 | 495 |
497 } // namespace sync_ui_util | 496 } // namespace sync_ui_util |
OLD | NEW |