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/channel_info.h" | 5 #include "chrome/common/channel_info.h" |
6 | 6 |
7 #include "base/debug/profiler.h" | 7 #include "base/debug/profiler.h" |
8 #include "base/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/install_static/install_details.h" | 11 #include "chrome/install_static/install_util.h" |
12 #include "components/version_info/version_info.h" | |
13 | 12 |
14 namespace chrome { | 13 namespace chrome { |
15 | 14 |
16 std::string GetChannelString() { | 15 std::string GetChannelString() { |
17 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is | 16 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is |
18 // fixed. | 17 // fixed. |
19 tracked_objects::ScopedTracker tracking_profile( | 18 tracked_objects::ScopedTracker tracking_profile( |
20 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 19 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
21 "422460 VersionInfo::GetVersionStringModifier")); | 20 "422460 VersionInfo::GetVersionStringModifier")); |
22 | 21 |
23 #if defined(GOOGLE_CHROME_BUILD) | 22 #if defined(GOOGLE_CHROME_BUILD) |
24 base::string16 channel(install_static::InstallDetails::Get().channel()); | 23 base::string16 channel(install_static::GetChromeChannelName()); |
25 #if defined(SYZYASAN) | 24 #if defined(SYZYASAN) |
26 if (base::debug::IsBinaryInstrumented()) | 25 if (base::debug::IsBinaryInstrumented()) |
27 channel += L" SyzyASan"; | 26 channel += L" SyzyASan"; |
28 #endif | 27 #endif |
29 return base::UTF16ToASCII(channel); | 28 return base::UTF16ToASCII(channel); |
30 #else | 29 #else |
31 return std::string(); | 30 return std::string(); |
32 #endif | 31 #endif |
33 } | 32 } |
34 | 33 |
35 version_info::Channel GetChannel() { | 34 version_info::Channel GetChannel() { |
36 #if defined(GOOGLE_CHROME_BUILD) | 35 return install_static::GetChromeChannel(); |
37 base::string16 channel(install_static::InstallDetails::Get().channel()); | |
38 | |
39 if (channel.empty()) { | |
40 return version_info::Channel::STABLE; | |
41 } else if (channel == L"beta") { | |
42 return version_info::Channel::BETA; | |
43 } else if (channel == L"dev") { | |
44 return version_info::Channel::DEV; | |
45 } else if (channel == L"canary") { | |
46 return version_info::Channel::CANARY; | |
47 } | |
48 #endif | |
49 | |
50 return version_info::Channel::UNKNOWN; | |
51 } | 36 } |
52 | 37 |
53 } // namespace chrome | 38 } // namespace chrome |
OLD | NEW |