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" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
13 #include "chrome/browser/sync/profile_sync_service.h" | 13 #include "chrome/browser/sync/profile_sync_service.h" |
14 #include "chrome/browser/sync/protocol/proto_enum_conversions.h" | 14 #include "chrome/browser/sync/protocol/proto_enum_conversions.h" |
15 #include "chrome/browser/sync/protocol/sync_protocol_error.h" | 15 #include "chrome/browser/sync/protocol/sync_protocol_error.h" |
16 #include "chrome/browser/sync/syncable/model_type.h" | 16 #include "chrome/browser/sync/syncable/model_type.h" |
17 #include "chrome/browser/sync/sessions/session_state.h" | 17 #include "chrome/browser/sync/sessions/session_state.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/chrome_version_info.h" | |
21 #include "chrome/common/net/gaia/google_service_auth_error.h" | 22 #include "chrome/common/net/gaia/google_service_auth_error.h" |
22 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
23 #include "grit/browser_resources.h" | 24 #include "grit/browser_resources.h" |
24 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
25 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
26 #include "grit/locale_settings.h" | 27 #include "grit/locale_settings.h" |
27 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
28 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
29 | 30 |
30 typedef GoogleServiceAuthError AuthError; | 31 typedef GoogleServiceAuthError AuthError; |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
484 strings->SetString("summary", "SYNC DISABLED"); | 485 strings->SetString("summary", "SYNC DISABLED"); |
485 } else { | 486 } else { |
486 sync_api::SyncManager::Status full_status( | 487 sync_api::SyncManager::Status full_status( |
487 service->QueryDetailedSyncStatus()); | 488 service->QueryDetailedSyncStatus()); |
488 | 489 |
489 strings->SetString("service_url", service->sync_service_url().spec()); | 490 strings->SetString("service_url", service->sync_service_url().spec()); |
490 strings->SetString("summary", | 491 strings->SetString("summary", |
491 ProfileSyncService::BuildSyncStatusSummaryText( | 492 ProfileSyncService::BuildSyncStatusSummaryText( |
492 full_status.summary)); | 493 full_status.summary)); |
493 | 494 |
495 // Build a version string that matches MakeUserAgentForSyncApi with the | |
496 // addition of channel info and proper OS names. | |
497 chrome::VersionInfo chrome_version; | |
akalin
2011/11/17 04:12:43
Maybe a special string if VersionInfo is invalid
Nicolas Zea
2011/11/17 04:58:10
Done.
| |
498 std::string version_modifier = | |
akalin
2011/11/17 04:12:43
Can you decomp the string-building logic into a se
Nicolas Zea
2011/11/17 04:58:10
Done.
| |
499 " " + chrome::VersionInfo::GetVersionStringModifier(); | |
akalin
2011/11/17 04:12:43
Hmm docs for GetVersionStringModifier() say that i
Nicolas Zea
2011/11/17 04:58:10
Good catch. Done.
| |
500 if (version_modifier == " ") // Not set for unofficial builds. | |
501 version_modifier = "-devel"; | |
502 strings->SetString("version", chrome_version.Name() + " " + | |
503 chrome_version.OSType() + " " + chrome_version.Version() + " (" + | |
504 chrome_version.LastChange() + ")" + version_modifier); | |
494 strings->Set("authenticated", | 505 strings->Set("authenticated", |
495 new base::FundamentalValue(full_status.authenticated)); | 506 new base::FundamentalValue(full_status.authenticated)); |
496 strings->SetString("auth_problem", | 507 strings->SetString("auth_problem", |
497 sync_ui_util::MakeSyncAuthErrorText( | 508 sync_ui_util::MakeSyncAuthErrorText( |
498 service->GetAuthError().state())); | 509 service->GetAuthError().state())); |
499 | 510 |
500 strings->SetString("time_since_sync", service->GetLastSyncedTimeString()); | 511 strings->SetString("time_since_sync", service->GetLastSyncedTimeString()); |
501 | 512 |
502 ListValue* details = new ListValue(); | 513 ListValue* details = new ListValue(); |
503 strings->Set("details", details); | 514 strings->Set("details", details); |
504 sync_ui_util::AddBoolSyncDetail(details, "Sync Initialized", | 515 sync_ui_util::AddBoolSyncDetail(details, "Sync Initialized", |
505 service->sync_initialized()); | 516 service->sync_initialized()); |
506 sync_ui_util::AddBoolSyncDetail(details, "Sync Setup Has Completed", | 517 sync_ui_util::AddBoolSyncDetail(details, "Sync Setup Has Completed", |
507 service->HasSyncSetupCompleted()); | 518 service->HasSyncSetupCompleted()); |
519 sync_ui_util::AddStringSyncDetails( | |
520 details, | |
521 "Client ID", | |
522 full_status.unique_id == "" ? "none" : full_status.unique_id); | |
akalin
2011/11/17 04:12:43
unique_id.empty()
Nicolas Zea
2011/11/17 04:58:10
Done.
| |
508 sync_ui_util::AddBoolSyncDetail(details, | 523 sync_ui_util::AddBoolSyncDetail(details, |
509 "Server Up", | 524 "Server Up", |
510 full_status.server_up); | 525 full_status.server_up); |
511 sync_ui_util::AddBoolSyncDetail(details, | 526 sync_ui_util::AddBoolSyncDetail(details, |
512 "Server Reachable", | 527 "Server Reachable", |
513 full_status.server_reachable); | 528 full_status.server_reachable); |
514 sync_ui_util::AddBoolSyncDetail(details, | 529 sync_ui_util::AddBoolSyncDetail(details, |
515 "Server Broken", | 530 "Server Broken", |
516 full_status.server_broken); | 531 full_status.server_broken); |
517 sync_ui_util::AddBoolSyncDetail(details, | 532 sync_ui_util::AddBoolSyncDetail(details, |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
657 DictionaryValue* val = new DictionaryValue; | 672 DictionaryValue* val = new DictionaryValue; |
658 val->SetString("model_type", ModelTypeToString(it->first)); | 673 val->SetString("model_type", ModelTypeToString(it->first)); |
659 val->SetString("group", ModelSafeGroupToString(it->second)); | 674 val->SetString("group", ModelSafeGroupToString(it->second)); |
660 routing_info->Append(val); | 675 routing_info->Append(val); |
661 } | 676 } |
662 } | 677 } |
663 } | 678 } |
664 } | 679 } |
665 | 680 |
666 } // namespace sync_ui_util | 681 } // namespace sync_ui_util |
OLD | NEW |