OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/common/chrome_version_info.h" | 5 #include "chrome/common/channel_info.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/debug/profiler.h" | 8 #include "base/debug/profiler.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/profiler/scoped_tracker.h" | 11 #include "base/profiler/scoped_tracker.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/installer/util/google_update_settings.h" | 14 #include "chrome/installer/util/google_update_settings.h" |
15 #include "chrome/installer/util/install_util.h" | 15 #include "chrome/installer/util/install_util.h" |
| 16 #include "components/version_info/version_info.h" |
16 | 17 |
17 namespace chrome { | 18 namespace chrome { |
18 | 19 |
19 // static | 20 std::string GetChannelString() { |
20 std::string VersionInfo::GetVersionStringModifier() { | |
21 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is | 21 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is |
22 // fixed. | 22 // fixed. |
23 tracked_objects::ScopedTracker tracking_profile( | 23 tracked_objects::ScopedTracker tracking_profile( |
24 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 24 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
25 "422460 VersionInfo::GetVersionStringModifier")); | 25 "422460 VersionInfo::GetVersionStringModifier")); |
26 | 26 |
27 #if defined(GOOGLE_CHROME_BUILD) | 27 #if defined(GOOGLE_CHROME_BUILD) |
28 base::FilePath module; | 28 base::FilePath module; |
29 base::string16 channel; | 29 base::string16 channel; |
30 if (PathService::Get(base::FILE_MODULE, &module)) { | 30 if (PathService::Get(base::FILE_MODULE, &module)) { |
31 bool is_system_install = !InstallUtil::IsPerUserInstall(module); | 31 bool is_system_install = !InstallUtil::IsPerUserInstall(module); |
32 GoogleUpdateSettings::GetChromeChannelAndModifiers(is_system_install, | 32 GoogleUpdateSettings::GetChromeChannelAndModifiers(is_system_install, |
33 &channel); | 33 &channel); |
34 } | 34 } |
35 #if defined(SYZYASAN) | 35 #if defined(SYZYASAN) |
36 if (base::debug::IsBinaryInstrumented()) | 36 if (base::debug::IsBinaryInstrumented()) |
37 channel += L" SyzyASan"; | 37 channel += L" SyzyASan"; |
38 #endif | 38 #endif |
39 return base::UTF16ToASCII(channel); | 39 return base::UTF16ToASCII(channel); |
40 #else | 40 #else |
41 return std::string(); | 41 return std::string(); |
42 #endif | 42 #endif |
43 } | 43 } |
44 | 44 |
45 // static | 45 version_info::Channel GetChannel() { |
46 version_info::Channel VersionInfo::GetChannel() { | |
47 #if defined(GOOGLE_CHROME_BUILD) | 46 #if defined(GOOGLE_CHROME_BUILD) |
48 std::wstring channel(L"unknown"); | 47 std::wstring channel(L"unknown"); |
49 | 48 |
50 base::FilePath module; | 49 base::FilePath module; |
51 if (PathService::Get(base::FILE_MODULE, &module)) { | 50 if (PathService::Get(base::FILE_MODULE, &module)) { |
52 bool is_system_install = !InstallUtil::IsPerUserInstall(module); | 51 bool is_system_install = !InstallUtil::IsPerUserInstall(module); |
53 channel = GoogleUpdateSettings::GetChromeChannel(is_system_install); | 52 channel = GoogleUpdateSettings::GetChromeChannel(is_system_install); |
54 } | 53 } |
55 | 54 |
56 if (channel.empty()) { | 55 if (channel.empty()) { |
57 return version_info::Channel::STABLE; | 56 return version_info::Channel::STABLE; |
58 } else if (channel == L"beta") { | 57 } else if (channel == L"beta") { |
59 return version_info::Channel::BETA; | 58 return version_info::Channel::BETA; |
60 } else if (channel == L"dev") { | 59 } else if (channel == L"dev") { |
61 return version_info::Channel::DEV; | 60 return version_info::Channel::DEV; |
62 } else if (channel == L"canary") { | 61 } else if (channel == L"canary") { |
63 return version_info::Channel::CANARY; | 62 return version_info::Channel::CANARY; |
64 } | 63 } |
65 #endif | 64 #endif |
66 | 65 |
67 return version_info::Channel::UNKNOWN; | 66 return version_info::Channel::UNKNOWN; |
68 } | 67 } |
69 | 68 |
70 } // namespace chrome | 69 } // namespace chrome |
OLD | NEW |