Don't compile save_password_infobar_delegate.cc everywhere but Mac and Android
[chromium-blink-merge.git] / chrome / common / metrics / version_utils.cc
blobbc74100035e84e29380cbcabd7b6798457dbf7fb
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
3 // found in the LICENSE file.
5 #include "chrome/common/metrics/version_utils.h"
7 #include "base/logging.h"
8 #include "components/version_info/version_info.h"
9 #include "components/version_info/version_info_values.h"
11 namespace metrics {
13 std::string GetVersionString() {
14 std::string version = PRODUCT_VERSION;
15 #if defined(ARCH_CPU_64_BITS)
16 version += "-64";
17 #endif // defined(ARCH_CPU_64_BITS)
18 if (!IS_OFFICIAL_BUILD)
19 version.append("-devel");
20 return version;
23 SystemProfileProto::Channel AsProtobufChannel(
24 version_info::Channel channel) {
25 switch (channel) {
26 case version_info::Channel::UNKNOWN:
27 return SystemProfileProto::CHANNEL_UNKNOWN;
28 case version_info::Channel::CANARY:
29 return SystemProfileProto::CHANNEL_CANARY;
30 case version_info::Channel::DEV:
31 return SystemProfileProto::CHANNEL_DEV;
32 case version_info::Channel::BETA:
33 return SystemProfileProto::CHANNEL_BETA;
34 case version_info::Channel::STABLE:
35 return SystemProfileProto::CHANNEL_STABLE;
37 NOTREACHED();
38 return SystemProfileProto::CHANNEL_UNKNOWN;
41 } // namespace metrics