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

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

Issue 8590030: Revert "[Sync] Add version info to about:sync" (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"
22 #include "chrome/common/net/gaia/google_service_auth_error.h" 21 #include "chrome/common/net/gaia/google_service_auth_error.h"
23 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
24 #include "grit/browser_resources.h" 23 #include "grit/browser_resources.h"
25 #include "grit/chromium_strings.h" 24 #include "grit/chromium_strings.h"
26 #include "grit/generated_resources.h" 25 #include "grit/generated_resources.h"
27 #include "grit/locale_settings.h" 26 #include "grit/locale_settings.h"
28 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
29 #include "ui/base/resource/resource_bundle.h" 28 #include "ui/base/resource/resource_bundle.h"
30 29
31 typedef GoogleServiceAuthError AuthError; 30 typedef GoogleServiceAuthError AuthError;
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 strings->SetString("summary", "SYNC DISABLED"); 484 strings->SetString("summary", "SYNC DISABLED");
486 } else { 485 } else {
487 sync_api::SyncManager::Status full_status( 486 sync_api::SyncManager::Status full_status(
488 service->QueryDetailedSyncStatus()); 487 service->QueryDetailedSyncStatus());
489 488
490 strings->SetString("service_url", service->sync_service_url().spec()); 489 strings->SetString("service_url", service->sync_service_url().spec());
491 strings->SetString("summary", 490 strings->SetString("summary",
492 ProfileSyncService::BuildSyncStatusSummaryText( 491 ProfileSyncService::BuildSyncStatusSummaryText(
493 full_status.summary)); 492 full_status.summary));
494 493
495 strings->SetString("version", GetVersionString());
496 strings->Set("authenticated", 494 strings->Set("authenticated",
497 new base::FundamentalValue(full_status.authenticated)); 495 new base::FundamentalValue(full_status.authenticated));
498 strings->SetString("auth_problem", 496 strings->SetString("auth_problem",
499 sync_ui_util::MakeSyncAuthErrorText( 497 sync_ui_util::MakeSyncAuthErrorText(
500 service->GetAuthError().state())); 498 service->GetAuthError().state()));
501 499
502 strings->SetString("time_since_sync", service->GetLastSyncedTimeString()); 500 strings->SetString("time_since_sync", service->GetLastSyncedTimeString());
503 501
504 ListValue* details = new ListValue(); 502 ListValue* details = new ListValue();
505 strings->Set("details", details); 503 strings->Set("details", details);
506 sync_ui_util::AddBoolSyncDetail(details, "Sync Initialized", 504 sync_ui_util::AddBoolSyncDetail(details, "Sync Initialized",
507 service->sync_initialized()); 505 service->sync_initialized());
508 sync_ui_util::AddBoolSyncDetail(details, "Sync Setup Has Completed", 506 sync_ui_util::AddBoolSyncDetail(details, "Sync Setup Has Completed",
509 service->HasSyncSetupCompleted()); 507 service->HasSyncSetupCompleted());
510 sync_ui_util::AddStringSyncDetails(
511 details,
512 "Client ID",
513 full_status.unique_id.empty() ? "none" : full_status.unique_id);
514 sync_ui_util::AddBoolSyncDetail(details, 508 sync_ui_util::AddBoolSyncDetail(details,
515 "Server Up", 509 "Server Up",
516 full_status.server_up); 510 full_status.server_up);
517 sync_ui_util::AddBoolSyncDetail(details, 511 sync_ui_util::AddBoolSyncDetail(details,
518 "Server Reachable", 512 "Server Reachable",
519 full_status.server_reachable); 513 full_status.server_reachable);
520 sync_ui_util::AddBoolSyncDetail(details, 514 sync_ui_util::AddBoolSyncDetail(details,
521 "Server Broken", 515 "Server Broken",
522 full_status.server_broken); 516 full_status.server_broken);
523 sync_ui_util::AddBoolSyncDetail(details, 517 sync_ui_util::AddBoolSyncDetail(details,
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 for (; it != routes.end(); ++it) { 656 for (; it != routes.end(); ++it) {
663 DictionaryValue* val = new DictionaryValue; 657 DictionaryValue* val = new DictionaryValue;
664 val->SetString("model_type", ModelTypeToString(it->first)); 658 val->SetString("model_type", ModelTypeToString(it->first));
665 val->SetString("group", ModelSafeGroupToString(it->second)); 659 val->SetString("group", ModelSafeGroupToString(it->second));
666 routing_info->Append(val); 660 routing_info->Append(val);
667 } 661 }
668 } 662 }
669 } 663 }
670 } 664 }
671 665
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
696 } // namespace sync_ui_util 666 } // 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