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/net/version_utils.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "build/build_config.h" |
8 #include "components/version_info/version_info.h" | 9 #include "components/version_info/version_info.h" |
9 #include "components/version_info/version_info_values.h" | |
10 | 10 |
11 namespace metrics { | 11 namespace metrics { |
12 | 12 |
13 std::string GetVersionString() { | 13 std::string GetVersionString() { |
14 std::string version = PRODUCT_VERSION; | 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 (!IS_OFFICIAL_BUILD) | 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( |
24 version_info::Channel channel) { | 24 version_info::Channel channel) { |
25 switch (channel) { | 25 switch (channel) { |
26 case version_info::Channel::UNKNOWN: | 26 case version_info::Channel::UNKNOWN: |
27 return SystemProfileProto::CHANNEL_UNKNOWN; | 27 return SystemProfileProto::CHANNEL_UNKNOWN; |
28 case version_info::Channel::CANARY: | 28 case version_info::Channel::CANARY: |
29 return SystemProfileProto::CHANNEL_CANARY; | 29 return SystemProfileProto::CHANNEL_CANARY; |
30 case version_info::Channel::DEV: | 30 case version_info::Channel::DEV: |
31 return SystemProfileProto::CHANNEL_DEV; | 31 return SystemProfileProto::CHANNEL_DEV; |
32 case version_info::Channel::BETA: | 32 case version_info::Channel::BETA: |
33 return SystemProfileProto::CHANNEL_BETA; | 33 return SystemProfileProto::CHANNEL_BETA; |
34 case version_info::Channel::STABLE: | 34 case version_info::Channel::STABLE: |
35 return SystemProfileProto::CHANNEL_STABLE; | 35 return SystemProfileProto::CHANNEL_STABLE; |
36 } | 36 } |
37 NOTREACHED(); | 37 NOTREACHED(); |
38 return SystemProfileProto::CHANNEL_UNKNOWN; | 38 return SystemProfileProto::CHANNEL_UNKNOWN; |
39 } | 39 } |
40 | 40 |
41 } // namespace metrics | 41 } // namespace metrics |
OLD | NEW |