| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ | 5 #ifndef COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ |
| 6 #define COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ | 6 #define COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "components/variations/proto/study.pb.h" | 21 #include "components/variations/proto/study.pb.h" |
| 22 #include "components/variations/proto/variations_seed.pb.h" | 22 #include "components/variations/proto/variations_seed.pb.h" |
| 23 | 23 |
| 24 namespace base { | 24 namespace base { |
| 25 class FeatureList; | 25 class FeatureList; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace variations { | 28 namespace variations { |
| 29 | 29 |
| 30 class ProcessedStudy; | 30 class ProcessedStudy; |
| 31 struct ClientFilterableState; |
| 31 | 32 |
| 32 // Helper class to instantiate field trials from a variations seed. | 33 // Helper class to instantiate field trials from a variations seed. |
| 33 class VariationsSeedProcessor { | 34 class VariationsSeedProcessor { |
| 34 public: | 35 public: |
| 35 typedef base::Callback<void(uint32_t, const base::string16&)> | 36 typedef base::Callback<void(uint32_t, const base::string16&)> |
| 36 UIStringOverrideCallback; | 37 UIStringOverrideCallback; |
| 37 | 38 |
| 38 VariationsSeedProcessor(); | 39 VariationsSeedProcessor(); |
| 39 virtual ~VariationsSeedProcessor(); | 40 virtual ~VariationsSeedProcessor(); |
| 40 | 41 |
| 41 // Creates field trials from the specified variations |seed|, based on the | 42 // Creates field trials from the specified variations |seed|, filtered |
| 42 // specified configuration, as specified in the parameters. Any study that | 43 // according to the client's |client_state|. Any study that should use low |
| 43 // should use low entropy will use |low_entropy_provider| for group | 44 // entropy will use |low_entropy_provider| for group selection. These studies |
| 44 // selection. These studies are defined by ShouldStudyUseLowEntropy; | 45 // are defined by ShouldStudyUseLowEntropy; |
| 45 void CreateTrialsFromSeed( | 46 void CreateTrialsFromSeed( |
| 46 const VariationsSeed& seed, | 47 const VariationsSeed& seed, |
| 47 const std::string& locale, | 48 const ClientFilterableState& client_state, |
| 48 const base::Time& reference_date, | |
| 49 const base::Version& version, | |
| 50 Study_Channel channel, | |
| 51 Study_FormFactor form_factor, | |
| 52 const std::string& hardware_class, | |
| 53 const std::string& session_consistency_country, | |
| 54 const std::string& permanent_consistency_country, | |
| 55 const UIStringOverrideCallback& override_callback, | 49 const UIStringOverrideCallback& override_callback, |
| 56 const base::FieldTrial::EntropyProvider* low_entropy_provider, | 50 const base::FieldTrial::EntropyProvider* low_entropy_provider, |
| 57 base::FeatureList* feature_list); | 51 base::FeatureList* feature_list); |
| 58 | 52 |
| 59 // If the given |study| should alwoys use low entropy. This is true for any | 53 // If the given |study| should alwoys use low entropy. This is true for any |
| 60 // study that can send data to other Google properties. | 54 // study that can send data to other Google properties. |
| 61 static bool ShouldStudyUseLowEntropy(const Study& study); | 55 static bool ShouldStudyUseLowEntropy(const Study& study); |
| 62 | 56 |
| 63 private: | 57 private: |
| 64 friend class VariationsSeedProcessorTest; | 58 friend class VariationsSeedProcessorTest; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 93 const UIStringOverrideCallback& override_callback, | 87 const UIStringOverrideCallback& override_callback, |
| 94 const base::FieldTrial::EntropyProvider* low_entropy_provider, | 88 const base::FieldTrial::EntropyProvider* low_entropy_provider, |
| 95 base::FeatureList* feature_list); | 89 base::FeatureList* feature_list); |
| 96 | 90 |
| 97 DISALLOW_COPY_AND_ASSIGN(VariationsSeedProcessor); | 91 DISALLOW_COPY_AND_ASSIGN(VariationsSeedProcessor); |
| 98 }; | 92 }; |
| 99 | 93 |
| 100 } // namespace variations | 94 } // namespace variations |
| 101 | 95 |
| 102 #endif // COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ | 96 #endif // COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ |
| OLD | NEW |