#include "chrome/browser/lookalikes/lookalike_url_navigation_throttle.h"
#include <map>
#include <memory>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "chrome/browser/lookalikes/lookalike_url_blocking_page.h"
#include "chrome/browser/lookalikes/lookalike_url_controller_client.h"
#include "chrome/browser/lookalikes/lookalike_url_service.h"
#include "chrome/browser/lookalikes/lookalike_url_tab_storage.h"
#include "chrome/browser/preloading/prefetch/no_state_prefetch/chrome_no_state_prefetch_contents_delegate.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_selections.h"
#include "chrome/common/channel_info.h"
#include "components/lookalikes/core/lookalike_url_ui_util.h"
#include "components/lookalikes/core/lookalike_url_util.h"
#include "components/lookalikes/core/safety_tips_config.h"
#include "components/no_state_prefetch/browser/no_state_prefetch_contents.h"
#include "components/security_interstitials/content/security_interstitial_tab_helper.h"
#include "components/site_engagement/content/site_engagement_service.h"
#include "components/url_formatter/spoof_checks/top_domains/top_bucket_domains.h"
#include "components/url_formatter/spoof_checks/top_domains/top_domain_util.h"
#include "content/public/browser/navigation_handle.h"
#include "third_party/blink/public/mojom/loader/referrer.mojom.h"
DomainInfo;
GetETLDPlusOne;
LookalikeActionType;
LookalikeUrlMatchType;
namespace {
ThrottleCheckResult;
bool IsInterstitialReload(const GURL& current_url,
const std::vector<GURL>& stored_redirect_chain) { … }
void RecordPerformCheckLatenciesForAllowedNavigation(
base::TimeTicks check_start_time,
base::TimeDelta is_lookalike_url_duration,
base::TimeDelta get_domain_info_duration) { … }
bool IsLookalikeUrl(Profile* profile,
const GURL& url,
const std::vector<DomainInfo>& engaged_sites,
LookalikeUrlMatchType* match_type,
GURL* suggested_url,
base::TimeDelta* get_domain_info_duration) { … }
}
BASE_FEATURE(…);
LookalikeUrlNavigationThrottle::LookalikeUrlNavigationThrottle(
content::NavigationHandle* navigation_handle)
: … { … }
LookalikeUrlNavigationThrottle::~LookalikeUrlNavigationThrottle() { … }
ThrottleCheckResult LookalikeUrlNavigationThrottle::WillStartRequest() { … }
ThrottleCheckResult LookalikeUrlNavigationThrottle::WillRedirectRequest() { … }
void LookalikeUrlNavigationThrottle::PrewarmLookalikeCheckAsync() { … }
void LookalikeUrlNavigationThrottle::PrewarmLookalikeCheckSyncWithSites(
const std::vector<DomainInfo>& engaged_sites) { … }
void LookalikeUrlNavigationThrottle::PrewarmLookalikeCheckSync() { … }
void LookalikeUrlNavigationThrottle::PrewarmLookalikeCheckForURL(
const GURL& url,
const std::vector<DomainInfo>& engaged_sites) { … }
ThrottleCheckResult LookalikeUrlNavigationThrottle::WillProcessResponse() { … }
const char* LookalikeUrlNavigationThrottle::GetNameForLogging() { … }
ThrottleCheckResult LookalikeUrlNavigationThrottle::ShowInterstitial(
const GURL& safe_domain,
const GURL& lookalike_domain,
ukm::SourceId source_id,
LookalikeUrlMatchType match_type,
bool triggered_by_initial_url) { … }
std::unique_ptr<LookalikeUrlNavigationThrottle>
LookalikeUrlNavigationThrottle::MaybeCreateNavigationThrottle(
content::NavigationHandle* navigation_handle) { … }
ThrottleCheckResult
LookalikeUrlNavigationThrottle::CheckAndMaybeShowInterstitial(
const GURL& safe_domain,
const GURL& lookalike_domain,
ukm::SourceId source_id,
LookalikeUrlMatchType match_type,
bool triggered_by_initial_url) { … }
void LookalikeUrlNavigationThrottle::PerformChecksDeferred(
base::TimeTicks start,
const std::vector<DomainInfo>& engaged_sites) { … }
ThrottleCheckResult LookalikeUrlNavigationThrottle::PerformChecks(
const std::vector<DomainInfo>& engaged_sites) { … }