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

// 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.

#include "components/autofill/core/browser/autofill_ablation_study.h"

#include "base/base64.h"
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/containers/span.h"
#include "base/hash/md5.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/field_trial.h"
#include "base/no_destructor.h"
#include "base/numerics/byte_conversions.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "components/autofill/core/browser/autofill_optimization_guide.h"
#include "components/autofill/core/common/autofill_clock.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/autofill_prefs.h"
#include "components/optimization_guide/proto/hints.pb.h"
#include "components/prefs/pref_service.h"
#include "third_party/icu/source/i18n/unicode/timezone.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace autofill {

kAutofillAblationStudyAblationWeightPerMilleList1Param;
kAutofillAblationStudyAblationWeightPerMilleList2Param;
kAutofillAblationStudyAblationWeightPerMilleList3Param;
kAutofillAblationStudyAblationWeightPerMilleList4Param;
kAutofillAblationStudyAblationWeightPerMilleList5Param;
kAutofillAblationStudyAblationWeightPerMilleList6Param;
kAutofillAblationStudyAblationWeightPerMilleParam;
kAutofillAblationStudyEnabledForAddressesParam;
kAutofillAblationStudyEnabledForPaymentsParam;
kAutofillEnableAblationStudy;
kAutofillShowTypePredictions;

namespace {

// Number of bytes that we use to randomly seed the MD5Sum.
constexpr size_t kSeedLengthInBytes =;

// Converts the 8-byte prefix of an MD5 hash into a uint64_t value.
inline uint64_t DigestToUInt64(const base::MD5Digest& digest) {}

// Returns the ablation seed from prefs and creates one if that has not happened
// before.
std::string GetSeed(PrefService* pref_service) {}

}  // namespace

// Returns the number of days since Windows epoch but aligns timezones so that
// the first day starts at midnight in the local timezone (ignoring daylight
// saving time).
int DaysSinceLocalWindowsEpoch(base::Time now) {}

// Returns a 64 bit hash of |seed|, the site and the current day, which is can
// be used to decide whether a form impression should be exposed to autofill
// ablation.
uint64_t GetAblationHash(const std::string& seed,
                         const GURL& url,
                         base::Time now) {}

int GetDayInAblationWindow(base::Time now) {}

AutofillAblationStudy::AutofillAblationStudy(std::string_view seed)
    :{}
AutofillAblationStudy::AutofillAblationStudy(PrefService* local_state)
    :{}
AutofillAblationStudy::~AutofillAblationStudy() = default;

// static
const AutofillAblationStudy& AutofillAblationStudy::disabled_study() {}

AblationGroup AutofillAblationStudy::GetAblationGroup(
    const GURL& url,
    FormTypeForAblationStudy form_type,
    AutofillOptimizationGuide* autofill_optimization_guide) const {}

AblationGroup AutofillAblationStudy::GetAblationGroupImpl(
    const GURL& url,
    base::Time now,
    uint32_t ablation_weight_per_mille) const {}

}  // namespace autofill