#include "chrome/browser/safe_browsing/download_protection/download_request_maker.h"
#include <memory>
#include "base/feature_list.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_item_warning_data.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/advanced_protection_status_manager.h"
#include "chrome/browser/safe_browsing/advanced_protection_status_manager_factory.h"
#include "chrome/browser/safe_browsing/chrome_user_population_helper.h"
#include "chrome/browser/safe_browsing/download_protection/download_protection_service.h"
#include "chrome/browser/safe_browsing/download_protection/download_protection_util.h"
#include "components/safe_browsing/core/common/features.h"
#include "components/safe_browsing/core/common/proto/csd.pb.h"
#include "components/safe_browsing/core/common/utils.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/download_item_utils.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
namespace safe_browsing {
namespace {
constexpr int kTailoredWarningVersion = …;
DownloadRequestMaker::TabUrls TabUrlsFromWebContents(
content::WebContents* web_contents) { … }
void SetDownloadItemWarningData(download::DownloadItem* item,
const std::optional<std::string>& password,
const FileAnalyzer::Results& results) { … }
}
std::unique_ptr<DownloadRequestMaker>
DownloadRequestMaker::CreateFromDownloadItem(
scoped_refptr<BinaryFeatureExtractor> binary_feature_extractor,
download::DownloadItem* item,
base::optional_ref<const std::string> password) { … }
std::unique_ptr<DownloadRequestMaker>
DownloadRequestMaker::CreateFromFileSystemAccess(
scoped_refptr<BinaryFeatureExtractor> binary_feature_extractor,
DownloadProtectionService* service,
const content::FileSystemAccessWriteItem& item) { … }
DownloadRequestMaker::DownloadRequestMaker(
scoped_refptr<BinaryFeatureExtractor> binary_feature_extractor,
content::BrowserContext* browser_context,
TabUrls tab_urls,
base::FilePath target_file_path,
base::FilePath full_path,
GURL source_url,
std::string sha256_hash,
int64_t length,
const std::vector<ClientDownloadRequest::Resource>& resources,
bool is_user_initiated,
ReferrerChainData* referrer_chain_data,
base::optional_ref<const std::string> password,
const std::string& previous_token,
base::OnceCallback<void(const FileAnalyzer::Results&)> on_results_callback)
: … { … }
DownloadRequestMaker::~DownloadRequestMaker() = default;
void DownloadRequestMaker::Start(DownloadRequestMaker::Callback callback) { … }
void DownloadRequestMaker::OnFileFeatureExtractionDone(
FileAnalyzer::Results results) { … }
void DownloadRequestMaker::GetTabRedirects() { … }
void DownloadRequestMaker::OnGotTabRedirects(
history::RedirectList redirect_list) { … }
void DownloadRequestMaker::PopulateTailoredInfo() { … }
}