chromium/components/permissions/notifications_engagement_service.cc

// Copyright 2022 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/permissions/notifications_engagement_service.h"

#include "components/permissions/permissions_client.h"
#include "url/gurl.h"

namespace permissions {

namespace {

// For each origin that has the  |ContentSettingsType::NOTIFICATIONS|
// permission, we record the number of notifications that were displayed
// and interacted with. The data is stored in the website setting
// |NOTIFICATION_INTERACTIONS|  keyed to the same origin. The internal
// structure of this metadata is a dictionary:
//
//   {"1644163200": {"display_count": 3},  # Implied click_count = 0.
//    "1644768000": {"display_count": 6, "click_count": 1}}
//
// Currently, entries will be recorded daily.

constexpr char kEngagementKey[] =;
constexpr char kDisplayedKey[] =;

// Entries in notifications engagement expire after they become this old.
constexpr base::TimeDelta kMaxAge =;

// Discards notification interactions stored in `engagement` for time
// periods older than |kMaxAge|.
void EraseStaleEntries(base::Value::Dict& engagement) {}
}  // namespace

NotificationsEngagementService::NotificationsEngagementService(
    content::BrowserContext* context,
    PrefService* pref_service)
    :{}

void NotificationsEngagementService::Shutdown() {}

void NotificationsEngagementService::RecordNotificationDisplayed(
    const GURL& url) {}

void NotificationsEngagementService::RecordNotificationDisplayed(
    const GURL& url,
    int display_count) {}

void NotificationsEngagementService::RecordNotificationInteraction(
    const GURL& url) {}

void NotificationsEngagementService::IncrementCounts(const GURL& url,
                                                     int display_count_delta,
                                                     int click_count_delta) {}

// static
std::string NotificationsEngagementService::GetBucketLabel(base::Time date) {}

// static
std::optional<base::Time>
NotificationsEngagementService::ParsePeriodBeginFromBucketLabel(
    const std::string& label) {}

}  // namespace permissions