chromium/components/page_load_metrics/browser/observers/ad_metrics/page_ad_density_tracker.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_PAGE_LOAD_METRICS_BROWSER_OBSERVERS_AD_METRICS_PAGE_AD_DENSITY_TRACKER_H_
#define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_OBSERVERS_AD_METRICS_PAGE_AD_DENSITY_TRACKER_H_

#include <base/containers/flat_map.h>

#include <map>
#include <optional>
#include <set>

#include "base/memory/raw_ptr.h"
#include "base/time/tick_clock.h"
#include "base/time/time.h"
#include "components/page_load_metrics/browser/observers/ad_metrics/page_ad_density_tracker.h"
#include "components/page_load_metrics/browser/observers/ad_metrics/univariate_stats.h"
#include "ui/gfx/geometry/rect.h"

namespace page_load_metrics {

// Tracks the ad density of a page through the page's lifecycle.
// It has the following usage:
//    1. Set subframe, mainframe, and viewport rects using operations (AddRect,
//       RemoveRect, UpdateMainFrameRect, UpdateMainFrameViewportRect).
//    2. When the main frame rect or a subframe rect is updated, get current
//       page ad density using CalculatePageAdDensity.
//    3. When the main frame viewport rect or a subframe rect is updated, get
//       current viewport ad density using CalculateViewportAdDensity.
class PageAdDensityTracker {};

}  // namespace page_load_metrics

#endif  // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_OBSERVERS_AD_METRICS_PAGE_AD_DENSITY_TRACKER_H_