1 // Copyright (c) 2011 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/chrome_version_info.h"
7 #include "base/base_paths.h"
8 #include "base/debug/profiler.h"
9 #include "base/files/file_path.h"
10 #include "base/path_service.h"
11 #include "base/strings/string_util.h"
12 #include "chrome/installer/util/google_update_settings.h"
13 #include "chrome/installer/util/install_util.h"
18 std::string VersionInfo::GetVersionStringModifier() {
19 #if defined(GOOGLE_CHROME_BUILD)
20 base::FilePath module;
22 if (PathService::Get(base::FILE_MODULE, &module)) {
23 bool is_system_install =
24 !InstallUtil::IsPerUserInstall(module.value().c_str());
26 GoogleUpdateSettings::GetChromeChannelAndModifiers(is_system_install,
32 #if defined(ADDRESS_SANITIZER)
33 if (base::debug::IsBinaryInstrumented())
34 channel += L" SyzyASan";
36 return UTF16ToASCII(channel);
43 VersionInfo::Channel VersionInfo::GetChannel() {
44 #if defined(GOOGLE_CHROME_BUILD)
45 std::wstring channel(L"unknown");
47 base::FilePath module;
48 if (PathService::Get(base::FILE_MODULE, &module)) {
49 bool is_system_install =
50 !InstallUtil::IsPerUserInstall(module.value().c_str());
51 channel = GoogleUpdateSettings::GetChromeChannel(is_system_install);
54 if (channel.empty()) {
55 return CHANNEL_STABLE;
56 } else if (channel == L"beta") {
58 } else if (channel == L"dev") {
60 } else if (channel == L"canary") {
61 return CHANNEL_CANARY;
65 return CHANNEL_UNKNOWN;