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

Side by Side Diff: chrome/common/chrome_version_info.cc

Issue 7104106: Unify the version string to be displayed on "About Chromium" dialog. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Change the regular expression to extract git-svn-id Created 9 years, 6 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 | Annotate | Revision Log
OLDNEW
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"
12 #include "chrome/browser/platform_util.h"
13 #include "grit/chromium_strings.h" 13 #include "grit/chromium_strings.h"
14 #include "grit/generated_resources.h"
15 #include "ui/base/l10n/l10n_util.h"
14 16
15 namespace chrome { 17 namespace chrome {
16 18
17 #if defined(OS_WIN) || defined(OS_MACOSX) 19 #if defined(OS_WIN) || defined(OS_MACOSX)
18 // On Windows and Mac, we get the Chrome version info by querying 20 // On Windows and Mac, we get the Chrome version info by querying
19 // FileVersionInfo for the current module. 21 // FileVersionInfo for the current module.
20 22
21 VersionInfo::VersionInfo() { 23 VersionInfo::VersionInfo() {
22 // The current module is already loaded in memory, so this will be cheap. 24 // The current module is already loaded in memory, so this will be cheap.
23 base::ThreadRestrictions::ScopedAllowIO allow_io; 25 base::ThreadRestrictions::ScopedAllowIO allow_io;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 std::string VersionInfo::LastChange() const { 84 std::string VersionInfo::LastChange() const {
83 return LAST_CHANGE; 85 return LAST_CHANGE;
84 } 86 }
85 87
86 bool VersionInfo::IsOfficialBuild() const { 88 bool VersionInfo::IsOfficialBuild() const {
87 return OFFICIAL_BUILD; 89 return OFFICIAL_BUILD;
88 } 90 }
89 91
90 #endif 92 #endif
91 93
94 std::string VersionInfo::CreateVersionString() const {
95 std::string current_version = "";
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() ?
102 IDS_ABOUT_VERSION_OFFICIAL : IDS_ABOUT_VERSION_UNOFFICIAL);
103 current_version += " ";
104 current_version += OSType();
105 current_version += " ";
106 current_version += LastChange();
107 current_version += ")";
108 #endif
109 std::string modifier = platform_util::GetVersionStringModifier();
110 if (!modifier.empty())
111 current_version += " " + modifier;
112 }
113 return current_version;
114 }
115
92 std::string VersionInfo::OSType() const { 116 std::string VersionInfo::OSType() const {
93 #if defined(OS_WIN) 117 #if defined(OS_WIN)
94 return "Windows"; 118 return "Windows";
95 #elif defined(OS_MACOSX) 119 #elif defined(OS_MACOSX)
96 return "Mac OS"; 120 return "Mac OS";
97 #elif defined(OS_CHROMEOS) 121 #elif defined(OS_CHROMEOS)
98 return UTF16ToASCII(l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)); 122 return UTF16ToASCII(l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME));
99 #elif defined(OS_LINUX) 123 #elif defined(OS_LINUX)
100 return "Linux"; 124 return "Linux";
101 #elif defined(OS_FREEBSD) 125 #elif defined(OS_FREEBSD)
102 return "FreeBSD"; 126 return "FreeBSD";
103 #elif defined(OS_OPENBSD) 127 #elif defined(OS_OPENBSD)
104 return "OpenBSD"; 128 return "OpenBSD";
105 #elif defined(OS_SOLARIS) 129 #elif defined(OS_SOLARIS)
106 return "Solaris"; 130 return "Solaris";
107 #else 131 #else
108 return "Unknown"; 132 return "Unknown";
109 #endif 133 #endif
110 } 134 }
111 135
112 } // namespace chrome 136 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698