/* * Copyright (c) 2022, Dex♪ * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include namespace Protocol { class Request; class RequestClient; } namespace WebView { class RequestServerRequestAdapter : public Web::ResourceLoaderConnectorRequest , public Weakable { public: static ErrorOr> try_create(NonnullRefPtr); virtual ~RequestServerRequestAdapter() override; virtual void set_should_buffer_all_input(bool) override; virtual bool stop() override; virtual void stream_into(Stream&) override; private: RequestServerRequestAdapter(NonnullRefPtr); NonnullRefPtr m_request; }; class RequestServerAdapter : public Web::ResourceLoaderConnector { public: static ErrorOr> try_create(); virtual ~RequestServerAdapter() override; virtual void prefetch_dns(AK::URL const& url) override; virtual void preconnect(AK::URL const& url) override; virtual RefPtr start_request(DeprecatedString const& method, URL const&, HashMap const& request_headers = {}, ReadonlyBytes request_body = {}, Core::ProxyData const& = {}) override; private: RequestServerAdapter(NonnullRefPtr protocol_client); RefPtr m_protocol_client; }; }