Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: chrome/browser/sync/sync_ui_util.cc

Issue 8585037: Revert the revert. This change was not the cause of the failures, so relanding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/sync_ui_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 strings->SetString("version", GetVersionString());
494 strings->Set("authenticated", 496 strings->Set("authenticated",
495 new base::FundamentalValue(full_status.authenticated)); 497 new base::FundamentalValue(full_status.authenticated));
496 strings->SetString("auth_problem", 498 strings->SetString("auth_problem",
497 sync_ui_util::MakeSyncAuthErrorText( 499 sync_ui_util::MakeSyncAuthErrorText(
498 service->GetAuthError().state())); 500 service->GetAuthError().state()));
499 501
500 strings->SetString("time_since_sync", service->GetLastSyncedTimeString()); 502 strings->SetString("time_since_sync", service->GetLastSyncedTimeString());
501 503
502 ListValue* details = new ListValue(); 504 ListValue* details = new ListValue();
503 strings->Set("details", details); 505 strings->Set("details", details);
504 sync_ui_util::AddBoolSyncDetail(details, "Sync Initialized", 506 sync_ui_util::AddBoolSyncDetail(details, "Sync Initialized",
505 service->sync_initialized()); 507 service->sync_initialized());
506 sync_ui_util::AddBoolSyncDetail(details, "Sync Setup Has Completed", 508 sync_ui_util::AddBoolSyncDetail(details, "Sync Setup Has Completed",
507 service->HasSyncSetupCompleted()); 509 service->HasSyncSetupCompleted());
510 sync_ui_util::AddStringSyncDetails(
511 details,
512 "Client ID",
513 full_status.unique_id.empty() ? "none" : full_status.unique_id);
508 sync_ui_util::AddBoolSyncDetail(details, 514 sync_ui_util::AddBoolSyncDetail(details,
509 "Server Up", 515 "Server Up",
510 full_status.server_up); 516 full_status.server_up);
511 sync_ui_util::AddBoolSyncDetail(details, 517 sync_ui_util::AddBoolSyncDetail(details,
512 "Server Reachable", 518 "Server Reachable",
513 full_status.server_reachable); 519 full_status.server_reachable);
514 sync_ui_util::AddBoolSyncDetail(details, 520 sync_ui_util::AddBoolSyncDetail(details,
515 "Server Broken", 521 "Server Broken",
516 full_status.server_broken); 522 full_status.server_broken);
517 sync_ui_util::AddBoolSyncDetail(details, 523 sync_ui_util::AddBoolSyncDetail(details,
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 for (; it != routes.end(); ++it) { 662 for (; it != routes.end(); ++it) {
657 DictionaryValue* val = new DictionaryValue; 663 DictionaryValue* val = new DictionaryValue;
658 val->SetString("model_type", ModelTypeToString(it->first)); 664 val->SetString("model_type", ModelTypeToString(it->first));
659 val->SetString("group", ModelSafeGroupToString(it->second)); 665 val->SetString("group", ModelSafeGroupToString(it->second));
660 routing_info->Append(val); 666 routing_info->Append(val);
661 } 667 }
662 } 668 }
663 } 669 }
664 } 670 }
665 671
672 std::string GetVersionString() {
673 // Build a version string that matches MakeUserAgentForSyncApi with the
674 // addition of channel info and proper OS names.
675 chrome::VersionInfo chrome_version;
676 if (!chrome_version.is_valid())
677 return "invalid";
678 // GetVersionStringModifier returns empty string for stable channel or
679 // unofficial builds, the channel string otherwise. We want to have "-devel"
680 // for unofficial builds only.
681 std::string version_modifier =
682 chrome::VersionInfo::GetVersionStringModifier();
683 if (version_modifier.empty()) {
684 if (chrome::VersionInfo::GetChannel() !=
685 chrome::VersionInfo::CHANNEL_STABLE) {
686 version_modifier = "-devel";
687 }
688 } else {
689 version_modifier = " " + version_modifier;
690 }
691 return chrome_version.Name() + " " + chrome_version.OSType() + " " +
692 chrome_version.Version() + " (" + chrome_version.LastChange() + ")" +
693 version_modifier;
694 }
695
666 } // namespace sync_ui_util 696 } // namespace sync_ui_util
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_ui_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698