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
3 // found in the LICENSE file.
5 #include "chrome/common/chrome_version_info.h"
7 #include "base/basictypes.h"
8 #include "base/file_version_info.h"
9 #include "base/strings/utf_string_conversions.h"
10 #include "base/threading/thread_restrictions.h"
11 #include "build/build_config.h"
12 #include "chrome/common/chrome_version_info_values.h"
13 #include "chrome/grit/chromium_strings.h"
14 #include "chrome/grit/generated_resources.h"
15 #include "ui/base/l10n/l10n_util.h"
19 std::string
VersionInfo::ProductNameAndVersionForUserAgent() const {
20 return "Chrome/" + Version();
23 VersionInfo::VersionInfo() {
26 VersionInfo::~VersionInfo() {
29 std::string
VersionInfo::Name() const {
33 std::string
VersionInfo::Version() const {
34 return PRODUCT_VERSION
;
37 std::string
VersionInfo::LastChange() const {
41 bool VersionInfo::IsOfficialBuild() const {
42 return IS_OFFICIAL_BUILD
;
45 std::string
VersionInfo::CreateVersionString() const {
46 std::string current_version
;
47 current_version
+= Version();
48 #if !defined(GOOGLE_CHROME_BUILD)
49 current_version
+= " (";
50 current_version
+= l10n_util::GetStringUTF8(IDS_ABOUT_VERSION_UNOFFICIAL
);
51 current_version
+= " ";
52 current_version
+= LastChange();
53 current_version
+= " ";
54 current_version
+= OSType();
55 current_version
+= ")";
57 std::string modifier
= GetVersionStringModifier();
58 if (!modifier
.empty())
59 current_version
+= " " + modifier
;
60 return current_version
;
63 std::string
VersionInfo::OSType() const {
68 #elif defined(OS_MACOSX)
70 #elif defined(OS_CHROMEOS)
71 #if defined(GOOGLE_CHROME_BUILD)
76 #elif defined(OS_ANDROID)
78 #elif defined(OS_LINUX)
80 #elif defined(OS_FREEBSD)
82 #elif defined(OS_OPENBSD)
84 #elif defined(OS_SOLARIS)