chromium/services/network/shared_storage/shared_storage_request_helper.h

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

#ifndef SERVICES_NETWORK_SHARED_STORAGE_SHARED_STORAGE_REQUEST_HELPER_H_
#define SERVICES_NETWORK_SHARED_STORAGE_SHARED_STORAGE_REQUEST_HELPER_H_

#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include <vector>

#include "base/functional/callback_forward.h"
#include "base/memory/weak_ptr.h"
#include "net/http/structured_headers.h"
#include "services/network/public/mojom/url_loader_network_service_observer.mojom.h"
#include "url/origin.h"

namespace net {
class URLRequest;
}  // namespace net

namespace network {

// Used by the `URLLoader` to help handle shared-storage-related requests.
// Contains methods to create the helper, process the outgoing request, process
// the incoming response, and reset shared-storage-eligibility when it has been
// lost on a redirect.
//
// Requests are eligible for shared storage when
// `ResourceRequest::shared_storage_writable` is true (which can only occur when
// `blink::features::kSharedStorageAPI` is enabled). When a request is eligible,
// `ProcessOutgoingRequest()` will add the "Sec-Shared-Storage-Writable" request
// header to the outgoing request.
//
// When "Shared-Storage-Write" response header(s) are received, if the request
// is eligible for shared storage, then `ProcessIncomingRequest()` will process
// the header(s) into vectors of operation structs, to be sent via
// `mojom::OnSharedStorageHeaderReceived()`.
class SharedStorageRequestHelper {};

}  // namespace network

#endif  // SERVICES_NETWORK_SHARED_STORAGE_SHARED_STORAGE_REQUEST_HELPER_H_