chromium/chrome/browser/tpcd/heuristics/opener_heuristic_tab_helper.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/tpcd/heuristics/opener_heuristic_tab_helper.h"

#include <utility>

#include "base/functional/bind.h"
#include "base/functional/callback_forward.h"
#include "base/memory/weak_ptr.h"
#include "base/rand_util.h"
#include "base/time/clock.h"
#include "base/time/default_clock.h"
#include "base/time/time.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/dips/dips_bounce_detector.h"
#include "chrome/browser/dips/dips_service.h"
#include "chrome/browser/dips/dips_utils.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_service.h"
#include "chrome/browser/tpcd/heuristics/opener_heuristic_utils.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_source_id.h"

NavigationHandle;
RenderFrameHost;
WebContents;
EnableForIframeTypes;

namespace {

// We don't need to protect this with a lock since it's only set while
// single-threaded in tests.
base::Clock* g_clock =;

base::Clock* GetClock() {}

}  // namespace

OpenerHeuristicTabHelper::OpenerHeuristicTabHelper(WebContents* web_contents)
    :{}

OpenerHeuristicTabHelper::~OpenerHeuristicTabHelper() = default;

/* static */
base::Clock* OpenerHeuristicTabHelper::SetClockForTesting(base::Clock* clock) {}

void OpenerHeuristicTabHelper::InitPopup(
    const GURL& popup_url,
    base::WeakPtr<OpenerHeuristicTabHelper> opener) {}

void OpenerHeuristicTabHelper::GotPopupDipsState(const DIPSState& state) {}

void OpenerHeuristicTabHelper::PrimaryPageChanged(content::Page& page) {}

void OpenerHeuristicTabHelper::DidOpenRequestedURL(
    WebContents* new_contents,
    RenderFrameHost* source_render_frame_host,
    const GURL& url,
    const content::Referrer& referrer,
    WindowOpenDisposition disposition,
    ui::PageTransition transition,
    bool started_from_context_menu,
    bool renderer_initiated) {}

bool OpenerHeuristicTabHelper::PassesIframeInitiatorCheck(
    content::RenderFrameHost* source_render_frame_host) {}

WEB_CONTENTS_USER_DATA_KEY_IMPL(OpenerHeuristicTabHelper);

OpenerHeuristicTabHelper::PopupObserver::PopupObserver(
    WebContents* web_contents,
    const GURL& initial_url,
    base::WeakPtr<OpenerHeuristicTabHelper> opener)
    :{}

OpenerHeuristicTabHelper::PopupObserver::~PopupObserver() = default;

void OpenerHeuristicTabHelper::PopupObserver::SetPastInteractionTime(
    TimestampRange interaction_times) {}

void OpenerHeuristicTabHelper::PopupObserver::EmitPastInteractionIfReady() {}

void OpenerHeuristicTabHelper::PopupObserver::DidFinishNavigation(
    NavigationHandle* navigation_handle) {}

void OpenerHeuristicTabHelper::PopupObserver::FrameReceivedUserActivation(
    RenderFrameHost* render_frame_host) {}

void OpenerHeuristicTabHelper::OnCookiesAccessed(
    content::RenderFrameHost* render_frame_host,
    const content::CookieAccessDetails& details) {}

void OpenerHeuristicTabHelper::OnCookiesAccessed(
    content::NavigationHandle* navigation_handle,
    const content::CookieAccessDetails& details) {}

void OpenerHeuristicTabHelper::OnCookiesAccessed(
    const ukm::SourceId& source_id,
    const content::CookieAccessDetails& details) {}

void OpenerHeuristicTabHelper::EmitPostPopupCookieAccess(
    const ukm::SourceId& source_id,
    const content::CookieAccessDetails& details,
    std::optional<PopupsStateValue> value) {}

void OpenerHeuristicTabHelper::PopupObserver::EmitTopLevelAndCreateGrant(
    const GURL& popup_url,
    OptionalBool has_iframe,
    bool is_current_interaction,
    bool should_record_popup_and_maybe_grant,
    base::TimeDelta grant_duration) {}

void OpenerHeuristicTabHelper::PopupObserver::MaybeCreateOpenerHeuristicGrant(
    const GURL& url,
    base::TimeDelta grant_duration) {}

OptionalBool
OpenerHeuristicTabHelper::PopupObserver::GetOpenerHasSameSiteIframe(
    const GURL& popup_url) {}