chromium/components/subresource_filter/content/browser/ads_intervention_manager.h

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

#ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_ADS_INTERVENTION_MANAGER_H_
#define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_ADS_INTERVENTION_MANAGER_H_

#include <optional>

#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "components/subresource_filter/content/browser/subresource_filter_content_settings_manager.h"
#include "components/subresource_filter/core/mojom/subresource_filter.mojom.h"

class GURL;

namespace base {
class Clock;
}

namespace content {
class NavigationHandle;
}

// The subresource filter activation status associated with an ads
// intervention during page load.
enum class AdsInterventionStatus {};

namespace subresource_filter {

// This class tracks ads interventions that have occurred on origins and is
// bound to the user's profile. The ads intervention manager operates in two
// modes set by the feature flag kAdsInterventionsEnforced:
// 1. Dry run: Ads are not blocked on sites with ad interventions, however,
//    the ads intervention manager records metrics as if ads were blocked.
//    If the ads intervention manager is asked to intervene on the same URL
//    in the period where we would block ads during enforcement, it will only
//    record the first seen intervention.
// 2. Enforced: Ads are blocked on sites with ad interventions.
//
// The duration of an ad intervention is set by the feature flag
// kAdsInterventionDuration.
//
// This class maintain's metadata for ads interventions in the user's website
// settings. This is persisted to disk and cleared with browsing history. The
// content subresource filter manager expires ads intervention metadata after
// 7 days. As a result, kAdsInterventionDuration should be less than 7 days
// to prevent expiry from impacting metrics. The metadata is scoped to each
// url's origin. This API would ideally work with Origins insead of GURLs,
// however, downstream APIs use GURL's.
class AdsInterventionManager {};

}  // namespace subresource_filter

#endif  // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_ADS_INTERVENTION_MANAGER_H_