chromium/components/page_load_metrics/browser/observers/abandoned_page_load_metrics_observer.h

// Copyright 2024 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_ABANDONED_PAGE_LOAD_METRICS_OBSERVER_H_
#define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_OBSERVERS_ABANDONED_PAGE_LOAD_METRICS_OBSERVER_H_

#include "components/page_load_metrics/browser/page_load_metrics_observer.h"
#include "content/public/browser/navigation_handle_timing.h"
#include "services/metrics/public/cpp/ukm_builders.h"

namespace internal {
// Exposed for tests.
extern const char kAbandonedPageLoadMetricsHistogramPrefix[];
extern const char kSuffixWasBackgrounded[];
extern const char kSuffixWasHidden[];
extern const char kRendererProcessCreatedBeforeNavHistogramName[];
extern const char kRendererProcessInitHistogramName[];

}  // namespace internal

// Observes and records UMA for navigations which might or might get
// "abandoned" at some point during the navigation / loading, for navigations
// that target any URL. This observer will log the navigation milestones even if
// the navigation didn't end up reaching all the milestones. This allows us to
// look at the amount of navigations that reached each milestone, to see where
// the navigation gets abandoned. In addition to that, this observer will also
// log the abandonment reason and the last navigation milestone the navigation
// reached before getting abandoned.
class AbandonedPageLoadMetricsObserver
    : public page_load_metrics::PageLoadMetricsObserver {};

#endif  // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_OBSERVERS_ABANDONED_PAGE_LOAD_METRICS_OBSERVER_H_