diff options
author | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-15 18:38:25 +0000 |
---|---|---|
committer | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-15 18:38:25 +0000 |
commit | 2772b637e69f7160b08cc1367f9382ab8656e1a9 (patch) | |
tree | 2e4c23b7a67c974c1e6aa488bd6e52965284ee12 | |
parent | 38b44f19e11a45dcbb34c35f0c85d687aabf6b65 (diff) | |
download | chromium_src-2772b637e69f7160b08cc1367f9382ab8656e1a9.zip chromium_src-2772b637e69f7160b08cc1367f9382ab8656e1a9.tar.gz chromium_src-2772b637e69f7160b08cc1367f9382ab8656e1a9.tar.bz2 |
New consensus is to print
"" if stable,
"dev" or "beta" if dev or beta, and
"unknown" in all other cases.
BUG=31772
Review URL: http://codereview.chromium.org/545063
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36375 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/common/platform_util_linux.cc | 20 | ||||
-rw-r--r-- | chrome/common/platform_util_mac.mm | 11 | ||||
-rw-r--r-- | chrome/common/platform_util_win.cc | 12 |
3 files changed, 34 insertions, 9 deletions
diff --git a/chrome/common/platform_util_linux.cc b/chrome/common/platform_util_linux.cc index eb991ef..3bc99ee 100644 --- a/chrome/common/platform_util_linux.cc +++ b/chrome/common/platform_util_linux.cc @@ -90,7 +90,25 @@ void SimpleErrorBox(gfx::NativeWindow parent, /* Warning: this may be either Linux or ChromeOS */ string16 GetVersionStringModifier() { - return ASCIIToUTF16(getenv("CHROME_VERSION_EXTRA")); + char* env = getenv("CHROME_VERSION_EXTRA"); + if (!env) + return string16(); + std::string modifier(env); + +#if defined(GOOGLE_CHROME_BUILD) + // Only ever return "", "unknown", "dev" or "beta" in a branded build. + if (modifier == "unstable") // linux version of "dev" + modifier = "dev"; + if (modifier == "stable") { + modifier = ""; + } else if ((modifier == "dev") || (modifier == "beta")) { + // do nothing. + } else { + modifier = "unknown"; + } +#endif + + return ASCIIToUTF16(modifier); } } // namespace platform_util diff --git a/chrome/common/platform_util_mac.mm b/chrome/common/platform_util_mac.mm index 359af9e..3b72ef3 100644 --- a/chrome/common/platform_util_mac.mm +++ b/chrome/common/platform_util_mac.mm @@ -89,8 +89,15 @@ string16 GetVersionStringModifier() { #if defined(GOOGLE_CHROME_BUILD) NSBundle* bundle = mac_util::MainAppBundle(); NSString* channel = [bundle objectForInfoDictionaryKey:@"KSChannelID"]; - if (!channel) - channel = @"stable"; + // Only ever return "", "unknown", "beta" or "dev" in a branded build. + if ([channel isEqual:@"stable"]) { + channel = @""; + } else if ([channel isEqual:@"beta"] || [channel isEqual:@"dev"]) { + // do nothing. + } else { + channel = @"unknown"; + } + return base::SysNSStringToUTF16(channel); #else return string16(); diff --git a/chrome/common/platform_util_win.cc b/chrome/common/platform_util_win.cc index 9b786c2..93da55c 100644 --- a/chrome/common/platform_util_win.cc +++ b/chrome/common/platform_util_win.cc @@ -177,7 +177,7 @@ std::wstring CurrentChromeChannel() { } } - std::wstring update_branch; + std::wstring update_branch(L"unknown"); // the default. if (registry_hive != 0) { // Now that we know which hive to use, read the 'ap' key from it. std::wstring key = google_update::kRegPathClientState + @@ -186,8 +186,9 @@ std::wstring CurrentChromeChannel() { client_state.ReadValue(google_update::kRegApField, &update_branch); // If the parent folder exists (we have a valid install) but the // 'ap' key is empty, we necessarily are the stable channel. + // So we print nothing. if (update_branch.empty() && client_state.Valid()) { - update_branch = L"stable"; + update_branch = L""; } } @@ -195,14 +196,13 @@ std::wstring CurrentChromeChannel() { // what the ap string can contain, but generally it will contain a number // followed by a dash followed by the branch name (and then some random // suffix). We fall back on empty string in case we fail to parse. + // Only ever return "", "unknown", "dev" or "beta". if (update_branch.find(L"-beta") != std::wstring::npos) update_branch = L"beta"; else if (update_branch.find(L"-dev") != std::wstring::npos) update_branch = L"dev"; - else if (update_branch.find(L"stable") != std::wstring::npos) - update_branch = L"stable"; - else - update_branch = L""; + else if (!update_branch.empty()) + update_branch = L"unknown"; return update_branch; } |