blob: a07eedb4e4778f5f58115cb3d22c98d4b64c5494 [file] [log] [blame]
Kyle Milka9ae0cdee2017-07-20 20:24:571// 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 Violet69a5d8dd2021-06-01 23:46:488#include "base/component_export.h"
Kyle Milka9ae0cdee2017-07-20 20:24:579#include "base/metrics/field_trial.h"
10
11namespace variations {
12
13// Infrastructure for setting up platform specific field trials. Chrome and
14// WebView make use through their corresponding subclasses.
Scott Violet69a5d8dd2021-06-01 23:46:4815class COMPONENT_EXPORT(VARIATIONS) PlatformFieldTrials {
Kyle Milka9ae0cdee2017-07-20 20:24:5716 public:
Scott Violet14742de2018-01-09 17:44:5517 PlatformFieldTrials() = default;
Peter Boström09c01822021-09-20 22:43:2718
19 PlatformFieldTrials(const PlatformFieldTrials&) = delete;
20 PlatformFieldTrials& operator=(const PlatformFieldTrials&) = delete;
21
Scott Violet14742de2018-01-09 17:44:5522 virtual ~PlatformFieldTrials() = default;
Kyle Milka9ae0cdee2017-07-20 20:24:5723
24 // Set up field trials for a specific platform.
Caitlin Fischer372dd562021-10-18 20:19:3125 virtual void SetUpFieldTrials() = 0;
Kyle Milka9ae0cdee2017-07-20 20:24:5726
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 Lu4b15abc2020-11-09 20:19:1932 // 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 Fischer372dd562021-10-18 20:19:3135 virtual void SetUpFeatureControllingFieldTrials(
Kyle Milka9ae0cdee2017-07-20 20:24:5736 bool has_seed,
Ilya Shermaned4ff892021-03-23 15:11:0937 const base::FieldTrial::EntropyProvider* low_entropy_provider,
Kyle Milka9ae0cdee2017-07-20 20:24:5738 base::FeatureList* feature_list) = 0;
39
Matthew Cary4f09c142019-03-06 11:15:5640 // 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 Milka9ae0cdee2017-07-20 20:24:5743};
44
45} // namespace variations
46
47#endif // COMPONENTS_VARIATIONS_PLATFORM_FIELD_TRIALS_H_