Commit 94b2aa6c authored by Xi Han's avatar Xi Han Committed by Commit Bot

Fix: variations service not processing studies on ChromeOS.

This is caused by not setting chrome channel before initializing FeatureList in
early startup, which was introduced in CL (https://crbug.com/1173163). In this
CL, we make GetChannel() call the SetChannel() if the channel hasn't been set
yet.

Bug: 896416
Change-Id: Id89c199779074d762f1d16edc711fedaaab66694
Reviewed-on: https://chromium-review.googlesource.com/c/1287850
Commit-Queue: Xi Han <hanxi@chromium.org>
Reviewed-by: default avatarRobert Kaplow (sloooow) <rkaplow@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601119}
parent 5148351b
......@@ -550,13 +550,6 @@ int ChromeBrowserMainPartsChromeos::PreEarlyInitialization() {
.value();
}
#if defined(GOOGLE_CHROME_BUILD)
const char kChromeOSReleaseTrack[] = "CHROMEOS_RELEASE_TRACK";
std::string channel;
if (base::SysInfo::GetLsbReleaseValue(kChromeOSReleaseTrack, &channel))
chrome::SetChannel(channel);
#endif
if (!is_dbus_initialized_)
PreEarlyInitDBus();
......
......@@ -44,11 +44,6 @@ version_info::Channel GetChannel();
version_info::Channel GetChannelByName(const std::string& channel);
#endif
#if defined(OS_CHROMEOS)
// Sets channel before use.
void SetChannel(const std::string& channel);
#endif
#if defined(OS_POSIX) && defined(GOOGLE_CHROME_BUILD)
// Returns a channel-specific suffix to use when constructing the path of the
// default user data directory, allowing multiple channels to run side-by-side.
......
......@@ -4,11 +4,32 @@
#include "chrome/common/channel_info.h"
#include "base/sys_info.h"
#include "components/version_info/version_info.h"
namespace chrome {
namespace {
static version_info::Channel chromeos_channel = version_info::Channel::UNKNOWN;
version_info::Channel chromeos_channel = version_info::Channel::UNKNOWN;
#if defined(GOOGLE_CHROME_BUILD)
// Sets the |chromeos_channel|.
void SetChannel(const std::string& channel) {
if (channel == "stable-channel") {
chromeos_channel = version_info::Channel::STABLE;
} else if (channel == "beta-channel") {
chromeos_channel = version_info::Channel::BETA;
} else if (channel == "dev-channel") {
chromeos_channel = version_info::Channel::DEV;
} else if (channel == "canary-channel") {
chromeos_channel = version_info::Channel::CANARY;
} else {
chromeos_channel = version_info::Channel::UNKNOWN;
}
}
#endif
} // namespace
std::string GetChannelName() {
#if defined(GOOGLE_CHROME_BUILD)
......@@ -29,20 +50,20 @@ std::string GetChannelName() {
}
version_info::Channel GetChannel() {
return chromeos_channel;
}
static bool is_channel_set = false;
if (is_channel_set)
return chromeos_channel;
void SetChannel(const std::string& channel) {
#if defined(GOOGLE_CHROME_BUILD)
if (channel == "stable-channel") {
chromeos_channel = version_info::Channel::STABLE;
} else if (channel == "beta-channel") {
chromeos_channel = version_info::Channel::BETA;
} else if (channel == "dev-channel") {
chromeos_channel = version_info::Channel::DEV;
} else if (channel == "canary-channel") {
chromeos_channel = version_info::Channel::CANARY;
#if !defined(GOOGLE_CHROME_BUILD)
return version_info::Channel::UNKNOWN;
#else
static const char kChromeOSReleaseTrack[] = "CHROMEOS_RELEASE_TRACK";
std::string channel;
if (base::SysInfo::GetLsbReleaseValue(kChromeOSReleaseTrack, &channel)) {
SetChannel(channel);
is_channel_set = true;
}
return chromeos_channel;
#endif
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment