chromium/components/autofill/core/browser/autofill_ablation_study.h

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_ABLATION_STUDY_H_
#define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_ABLATION_STUDY_H_

#include <stdint.h>

#include <string>
#include <string_view>

class GURL;
class PrefService;
namespace base {
class Time;
}
namespace autofill {
class AutofillOptimizationGuide;
}

namespace autofill {

// Number of days for which the ablation behavior stays constant for a client.
inline constexpr int kAblationWindowInDays =;

// The ablation group of a specific [site * 14 day window * seed].
enum class AblationGroup {};

// Distinction of form types. For ablation purposes, address and payment forms
// can be configured for ablation independently. Today we don't offer autofill
// for other form types. They would be put into the AblationGroup::kDefault.
enum class FormTypeForAblationStudy {};

#if defined(UNIT_TEST)
int DaysSinceLocalWindowsEpoch(base::Time now);
uint64_t GetAblationHash(const std::string& seed,
                         const GURL& url,
                         base::Time now);
#endif  // defined(UNIT_TEST)

// Returns a number between 0 (incl.) and kAblationWindowInDays (excl.)
// reflecting the number of days that have passed since the beginning of an
// ablation window during which the ablation behavior remains constant for a
// client.
int GetDayInAblationWindow(base::Time now);

// A class to control the ablation study. The decision whether a given form
// is subject to an ablated experience is pseudorandomly derived from the
// combination of [site * 14 day window * seed]: Different sites may have
// ablation configurations. The ablation state changes every 14 days.
// Different users may have different ablation configurations.
// The ablation is controlled by features::kAutofillEnableAblationStudy.
class AutofillAblationStudy {};

}  // namespace autofill

#endif  // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_ABLATION_STUDY_H_