#include "chrome/browser/safe_browsing/download_protection/download_protection_util.h"
#include "base/hash/sha1.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/download/download_item_warning_data.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager_factory.h"
#include "components/safe_browsing/content/common/file_type_policies.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/sessions/content/session_tab_helper.h"
#include "content/public/browser/download_item_utils.h"
#include "net/cert/x509_util.h"
#include "url/gurl.h"
namespace safe_browsing {
namespace {
std::string EscapeCertAttribute(const std::string& attribute) { … }
int ArchiveEntryWeight(const ClientDownloadRequest::ArchivedBinary& entry) { … }
size_t ArchiveEntryDepth(const ClientDownloadRequest::ArchivedBinary& entry) { … }
void SelectEncryptedEntry(
std::vector<ClientDownloadRequest::ArchivedBinary>* considering,
google::protobuf::RepeatedPtrField<ClientDownloadRequest::ArchivedBinary>*
selected) { … }
void SelectDeepestEntry(
std::vector<ClientDownloadRequest::ArchivedBinary>* considering,
google::protobuf::RepeatedPtrField<ClientDownloadRequest::ArchivedBinary>*
selected) { … }
void SelectWildcardEntryAtFront(
std::vector<ClientDownloadRequest::ArchivedBinary>* considering,
google::protobuf::RepeatedPtrField<ClientDownloadRequest::ArchivedBinary>*
selected) { … }
SafeBrowsingNavigationObserverManager* GetNavigationObserverManager(
content::WebContents* web_contents) { … }
void AddEventUrlToReferrerChain(const download::DownloadItem& item,
content::RenderFrameHost* render_frame_host,
ReferrerChain* out_referrer_chain) { … }
}
void GetCertificateAllowlistStrings(
const net::X509Certificate& certificate,
const net::X509Certificate& issuer,
std::vector<std::string>* allowlist_strings) { … }
GURL GetFileSystemAccessDownloadUrl(const GURL& frame_url) { … }
google::protobuf::RepeatedPtrField<ClientDownloadRequest::ArchivedBinary>
SelectArchiveEntries(const google::protobuf::RepeatedPtrField<
ClientDownloadRequest::ArchivedBinary>& src_binaries) { … }
void LogDeepScanEvent(download::DownloadItem* item, DeepScanEvent event) { … }
void LogLocalDecryptionEvent(DeepScanEvent event) { … }
std::unique_ptr<ReferrerChainData> IdentifyReferrerChain(
const download::DownloadItem& item,
int user_gesture_limit) { … }
std::unique_ptr<ReferrerChainData> IdentifyReferrerChain(
const content::FileSystemAccessWriteItem& item,
int user_gesture_limit) { … }
}