OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 BASE_FEATURE_LIST_H_ | 5 #ifndef BASE_FEATURE_LIST_H_ |
6 #define BASE_FEATURE_LIST_H_ | 6 #define BASE_FEATURE_LIST_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
9 #include <string> | 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/base_export.h" | 13 #include "base/base_export.h" |
13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "base/strings/string_piece.h" | 16 #include "base/strings/string_piece.h" |
17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 | 20 |
21 class FieldTrial; | 21 class FieldTrial; |
22 | 22 |
23 // Specifies whether a given feature is enabled or disabled by default. | 23 // Specifies whether a given feature is enabled or disabled by default. |
24 enum FeatureState { | 24 enum FeatureState { |
25 FEATURE_DISABLED_BY_DEFAULT, | 25 FEATURE_DISABLED_BY_DEFAULT, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // |disable_features| parameters. | 152 // |disable_features| parameters. |
153 static void InitializeInstance(const std::string& enable_features, | 153 static void InitializeInstance(const std::string& enable_features, |
154 const std::string& disable_features); | 154 const std::string& disable_features); |
155 | 155 |
156 // Returns the singleton instance of FeatureList. Will return null until an | 156 // Returns the singleton instance of FeatureList. Will return null until an |
157 // instance is registered via SetInstance(). | 157 // instance is registered via SetInstance(). |
158 static FeatureList* GetInstance(); | 158 static FeatureList* GetInstance(); |
159 | 159 |
160 // Registers the given |instance| to be the singleton feature list for this | 160 // Registers the given |instance| to be the singleton feature list for this |
161 // process. This should only be called once and |instance| must not be null. | 161 // process. This should only be called once and |instance| must not be null. |
162 static void SetInstance(scoped_ptr<FeatureList> instance); | 162 static void SetInstance(std::unique_ptr<FeatureList> instance); |
163 | 163 |
164 // Clears the previously-registered singleton instance for tests. | 164 // Clears the previously-registered singleton instance for tests. |
165 static void ClearInstanceForTesting(); | 165 static void ClearInstanceForTesting(); |
166 | 166 |
167 private: | 167 private: |
168 FRIEND_TEST_ALL_PREFIXES(FeatureListTest, CheckFeatureIdentity); | 168 FRIEND_TEST_ALL_PREFIXES(FeatureListTest, CheckFeatureIdentity); |
169 | 169 |
170 struct OverrideEntry { | 170 struct OverrideEntry { |
171 // The overridden enable (on/off) state of the feature. | 171 // The overridden enable (on/off) state of the feature. |
172 const OverrideState overridden_state; | 172 const OverrideState overridden_state; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 241 |
242 // Whether this object has been initialized from command line. | 242 // Whether this object has been initialized from command line. |
243 bool initialized_from_command_line_; | 243 bool initialized_from_command_line_; |
244 | 244 |
245 DISALLOW_COPY_AND_ASSIGN(FeatureList); | 245 DISALLOW_COPY_AND_ASSIGN(FeatureList); |
246 }; | 246 }; |
247 | 247 |
248 } // namespace base | 248 } // namespace base |
249 | 249 |
250 #endif // BASE_FEATURE_LIST_H_ | 250 #endif // BASE_FEATURE_LIST_H_ |
OLD | NEW |