blob: b52e51e90c6ca493cacf27e183773044f08ff0fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#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 {
// static
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
}
// static
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;
}
} // namespace chrome
|