#include "components/safe_browsing/core/browser/password_protection/password_protection_request.h"
#include <cstddef>
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/escape.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "build/build_config.h"
#include "components/safe_browsing/core/browser/db/allowlist_checker_client.h"
#include "components/safe_browsing/core/browser/db/database_manager.h"
#include "components/safe_browsing/core/browser/password_protection/password_protection_service_base.h"
#include "components/safe_browsing/core/browser/user_population.h"
#include "components/safe_browsing/core/common/features.h"
#include "components/safe_browsing/core/common/safebrowsing_constants.h"
#include "components/safe_browsing/core/common/utils.h"
#include "components/url_formatter/url_formatter.h"
#include "net/base/load_flags.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_status_code.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "ui/gfx/geometry/size.h"
#include "url/gurl.h"
namespace safe_browsing {
ReusedPasswordAccountType;
namespace {
const int kMaxReusedDomains = …;
std::vector<std::string> GetMatchingDomains(
const std::vector<password_manager::MatchingReusedCredential>&
matching_reused_credentials) { … }
}
PasswordProtectionRequest::PasswordProtectionRequest(
scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
scoped_refptr<base::SequencedTaskRunner> io_task_runner,
const GURL& main_frame_url,
const GURL& password_form_action,
const GURL& password_form_frame_url,
const std::string& mime_type,
const std::string& username,
PasswordType password_type,
const std::vector<password_manager::MatchingReusedCredential>&
matching_reused_credentials,
LoginReputationClientRequest::TriggerType type,
bool password_field_exists,
PasswordProtectionServiceBase* pps,
int request_timeout_in_ms)
: … { … }
PasswordProtectionRequest::~PasswordProtectionRequest() = default;
void PasswordProtectionRequest::Start() { … }
void PasswordProtectionRequest::CheckAllowlist() { … }
void PasswordProtectionRequest::OnAllowlistCheckDone(bool match_allowlist) { … }
void PasswordProtectionRequest::CheckCachedVerdicts() { … }
void PasswordProtectionRequest::FillRequestProto(bool is_sampled_ping) { … }
#if BUILDFLAG(SAFE_BROWSING_AVAILABLE)
bool PasswordProtectionRequest::IsClientSideDetectionEnabled() { … }
bool PasswordProtectionRequest::IsVisualFeaturesEnabled() { … }
#endif
void PasswordProtectionRequest::SendRequest() { … }
void PasswordProtectionRequest::SendRequestWithToken(
const std::string& access_token) { … }
void PasswordProtectionRequest::StartTimeout() { … }
void PasswordProtectionRequest::OnURLLoaderComplete(
std::unique_ptr<std::string> response_body) { … }
void PasswordProtectionRequest::Finish(
RequestOutcome outcome,
std::unique_ptr<LoginReputationClientResponse> response) { … }
void PasswordProtectionRequest::Cancel(bool timed_out) { … }
}