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

// Copyright 2024 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/resumable_uploader.h"

#include <memory>

#include "base/files/file_path.h"
#include "base/files/memory_mapped_file.h"
#include "base/functional/bind.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/task/thread_pool.h"
#include "base/time/time.h"
#include "components/file_access/scoped_file_access_delegate.h"
#include "components/safe_browsing/core/common/utils.h"
#include "content/public/browser/browser_thread.h"
#include "net/http/http_status_code.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/url_response_head.mojom.h"

namespace safe_browsing {

namespace {

// HTTP headers for resumable upload requests
constexpr char kUploadProtocolHeader[] =;
constexpr char kUploadCommandHeader[] =;
constexpr char kUploadHeaderContentLengthHeader[] =;
constexpr char kUploadHeaderContentTypeHeader[] =;
constexpr char kUploadStatusHeader[] =;
constexpr char kUploadUrlHeader[] =;
constexpr char kUploadOffsetHeader[] =;
// Content type of the upload contents.
constexpr char kUploadContentType[] =;
// Content type of metadata.
constexpr char kMetadataContentType[] =;

std::unique_ptr<ConnectorDataPipeGetter> CreateFileDataPipeGetterBlocking(
    const base::FilePath& path) {}

}  // namespace

ResumableUploadRequest::ResumableUploadRequest(
    scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
    const GURL& base_url,
    const std::string& metadata,
    BinaryUploadService::Result get_data_result,
    const base::FilePath& path,
    uint64_t file_size,
    const net::NetworkTrafficAnnotationTag& traffic_annotation,
    Callback callback)
    :{}

ResumableUploadRequest::ResumableUploadRequest(
    scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
    const GURL& base_url,
    const std::string& metadata,
    BinaryUploadService::Result get_data_result,
    base::ReadOnlySharedMemoryRegion page_region,
    const net::NetworkTrafficAnnotationTag& traffic_annotation,
    Callback callback)
    :{}

ResumableUploadRequest::~ResumableUploadRequest() = default;

void ResumableUploadRequest::SetMetadataRequestHeaders(
    network::ResourceRequest* request) {}

void ResumableUploadRequest::Start() {}

std::string ResumableUploadRequest::GetUploadInfo() {}

// static
std::unique_ptr<ConnectorUploadRequest>
ResumableUploadRequest::CreateFileRequest(
    scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
    const GURL& base_url,
    const std::string& metadata,
    BinaryUploadService::Result get_data_result,
    const base::FilePath& path,
    uint64_t file_size,
    const net::NetworkTrafficAnnotationTag& traffic_annotation,
    ResumableUploadRequest::Callback callback) {}

// static
std::unique_ptr<ConnectorUploadRequest>
ResumableUploadRequest::CreatePageRequest(
    scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
    const GURL& base_url,
    const std::string& metadata,
    BinaryUploadService::Result get_data_result,
    base::ReadOnlySharedMemoryRegion page_region,
    const net::NetworkTrafficAnnotationTag& traffic_annotation,
    ResumableUploadRequest::Callback callback) {}

void ResumableUploadRequest::SendMetadataRequest() {}

void ResumableUploadRequest::OnMetadataUploadCompleted(
    base::TimeTicks start_time,
    std::optional<std::string> response_body) {}

void ResumableUploadRequest::SendContentSoon() {}

// TODO(b/328415950): Move the data pipe creation logics to
// connector_upload_request.
void ResumableUploadRequest::CreateDatapipe(
    std::unique_ptr<network::ResourceRequest> request,
    file_access::ScopedFileAccess file_access) {}

void ResumableUploadRequest::OnDataPipeCreated(
    std::unique_ptr<network::ResourceRequest> request,
    std::unique_ptr<ConnectorDataPipeGetter> data_pipe_getter) {}

void ResumableUploadRequest::SendContentNow(
    std::unique_ptr<network::ResourceRequest> request) {}

void ResumableUploadRequest::OnSendContentCompleted(
    base::TimeTicks start_time,
    std::optional<std::string> response_body) {}

bool ResumableUploadRequest::CanUploadContent(
    const scoped_refptr<net::HttpResponseHeaders>& headers) {}

void ResumableUploadRequest::Finish(int net_error,
                                    int response_code,
                                    std::optional<std::string> response_body) {}

std::string ResumableUploadRequest::GetRequestType() {}

}  // namespace safe_browsing