This source file includes following definitions.
- GetVersionStringModifier
- GetChannel
#include "chrome/common/chrome_version_info.h"
#include "base/base_paths.h"
#include "base/debug/profiler.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/installer/util/google_update_settings.h"
#include "chrome/installer/util/install_util.h"
namespace chrome {
std::string VersionInfo::GetVersionStringModifier() {
#if defined(GOOGLE_CHROME_BUILD)
base::FilePath module;
base::string16 channel;
if (PathService::Get(base::FILE_MODULE, &module)) {
bool is_system_install =
!InstallUtil::IsPerUserInstall(module.value().c_str());
GoogleUpdateSettings::GetChromeChannelAndModifiers(is_system_install,
&channel);
}
#if defined(SYZYASAN)
if (base::debug::IsBinaryInstrumented())
channel += L" SyzyASan";
#endif
return base::UTF16ToASCII(channel);
#else
return std::string();
#endif
}
VersionInfo::Channel VersionInfo::GetChannel() {
#if defined(GOOGLE_CHROME_BUILD)
std::wstring channel(L"unknown");
base::FilePath module;
if (PathService::Get(base::FILE_MODULE, &module)) {
bool is_system_install =
!InstallUtil::IsPerUserInstall(module.value().c_str());
channel = GoogleUpdateSettings::GetChromeChannel(is_system_install);
}
if (channel.empty()) {
return CHANNEL_STABLE;
} else if (channel == L"beta") {
return CHANNEL_BETA;
} else if (channel == L"dev") {
return CHANNEL_DEV;
} else if (channel == L"canary") {
return CHANNEL_CANARY;
}
#endif
return CHANNEL_UNKNOWN;
}
}