OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 if (service->unrecoverable_error_detected()) { | 353 if (service->unrecoverable_error_detected()) { |
354 strings->Set("unrecoverable_error_detected", new FundamentalValue(true)); | 354 strings->Set("unrecoverable_error_detected", new FundamentalValue(true)); |
355 strings->SetString("unrecoverable_error_message", | 355 strings->SetString("unrecoverable_error_message", |
356 service->unrecoverable_error_message()); | 356 service->unrecoverable_error_message()); |
357 tracked_objects::Location loc(service->unrecoverable_error_location()); | 357 tracked_objects::Location loc(service->unrecoverable_error_location()); |
358 std::string location_str; | 358 std::string location_str; |
359 loc.Write(true, true, &location_str); | 359 loc.Write(true, true, &location_str); |
360 strings->SetString("unrecoverable_error_location", location_str); | 360 strings->SetString("unrecoverable_error_location", location_str); |
361 } else if (!service->sync_initialized()) { | 361 } else if (!service->sync_initialized()) { |
362 strings->SetString("summary", "Sync not yet initialized"); | 362 strings->SetString("summary", "Sync not yet initialized"); |
363 } else if (service->backend() == NULL) { | |
364 strings->SetString("summary", | |
365 "Unrecoverable error detected. Backend is null when it shouldnt be"); | |
366 NOTREACHED(); | |
367 } else { | 363 } else { |
368 browser_sync::ModelSafeRoutingInfo routes; | 364 browser_sync::ModelSafeRoutingInfo routes; |
369 service->backend()->GetModelSafeRoutingInfo(&routes); | 365 service->GetModelSafeRoutingInfo(&routes); |
370 ListValue* routing_info = new ListValue(); | 366 ListValue* routing_info = new ListValue(); |
371 strings->Set("routing_info", routing_info); | 367 strings->Set("routing_info", routing_info); |
372 browser_sync::ModelSafeRoutingInfo::const_iterator it = routes.begin(); | 368 browser_sync::ModelSafeRoutingInfo::const_iterator it = routes.begin(); |
373 for (; it != routes.end(); ++it) { | 369 for (; it != routes.end(); ++it) { |
374 DictionaryValue* val = new DictionaryValue; | 370 DictionaryValue* val = new DictionaryValue; |
375 val->SetString("model_type", ModelTypeToString(it->first)); | 371 val->SetString("model_type", ModelTypeToString(it->first)); |
376 val->SetString("group", ModelSafeGroupToString(it->second)); | 372 val->SetString("group", ModelSafeGroupToString(it->second)); |
377 routing_info->Append(val); | 373 routing_info->Append(val); |
378 } | 374 } |
379 | 375 |
380 sync_ui_util::AddBoolSyncDetail(details, | 376 sync_ui_util::AddBoolSyncDetail(details, |
381 "Autofill Migrated", | 377 "Autofill Migrated", |
382 service->backend()->GetAutofillMigrationState() == | 378 service->GetAutofillMigrationState() == |
383 syncable::MIGRATED); | 379 syncable::MIGRATED); |
384 syncable::AutofillMigrationDebugInfo info = | 380 syncable::AutofillMigrationDebugInfo info = |
385 service->backend()->GetAutofillMigrationDebugInfo(); | 381 service->GetAutofillMigrationDebugInfo(); |
386 | 382 |
387 sync_ui_util::AddIntSyncDetail(details, | 383 sync_ui_util::AddIntSyncDetail(details, |
388 "Bookmarks created during migration", | 384 "Bookmarks created during migration", |
389 info.bookmarks_added_during_migration); | 385 info.bookmarks_added_during_migration); |
390 sync_ui_util::AddIntSyncDetail(details, | 386 sync_ui_util::AddIntSyncDetail(details, |
391 "Autofill entries created during migration", | 387 "Autofill entries created during migration", |
392 info.autofill_entries_added_during_migration); | 388 info.autofill_entries_added_during_migration); |
393 sync_ui_util::AddIntSyncDetail(details, | 389 sync_ui_util::AddIntSyncDetail(details, |
394 "Autofill Profiles created during migration", | 390 "Autofill Profiles created during migration", |
395 info.autofill_profile_added_during_migration); | 391 info.autofill_profile_added_during_migration); |
396 | 392 |
397 DictionaryValue* val = new DictionaryValue; | 393 DictionaryValue* val = new DictionaryValue; |
398 val->SetString("stat_name", "Autofill Migration Time"); | 394 val->SetString("stat_name", "Autofill Migration Time"); |
399 val->SetString("stat_value", ConstructTime(info.autofill_migration_time)); | 395 val->SetString("stat_value", ConstructTime(info.autofill_migration_time)); |
400 details->Append(val); | 396 details->Append(val); |
401 } | 397 } |
402 } | 398 } |
403 } | 399 } |
404 | 400 |
405 } // namespace sync_ui_util | 401 } // namespace sync_ui_util |
OLD | NEW |