chromium/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.h"

#include "base/metrics/histogram_functions.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "chrome/browser/enterprise/connectors/common.h"
#include "chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.h"
#include "chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router_factory.h"
#include "chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.h"
#include "components/crash/core/common/crash_key.h"

namespace safe_browsing {

namespace {

constexpr int kMinBytesPerSecond =;
constexpr int kMaxBytesPerSecond =;  // 100 MB/s

std::string MaybeGetUnscannedReason(BinaryUploadService::Result result) {}

crash_reporter::CrashKeyString<7>* GetScanCrashKey(ScanningCrashKey key) {}

int* GetScanCrashKeyCount(ScanningCrashKey key) {}

void ModifyKey(ScanningCrashKey key, int delta) {}

void AddCustomMessageRule(
    enterprise_connectors::ContentAnalysisResponse::Result::TriggeredRule&
        rule) {}

}  // namespace

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) {}

std::string EventResultToString(EventResult result) {}

std::string DeepScanAccessPointToString(DeepScanAccessPoint access_point) {}

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 BinaryUploadServiceResultToString(
    const BinaryUploadService::Result& result,
    bool success) {}

void IncrementCrashKey(ScanningCrashKey key, int delta) {}

void DecrementCrashKey(ScanningCrashKey key, int delta) {}

bool IsConsumerScanRequest(const BinaryUploadService::Request& request) {}

}  // namespace safe_browsing