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
3 // found in the LICENSE file.
5 #include "chrome/common/chrome_version_info.h"
7 #include "base/strings/string_util.h"
8 #include "build/build_config.h"
13 std::string
VersionInfo::GetVersionStringModifier() {
14 char* env
= getenv("CHROME_VERSION_EXTRA");
17 #if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS)
22 std::string
modifier(env
);
24 #if defined(GOOGLE_CHROME_BUILD)
25 // Only ever return "", "unknown", "dev" or "beta" in a branded build.
26 if (modifier
== "unstable") // linux version of "dev"
28 if (modifier
== "stable") {
30 } else if ((modifier
== "dev") || (modifier
== "beta")) {
37 #if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS)
45 VersionInfo::Channel
VersionInfo::GetChannel() {
46 #if defined(GOOGLE_CHROME_BUILD)
47 std::string channel
= GetVersionStringModifier();
48 // There might be suffixes after channel name (e.g. "aura"), so match just
49 // the beginning of version string modifier.
50 if (channel
.empty()) {
51 return CHANNEL_STABLE
;
52 } else if (StartsWithASCII(channel
, "beta ", true)) {
54 } else if (StartsWithASCII(channel
, "dev ", true)) {
56 } else if (StartsWithASCII(channel
, "canary ", true)) {
57 return CHANNEL_CANARY
;
61 return CHANNEL_UNKNOWN
;