1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/version_info/version_info.h"
7 #include "build/build_config.h"
8 #include "components/version_info/version_info_values.h"
9 #include "grit/components_strings.h"
10 #include "ui/base/l10n/l10n_util.h"
12 namespace version_info
{
14 std::string
GetProductNameAndVersionForUserAgent() {
15 return "Chrome/" + GetVersionNumber();
18 std::string
GetProductName() {
22 std::string
GetVersionNumber() {
23 return PRODUCT_VERSION
;
26 std::string
GetLastChange() {
30 bool IsOfficialBuild() {
31 return IS_OFFICIAL_BUILD
;
34 std::string
GetOSType() {
39 #elif defined(OS_MACOSX)
41 #elif defined(OS_CHROMEOS)
42 # if defined(GOOGLE_CHROME_BUILD)
47 #elif defined(OS_ANDROID)
49 #elif defined(OS_LINUX)
51 #elif defined(OS_FREEBSD)
53 #elif defined(OS_OPENBSD)
55 #elif defined(OS_SOLARIS)
62 std::string
GetChannelString(Channel channel
) {
76 case Channel::UNKNOWN
:
83 std::string
GetVersionStringWithModifier(const std::string
& modifier
) {
84 std::string current_version
;
85 current_version
+= GetVersionNumber();
86 #if !defined(GOOGLE_CHROME_BUILD)
87 current_version
+= " (";
88 current_version
+= l10n_util::GetStringUTF8(IDS_ABOUT_VERSION_UNOFFICIAL
);
89 current_version
+= " ";
90 current_version
+= GetLastChange();
91 current_version
+= " ";
92 current_version
+= GetOSType();
93 current_version
+= ")";
95 if (!modifier
.empty())
96 current_version
+= " " + modifier
;
97 return current_version
;
100 } // namespace version_info