#include "services/network/shared_storage/shared_storage_request_helper.h"
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/notreached.h"
#include "base/strings/string_util.h"
#include "net/http/structured_headers.h"
#include "net/url_request/url_request.h"
#include "services/network/public/mojom/optional_bool.mojom.h"
#include "services/network/public/mojom/url_loader_network_service_observer.mojom.h"
#include "services/network/shared_storage/shared_storage_header_utils.h"
namespace network {
namespace {
[[nodiscard]] bool IsStringLike(const net::structured_headers::Item& item) { … }
void AddWritableRequestHeader(net::URLRequest& request) { … }
std::optional<std::string> GetSharedStorageWriteHeader(
net::URLRequest& request) { … }
void RemoveSharedStorageWriteHeader(net::URLRequest& request) { … }
mojom::SharedStorageOperationPtr MakeSharedStorageOperation(
const net::structured_headers::ParameterizedMember& parameterized_member) { … }
}
SharedStorageRequestHelper::SharedStorageRequestHelper(
bool shared_storage_writable_eligible,
mojom::URLLoaderNetworkServiceObserver* observer)
: … { … }
SharedStorageRequestHelper::~SharedStorageRequestHelper() = default;
void SharedStorageRequestHelper::ProcessOutgoingRequest(
net::URLRequest& request) { … }
bool SharedStorageRequestHelper::ProcessIncomingResponse(
net::URLRequest& request,
base::OnceClosure done) { … }
void SharedStorageRequestHelper::UpdateSharedStorageWritableEligible(
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers) { … }
bool SharedStorageRequestHelper::ProcessResponse(net::URLRequest& request,
std::string_view value,
base::OnceClosure done) { … }
void SharedStorageRequestHelper::OnOperationsQueued(base::OnceClosure done) { … }
}