1 // Copyright 2017 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BASE_VERSION_INFO_CHANNEL_H_ 6 #define BASE_VERSION_INFO_CHANNEL_H_ 7 8 #include <string_view> 9 10 #include "base/notreached.h" 11 12 namespace version_info { 13 14 // The possible channels for an installation, from most fun to most stable. 15 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.base.version_info 16 enum class Channel { 17 UNKNOWN = 0, 18 // DEFAULT is an alias for UNKNOWN because the build files use DEFAULT but the 19 // code uses UNKNOWN. TODO(paulmiller): Combine DEFAULT & UNKNOWN. 20 DEFAULT = UNKNOWN, 21 CANARY = 1, 22 DEV = 2, 23 BETA = 3, 24 STABLE = 4, 25 }; 26 27 // Returns a string equivalent of |channel|, independent of whether the build 28 // is branded or not and without any additional modifiers. GetChannelString(Channel channel)29constexpr std::string_view GetChannelString(Channel channel) { 30 switch (channel) { 31 case Channel::STABLE: 32 return "stable"; 33 case Channel::BETA: 34 return "beta"; 35 case Channel::DEV: 36 return "dev"; 37 case Channel::CANARY: 38 return "canary"; 39 case Channel::UNKNOWN: 40 return "unknown"; 41 } 42 NOTREACHED_NORETURN(); 43 } 44 45 } // namespace version_info 46 47 #endif // BASE_VERSION_INFO_CHANNEL_H_ 48