#include "chrome/browser/page_load_metrics/observers/third_party_cookie_deprecation_page_load_metrics_observer.h"
#include "base/metrics/histogram_macros.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/privacy_sandbox/tracking_protection_onboarding_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tpcd/experiment/experiment_manager_impl.h"
#include "chrome/browser/tpcd/experiment/tpcd_experiment_features.h"
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/page_load_metrics/browser/metrics_web_contents_observer.h"
#include "components/page_load_metrics/browser/page_load_metrics_util.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "net/cookies/site_for_cookies.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom.h"
#include "url/gurl.h"
namespace {
CookieSettingsBase;
ThirdPartyCookieAllowMechanism;
OnboardingStatus;
bool IsSameSite(const GURL& url1, const GURL& url2) { … }
enum CookieReadStatus { … };
}
ThirdPartyCookieDeprecationMetricsObserver::
ThirdPartyCookieDeprecationMetricsObserver(
content::BrowserContext* context) { … }
ThirdPartyCookieDeprecationMetricsObserver::
~ThirdPartyCookieDeprecationMetricsObserver() = default;
const char* ThirdPartyCookieDeprecationMetricsObserver::GetObserverName()
const { … }
page_load_metrics::PageLoadMetricsObserver::ObservePolicy
ThirdPartyCookieDeprecationMetricsObserver::OnPrerenderStart(
content::NavigationHandle* navigation_handle,
const GURL& currently_committed_url) { … }
page_load_metrics::PageLoadMetricsObserver::ObservePolicy
ThirdPartyCookieDeprecationMetricsObserver::OnFencedFramesStart(
content::NavigationHandle* navigation_handle,
const GURL& currently_committed_url) { … }
void ThirdPartyCookieDeprecationMetricsObserver::OnCookiesRead(
const GURL& url,
const GURL& first_party_url,
bool blocked_by_policy,
bool is_ad_tagged,
const net::CookieSettingOverrides& cookie_setting_overrides,
bool is_partitioned_access) { … }
void ThirdPartyCookieDeprecationMetricsObserver::OnCookieChange(
const GURL& url,
const GURL& first_party_url,
const net::CanonicalCookie& cookie,
bool blocked_by_policy,
bool is_ad_tagged,
const net::CookieSettingOverrides& cookie_setting_overrides,
bool is_partitioned_access) { … }
void ThirdPartyCookieDeprecationMetricsObserver::RecordCookieUseCounters(
const GURL& url,
const GURL& first_party_url,
bool blocked_by_policy,
ThirdPartyCookieAllowMechanism allow_mechanism) { … }
void ThirdPartyCookieDeprecationMetricsObserver::RecordCookieReadUseCounters(
const GURL& url,
const GURL& first_party_url,
bool blocked_by_policy,
bool is_ad_tagged,
ThirdPartyCookieAllowMechanism allow_mechanism,
const net::CookieSettingOverrides& cookie_setting_overrides,
bool is_partitioned_access) { … }
bool ThirdPartyCookieDeprecationMetricsObserver::IsThirdParty(
const GURL& url,
const GURL& first_party_url) { … }
bool ThirdPartyCookieDeprecationMetricsObserver::
IsBlockedByThirdPartyDeprecationExperiment() { … }