| OLD | NEW |
| (Empty) |
| 1 // Copyright 2017 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 CHROMECAST_BASE_CAST_FEATURES_H_ | |
| 6 #define CHROMECAST_BASE_CAST_FEATURES_H_ | |
| 7 | |
| 8 #include <cstdint> | |
| 9 #include <memory> | |
| 10 #include <string> | |
| 11 #include <unordered_set> | |
| 12 | |
| 13 #include "base/feature_list.h" | |
| 14 #include "base/macros.h" | |
| 15 | |
| 16 namespace base { | |
| 17 class DictionaryValue; | |
| 18 class ListValue; | |
| 19 } | |
| 20 | |
| 21 namespace chromecast { | |
| 22 | |
| 23 // Initialize the global base::FeatureList instance, taking into account | |
| 24 // overrides from DCS and the command line. |dcs_features| and | |
| 25 // |dcs_experiment_ids| are read from the PrefService in the browser process. | |
| 26 // |cmd_line_enable_features| and |cmd_line_disable_features| should be passed | |
| 27 // to this function, unmodified from the command line. | |
| 28 // | |
| 29 // This function should be called before the browser's main loop. After this is | |
| 30 // called, the other functions in this file may be called on any thread. | |
| 31 void InitializeFeatureList(const base::DictionaryValue& dcs_features, | |
| 32 const base::ListValue& dcs_experiment_ids, | |
| 33 const std::string& cmd_line_enable_features, | |
| 34 const std::string& cmd_line_disable_features); | |
| 35 | |
| 36 // Given a dictionary of features, create a copy that is ready to be persisted | |
| 37 // to disk. Encodes all values as strings, which is how the FieldTrial | |
| 38 // classes expect the param data. | |
| 39 base::DictionaryValue GetOverriddenFeaturesForStorage( | |
| 40 const base::DictionaryValue& features); | |
| 41 | |
| 42 // Query the set of experiment ids set for this run. Intended only for metrics | |
| 43 // reporting. Must be called after InitializeFeatureList(). May be called on any | |
| 44 // thread. | |
| 45 const std::unordered_set<int32_t>& GetDCSExperimentIds(); | |
| 46 | |
| 47 // Reset static state to ensure clean unittests. For tests only. | |
| 48 void ResetCastFeaturesForTesting(); | |
| 49 | |
| 50 } // namespace chromecast | |
| 51 | |
| 52 #endif // CHROMECAST_BASE_CAST_FEATURES_H_ | |
| OLD | NEW |