chromium/content/browser/file_system/file_system_url_loader_factory.cc

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

#include "content/browser/file_system/file_system_url_loader_factory.h"

#include <algorithm>
#include <map>
#include <memory>
#include <string_view>
#include <utility>
#include <vector>

#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/task_traits.h"
#include "build/build_config.h"
#include "components/file_access/scoped_file_access.h"
#include "components/file_access/scoped_file_access_delegate.h"
#include "components/services/filesystem/public/mojom/types.mojom.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_host.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/data_pipe_producer.h"
#include "mojo/public/cpp/system/string_data_source.h"
#include "net/base/completion_repeating_callback.h"
#include "net/base/directory_listing.h"
#include "net/base/io_buffer.h"
#include "net/base/mime_sniffer.h"
#include "net/base/mime_util.h"
#include "net/http/http_byte_range.h"
#include "net/http/http_util.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/self_deleting_url_loader_factory.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "storage/browser/file_system/file_stream_reader.h"
#include "storage/browser/file_system/file_system_context.h"
#include "storage/browser/file_system/file_system_operation_runner.h"
#include "storage/browser/file_system/file_system_request_info.h"
#include "storage/browser/file_system/file_system_url.h"
#include "storage/common/file_system/file_system_util.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "url/gurl.h"
#include "url/origin.h"

DirectoryEntry;
FileStreamReader;
FileSystemContext;
FileSystemOperation;
FileSystemURL;
VirtualPath;

namespace content {
namespace {

struct FactoryParams {};

constexpr size_t kDefaultFileSystemUrlPipeSize =;

// Implementation sniffs the first file chunk to determine the mime-type.
static_assert;

scoped_refptr<net::HttpResponseHeaders> CreateHttpResponseHeaders(
    int response_code) {}

bool GetMimeType(const FileSystemURL& url, std::string* mime_type) {}

// Common implementation shared between the file and directory URLLoaders.
class FileSystemEntryURLLoader : public network::mojom::URLLoader {};

class FileSystemDirectoryURLLoader final : public FileSystemEntryURLLoader {};

class FileSystemFileURLLoader final : public FileSystemEntryURLLoader {};

// A URLLoaderFactory used for the filesystem:// scheme used when the Network
// Service is enabled.
class FileSystemURLLoaderFactory
    : public network::SelfDeletingURLLoaderFactory {};

}  // anonymous namespace

mojo::PendingRemote<network::mojom::URLLoaderFactory>
CreateFileSystemURLLoaderFactory(
    int render_process_host_id,
    int frame_tree_node_id,
    scoped_refptr<FileSystemContext> file_system_context,
    const std::string& storage_domain,
    const blink::StorageKey& storage_key) {}

}  // namespace content