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

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

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
« no previous file with comments | « chrome/common/extensions/features/feature.h ('k') | chrome/common/extensions/features/feature_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/features/feature.cc
diff --git a/chrome/common/extensions/features/feature.cc b/chrome/common/extensions/features/feature.cc
index 1d65e572c2c93d312f036a6e2d265ae8f282fe59..3da8726e386acf3003ece3a22741e6612cb42836 100644
--- a/chrome/common/extensions/features/feature.cc
+++ b/chrome/common/extensions/features/feature.cc
@@ -49,7 +49,7 @@ struct Mappings {
std::map<std::string, VersionInfo::Channel> channels;
};
-static base::LazyInstance<Mappings> g_mappings = LAZY_INSTANCE_INITIALIZER;
+base::LazyInstance<Mappings> g_mappings = LAZY_INSTANCE_INITIALIZER;
std::string GetChannelName(VersionInfo::Channel channel) {
typedef std::map<std::string, VersionInfo::Channel> ChannelsMap;
@@ -62,30 +62,7 @@ std::string GetChannelName(VersionInfo::Channel channel) {
return "unknown";
}
-static bool g_channel_checking_enabled = false;
-
-class Channel {
- public:
- VersionInfo::Channel GetChannel() {
- CHECK(g_channel_checking_enabled);
- if (channel_for_testing_.get())
- return *channel_for_testing_;
- return VersionInfo::GetChannel();
- }
-
- void SetChannelForTesting(VersionInfo::Channel channel_for_testing) {
- channel_for_testing_.reset(new VersionInfo::Channel(channel_for_testing));
- }
-
- void ResetChannelForTesting() {
- channel_for_testing_.reset();
- }
-
- private:
- scoped_ptr<VersionInfo::Channel> channel_for_testing_;
-};
-
-static base::LazyInstance<Channel> g_channel = LAZY_INSTANCE_INITIALIZER;
+VersionInfo::Channel g_current_channel = VersionInfo::CHANNEL_STABLE;
// TODO(aa): Can we replace all this manual parsing with JSON schema stuff?
@@ -320,10 +297,8 @@ Feature::Availability Feature::IsAvailableToManifest(
if (max_manifest_version_ != 0 && manifest_version > max_manifest_version_)
return INVALID_MAX_MANIFEST_VERSION;
- if (g_channel_checking_enabled) {
- if (channel_ < g_channel.Get().GetChannel())
- return UNSUPPORTED_CHANNEL;
- }
+ if (channel_ < g_current_channel)
+ return UNSUPPORTED_CHANNEL;
return IS_AVAILABLE;
}
@@ -350,30 +325,13 @@ Feature::Availability Feature::IsAvailableToContext(
}
// static
-void Feature::SetChannelCheckingEnabled(bool enabled) {
- g_channel_checking_enabled = enabled;
-}
-
-// static
-void Feature::ResetChannelCheckingEnabled() {
- g_channel_checking_enabled = false;
-}
-
-// static
-void Feature::SetChannelForTesting(VersionInfo::Channel channel) {
- g_channel.Get().SetChannelForTesting(channel);
-}
-
-// static
-void Feature::ResetChannelForTesting() {
- g_channel.Get().ResetChannelForTesting();
+chrome::VersionInfo::Channel Feature::GetCurrentChannel() {
+ return g_current_channel;
}
// static
-chrome::VersionInfo::Channel Feature::GetCurrentChannel() {
- if (g_channel_checking_enabled)
- return g_channel.Get().GetChannel();
- return chrome::VersionInfo::GetChannel();
+void Feature::SetCurrentChannel(VersionInfo::Channel channel) {
+ g_current_channel = channel;
}
} // namespace
« no previous file with comments | « chrome/common/extensions/features/feature.h ('k') | chrome/common/extensions/features/feature_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698