Enable PPAPI tests for non-SFI mode.
[chromium-blink-merge.git] / chrome / common / chrome_version_info_posix.cc
bloba243b07416409bdd31ca637f5b175ec17c597fb2
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"
10 namespace chrome {
12 // static
13 std::string VersionInfo::GetVersionStringModifier() {
14 char* env = getenv("CHROME_VERSION_EXTRA");
15 if (!env) {
16 std::string modifier;
17 #if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS)
18 modifier = "aura";
19 #endif
20 return modifier;
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"
27 modifier = "dev";
28 if (modifier == "stable") {
29 modifier = "";
30 } else if ((modifier == "dev") || (modifier == "beta")) {
31 // do nothing.
32 } else {
33 modifier = "unknown";
35 #endif
37 #if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS)
38 modifier += " aura";
39 #endif
41 return modifier;
44 // static
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)) {
53 return CHANNEL_BETA;
54 } else if (StartsWithASCII(channel, "dev ", true)) {
55 return CHANNEL_DEV;
56 } else if (StartsWithASCII(channel, "canary ", true)) {
57 return CHANNEL_CANARY;
59 #endif
61 return CHANNEL_UNKNOWN;
64 } // namespace chrome