summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_about_handler.cc3
-rw-r--r--chrome/browser/cocoa/about_window_controller.mm18
-rw-r--r--chrome/browser/resources/about_version.html2
-rwxr-xr-xchrome/browser/views/about_chrome_view.cc81
-rw-r--r--chrome/common/platform_util.h5
-rw-r--r--chrome/common/platform_util_linux.cc9
-rw-r--r--chrome/common/platform_util_mac.mm13
-rw-r--r--chrome/common/platform_util_win.cc77
8 files changed, 123 insertions, 85 deletions
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc
index 128ad14..320af0c 100644
--- a/chrome/browser/browser_about_handler.cc
+++ b/chrome/browser/browser_about_handler.cc
@@ -34,6 +34,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/histogram_synchronizer.h"
#include "chrome/common/jstemplate_builder.h"
+#include "chrome/common/platform_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/render_messages.h"
@@ -506,6 +507,8 @@ std::string AboutVersion(DictionaryValue* localized_strings) {
localized_strings->SetString(L"name",
l10n_util::GetString(IDS_PRODUCT_NAME));
localized_strings->SetString(L"version", version_info->file_version());
+ std::wstring mod = UTF16ToWide(platform_util::GetVersionStringModifier());
+ localized_strings->SetString(L"version_modifier", mod);
localized_strings->SetString(L"js_engine", js_engine);
localized_strings->SetString(L"js_version", js_version);
localized_strings->SetString(L"webkit_version", webkit_version);
diff --git a/chrome/browser/cocoa/about_window_controller.mm b/chrome/browser/cocoa/about_window_controller.mm
index 47631a6..ae71983 100644
--- a/chrome/browser/cocoa/about_window_controller.mm
+++ b/chrome/browser/cocoa/about_window_controller.mm
@@ -14,6 +14,7 @@
#import "chrome/browser/cocoa/background_tile_view.h"
#import "chrome/browser/cocoa/keystone_glue.h"
#include "chrome/browser/cocoa/restart_browser.h"
+#include "chrome/common/platform_util.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -127,19 +128,18 @@ static BOOL recentShownUserActionFailedStatus = NO;
NSString* chromeVersion =
[bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
-#if defined(GOOGLE_CHROME_BUILD)
- NSString* version = chromeVersion;
- NSString* channel = [bundle objectForInfoDictionaryKey:@"KSChannelID"];
- if (!channel)
- channel = @"stable";
- version = [NSString stringWithFormat:@"%@ %@", version, channel];
-#else // GOOGLE_CHROME_BUILD
+ NSString* versionModifier = @"";
+ string16 modifier = platform_util::GetVersionStringModifier();
+ if (modifier.length())
+ versionModifier = [NSString stringWithFormat:@" %@",
+ base::SysUTF16ToNSString(modifier)];
+
// The format string is not localized, but this is how the displayed version
// is built on Windows too.
NSString* svnRevision = [bundle objectForInfoDictionaryKey:@"SVNRevision"];
NSString* version =
- [NSString stringWithFormat:@"%@ (%@)", chromeVersion, svnRevision];
-#endif // GOOGLE_CHROME_BUILD
+ [NSString stringWithFormat:@"%@%@ (%@)",
+ chromeVersion, versionModifier, svnRevision];
[version_ setStringValue:version];
diff --git a/chrome/browser/resources/about_version.html b/chrome/browser/resources/about_version.html
index cb2e02b..dc87c24 100644
--- a/chrome/browser/resources/about_version.html
+++ b/chrome/browser/resources/about_version.html
@@ -74,7 +74,7 @@ about:version template page
<td class="version" id="os_version"><span i18n-content="os_version"></span></td>
</tr>
<tr><td class="label" valign="top" id="name" i18n-content="name"></td>
- <td class="version" id="version"><span i18n-content="version"></span> (<span i18n-content="official"></span> <span i18n-content="cl"></span>)</td>
+ <td class="version" id="version"><span i18n-content="version"></span> <span i18n-content="version_modifier"></span> (<span i18n-content="official"></span> <span i18n-content="cl"></span>)</td>
</tr>
<tr><td class="label" valign="top">WebKit</td>
<td class="version" id="webkit_version" i18n-content="webkit_version"></td>
diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc
index 9877ec2..0e8b79c 100755
--- a/chrome/browser/views/about_chrome_view.cc
+++ b/chrome/browser/views/about_chrome_view.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/common/chrome_constants.h"
+#include "chrome/common/platform_util.h"
#include "chrome/common/url_constants.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -62,74 +63,6 @@ std::wstring StringSubRange(const std::wstring& text, size_t start,
return text.substr(start, end - start);
}
-#if defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)
-
-// Constants copied from src/tools/channel_changer/channel_changer.cc.
-
-// The Google Update key to read to find out which branch you are on.
-const wchar_t* const kChromeClientStateKey =
- L"Software\\Google\\Update\\ClientState\\"
- L"{8A69D345-D564-463C-AFF1-A69D9E530F96}";
-
-// The Google Client key to read to find out which branch you are on.
-const wchar_t* const kChromeClientsKey =
- L"Software\\Google\\Update\\Clients\\"
- L"{8A69D345-D564-463C-AFF1-A69D9E530F96}";
-
-// The Google Update value that defines which branch you are on.
-const wchar_t* const kBranchKey = L"ap";
-
-// The suffix Google Update sometimes adds to the channel name (channel names
-// are defined in kBranchStrings), indicating that a full install is needed. We
-// strip this out (if present) for the purpose of determining which channel you
-// are on.
-const wchar_t* const kChannelSuffix = L"-full";
-
-// See DetectBranch() in src/tools/channel_changer/channel_changer.cc.
-std::wstring CurrentChromeChannel() {
- std::wstring update_branch = L"stable"; // default if we get confused.
-
- // See if we can find the Clients key on the HKLM branch.
- HKEY registry_hive = HKEY_LOCAL_MACHINE;
- RegKey google_update_hklm(registry_hive, kChromeClientsKey, KEY_READ);
- if (!google_update_hklm.Valid()) {
- // HKLM failed us, try the same for the HKCU branch.
- registry_hive = HKEY_CURRENT_USER;
- RegKey google_update_hkcu(registry_hive, kChromeClientsKey, KEY_READ);
- if (!google_update_hkcu.Valid()) {
- // Unknown.
- registry_hive = 0;
- }
- }
-
- if (registry_hive != 0) {
- // Now that we know which hive to use, read the 'ap' key from it.
- RegKey client_state(registry_hive, kChromeClientStateKey, KEY_READ);
- client_state.ReadValue(kBranchKey, &update_branch);
-
- // We look for '1.1-beta' or '1.1-dev', but Google Update might have added
- // '-full' to the channel name, which we need to strip out to determine what
- // channel you are on.
- std::wstring suffix = kChannelSuffix;
- if (update_branch.length() > suffix.length()) {
- size_t index = update_branch.rfind(suffix);
- if (index != std::wstring::npos &&
- index == update_branch.length() - suffix.length()) {
- update_branch = update_branch.substr(0, index);
- }
- }
- }
-
- // Map to something pithy for human consumption.
- if ((update_branch == L"2.0-dev") ||(update_branch == L"1.1-dev"))
- update_branch = L"dev";
- else if (update_branch == L"1.1-beta")
- update_branch = L"beta";
-
- return update_branch;
-}
-#endif /* GOOGLE_CHROME_BUILD && OS_WIN */
-
} // namespace
namespace browser {
@@ -203,17 +136,15 @@ void AboutChromeView::Init() {
return;
}
+ string16 version_modifier = platform_util::GetVersionStringModifier();
+ if (version_modifier.length()) {
+ current_version_ += L" ";
+ current_version_ += UTF16ToWide(version_modifier);
+ }
current_version_ = version_info->file_version();
-#if defined(GOOGLE_CHROME_BUILD)
-#if defined(OS_WIN)
- current_version_ += L" ";
- current_version_ += CurrentChromeChannel();
-#endif
-#else
current_version_ += L" (";
current_version_ += version_info->last_change();
current_version_ += L")";
-#endif
// Views we will add to the *parent* of this dialog, since it will display
// next to the buttons which we don't draw ourselves.
diff --git a/chrome/common/platform_util.h b/chrome/common/platform_util.h
index 0a042f2..99b322e 100644
--- a/chrome/common/platform_util.h
+++ b/chrome/common/platform_util.h
@@ -44,6 +44,11 @@ void SimpleErrorBox(gfx::NativeWindow parent,
const string16& title,
const string16& message);
+// Return a human readable modifier for the version string. For a
+// branded Chrome (not Chromium), this modifier is the channel (dev,
+// beta, stable).
+string16 GetVersionStringModifier();
+
}
#endif // CHROME_COMMON_PLATFORM_UTIL_H_
diff --git a/chrome/common/platform_util_linux.cc b/chrome/common/platform_util_linux.cc
index b7853c5..79990a5 100644
--- a/chrome/common/platform_util_linux.cc
+++ b/chrome/common/platform_util_linux.cc
@@ -88,4 +88,13 @@ void SimpleErrorBox(gfx::NativeWindow parent,
gtk_widget_show_all(dialog);
}
+/* Warning: this may be either Linux or ChromeOS */
+string16 GetVersionStringModifier() {
+#if defined(GOOGLE_CHROME_BUILD)
+ return EmptyString16(); /* TODO(jrg,mmoss) */
+#else
+ return EmptyString16();
+#endif
+}
+
} // namespace platform_util
diff --git a/chrome/common/platform_util_mac.mm b/chrome/common/platform_util_mac.mm
index 2c9883a..14ba3a5 100644
--- a/chrome/common/platform_util_mac.mm
+++ b/chrome/common/platform_util_mac.mm
@@ -10,6 +10,7 @@
#include "app/l10n_util_mac.h"
#include "base/file_path.h"
#include "base/logging.h"
+#include "base/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/cocoa/tab_window_controller.h"
#include "googleurl/src/gurl.h"
@@ -84,4 +85,16 @@ void SimpleErrorBox(gfx::NativeWindow parent,
[alert runModal];
}
+string16 GetVersionStringModifier() {
+#if defined(GOOGLE_CHROME_BUILD)
+ NSBundle* bundle = mac_util::MainAppBundle();
+ NSString* channel = [bundle objectForInfoDictionaryKey:@"KSChannelID"];
+ if (!channel)
+ channel = @"stable";
+ return base::SysNSStringToUTF16(channel);
+#else
+ return EmptyString16();
+#endif
+}
+
} // namespace platform_util
diff --git a/chrome/common/platform_util_win.cc b/chrome/common/platform_util_win.cc
index 1b1b666..2427d3f 100644
--- a/chrome/common/platform_util_win.cc
+++ b/chrome/common/platform_util_win.cc
@@ -157,4 +157,81 @@ void SimpleErrorBox(gfx::NativeWindow parent,
win_util::MessageBox(parent, message, title, MB_OK | MB_SETFOREGROUND);
}
+
+namespace {
+// Constants copied from src/tools/channel_changer/channel_changer.cc.
+
+// The Google Update key to read to find out which branch you are on.
+const wchar_t* const kChromeClientStateKey =
+ L"Software\\Google\\Update\\ClientState\\"
+ L"{8A69D345-D564-463C-AFF1-A69D9E530F96}";
+
+// The Google Client key to read to find out which branch you are on.
+const wchar_t* const kChromeClientsKey =
+ L"Software\\Google\\Update\\Clients\\"
+ L"{8A69D345-D564-463C-AFF1-A69D9E530F96}";
+
+// The Google Update value that defines which branch you are on.
+const wchar_t* const kBranchKey = L"ap";
+
+// The suffix Google Update sometimes adds to the channel name (channel names
+// are defined in kBranchStrings), indicating that a full install is needed. We
+// strip this out (if present) for the purpose of determining which channel you
+// are on.
+const wchar_t* const kChannelSuffix = L"-full";
+
+// See DetectBranch() in src/tools/channel_changer/channel_changer.cc.
+std::wstring CurrentChromeChannel() {
+ std::wstring update_branch = L"stable"; // default if we get confused.
+
+ // See if we can find the Clients key on the HKLM branch.
+ HKEY registry_hive = HKEY_LOCAL_MACHINE;
+ RegKey google_update_hklm(registry_hive, kChromeClientsKey, KEY_READ);
+ if (!google_update_hklm.Valid()) {
+ // HKLM failed us, try the same for the HKCU branch.
+ registry_hive = HKEY_CURRENT_USER;
+ RegKey google_update_hkcu(registry_hive, kChromeClientsKey, KEY_READ);
+ if (!google_update_hkcu.Valid()) {
+ // Unknown.
+ registry_hive = 0;
+ }
+ }
+
+ if (registry_hive != 0) {
+ // Now that we know which hive to use, read the 'ap' key from it.
+ RegKey client_state(registry_hive, kChromeClientStateKey, KEY_READ);
+ client_state.ReadValue(kBranchKey, &update_branch);
+
+ // We look for '1.1-beta' or '1.1-dev', but Google Update might have added
+ // '-full' to the channel name, which we need to strip out to determine what
+ // channel you are on.
+ std::wstring suffix = kChannelSuffix;
+ if (update_branch.length() > suffix.length()) {
+ size_t index = update_branch.rfind(suffix);
+ if (index != std::wstring::npos &&
+ index == update_branch.length() - suffix.length()) {
+ update_branch = update_branch.substr(0, index);
+ }
+ }
+ }
+
+ // Map to something pithy for human consumption.
+ if ((update_branch == L"2.0-dev") ||(update_branch == L"1.1-dev"))
+ update_branch = L"dev";
+ else if (update_branch == L"1.1-beta")
+ update_branch = L"beta";
+
+ return update_branch;
+}
+
+} // namespace
+
+string16 GetVersionStringModifier() {
+#if defined(GOOGLE_CHROME_BUILD)
+ return CurrentChromeChannel();
+#else
+ return EmptyString16();
+#endif
+}
+
} // namespace platform_util