1 // Copyright 2015 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.
5 #include "components/metrics/version_utils.h"
7 #include "base/notreached.h"
8 #include "build/branding_buildflags.h"
9 #include "build/build_config.h"
10 #include "components/version_info/version_info.h"
12 #if BUILDFLAG(IS_ANDROID)
13 #include "base/android/build_info.h"
18 std::string GetVersionString() {
19 std::string version(version_info::GetVersionNumber());
20 #if defined(ARCH_CPU_64_BITS)
22 #endif // defined(ARCH_CPU_64_BITS)
24 #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
25 bool is_chrome_branded = true;
27 bool is_chrome_branded = false;
29 if (!is_chrome_branded || !version_info::IsOfficialBuild())
30 version.append("-devel");
34 SystemProfileProto::Channel AsProtobufChannel(version_info::Channel channel) {
36 case version_info::Channel::UNKNOWN:
37 return SystemProfileProto::CHANNEL_UNKNOWN;
38 case version_info::Channel::CANARY:
39 return SystemProfileProto::CHANNEL_CANARY;
40 case version_info::Channel::DEV:
41 return SystemProfileProto::CHANNEL_DEV;
42 case version_info::Channel::BETA:
43 return SystemProfileProto::CHANNEL_BETA;
44 case version_info::Channel::STABLE:
45 return SystemProfileProto::CHANNEL_STABLE;
48 return SystemProfileProto::CHANNEL_UNKNOWN;
51 std::string GetAppPackageName() {
52 #if BUILDFLAG(IS_ANDROID)
53 return base::android::BuildInfo::GetInstance()->package_name();
59 } // namespace metrics