| // Copyright 2019 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 "components/variations/service/variations_service_client.h" |
| |
| #include "base/command_line.h" |
| #include "components/variations/variations_switches.h" |
| |
| namespace variations { |
| |
| version_info::Channel VariationsServiceClient::GetChannelForVariations() { |
| const std::string forced_channel = |
| base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| switches::kFakeVariationsChannel); |
| if (!forced_channel.empty()) { |
| if (forced_channel == "stable") |
| return version_info::Channel::STABLE; |
| if (forced_channel == "beta") |
| return version_info::Channel::BETA; |
| if (forced_channel == "dev") |
| return version_info::Channel::DEV; |
| if (forced_channel == "canary") |
| return version_info::Channel::CANARY; |
| DVLOG(1) << "Invalid channel provided: " << forced_channel; |
| } |
| |
| // Return the embedder-provided channel if no forced channel is specified. |
| return GetChannel(); |
| } |
| |
| } // namespace variations |