diff options
author | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-15 19:46:26 +0000 |
---|---|---|
committer | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-15 19:46:26 +0000 |
commit | d87dae2f56e7a32444dfc8750c4c560becf7548a (patch) | |
tree | ddf9f70350fb7904c589d45f6cd08c6fd0ae8ab1 /chrome/browser | |
parent | 2393d25daf892ef6d891ed9c7bacc4f4a11cf0f7 (diff) | |
download | chromium_src-d87dae2f56e7a32444dfc8750c4c560becf7548a.zip chromium_src-d87dae2f56e7a32444dfc8750c4c560becf7548a.tar.gz chromium_src-d87dae2f56e7a32444dfc8750c4c560becf7548a.tar.bz2 |
Move channel (beta,dev,stable) determination code to a common location.
Add channel info to about:version.
Linux about box work not done.
Linux channel determination code still a stub.
BUG=30444
How to verify:
- on both Mac and Win, with a branded build:
- confirm the About Box and about:version have channel info after the version number.
Channel for PC comes from the registry so it'll be the channel of your official install, not this build.
Channel for Mac comes from the Info.plist so it WILL be from the current version; stable if undefined.
Review URL: http://codereview.chromium.org/506007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34583 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser_about_handler.cc | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/about_window_controller.mm | 18 | ||||
-rw-r--r-- | chrome/browser/resources/about_version.html | 2 | ||||
-rwxr-xr-x | chrome/browser/views/about_chrome_view.cc | 81 |
4 files changed, 19 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. |