chromium/chrome/browser/lookalikes/safety_tip_web_contents_observer.cc

// Copyright 2019 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/lookalikes/safety_tip_web_contents_observer.h"

#include <optional>
#include <string>
#include <utility>

#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "build/build_config.h"
#include "chrome/browser/lookalikes/lookalike_url_service.h"
#include "chrome/browser/lookalikes/safety_tip_ui.h"
#include "chrome/browser/profiles/profile.h"
#include "components/lookalikes/core/lookalike_url_util.h"
#include "components/security_state/core/security_state.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/common/page_visibility_state.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "url/gurl.h"

namespace {

void RecordHeuristicsUKMData(SafetyTipCheckResult result,
                             ukm::SourceId navigation_source_id,
                             SafetyTipInteraction action) {}

void OnSafetyTipClosed(SafetyTipCheckResult result,
                       ukm::SourceId navigation_source_id,
                       Profile* profile,
                       const GURL& url,
                       security_state::SafetyTipStatus status,
                       base::OnceClosure safety_tip_close_callback_for_testing,
                       SafetyTipInteraction action) {}

// Safety Tips does not use starts_active (since flagged sites are so rare to
// begin with), so this function records the same metric as "SafetyTipShown",
// but does so after the flag check, which may impact flag recording.
void RecordPostFlagCheckHistogram(security_state::SafetyTipStatus status) {}

// Records a histogram that embeds the safety tip status along with whether the
// navigation was initiated cross- or same-origin.
void RecordSafetyTipStatusWithInitiatorOriginInfo(
    const std::optional<url::Origin>& committed_initiator_origin,
    const GURL& committed_url,
    const GURL& current_url,
    security_state::SafetyTipStatus status) {}

}  // namespace

SafetyTipWebContentsObserver::~SafetyTipWebContentsObserver() = default;

void SafetyTipWebContentsObserver::DidFinishNavigation(
    content::NavigationHandle* navigation_handle) {}

void SafetyTipWebContentsObserver::OnVisibilityChanged(
    content::Visibility visibility) {}

security_state::SafetyTipInfo
SafetyTipWebContentsObserver::GetSafetyTipInfoForVisibleNavigation() const {}

void SafetyTipWebContentsObserver::RegisterSafetyTipCheckCallbackForTesting(
    base::OnceClosure callback) {}

void SafetyTipWebContentsObserver::RegisterSafetyTipCloseCallbackForTesting(
    base::OnceClosure callback) {}

SafetyTipWebContentsObserver::SafetyTipWebContentsObserver(
    content::WebContents* web_contents)
    :{}

void SafetyTipWebContentsObserver::MaybeShowSafetyTip(
    ukm::SourceId navigation_source_id,
    bool called_from_visibility_check,
    bool record_ukm_if_tip_not_shown) {}

void SafetyTipWebContentsObserver::HandleSafetyTipCheckResult(
    ukm::SourceId navigation_source_id,
    bool called_from_visibility_check,
    bool record_ukm_if_tip_not_shown,
    SafetyTipCheckResult result) {}

void SafetyTipWebContentsObserver::MaybeCallSafetyTipCheckCallback(
    bool heuristics_checked) {}

void SafetyTipWebContentsObserver::FinalizeSafetyTipCheckWhenTipNotShown(
    bool record_ukm,
    SafetyTipCheckResult result,
    ukm::SourceId navigation_source_id) {}

WEB_CONTENTS_USER_DATA_KEY_IMPL(SafetyTipWebContentsObserver);