| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_CHANNEL_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_CHANNEL_H_ |
| 7 |
| 8 #include "chrome/common/chrome_version_info.h" |
| 9 |
| 10 namespace extensions { |
| 11 |
| 12 // Gets the current channel as seen by the Feature system. |
| 13 chrome::VersionInfo::Channel GetCurrentChannel(); |
| 14 |
| 15 // Sets the current channel as seen by the Feature system. In the browser |
| 16 // process this should be chrome::VersionInfo::GetChannel(), and in the |
| 17 // renderer this will need to come from an IPC. |
| 18 void SetCurrentChannel(chrome::VersionInfo::Channel channel); |
| 19 |
| 20 // Gets the default channel as seen by the Feature system. |
| 21 chrome::VersionInfo::Channel GetDefaultChannel(); |
| 22 |
| 23 // Scoped channel setter. Use for tests. |
| 24 class ScopedCurrentChannel { |
| 25 public: |
| 26 explicit ScopedCurrentChannel(chrome::VersionInfo::Channel channel) |
| 27 : original_channel_(chrome::VersionInfo::CHANNEL_UNKNOWN) { |
| 28 original_channel_ = GetCurrentChannel(); |
| 29 SetCurrentChannel(channel); |
| 30 } |
| 31 |
| 32 ~ScopedCurrentChannel() { |
| 33 SetCurrentChannel(original_channel_); |
| 34 } |
| 35 |
| 36 private: |
| 37 chrome::VersionInfo::Channel original_channel_; |
| 38 }; |
| 39 |
| 40 } // namespace extensions |
| 41 |
| 42 #endif // CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_CHANNEL_H_ |
| OLD | NEW |