summaryrefslogtreecommitdiffstats
path: root/chrome/common/chrome_version_info_linux.cc
diff options
context:
space:
mode:
authorharaken@google.com <haraken@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-24 18:39:12 +0000
committerharaken@google.com <haraken@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-24 18:39:12 +0000
commitf44f0a822af7153715776df850d43e7dee4b44ba (patch)
tree2edd15ceb2430e075f9b2f3384af95b6c3d1550f /chrome/common/chrome_version_info_linux.cc
parenta920effbdf6a9bccff256c2e6396ed7ddf4e5b0a (diff)
downloadchromium_src-f44f0a822af7153715776df850d43e7dee4b44ba.zip
chromium_src-f44f0a822af7153715776df850d43e7dee4b44ba.tar.gz
chromium_src-f44f0a822af7153715776df850d43e7dee4b44ba.tar.bz2
Move GetVersionStringModifier() and GetChannel() from platform_util_* to chrome_version_info_*
BUG=37186 TEST=No behavior change. Manually confirm that build succeeds on Linux, Mac and Windows if we comment out '#if defined(GOOGLE_CHROME_BUILD)' in chrome_version_info_*. Review URL: http://codereview.chromium.org/7249003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90394 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/chrome_version_info_linux.cc')
-rw-r--r--chrome/common/chrome_version_info_linux.cc50
1 files changed, 50 insertions, 0 deletions
diff --git a/chrome/common/chrome_version_info_linux.cc b/chrome/common/chrome_version_info_linux.cc
new file mode 100644
index 0000000..301ed70
--- /dev/null
+++ b/chrome/common/chrome_version_info_linux.cc
@@ -0,0 +1,50 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/chrome_version_info.h"
+
+namespace chrome {
+
+// static. Warning: this may be either Linux or ChromeOS.
+std::string VersionInfo::GetVersionStringModifier() {
+ char* env = getenv("CHROME_VERSION_EXTRA");
+ if (!env)
+ return std::string();
+ 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 modifier;
+}
+
+// static. Warning: this may be either Linux or ChromeOS.
+VersionInfo::Channel VersionInfo::GetChannel() {
+#if defined(GOOGLE_CHROME_BUILD)
+ std::string channel = GetVersionStringModifier();
+ if (channel.empty()) {
+ return CHANNEL_STABLE;
+ } else if (channel == "beta") {
+ return CHANNEL_BETA;
+ } else if (channel == "dev") {
+ return CHANNEL_DEV;
+ } else if (channel == "canary") {
+ return CHANNEL_CANARY;
+ }
+#endif
+
+ return CHANNEL_UNKNOWN;
+}
+
+} // namespace chrome