#include "components/subresource_filter/content/browser/safe_browsing_page_activation_throttle.h"
#include <optional>
#include <sstream>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_macros.h"
#include "base/not_fatal_until.h"
#include "base/ranges/algorithm.h"
#include "base/task/single_thread_task_runner.h"
#include "base/timer/timer.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/traced_value.h"
#include "components/safe_browsing/core/common/features.h"
#include "components/subresource_filter/content/browser/content_activation_list_utils.h"
#include "components/subresource_filter/content/browser/devtools_interaction_tracker.h"
#include "components/subresource_filter/content/browser/navigation_console_logger.h"
#include "components/subresource_filter/content/browser/subresource_filter_observer_manager.h"
#include "components/subresource_filter/content/browser/subresource_filter_safe_browsing_client.h"
#include "components/subresource_filter/content/shared/common/subresource_filter_utils.h"
#include "components/subresource_filter/core/browser/subresource_filter_constants.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_source.h"
#include "third_party/blink/public/mojom/devtools/console_message.mojom.h"
#include "ui/base/page_transition_types.h"
#include "url/gurl.h"
namespace subresource_filter {
namespace {
CheckResults;
std::optional<RedirectPosition> GetEnforcementRedirectPosition(
const CheckResults& results) { … }
}
SafeBrowsingPageActivationThrottle::SafeBrowsingPageActivationThrottle(
content::NavigationHandle* handle,
SafeBrowsingPageActivationThrottle::Delegate* delegate,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager)
: … { … }
SafeBrowsingPageActivationThrottle::
~SafeBrowsingPageActivationThrottle() = default;
content::NavigationThrottle::ThrottleCheckResult
SafeBrowsingPageActivationThrottle::WillRedirectRequest() { … }
content::NavigationThrottle::ThrottleCheckResult
SafeBrowsingPageActivationThrottle::WillProcessResponse() { … }
const char*
SafeBrowsingPageActivationThrottle::GetNameForLogging() { … }
void SafeBrowsingPageActivationThrottle::OnCheckUrlResultOnUI(
const SubresourceFilterSafeBrowsingClient::CheckResult& result) { … }
SafeBrowsingPageActivationThrottle::ConfigResult::ConfigResult(
Configuration config,
bool warning,
bool matched_valid_configuration,
ActivationList matched_list)
: … { … }
SafeBrowsingPageActivationThrottle::ConfigResult::ConfigResult() =
default;
SafeBrowsingPageActivationThrottle::ConfigResult::ConfigResult(
const ConfigResult&) = default;
SafeBrowsingPageActivationThrottle::ConfigResult::~ConfigResult() =
default;
void SafeBrowsingPageActivationThrottle::CheckCurrentUrl() { … }
void SafeBrowsingPageActivationThrottle::NotifyResult() { … }
void SafeBrowsingPageActivationThrottle::
LogMetricsOnChecksComplete(ActivationList matched_list,
ActivationDecision decision,
mojom::ActivationLevel level) const { … }
bool SafeBrowsingPageActivationThrottle::
HasFinishedAllSafeBrowsingChecks() const { … }
SafeBrowsingPageActivationThrottle::ConfigResult
SafeBrowsingPageActivationThrottle::
GetHighestPriorityConfiguration(
const SubresourceFilterSafeBrowsingClient::CheckResult& result) { … }
ActivationDecision
SafeBrowsingPageActivationThrottle::GetActivationDecision(
const ConfigResult& config) { … }
bool SafeBrowsingPageActivationThrottle::
DoesRootFrameURLSatisfyActivationConditions(
const Configuration::ActivationConditions& conditions,
ActivationList matched_list) const { … }
}