Transfer Password sync to use new sync API.
[chromium-blink-merge.git] / chrome / common / chrome_version_info_win.cc
bloba7568a8808bc2b7c802b375c4989b8f481c456e1
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"
15 namespace chrome {
17 // static
18 std::string VersionInfo::GetVersionStringModifier() {
19 #if defined(GOOGLE_CHROME_BUILD)
20 base::FilePath module;
21 base::string16 channel;
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,
27 &channel);
29 #if defined(ADDRESS_SANITIZER)
30 if (base::debug::IsBinaryInstrumented())
31 channel += L" SyzyASan";
32 #endif
33 return UTF16ToASCII(channel);
34 #else
35 return std::string();
36 #endif
39 // static
40 VersionInfo::Channel VersionInfo::GetChannel() {
41 #if defined(GOOGLE_CHROME_BUILD)
42 std::wstring channel(L"unknown");
44 base::FilePath module;
45 if (PathService::Get(base::FILE_MODULE, &module)) {
46 bool is_system_install =
47 !InstallUtil::IsPerUserInstall(module.value().c_str());
48 channel = GoogleUpdateSettings::GetChromeChannel(is_system_install);
51 if (channel.empty()) {
52 return CHANNEL_STABLE;
53 } else if (channel == L"beta") {
54 return CHANNEL_BETA;
55 } else if (channel == L"dev") {
56 return CHANNEL_DEV;
57 } else if (channel == L"canary") {
58 return CHANNEL_CANARY;
60 #endif
62 return CHANNEL_UNKNOWN;
65 } // namespace chrome