| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/chrome_version_info.h" | 5 #include "chrome/common/chrome_version_info.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" |
| 7 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 8 | 9 |
| 9 namespace chrome { | 10 namespace chrome { |
| 10 | 11 |
| 11 // static | 12 // static |
| 12 std::string VersionInfo::GetVersionStringModifier() { | 13 std::string VersionInfo::GetVersionStringModifier() { |
| 13 char* env = getenv("CHROME_VERSION_EXTRA"); | 14 char* env = getenv("CHROME_VERSION_EXTRA"); |
| 14 if (!env) { | 15 if (!env) { |
| 15 std::string modifier; | 16 std::string modifier; |
| 16 #if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) | 17 #if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 37 modifier += " aura"; | 38 modifier += " aura"; |
| 38 #endif | 39 #endif |
| 39 | 40 |
| 40 return modifier; | 41 return modifier; |
| 41 } | 42 } |
| 42 | 43 |
| 43 // static | 44 // static |
| 44 VersionInfo::Channel VersionInfo::GetChannel() { | 45 VersionInfo::Channel VersionInfo::GetChannel() { |
| 45 #if defined(GOOGLE_CHROME_BUILD) | 46 #if defined(GOOGLE_CHROME_BUILD) |
| 46 std::string channel = GetVersionStringModifier(); | 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. |
| 47 if (channel.empty()) { | 50 if (channel.empty()) { |
| 48 return CHANNEL_STABLE; | 51 return CHANNEL_STABLE; |
| 49 } else if (channel == "beta") { | 52 } else if (StartsWithASCII(channel, "beta ", true)) { |
| 50 return CHANNEL_BETA; | 53 return CHANNEL_BETA; |
| 51 } else if (channel == "dev") { | 54 } else if (StartsWithASCII(channel, "dev ", true)) { |
| 52 return CHANNEL_DEV; | 55 return CHANNEL_DEV; |
| 53 } else if (channel == "canary") { | 56 } else if (StartsWithASCII(channel, "canary ", true)) { |
| 54 return CHANNEL_CANARY; | 57 return CHANNEL_CANARY; |
| 55 } | 58 } |
| 56 #endif | 59 #endif |
| 57 | 60 |
| 58 return CHANNEL_UNKNOWN; | 61 return CHANNEL_UNKNOWN; |
| 59 } | 62 } |
| 60 | 63 |
| 61 } // namespace chrome | 64 } // namespace chrome |
| OLD | NEW |