Patricia Alfonso | 3b296e9f | 2023-09-14 15:18:14 | [diff] [blame^] | 1 | // Copyright 2023 The Chromium Authors |
| 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 CHROME_BROWSER_TPCD_EXPERIMENT_EXPERIMENT_MANAGER_H_ |
| 6 | #define CHROME_BROWSER_TPCD_EXPERIMENT_EXPERIMENT_MANAGER_H_ |
| 7 | |
| 8 | namespace tpcd::experiment { |
| 9 | |
| 10 | class ExperimentManager { |
| 11 | public: |
| 12 | ExperimentManager() = default; |
| 13 | |
| 14 | // Called by EligibilityService to tell the manager whether a profile is |
| 15 | // eligible. Mode B also needs to know whether the profile has been onboarded |
| 16 | // to the 3PCD UX, but Mode A does not. |
| 17 | void SetClientEligibility(bool is_eligible, bool is_onboarded = false); |
| 18 | |
| 19 | private: |
| 20 | // Mode B experiment will need to register the client for the synthetic trial |
| 21 | // IFF the client is eligible and onboarded (TCPDExperimentState == |
| 22 | // kOnboardedEligible). Register the client for the correct arm of the |
| 23 | // synthetic trial based on Finch feature params. |
| 24 | void RegisterSyntheticTrial(); |
| 25 | |
| 26 | // If a previously registered client becomes ineligible, unregister it from |
| 27 | // the synthetic trial by registering it to a "invalidated" experiment arm. |
| 28 | void UnregisterSyntheticTrial(); |
| 29 | |
| 30 | // Check the client is eligible for 3PCD Experiments. Returns false when: the |
| 31 | // client is <30 days old or Android users with a PWA installed. |
| 32 | bool isClientEligible(); |
| 33 | }; |
| 34 | |
| 35 | } // namespace tpcd::experiment |
| 36 | |
| 37 | #endif // CHROME_BROWSER_TPCD_EXPERIMENT_EXPERIMENT_MANAGER_H_ |