#include "chrome/browser/page_load_metrics/observers/security_state_page_load_metrics_observer.h"
#include <cmath>
#include "base/check.h"
#include "base/metrics/histogram_functions.h"
#include "base/time/time.h"
#include "chrome/browser/engagement/site_engagement_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "components/security_state/content/security_state_tab_helper.h"
#include "components/security_state/core/security_state.h"
#include "components/site_engagement/content/site_engagement_service.h"
#include "content/public/browser/navigation_handle.h"
#include "services/metrics/public/cpp/metrics_utils.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
namespace {
const char kEngagementFinalPrefix[] = …;
const char kPageEndReasonPrefix[] = …;
const char kTimeOnPagePrefix[] = …;
const char kSecurityLevelOnCommit[] = …;
const char kSecurityLevelOnComplete[] = …;
}
std::unique_ptr<page_load_metrics::PageLoadMetricsObserver>
SecurityStatePageLoadMetricsObserver::MaybeCreateForProfile(
content::BrowserContext* profile) { … }
std::string
SecurityStatePageLoadMetricsObserver::GetEngagementFinalHistogramNameForTesting(
security_state::SecurityLevel level) { … }
std::string SecurityStatePageLoadMetricsObserver::
GetSecurityLevelPageEndReasonHistogramNameForTesting(
security_state::SecurityLevel level) { … }
std::string SecurityStatePageLoadMetricsObserver::
GetSafetyTipPageEndReasonHistogramNameForTesting(
security_state::SafetyTipStatus safety_tip_status) { … }
SecurityStatePageLoadMetricsObserver::SecurityStatePageLoadMetricsObserver(
site_engagement::SiteEngagementService* engagement_service)
: … { … }
SecurityStatePageLoadMetricsObserver::~SecurityStatePageLoadMetricsObserver() =
default;
page_load_metrics::PageLoadMetricsObserver::ObservePolicy
SecurityStatePageLoadMetricsObserver::OnStart(
content::NavigationHandle* navigation_handle,
const GURL& currently_committed_url,
bool started_in_foreground) { … }
page_load_metrics::PageLoadMetricsObserver::ObservePolicy
SecurityStatePageLoadMetricsObserver::OnFencedFramesStart(
content::NavigationHandle* navigation_handle,
const GURL& currently_committed_url) { … }
page_load_metrics::PageLoadMetricsObserver::ObservePolicy
SecurityStatePageLoadMetricsObserver::OnPrerenderStart(
content::NavigationHandle* navigation_handle,
const GURL& currently_committed_url) { … }
page_load_metrics::PageLoadMetricsObserver::ObservePolicy
SecurityStatePageLoadMetricsObserver::OnCommit(
content::NavigationHandle* navigation_handle) { … }
void SecurityStatePageLoadMetricsObserver::DidActivatePrerenderedPage(
content::NavigationHandle* navigation_handle) { … }
void SecurityStatePageLoadMetricsObserver::OnComplete(
const page_load_metrics::mojom::PageLoadTiming& timing) { … }
void SecurityStatePageLoadMetricsObserver::DidChangeVisibleSecurityState() { … }
void SecurityStatePageLoadMetricsObserver::RecordSecurityLevelHistogram(
content::NavigationHandle* navigation_handle) { … }