#include "components/safe_browsing/content/browser/base_blocking_page.h"
#include <memory>
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/lazy_instance.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "components/safe_browsing/content/browser/async_check_tracker.h"
#include "components/safe_browsing/content/browser/safe_browsing_controller_client.h"
#include "components/safe_browsing/content/browser/unsafe_resource_util.h"
#include "components/safe_browsing/core/common/features.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/safe_browsing/core/common/utils.h"
#include "components/security_interstitials/content/security_interstitial_controller_client.h"
#include "components/security_interstitials/content/settings_page_helper.h"
#include "components/security_interstitials/core/metrics_helper.h"
#include "components/security_interstitials/core/safe_browsing_loud_error_ui.h"
#include "components/security_interstitials/core/unsafe_resource.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
WebContents;
BaseSafeBrowsingErrorUI;
SafeBrowsingLoudErrorUI;
SecurityInterstitialControllerClient;
namespace safe_browsing {
namespace {
const int64_t kThreatDetailsProceedDelayMilliSeconds = …;
base::LazyInstance<BaseBlockingPage::UnsafeResourceMap>::Leaky
g_unsafe_resource_map = …;
}
BaseBlockingPage::BaseBlockingPage(
BaseUIManager* ui_manager,
WebContents* web_contents,
const GURL& main_frame_url,
const UnsafeResourceList& unsafe_resources,
std::unique_ptr<SecurityInterstitialControllerClient> controller_client,
const BaseSafeBrowsingErrorUI::SBErrorDisplayOptions& display_options)
: … { … }
BaseBlockingPage::~BaseBlockingPage() { … }
const security_interstitials::BaseSafeBrowsingErrorUI::SBErrorDisplayOptions
BaseBlockingPage::CreateDefaultDisplayOptions(
const UnsafeResourceList& unsafe_resources) { … }
bool BaseBlockingPage::IsMainPageLoadPending(
const UnsafeResourceList& unsafe_resources) { … }
void BaseBlockingPage::SetThreatDetailsProceedDelayForTesting(int64_t delay) { … }
void BaseBlockingPage::CommandReceived(const std::string& page_cmd) { … }
void BaseBlockingPage::PopulateInterstitialStrings(
base::Value::Dict& load_time_data) { … }
void BaseBlockingPage::FinishThreatDetails(const base::TimeDelta& delay,
bool did_proceed,
int num_visits) { … }
BaseBlockingPage::UnsafeResourceMap* BaseBlockingPage::GetUnsafeResourcesMap() { … }
std::string BaseBlockingPage::GetMetricPrefix(
const UnsafeResourceList& unsafe_resources,
BaseSafeBrowsingErrorUI::SBInterstitialReason interstitial_reason) { … }
security_interstitials::BaseSafeBrowsingErrorUI::SBInterstitialReason
BaseBlockingPage::GetInterstitialReason(
const UnsafeResourceList& unsafe_resources) { … }
BaseUIManager* BaseBlockingPage::ui_manager() const { … }
const GURL BaseBlockingPage::main_frame_url() const { … }
BaseBlockingPage::UnsafeResourceList BaseBlockingPage::unsafe_resources()
const { … }
bool BaseBlockingPage::proceeded() const { … }
int64_t BaseBlockingPage::threat_details_proceed_delay() const { … }
BaseSafeBrowsingErrorUI* BaseBlockingPage::sb_error_ui() const { … }
void BaseBlockingPage::set_proceeded(bool proceeded) { … }
security_interstitials::MetricsHelper::ReportDetails
BaseBlockingPage::GetReportingInfo(
const UnsafeResourceList& unsafe_resources,
std::optional<base::TimeTicks> blocked_page_shown_timestamp) { … }
std::unique_ptr<SecurityInterstitialControllerClient>
BaseBlockingPage::CreateControllerClient(
content::WebContents* web_contents,
const UnsafeResourceList& unsafe_resources,
BaseUIManager* ui_manager,
PrefService* pref_service,
std::unique_ptr<security_interstitials::SettingsPageHelper>
settings_page_helper,
std::optional<base::TimeTicks> blocked_page_shown_timestamp) { … }
int BaseBlockingPage::GetHTMLTemplateId() { … }
void BaseBlockingPage::set_sb_error_ui(
std::unique_ptr<BaseSafeBrowsingErrorUI> sb_error_ui) { … }
void BaseBlockingPage::OnDontProceedDone() { … }
bool BaseBlockingPage::ShouldReportThreatDetails(SBThreatType threat_type) { … }
}