chromium/components/site_engagement/content/site_engagement_score.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "components/site_engagement/content/site_engagement_score.h"

#include <algorithm>
#include <cmath>
#include <utility>

#include "base/metrics/field_trial_params.h"
#include "base/no_destructor.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/clock.h"
#include "base/time/time.h"
#include "base/values.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/content_settings/core/common/content_settings_utils.h"
#include "components/site_engagement/content/engagement_type.h"
#include "components/site_engagement/content/site_engagement_metrics.h"
#include "third_party/blink/public/mojom/site_engagement/site_engagement.mojom.h"

namespace site_engagement {

namespace {

// Delta within which to consider scores equal.
const double kScoreDelta =;

// Delta within which to consider internal time values equal. Internal time
// values are in microseconds, so this delta comes out at one second.
const double kTimeDelta =;

// Number of days after the last launch of an origin from an installed shortcut
// for which WEB_APP_INSTALLED_POINTS will be added to the engagement score.
const int kMaxDaysSinceShortcutLaunch =;

bool DoublesConsideredDifferent(double value1, double value2, double delta) {}

base::Value::Dict GetSiteEngagementScoreDictForSettings(
    const HostContentSettingsMap* settings,
    const GURL& origin_url) {}

}  // namespace

const double SiteEngagementScore::kMaxPoints =;

const char SiteEngagementScore::kRawScoreKey[] =;
const char SiteEngagementScore::kPointsAddedTodayKey[] =;
const char SiteEngagementScore::kLastEngagementTimeKey[] =;
const char SiteEngagementScore::kLastShortcutLaunchTimeKey[] =;

// static
SiteEngagementScore::ParamValues& SiteEngagementScore::GetParamValues() {}

double SiteEngagementScore::GetMaxPointsPerDay() {}

double SiteEngagementScore::GetDecayPeriodInHours() {}

double SiteEngagementScore::GetDecayPoints() {}

double SiteEngagementScore::GetDecayProportion() {}

double SiteEngagementScore::GetScoreCleanupThreshold() {}

double SiteEngagementScore::GetNavigationPoints() {}

double SiteEngagementScore::GetUserInputPoints() {}

double SiteEngagementScore::GetVisibleMediaPoints() {}

double SiteEngagementScore::GetHiddenMediaPoints() {}

double SiteEngagementScore::GetWebAppInstalledPoints() {}

double SiteEngagementScore::GetFirstDailyEngagementPoints() {}

double SiteEngagementScore::GetBootstrapPoints() {}

double SiteEngagementScore::GetMediumEngagementBoundary() {}

double SiteEngagementScore::GetHighEngagementBoundary() {}

double SiteEngagementScore::GetMaxDecaysPerScore() {}

double SiteEngagementScore::GetLastEngagementGracePeriodInHours() {}

double SiteEngagementScore::GetNotificationInteractionPoints() {}

void SiteEngagementScore::SetParamValuesForTesting() {}
// static
void SiteEngagementScore::UpdateFromVariations(const char* param_name) {}

SiteEngagementScore::SiteEngagementScore(base::Clock* clock,
                                         const GURL& origin,
                                         HostContentSettingsMap* settings)
    :{}

SiteEngagementScore::SiteEngagementScore(SiteEngagementScore&& other) = default;

SiteEngagementScore::~SiteEngagementScore() {}

SiteEngagementScore& SiteEngagementScore::operator=(
    SiteEngagementScore&& other) = default;

void SiteEngagementScore::AddPoints(double points) {}

double SiteEngagementScore::GetTotalScore() const {}

mojom::SiteEngagementDetails SiteEngagementScore::GetDetails() const {}

void SiteEngagementScore::Commit() {}

blink::mojom::EngagementLevel SiteEngagementScore::GetEngagementLevel() const {}

bool SiteEngagementScore::MaxPointsPerDayAdded() const {}

void SiteEngagementScore::Reset(double points,
                                const base::Time last_engagement_time) {}

void SiteEngagementScore::SetLastEngagementTime(const base::Time& time) {}

bool SiteEngagementScore::UpdateScoreDict(base::Value::Dict& score_dict) {}

SiteEngagementScore::SiteEngagementScore(
    base::Clock* clock,
    const GURL& origin,
    std::optional<base::Value::Dict> score_dict)
    :{}

double SiteEngagementScore::DecayedScore() const {}

double SiteEngagementScore::BonusIfShortcutLaunched() const {}

}  // namespace site_engagement