Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4768)

Unified Diff: chrome/common/extensions/features/feature.h

Issue 10826199: Properly propagate the current Chrome channel into the Feature system on the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make the default stable Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/features/feature.h
diff --git a/chrome/common/extensions/features/feature.h b/chrome/common/extensions/features/feature.h
index 2683d5b8f999dcb592f80f5606ff7495f27af845..8d5b2c4fd3f32264c8d021b9d6b6aee6d8097dd9 100644
--- a/chrome/common/extensions/features/feature.h
+++ b/chrome/common/extensions/features/feature.h
@@ -68,23 +68,32 @@ class Feature {
Feature(const Feature& other);
virtual ~Feature();
- // (Re)Sets whether checking against "channel" should be done. This must only
- // be called on the browser process, since the check involves accessing the
- // filesystem.
- // See http://crbug.com/126535.
- static void SetChannelCheckingEnabled(bool enabled);
- static void ResetChannelCheckingEnabled();
-
- // (Re)Sets the Channel to for all Features to compare against. This is
- // usually chrome::VersionInfo::GetChannel(), but for tests allow this to be
- // overridden.
- static void SetChannelForTesting(chrome::VersionInfo::Channel channel);
- static void ResetChannelForTesting();
-
- // Returns the current channel as seen by the Feature system (i.e. the
- // ChannelForTesting if one is set, otherwise the actual channel).
+ // Gets the current channel as seen by the Feature system.
+ // Defaults to CHANNEL_STABLE.
static chrome::VersionInfo::Channel GetCurrentChannel();
+ // Sets the current channel as seen by the Feature system. In the browser
+ // process this should be chrome::VersionInfo::GetChannel(), and in the
+ // renderer this will need to come from an IPC.
+ static void SetCurrentChannel(chrome::VersionInfo::Channel channel);
+
+ // Scoped channel setter. Use for tests.
+ class ScopedCurrentChannel {
+ public:
+ explicit ScopedCurrentChannel(chrome::VersionInfo::Channel channel)
+ : original_channel_(chrome::VersionInfo::CHANNEL_UNKNOWN) {
+ original_channel_ = GetCurrentChannel();
+ SetCurrentChannel(channel);
+ }
+
+ ~ScopedCurrentChannel() {
+ SetCurrentChannel(original_channel_);
+ }
+
+ private:
+ chrome::VersionInfo::Channel original_channel_;
+ };
+
const std::string& name() const { return name_; }
void set_name(const std::string& name) { name_ = name; }
« no previous file with comments | « chrome/browser/extensions/script_badge_controller_unittest.cc ('k') | chrome/common/extensions/features/feature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698