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

Side by Side Diff: chrome/common/extensions/features/feature.h

Issue 10854177: Only set the channel from ExtensionSystem if there hasn't been one set already. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_H_
6 #define CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_H_ 6 #define CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 INVALID_MAX_MANIFEST_VERSION, 62 INVALID_MAX_MANIFEST_VERSION,
63 NOT_PRESENT, 63 NOT_PRESENT,
64 UNSUPPORTED_CHANNEL, 64 UNSUPPORTED_CHANNEL,
65 }; 65 };
66 66
67 Feature(); 67 Feature();
68 Feature(const Feature& other); 68 Feature(const Feature& other);
69 virtual ~Feature(); 69 virtual ~Feature();
70 70
71 // Gets the current channel as seen by the Feature system. 71 // Gets the current channel as seen by the Feature system.
72 // Defaults to CHANNEL_STABLE.
73 static chrome::VersionInfo::Channel GetCurrentChannel(); 72 static chrome::VersionInfo::Channel GetCurrentChannel();
74 73
75 // Sets the current channel as seen by the Feature system. In the browser 74 // Sets the current channel as seen by the Feature system. In the browser
76 // process this should be chrome::VersionInfo::GetChannel(), and in the 75 // process this should be chrome::VersionInfo::GetChannel(), and in the
77 // renderer this will need to come from an IPC. 76 // renderer this will need to come from an IPC.
78 static void SetCurrentChannel(chrome::VersionInfo::Channel channel); 77 static void SetCurrentChannel(chrome::VersionInfo::Channel channel);
79 78
79 // Gets the default channel as seen by the Feature system.
80 static chrome::VersionInfo::Channel GetDefaultChannel();
81
80 // Scoped channel setter. Use for tests. 82 // Scoped channel setter. Use for tests.
81 class ScopedCurrentChannel { 83 class ScopedCurrentChannel {
82 public: 84 public:
83 explicit ScopedCurrentChannel(chrome::VersionInfo::Channel channel) 85 explicit ScopedCurrentChannel(chrome::VersionInfo::Channel channel)
84 : original_channel_(chrome::VersionInfo::CHANNEL_UNKNOWN) { 86 : original_channel_(chrome::VersionInfo::CHANNEL_UNKNOWN) {
85 original_channel_ = GetCurrentChannel(); 87 original_channel_ = GetCurrentChannel();
86 SetCurrentChannel(channel); 88 SetCurrentChannel(channel);
87 } 89 }
88 90
89 ~ScopedCurrentChannel() { 91 ~ScopedCurrentChannel() {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 Location location_; // we only care about component/not-component now 174 Location location_; // we only care about component/not-component now
173 Platform platform_; // we only care about chromeos/not-chromeos now 175 Platform platform_; // we only care about chromeos/not-chromeos now
174 int min_manifest_version_; 176 int min_manifest_version_;
175 int max_manifest_version_; 177 int max_manifest_version_;
176 chrome::VersionInfo::Channel channel_; 178 chrome::VersionInfo::Channel channel_;
177 }; 179 };
178 180
179 } // namespace extensions 181 } // namespace extensions
180 182
181 #endif // CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_H_ 183 #endif // CHROME_COMMON_EXTENSIONS_FEATURES_FEATURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698