page_load_metrics_observer_impl.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef WEBLAYER_BROWSER_PAGE_LOAD_METRICS_OBSERVER_IMPL_H_
  5. #define WEBLAYER_BROWSER_PAGE_LOAD_METRICS_OBSERVER_IMPL_H_
  6. #include "components/page_load_metrics/browser/page_load_metrics_observer.h"
  7. namespace weblayer {
  8. class PageLoadMetricsObserverImpl
  9. : public page_load_metrics::PageLoadMetricsObserver {
  10. public:
  11. PageLoadMetricsObserverImpl() = default;
  12. ~PageLoadMetricsObserverImpl() override = default;
  13. // page_load_metrics::PageLoadMetricsObserver implementation:
  14. ObservePolicy OnFencedFramesStart(
  15. content::NavigationHandle* navigation_handle,
  16. const GURL& currently_committed_url) override;
  17. ObservePolicy OnPrerenderStart(content::NavigationHandle* navigation_handle,
  18. const GURL& currently_committed_url) override;
  19. ObservePolicy FlushMetricsOnAppEnterBackground(
  20. const page_load_metrics::mojom::PageLoadTiming& timing) override;
  21. ObservePolicy OnHidden(
  22. const page_load_metrics::mojom::PageLoadTiming& timing) override;
  23. void OnComplete(
  24. const page_load_metrics::mojom::PageLoadTiming& timing) override;
  25. ObservePolicy OnCommit(content::NavigationHandle* navigation_handle) override;
  26. void OnFirstContentfulPaintInPage(
  27. const page_load_metrics::mojom::PageLoadTiming& timing) override;
  28. void ReportBufferedMetrics(
  29. const page_load_metrics::mojom::PageLoadTiming& timing);
  30. private:
  31. bool reported_buffered_metrics_ = false;
  32. };
  33. } // namespace weblayer
  34. #endif // WEBLAYER_BROWSER_PAGE_LOAD_METRICS_OBSERVER_IMPL_H_