#pragma once #include #include #include #include #include namespace AK { class SharedBuffer; } namespace LibProtocol { class Client; class Download : public RefCounted { public: static NonnullRefPtr create_from_id(Badge, Client& client, i32 download_id) { return adopt(*new Download(client, download_id)); } int id() const { return m_download_id; } bool stop(); Function payload_storage)> on_finish; Function on_progress; void did_finish(Badge, bool success, u32 total_size, i32 shared_buffer_id); void did_progress(Badge, u32 total_size, u32 downloaded_size); private: explicit Download(Client&, i32 download_id); WeakPtr m_client; int m_download_id { -1 }; }; }