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 !defined(NACL_WIN64) | |
96 if (is_valid()) { | |
97 current_version += Version(); | |
98 #if !defined(GOOGLE_CHROME_BUILD) | |
99 current_version += " ("; | |
100 current_version += l10n_util::GetStringUTF8( | |
101 IsOfficialBuild() ? | |
Mark Mentovai
2011/06/30 13:34:23
What does this even mean in the context of !define
haraken1
2011/07/04 07:50:52
Fixed it. As you pointed out, IsOfficialBuild() is
| |
102 IDS_ABOUT_VERSION_OFFICIAL : IDS_ABOUT_VERSION_UNOFFICIAL); | |
103 current_version += " "; | |
104 current_version += OSType(); | |
Mark Mentovai
2011/06/30 13:34:23
Why? This seems to be all of obvious, out-of-place
haraken1
2011/07/04 07:50:52
No change for now. I think that OS type is necessa
| |
105 current_version += " "; | |
106 current_version += LastChange(); | |
107 current_version += ")"; | |
108 #endif | |
109 std::string modifier = GetVersionStringModifier(); | |
110 if (!modifier.empty()) | |
111 current_version += " " + modifier; | |
112 } | |
113 #endif // !defined(NACL_WIN64) | |
114 return current_version; | |
115 } | |
116 | |
92 std::string VersionInfo::OSType() const { | 117 std::string VersionInfo::OSType() const { |
93 #if defined(OS_WIN) | 118 #if defined(OS_WIN) |
94 return "Windows"; | 119 return "Windows"; |
95 #elif defined(OS_MACOSX) | 120 #elif defined(OS_MACOSX) |
96 return "Mac OS"; | 121 return "Mac OS"; |
97 #elif defined(OS_CHROMEOS) | 122 #elif defined(OS_CHROMEOS) |
98 return UTF16ToASCII(l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)); | 123 return UTF16ToASCII(l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)); |
99 #elif defined(OS_LINUX) | 124 #elif defined(OS_LINUX) |
100 return "Linux"; | 125 return "Linux"; |
101 #elif defined(OS_FREEBSD) | 126 #elif defined(OS_FREEBSD) |
102 return "FreeBSD"; | 127 return "FreeBSD"; |
103 #elif defined(OS_OPENBSD) | 128 #elif defined(OS_OPENBSD) |
104 return "OpenBSD"; | 129 return "OpenBSD"; |
105 #elif defined(OS_SOLARIS) | 130 #elif defined(OS_SOLARIS) |
106 return "Solaris"; | 131 return "Solaris"; |
107 #else | 132 #else |
108 return "Unknown"; | 133 return "Unknown"; |
109 #endif | 134 #endif |
110 } | 135 } |
111 | 136 |
112 } // namespace chrome | 137 } // namespace chrome |
OLD | NEW |