#include "chrome/browser/tpcd/heuristics/redirect_heuristic_tab_helper.h"
#include "base/rand_util.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/dips/dips_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tpcd/experiment/tpcd_experiment_features.h"
#include "chrome/browser/tpcd/heuristics/opener_heuristic_metrics.h"
#include "chrome/browser/tpcd/heuristics/opener_heuristic_utils.h"
#include "components/content_settings/core/browser/cookie_settings.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "services/metrics/public/cpp/ukm_builders.h"
WEB_CONTENTS_USER_DATA_KEY_IMPL(RedirectHeuristicTabHelper);
RedirectHeuristicTabHelper::RedirectHeuristicTabHelper(
content::WebContents* web_contents)
: … { … }
RedirectHeuristicTabHelper::~RedirectHeuristicTabHelper() = default;
void RedirectHeuristicTabHelper::OnCookiesAccessed(
content::RenderFrameHost* render_frame_host,
const content::CookieAccessDetails& details) { … }
void RedirectHeuristicTabHelper::PrimaryPageChanged(content::Page& page) { … }
void RedirectHeuristicTabHelper::OnNavigationCommitted() { … }
void RedirectHeuristicTabHelper::MaybeRecordRedirectHeuristic(
const ukm::SourceId& first_party_source_id,
const content::CookieAccessDetails& details) { … }
void RedirectHeuristicTabHelper::RecordRedirectHeuristic(
const ukm::SourceId& first_party_source_id,
const ukm::SourceId& third_party_source_id,
const content::CookieAccessDetails& details,
const size_t sites_passed_count,
bool is_current_interaction,
std::optional<base::Time> last_user_interaction_time) { … }
void RedirectHeuristicTabHelper::CreateAllRedirectHeuristicGrants(
const GURL& first_party_url) { … }
void RedirectHeuristicTabHelper::CreateRedirectHeuristicGrant(
const GURL& url,
const GURL& first_party_url,
base::TimeDelta grant_duration,
bool has_interaction) { … }
std::set<std::string> RedirectHeuristicTabHelper::AllSitesFollowingFirstParty(
content::WebContents* web_contents,
const GURL& first_party_url) { … }
void RedirectHeuristicTabHelper::WebContentsDestroyed() { … }