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

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

Issue 1269773002: Cleanup VersionInfo after componentization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 4 months 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
OLDNEW
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/about_sync_util.h" 5 #include "chrome/browser/sync/about_sync_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/sync/profile_sync_service.h" 12 #include "chrome/browser/sync/profile_sync_service.h"
13 #include "chrome/common/chrome_version_info.h" 13 #include "chrome/common/channel_info.h"
14 #include "components/signin/core/browser/signin_manager.h" 14 #include "components/signin/core/browser/signin_manager.h"
15 #include "components/version_info/version_info.h"
15 #include "sync/api/time.h" 16 #include "sync/api/time.h"
16 #include "sync/internal_api/public/util/sync_string_conversions.h" 17 #include "sync/internal_api/public/util/sync_string_conversions.h"
17 #include "sync/protocol/proto_enum_conversions.h" 18 #include "sync/protocol/proto_enum_conversions.h"
18 19
19 using base::DictionaryValue; 20 using base::DictionaryValue;
20 using base::ListValue; 21 using base::ListValue;
21 22
22 const char kIdentityTitle[] = "Identity"; 23 const char kIdentityTitle[] = "Identity";
23 const char kDetailsKey[] = "details"; 24 const char kDetailsKey[] = "details";
24 25
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 136 }
136 137
137 // Returns a string describing the chrome version environment. Version format: 138 // Returns a string describing the chrome version environment. Version format:
138 // <Build Info> <OS> <Version number> (<Last change>)<channel or "-devel"> 139 // <Build Info> <OS> <Version number> (<Last change>)<channel or "-devel">
139 // If version information is unavailable, returns "invalid." 140 // If version information is unavailable, returns "invalid."
140 // TODO(zea): this approximately matches MakeUserAgentForSyncApi in 141 // TODO(zea): this approximately matches MakeUserAgentForSyncApi in
141 // sync_backend_host.cc. Unify the two if possible. 142 // sync_backend_host.cc. Unify the two if possible.
142 std::string GetVersionString() { 143 std::string GetVersionString() {
143 // Build a version string that matches MakeUserAgentForSyncApi with the 144 // Build a version string that matches MakeUserAgentForSyncApi with the
144 // addition of channel info and proper OS names. 145 // addition of channel info and proper OS names.
145 chrome::VersionInfo chrome_version; 146 // chrome::GetChannelString() returns empty string for stable channel or
146 // GetVersionStringModifier returns empty string for stable channel or
147 // unofficial builds, the channel string otherwise. We want to have "-devel" 147 // unofficial builds, the channel string otherwise. We want to have "-devel"
148 // for unofficial builds only. 148 // for unofficial builds only.
149 std::string version_modifier = 149 std::string version_modifier = chrome::GetChannelString();
150 chrome::VersionInfo::GetVersionStringModifier();
151 if (version_modifier.empty()) { 150 if (version_modifier.empty()) {
152 if (chrome::VersionInfo::GetChannel() != 151 if (chrome::GetChannel() != version_info::Channel::STABLE) {
153 version_info::Channel::STABLE) {
154 version_modifier = "-devel"; 152 version_modifier = "-devel";
155 } 153 }
156 } else { 154 } else {
157 version_modifier = " " + version_modifier; 155 version_modifier = " " + version_modifier;
158 } 156 }
159 return chrome_version.Name() + " " + chrome_version.OSType() + " " + 157 return version_info::GetProductName() + " " + version_info::GetOSType() +
160 chrome_version.Version() + " (" + chrome_version.LastChange() + ")" + 158 " " + version_info::GetVersionNumber() + " (" +
161 version_modifier; 159 version_info::GetLastChange() + ")" + version_modifier;
162 } 160 }
163 161
164 std::string GetTimeStr(base::Time time, const std::string& default_msg) { 162 std::string GetTimeStr(base::Time time, const std::string& default_msg) {
165 std::string time_str; 163 std::string time_str;
166 if (time.is_null()) 164 if (time.is_null())
167 time_str = default_msg; 165 time_str = default_msg;
168 else 166 else
169 time_str = syncer::GetTimeDebugString(time); 167 time_str = syncer::GetTimeDebugString(time);
170 return time_str; 168 return time_str;
171 } 169 }
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 about_info->SetString("unrecoverable_error_message", 482 about_info->SetString("unrecoverable_error_message",
485 unrecoverable_error_message); 483 unrecoverable_error_message);
486 } 484 }
487 485
488 about_info->Set("type_status", service->GetTypeStatusMap()); 486 about_info->Set("type_status", service->GetTypeStatusMap());
489 487
490 return about_info.Pass(); 488 return about_info.Pass();
491 } 489 }
492 490
493 } // namespace sync_ui_util 491 } // namespace sync_ui_util
OLDNEW
« no previous file with comments | « chrome/browser/sxs_linux.cc ('k') | chrome/browser/sync/glue/chrome_report_unrecoverable_error.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698