#include "chrome/browser/safe_browsing/download_protection/check_file_system_access_write_request.h"
#include <algorithm>
#include <memory>
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/safe_browsing/download_protection/download_feedback_service.h"
#include "chrome/browser/safe_browsing/download_protection/download_protection_service.h"
#include "chrome/browser/safe_browsing/download_protection/download_protection_util.h"
#include "chrome/common/safe_browsing/download_type_util.h"
#include "components/safe_browsing/content/common/file_type_policies.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/download_item_utils.h"
#include "content/public/browser/navigation_entry.h"
namespace safe_browsing {
BrowserThread;
CheckFileSystemAccessWriteRequest::CheckFileSystemAccessWriteRequest(
std::unique_ptr<content::FileSystemAccessWriteItem> item,
CheckDownloadCallback callback,
DownloadProtectionService* service,
scoped_refptr<SafeBrowsingDatabaseManager> database_manager,
scoped_refptr<BinaryFeatureExtractor> binary_feature_extractor)
: … { … }
CheckFileSystemAccessWriteRequest ::~CheckFileSystemAccessWriteRequest() =
default;
download::DownloadItem* CheckFileSystemAccessWriteRequest::item() const { … }
bool CheckFileSystemAccessWriteRequest::IsSupportedDownload(
DownloadCheckResultReason* reason) { … }
content::BrowserContext* CheckFileSystemAccessWriteRequest::GetBrowserContext()
const { … }
bool CheckFileSystemAccessWriteRequest::IsCancelled() { … }
base::WeakPtr<CheckClientDownloadRequestBase>
CheckFileSystemAccessWriteRequest::GetWeakPtr() { … }
void CheckFileSystemAccessWriteRequest::NotifySendRequest(
const ClientDownloadRequest* request) { … }
void CheckFileSystemAccessWriteRequest::SetDownloadProtectionData(
const std::string& token,
const ClientDownloadResponse::Verdict& verdict,
const ClientDownloadResponse::TailoredVerdict& tailored_verdict) { … }
void CheckFileSystemAccessWriteRequest::MaybeStorePingsForDownload(
DownloadCheckResult result,
bool upload_requested,
const std::string& request_data,
const std::string& response_body) { … }
std::optional<enterprise_connectors::AnalysisSettings>
CheckFileSystemAccessWriteRequest::ShouldUploadBinary(
DownloadCheckResultReason reason) { … }
void CheckFileSystemAccessWriteRequest::UploadBinary(
DownloadCheckResult result,
DownloadCheckResultReason reason,
enterprise_connectors::AnalysisSettings settings) { … }
bool CheckFileSystemAccessWriteRequest::ShouldImmediatelyDeepScan(
bool server_requests_prompt,
bool log_metrics) const { … }
bool CheckFileSystemAccessWriteRequest::ShouldPromptForDeepScanning(
bool server_requests_prompt) const { … }
bool CheckFileSystemAccessWriteRequest::ShouldPromptForLocalDecryption(
bool server_requests_prompt) const { … }
bool CheckFileSystemAccessWriteRequest::ShouldPromptForIncorrectPassword()
const { … }
bool CheckFileSystemAccessWriteRequest::ShouldShowScanFailure() const { … }
void CheckFileSystemAccessWriteRequest::NotifyRequestFinished(
DownloadCheckResult result,
DownloadCheckResultReason reason) { … }
bool CheckFileSystemAccessWriteRequest::IsAllowlistedByPolicy() const { … }
void CheckFileSystemAccessWriteRequest::LogDeepScanningPrompt(
bool did_prompt) const { … }
}