#include "chrome/browser/media/media_engagement_score.h"
#include <string_view>
#include <utility>
#include "base/metrics/field_trial_params.h"
#include "base/time/time.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/site_engagement_metrics.h"
#include "media/base/media_switches.h"
const char MediaEngagementScore::kVisitsKey[] = …;
const char MediaEngagementScore::kMediaPlaybacksKey[] = …;
const char MediaEngagementScore::kLastMediaPlaybackTimeKey[] = …;
const char MediaEngagementScore::kHasHighScoreKey[] = …;
const char MediaEngagementScore::kScoreMinVisitsParamName[] = …;
const char MediaEngagementScore::kHighScoreLowerThresholdParamName[] = …;
const char MediaEngagementScore::kHighScoreUpperThresholdParamName[] = …;
base::TimeDelta kScoreExpirationDuration = …;
namespace {
const int kScoreMinVisitsParamDefault = …;
const double kHighScoreLowerThresholdParamDefault = …;
const double kHighScoreUpperThresholdParamDefault = …;
base::Value::Dict GetMediaEngagementScoreDictForSettings(
const HostContentSettingsMap* settings,
const url::Origin& origin) { … }
void GetIntegerFromScore(const base::Value::Dict& dict,
std::string_view key,
int* out) { … }
}
double MediaEngagementScore::GetHighScoreLowerThreshold() { … }
double MediaEngagementScore::GetHighScoreUpperThreshold() { … }
int MediaEngagementScore::GetScoreMinVisits() { … }
MediaEngagementScore::MediaEngagementScore(base::Clock* clock,
const url::Origin& origin,
HostContentSettingsMap* settings)
: … { … }
MediaEngagementScore::MediaEngagementScore(base::Clock* clock,
const url::Origin& origin,
base::Value::Dict score_dict,
HostContentSettingsMap* settings)
: … { … }
media::mojom::MediaEngagementScoreDetailsPtr
MediaEngagementScore::GetScoreDetails() const { … }
MediaEngagementScore::~MediaEngagementScore() = default;
MediaEngagementScore::MediaEngagementScore(MediaEngagementScore&&) = default;
MediaEngagementScore& MediaEngagementScore::operator=(MediaEngagementScore&&) =
default;
void MediaEngagementScore::Commit(bool force_update) { … }
void MediaEngagementScore::IncrementMediaPlaybacks() { … }
bool MediaEngagementScore::UpdateScoreDict(bool force_update) { … }
void MediaEngagementScore::Recalculate() { … }
void MediaEngagementScore::SetVisits(int visits) { … }
void MediaEngagementScore::SetMediaPlaybacks(int media_playbacks) { … }