OLD | NEW |
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/common/chrome_version_info.h" | 5 #include "chrome/common/chrome_version_info.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "ui/base/l10n/l10n_util.h" | |
11 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
12 #include "build/build_config.h" | 11 #include "build/build_config.h" |
13 #include "grit/chromium_strings.h" | 12 #include "grit/chromium_strings.h" |
| 13 #include "grit/generated_resources.h" |
| 14 #include "ui/base/l10n/l10n_util.h" |
14 | 15 |
15 namespace chrome { | 16 namespace chrome { |
16 | 17 |
17 #if defined(OS_WIN) || defined(OS_MACOSX) | 18 #if defined(OS_WIN) || defined(OS_MACOSX) |
18 // On Windows and Mac, we get the Chrome version info by querying | 19 // On Windows and Mac, we get the Chrome version info by querying |
19 // FileVersionInfo for the current module. | 20 // FileVersionInfo for the current module. |
20 | 21 |
21 VersionInfo::VersionInfo() { | 22 VersionInfo::VersionInfo() { |
22 // The current module is already loaded in memory, so this will be cheap. | 23 // The current module is already loaded in memory, so this will be cheap. |
23 base::ThreadRestrictions::ScopedAllowIO allow_io; | 24 base::ThreadRestrictions::ScopedAllowIO allow_io; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 std::string VersionInfo::LastChange() const { | 83 std::string VersionInfo::LastChange() const { |
83 return LAST_CHANGE; | 84 return LAST_CHANGE; |
84 } | 85 } |
85 | 86 |
86 bool VersionInfo::IsOfficialBuild() const { | 87 bool VersionInfo::IsOfficialBuild() const { |
87 return OFFICIAL_BUILD; | 88 return OFFICIAL_BUILD; |
88 } | 89 } |
89 | 90 |
90 #endif | 91 #endif |
91 | 92 |
| 93 std::string VersionInfo::CreateVersionString() const { |
| 94 std::string current_version; |
| 95 if (is_valid()) { |
| 96 current_version += Version(); |
| 97 #if !defined(GOOGLE_CHROME_BUILD) |
| 98 current_version += " ("; |
| 99 current_version += l10n_util::GetStringUTF8(IDS_ABOUT_VERSION_UNOFFICIAL); |
| 100 current_version += " "; |
| 101 current_version += LastChange(); |
| 102 current_version += " "; |
| 103 current_version += OSType(); |
| 104 current_version += ")"; |
| 105 #endif |
| 106 std::string modifier = GetVersionStringModifier(); |
| 107 if (!modifier.empty()) |
| 108 current_version += " " + modifier; |
| 109 } |
| 110 return current_version; |
| 111 } |
| 112 |
92 std::string VersionInfo::OSType() const { | 113 std::string VersionInfo::OSType() const { |
93 #if defined(OS_WIN) | 114 #if defined(OS_WIN) |
94 return "Windows"; | 115 return "Windows"; |
95 #elif defined(OS_MACOSX) | 116 #elif defined(OS_MACOSX) |
96 return "Mac OS"; | 117 return "Mac OS X"; |
97 #elif defined(OS_CHROMEOS) | 118 #elif defined(OS_CHROMEOS) |
98 return UTF16ToASCII(l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)); | 119 return UTF16ToASCII(l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)); |
99 #elif defined(OS_LINUX) | 120 #elif defined(OS_LINUX) |
100 return "Linux"; | 121 return "Linux"; |
101 #elif defined(OS_FREEBSD) | 122 #elif defined(OS_FREEBSD) |
102 return "FreeBSD"; | 123 return "FreeBSD"; |
103 #elif defined(OS_OPENBSD) | 124 #elif defined(OS_OPENBSD) |
104 return "OpenBSD"; | 125 return "OpenBSD"; |
105 #elif defined(OS_SOLARIS) | 126 #elif defined(OS_SOLARIS) |
106 return "Solaris"; | 127 return "Solaris"; |
107 #else | 128 #else |
108 return "Unknown"; | 129 return "Unknown"; |
109 #endif | 130 #endif |
110 } | 131 } |
111 | 132 |
112 } // namespace chrome | 133 } // namespace chrome |
OLD | NEW |