Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / common / extensions / features / feature_channel.cc
blobba22f639312e06b9b4bec492d6654461f75500ab
1 // Copyright 2013 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/extensions/features/feature_channel.h"
7 #include "components/version_info/version_info.h"
9 namespace {
11 const version_info::Channel kDefaultChannel = version_info::Channel::STABLE;
12 version_info::Channel g_current_channel = kDefaultChannel;
14 } // namespace
16 namespace extensions {
18 version_info::Channel GetCurrentChannel() {
19 return g_current_channel;
22 void SetCurrentChannel(version_info::Channel channel) {
23 g_current_channel = channel;
26 version_info::Channel GetDefaultChannel() {
27 return kDefaultChannel;
30 ScopedCurrentChannel::ScopedCurrentChannel(version_info::Channel channel)
31 : original_channel_(version_info::Channel::UNKNOWN) {
32 original_channel_ = GetCurrentChannel();
33 SetCurrentChannel(channel);
36 ScopedCurrentChannel::~ScopedCurrentChannel() {
37 SetCurrentChannel(original_channel_);
40 } // namespace extensions