| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 l10n_util::GetStringUTF16(IDS_SYNC_AUTHENTICATING_LABEL)); | 285 l10n_util::GetStringUTF16(IDS_SYNC_AUTHENTICATING_LABEL)); |
| 286 } | 286 } |
| 287 } else if (auth_error.state() != AuthError::NONE && | 287 } else if (auth_error.state() != AuthError::NONE && |
| 288 auth_error.state() != AuthError::TWO_FACTOR) { | 288 auth_error.state() != AuthError::TWO_FACTOR) { |
| 289 if (status_label) { | 289 if (status_label) { |
| 290 status_label->clear(); | 290 status_label->clear(); |
| 291 GetStatusLabelsForAuthError(auth_error, *service, status_label, NULL, | 291 GetStatusLabelsForAuthError(auth_error, *service, status_label, NULL, |
| 292 NULL, NULL, NULL); | 292 NULL, NULL, NULL); |
| 293 } | 293 } |
| 294 result_type = SYNC_ERROR; | 294 result_type = SYNC_ERROR; |
| 295 } else if (!status.authenticated) { | |
| 296 if (status_label) { | |
| 297 status_label->assign( | |
| 298 l10n_util::GetStringUTF16(IDS_SYNC_ACCOUNT_DETAILS_NOT_ENTERED)); | |
| 299 } | |
| 300 } | 295 } |
| 301 } else if (service->unrecoverable_error_detected()) { | 296 } else if (service->unrecoverable_error_detected()) { |
| 302 result_type = SYNC_ERROR; | 297 result_type = SYNC_ERROR; |
| 303 ProfileSyncService::Status status(service->QueryDetailedSyncStatus()); | 298 ProfileSyncService::Status status(service->QueryDetailedSyncStatus()); |
| 304 if (ShouldShowActionOnUI(status.sync_protocol_error)) { | 299 if (ShouldShowActionOnUI(status.sync_protocol_error)) { |
| 305 if (status_label) { | 300 if (status_label) { |
| 306 GetStatusForActionableError(status.sync_protocol_error, | 301 GetStatusForActionableError(status.sync_protocol_error, |
| 307 status_label); | 302 status_label); |
| 308 } | 303 } |
| 309 } else if (status_label) { | 304 } else if (status_label) { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 } else { | 502 } else { |
| 508 sync_api::SyncManager::Status full_status( | 503 sync_api::SyncManager::Status full_status( |
| 509 service->QueryDetailedSyncStatus()); | 504 service->QueryDetailedSyncStatus()); |
| 510 | 505 |
| 511 strings->SetString("service_url", service->sync_service_url().spec()); | 506 strings->SetString("service_url", service->sync_service_url().spec()); |
| 512 strings->SetString("summary", | 507 strings->SetString("summary", |
| 513 ProfileSyncService::BuildSyncStatusSummaryText( | 508 ProfileSyncService::BuildSyncStatusSummaryText( |
| 514 full_status.summary)); | 509 full_status.summary)); |
| 515 | 510 |
| 516 strings->SetString("version", GetVersionString()); | 511 strings->SetString("version", GetVersionString()); |
| 517 strings->Set("authenticated", | |
| 518 new base::FundamentalValue(full_status.authenticated)); | |
| 519 strings->SetString("auth_problem", | 512 strings->SetString("auth_problem", |
| 520 sync_ui_util::MakeSyncAuthErrorText( | 513 sync_ui_util::MakeSyncAuthErrorText( |
| 521 service->GetAuthError().state())); | 514 service->GetAuthError().state())); |
| 522 | 515 |
| 523 strings->SetString("time_since_sync", service->GetLastSyncedTimeString()); | 516 strings->SetString("time_since_sync", service->GetLastSyncedTimeString()); |
| 524 | 517 |
| 525 ListValue* details = new ListValue(); | 518 ListValue* details = new ListValue(); |
| 526 strings->Set("details", details); | 519 strings->Set("details", details); |
| 527 sync_ui_util::AddBoolSyncDetail(details, "Sync Initialized", | 520 sync_ui_util::AddBoolSyncDetail(details, "Sync Initialized", |
| 528 service->sync_initialized()); | 521 service->sync_initialized()); |
| 529 sync_ui_util::AddBoolSyncDetail(details, "Sync Setup Has Completed", | 522 sync_ui_util::AddBoolSyncDetail(details, "Sync Setup Has Completed", |
| 530 service->HasSyncSetupCompleted()); | 523 service->HasSyncSetupCompleted()); |
| 531 sync_ui_util::AddStringSyncDetails( | 524 sync_ui_util::AddStringSyncDetails( |
| 532 details, | 525 details, |
| 533 "Client ID", | 526 "Client ID", |
| 534 full_status.unique_id.empty() ? "none" : full_status.unique_id); | 527 full_status.unique_id.empty() ? "none" : full_status.unique_id); |
| 535 sync_ui_util::AddBoolSyncDetail(details, | 528 sync_ui_util::AddBoolSyncDetail(details, |
| 536 "Server Up", | |
| 537 full_status.server_up); | |
| 538 sync_ui_util::AddBoolSyncDetail(details, | |
| 539 "Server Reachable", | |
| 540 full_status.server_reachable); | |
| 541 sync_ui_util::AddBoolSyncDetail(details, | |
| 542 "Notifications Enabled", | 529 "Notifications Enabled", |
| 543 full_status.notifications_enabled); | 530 full_status.notifications_enabled); |
| 544 sync_ui_util::AddIntSyncDetail(details, | 531 sync_ui_util::AddIntSyncDetail(details, |
| 545 "Notifications Received", | 532 "Notifications Received", |
| 546 full_status.notifications_received); | 533 full_status.notifications_received); |
| 547 sync_ui_util::AddIntSyncDetail(details, | 534 sync_ui_util::AddIntSyncDetail(details, |
| 548 "Unsynced Count", | 535 "Unsynced Count", |
| 549 full_status.unsynced_count); | 536 full_status.unsynced_count); |
| 550 sync_ui_util::AddIntSyncDetail(details, | 537 sync_ui_util::AddIntSyncDetail(details, |
| 551 "Conflicting Count", | 538 "Conflicting Count", |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 } | 689 } |
| 703 } else { | 690 } else { |
| 704 version_modifier = " " + version_modifier; | 691 version_modifier = " " + version_modifier; |
| 705 } | 692 } |
| 706 return chrome_version.Name() + " " + chrome_version.OSType() + " " + | 693 return chrome_version.Name() + " " + chrome_version.OSType() + " " + |
| 707 chrome_version.Version() + " (" + chrome_version.LastChange() + ")" + | 694 chrome_version.Version() + " (" + chrome_version.LastChange() + ")" + |
| 708 version_modifier; | 695 version_modifier; |
| 709 } | 696 } |
| 710 | 697 |
| 711 } // namespace sync_ui_util | 698 } // namespace sync_ui_util |
| OLD | NEW |