chromium/chrome/browser/page_load_metrics/observers/lcp_critical_path_predictor_page_load_metrics_observer.h

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

#ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_LCP_CRITICAL_PATH_PREDICTOR_PAGE_LOAD_METRICS_OBSERVER_H_
#define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_LCP_CRITICAL_PATH_PREDICTOR_PAGE_LOAD_METRICS_OBSERVER_H_

#include <vector>

#include "chrome/browser/predictors/lcp_critical_path_predictor/lcp_critical_path_predictor_util.h"
#include "components/page_load_metrics/browser/page_load_metrics_observer.h"
#include "content/public/browser/page_user_data.h"
#include "url/origin.h"

namespace internal {

// Expose metrics for tests.
extern const char kHistogramLCPPFirstContentfulPaint[];
extern const char kHistogramLCPPLargestContentfulPaint[];
extern const char kHistogramLCPPPredictResult[];
extern const char kHistogramLCPPPredictHitIndex[];
extern const char kHistogramLCPPActualLCPIndex[];

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class LCPPPredictResult {};

// Since histogram counts only positive numbers but the indexes origin 0,
// add 1 for offset.
const int kLCPIndexHistogramOffset =;
}  // namespace internal

// PageLoadMetricsObserver responsible for:
// - Staging LCP element locator, LCP influencer scripts, used fonts and other
//   information until LCP is finalized, and
// - Reporting "PageLoad.Clients.LCPP." UMAs
class LcpCriticalPathPredictorPageLoadMetricsObserver
    : public page_load_metrics::PageLoadMetricsObserver {};

#endif  // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_LCP_CRITICAL_PATH_PREDICTOR_PAGE_LOAD_METRICS_OBSERVER_H_