chromium/chrome/browser/ui/user_education/recent_session_policy.cc

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

#include "chrome/browser/ui/user_education/recent_session_policy.h"

#include <optional>

#include "base/dcheck_is_on.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_functions.h"
#include "base/time/time.h"
#include "chrome/browser/user_education/browser_feature_promo_storage_service.h"
#include "chrome/browser/user_education/user_education_service.h"

namespace {

constexpr int kMaxRecords =;

// Gets midnight at the start of the next local day.
// Note: inaccurate if the time is *exactly* midnight, but this will happen so
// rarely that it's not worth worrying about.
base::Time GetEndOfDay(base::Time time) {}

// Counts the number of active days in `recent_sessions` going back `num_days`
// from `last_day`. Returns null if session data recording does not go back far
// enough to cover the whole span.
std::optional<int> CountActiveDays(const RecentSessionData& recent_sessions,
                                   base::Time last_day,
                                   int num_days) {}

std::optional<int> ValueOrNull(int value) {}

}  // namespace

bool RecentSessionPolicyImpl::Constraint::ShouldSkipRecording(
    const RecentSessionData& recent_sessions) const {}

bool RecentSessionPolicyImpl::DailyConstraint::ShouldSkipRecording(
    const RecentSessionData& recent_sessions) const {}

std::optional<int> RecentSessionPolicyImpl::SessionCountConstraint::GetCount(
    const RecentSessionData& recent_sessions) const {}

std::optional<int> RecentSessionPolicyImpl::ActiveDaysConstraint::GetCount(
    const RecentSessionData& recent_sessions) const {}

std::optional<int> RecentSessionPolicyImpl::ActiveWeeksConstraint::GetCount(
    const RecentSessionData& recent_sessions) const {}

RecentSessionPolicyImpl::ConstraintInfo::ConstraintInfo() = default;
RecentSessionPolicyImpl::ConstraintInfo::ConstraintInfo(
    std::unique_ptr<Constraint> constraint_,
    std::string histogram_name_,
    std::optional<int> histogram_max_,
    std::optional<int> low_usage_max_)
    :{}
RecentSessionPolicyImpl::ConstraintInfo::ConstraintInfo(
    ConstraintInfo&&) noexcept = default;
RecentSessionPolicyImpl::ConstraintInfo&
RecentSessionPolicyImpl::ConstraintInfo::operator=(ConstraintInfo&&) noexcept =
    default;
RecentSessionPolicyImpl::ConstraintInfo::~ConstraintInfo() = default;

RecentSessionPolicyImpl::RecentSessionPolicyImpl(ConstraintInfos constraints)
    :{}

RecentSessionPolicyImpl::~RecentSessionPolicyImpl() = default;

void RecentSessionPolicyImpl::RecordRecentUsageMetrics(
    const RecentSessionData& recent_sessions) {}

bool RecentSessionPolicyImpl::ShouldEnableLowUsagePromoMode(
    const RecentSessionData& recent_sessions) const {}

// static
RecentSessionPolicyImpl::ConstraintInfos
RecentSessionPolicyImpl::GetDefaultConstraints() {}