#include "components/safe_browsing/content/browser/triggers/trigger_throttler.h"
#include "base/containers/contains.h"
#include "base/metrics/field_trial_params.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/time/default_clock.h"
#include "base/time/time.h"
#include "base/values.h"
#include "components/prefs/pref_service.h"
#include "components/safe_browsing/core/common/features.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
namespace safe_browsing {
const size_t kAdSamplerTriggerDefaultQuota = …;
const size_t kSuspiciousSiteTriggerDefaultQuota = …;
const char kSuspiciousSiteTriggerQuotaParam[] = …;
namespace {
const size_t kUnlimitedTriggerQuota = …;
constexpr base::TimeDelta kOneDayTimeDelta = …;
void ParseTriggerTypeAndQuotaParam(
std::vector<TriggerTypeAndQuotaItem>* trigger_type_and_quota_list) { … }
bool TryFindQuotaForTrigger(
const TriggerType trigger_type,
const std::vector<TriggerTypeAndQuotaItem>& trigger_quota_list,
size_t* out_quota) { … }
}
TriggerThrottler::TriggerThrottler(PrefService* local_state_prefs)
: … { … }
TriggerThrottler::~TriggerThrottler() { … }
void TriggerThrottler::SetClockForTesting(base::Clock* test_clock) { … }
bool TriggerThrottler::TriggerCanFire(const TriggerType trigger_type) const { … }
void TriggerThrottler::TriggerFired(const TriggerType trigger_type) { … }
void TriggerThrottler::CleanupOldEvents() { … }
void TriggerThrottler::LoadTriggerEventsFromPref() { … }
void TriggerThrottler::WriteTriggerEventsToPref() { … }
size_t TriggerThrottler::GetDailyQuotaForTrigger(
const TriggerType trigger_type) const { … }
void TriggerThrottler::ResetPrefsForTesting(PrefService* local_state_prefs) { … }
}