/* * Copyright (c) 2018-2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace Protocol { class Download; class Client : public IPC::ServerConnection , public ProtocolClientEndpoint { C_OBJECT(Client); public: virtual void handshake() override; bool is_supported_protocol(const String&); template> RefPtr start_download(const String& method, const String& url, const HashMap& request_headers = {}, ReadonlyBytes request_body = {}); bool stop_download(Badge, Download&); bool set_certificate(Badge, Download&, String, String); private: Client(); virtual void handle(const Messages::ProtocolClient::DownloadProgress&) override; virtual void handle(const Messages::ProtocolClient::DownloadFinished&) override; virtual OwnPtr handle(const Messages::ProtocolClient::CertificateRequested&) override; virtual void handle(const Messages::ProtocolClient::HeadersBecameAvailable&) override; HashMap> m_downloads; }; }