Kyle Milka | 9ae0cdee | 2017-07-20 20:24:57 | [diff] [blame] | 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 COMPONENTS_VARIATIONS_PLATFORM_FIELD_TRIALS_H_ |
| 6 | #define COMPONENTS_VARIATIONS_PLATFORM_FIELD_TRIALS_H_ |
| 7 | |
Scott Violet | 69a5d8dd | 2021-06-01 23:46:48 | [diff] [blame] | 8 | #include "base/component_export.h" |
Kyle Milka | 9ae0cdee | 2017-07-20 20:24:57 | [diff] [blame] | 9 | #include "base/metrics/field_trial.h" |
| 10 | |
| 11 | namespace variations { |
| 12 | |
| 13 | // Infrastructure for setting up platform specific field trials. Chrome and |
| 14 | // WebView make use through their corresponding subclasses. |
Scott Violet | 69a5d8dd | 2021-06-01 23:46:48 | [diff] [blame] | 15 | class COMPONENT_EXPORT(VARIATIONS) PlatformFieldTrials { |
Kyle Milka | 9ae0cdee | 2017-07-20 20:24:57 | [diff] [blame] | 16 | public: |
Scott Violet | 14742de | 2018-01-09 17:44:55 | [diff] [blame] | 17 | PlatformFieldTrials() = default; |
Peter Boström | 09c0182 | 2021-09-20 22:43:27 | [diff] [blame] | 18 | |
| 19 | PlatformFieldTrials(const PlatformFieldTrials&) = delete; |
| 20 | PlatformFieldTrials& operator=(const PlatformFieldTrials&) = delete; |
| 21 | |
Scott Violet | 14742de | 2018-01-09 17:44:55 | [diff] [blame] | 22 | virtual ~PlatformFieldTrials() = default; |
Kyle Milka | 9ae0cdee | 2017-07-20 20:24:57 | [diff] [blame] | 23 | |
| 24 | // Set up field trials for a specific platform. |
Caitlin Fischer | 372dd56 | 2021-10-18 20:19:31 | [diff] [blame] | 25 | virtual void SetUpFieldTrials() = 0; |
Kyle Milka | 9ae0cdee | 2017-07-20 20:24:57 | [diff] [blame] | 26 | |
| 27 | // Create field trials that will control feature list features. This should be |
| 28 | // called during the same timing window as |
| 29 | // FeatureList::AssociateReportingFieldTrial. |has_seed| indicates that the |
| 30 | // variations service used a seed to create field trials. This can be used to |
| 31 | // prevent associating a field trial with a feature that you expect to be |
Chris Lu | 4b15abc | 2020-11-09 20:19:19 | [diff] [blame] | 32 | // controlled by the variations seed. |low_entropy_provider| can be used as a |
| 33 | // parameter to creating a FieldTrial that should be visible to Google web |
| 34 | // properties. |
Caitlin Fischer | 372dd56 | 2021-10-18 20:19:31 | [diff] [blame] | 35 | virtual void SetUpFeatureControllingFieldTrials( |
Kyle Milka | 9ae0cdee | 2017-07-20 20:24:57 | [diff] [blame] | 36 | bool has_seed, |
Ilya Sherman | ed4ff89 | 2021-03-23 15:11:09 | [diff] [blame] | 37 | const base::FieldTrial::EntropyProvider* low_entropy_provider, |
Kyle Milka | 9ae0cdee | 2017-07-20 20:24:57 | [diff] [blame] | 38 | base::FeatureList* feature_list) = 0; |
| 39 | |
Matthew Cary | 4f09c14 | 2019-03-06 11:15:56 | [diff] [blame] | 40 | // Register any synthetic field trials. Will be called later than the above |
| 41 | // methods, in particular after g_browser_process is available.. |
| 42 | virtual void RegisterSyntheticTrials() {} |
Kyle Milka | 9ae0cdee | 2017-07-20 20:24:57 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | } // namespace variations |
| 46 | |
| 47 | #endif // COMPONENTS_VARIATIONS_PLATFORM_FIELD_TRIALS_H_ |