#ifndef CHROME_BROWSER_SAFE_BROWSING_CLOUD_CONTENT_SCANNING_DEEP_SCANNING_UTILS_H_
#define CHROME_BROWSER_SAFE_BROWSING_CLOUD_CONTENT_SCANNING_DEEP_SCANNING_UTILS_H_
#include <optional>
#include <string>
#include <vector>
#include "base/time/time.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.h"
#include "components/enterprise/common/proto/connectors.pb.h"
#include "url/gurl.h"
class Profile;
namespace enterprise_connectors {
class ContentAnalysisResponse;
}
namespace safe_browsing {
enum class DeepScanAccessPoint { … };
std::string DeepScanAccessPointToString(DeepScanAccessPoint access_point);
enum class EventResult { … };
void MaybeReportDeepScanningVerdict(
Profile* profile,
const GURL& url,
const GURL& tab_url,
const std::string& source,
const std::string& destination,
const std::string& file_name,
const std::string& download_digest_sha256,
const std::string& mime_type,
const std::string& trigger,
const std::string& content_transfer_method,
DeepScanAccessPoint access_point,
const int64_t content_size,
BinaryUploadService::Result result,
const enterprise_connectors::ContentAnalysisResponse& response,
EventResult event_result);
void ReportAnalysisConnectorWarningBypass(
Profile* profile,
const GURL& url,
const GURL& tab_url,
const std::string& source,
const std::string& destination,
const std::string& file_name,
const std::string& download_digest_sha256,
const std::string& mime_type,
const std::string& trigger,
const std::string& content_transfer_method,
DeepScanAccessPoint access_point,
const int64_t content_size,
const enterprise_connectors::ContentAnalysisResponse& response,
std::optional<std::u16string> user_justification);
void RecordDeepScanMetrics(
bool is_cloud,
DeepScanAccessPoint access_point,
base::TimeDelta duration,
int64_t total_bytes,
const BinaryUploadService::Result& result,
const enterprise_connectors::ContentAnalysisResponse& response);
void RecordDeepScanMetrics(bool is_cloud,
DeepScanAccessPoint access_point,
base::TimeDelta duration,
int64_t total_bytes,
const std::string& result,
bool success);
enterprise_connectors::ContentAnalysisResponse
SimpleContentAnalysisResponseForTesting(std::optional<bool> dlp_success,
std::optional<bool> malware_success,
bool has_custom_rule_message);
std::string EventResultToString(EventResult result);
std::string BinaryUploadServiceResultToString(
const BinaryUploadService::Result& result,
bool success);
enum class ScanningCrashKey { … };
void IncrementCrashKey(ScanningCrashKey key, int delta = 1);
void DecrementCrashKey(ScanningCrashKey key, int delta = 1);
bool IsConsumerScanRequest(
const safe_browsing::BinaryUploadService::Request& request);
}
#endif