| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/metrics/net/version_utils.h" | 5 #include "components/metrics/version_utils.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "components/version_info/version_info.h" | 9 #include "components/version_info/version_info.h" |
| 10 | 10 |
| 11 namespace metrics { | 11 namespace metrics { |
| 12 | 12 |
| 13 std::string GetVersionString() { | 13 std::string GetVersionString() { |
| 14 std::string version = version_info::GetVersionNumber(); | 14 std::string version = version_info::GetVersionNumber(); |
| 15 #if defined(ARCH_CPU_64_BITS) | 15 #if defined(ARCH_CPU_64_BITS) |
| 16 version += "-64"; | 16 version += "-64"; |
| 17 #endif // defined(ARCH_CPU_64_BITS) | 17 #endif // defined(ARCH_CPU_64_BITS) |
| 18 if (!version_info::IsOfficialBuild()) | 18 if (!version_info::IsOfficialBuild()) |
| 19 version.append("-devel"); | 19 version.append("-devel"); |
| 20 return version; | 20 return version; |
| 21 } | 21 } |
| 22 | 22 |
| 23 SystemProfileProto::Channel AsProtobufChannel( | 23 SystemProfileProto::Channel AsProtobufChannel(version_info::Channel channel) { |
| 24 version_info::Channel channel) { | |
| 25 switch (channel) { | 24 switch (channel) { |
| 26 case version_info::Channel::UNKNOWN: | 25 case version_info::Channel::UNKNOWN: |
| 27 return SystemProfileProto::CHANNEL_UNKNOWN; | 26 return SystemProfileProto::CHANNEL_UNKNOWN; |
| 28 case version_info::Channel::CANARY: | 27 case version_info::Channel::CANARY: |
| 29 return SystemProfileProto::CHANNEL_CANARY; | 28 return SystemProfileProto::CHANNEL_CANARY; |
| 30 case version_info::Channel::DEV: | 29 case version_info::Channel::DEV: |
| 31 return SystemProfileProto::CHANNEL_DEV; | 30 return SystemProfileProto::CHANNEL_DEV; |
| 32 case version_info::Channel::BETA: | 31 case version_info::Channel::BETA: |
| 33 return SystemProfileProto::CHANNEL_BETA; | 32 return SystemProfileProto::CHANNEL_BETA; |
| 34 case version_info::Channel::STABLE: | 33 case version_info::Channel::STABLE: |
| 35 return SystemProfileProto::CHANNEL_STABLE; | 34 return SystemProfileProto::CHANNEL_STABLE; |
| 36 } | 35 } |
| 37 NOTREACHED(); | 36 NOTREACHED(); |
| 38 return SystemProfileProto::CHANNEL_UNKNOWN; | 37 return SystemProfileProto::CHANNEL_UNKNOWN; |
| 39 } | 38 } |
| 40 | 39 |
| 41 } // namespace metrics | 40 } // namespace metrics |
| OLD | NEW |