mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:52:43 +00:00 
			
		
		
		
	 4a37bec27c
			
		
	
	
		4a37bec27c
		
	
	
	
	
		
			
			This matches what we're already calling the server-side subclasses better, though we'll probably want to find some better names for the client-side classes eventually.
		
			
				
	
	
		
			31 lines
		
	
	
	
		
			778 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
	
		
			778 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <LibIPC/IServerConnection.h>
 | |
| #include <ProtocolServer/ProtocolClientEndpoint.h>
 | |
| #include <ProtocolServer/ProtocolServerEndpoint.h>
 | |
| 
 | |
| namespace LibProtocol {
 | |
| 
 | |
| class Download;
 | |
| 
 | |
| class Client : public IServerConnection<ProtocolClientEndpoint, ProtocolServerEndpoint>
 | |
|     , public ProtocolClientEndpoint {
 | |
|     C_OBJECT(Client)
 | |
| public:
 | |
|     Client();
 | |
| 
 | |
|     virtual void handshake() override;
 | |
| 
 | |
|     bool is_supported_protocol(const String&);
 | |
|     RefPtr<Download> start_download(const String& url);
 | |
| 
 | |
|     bool stop_download(Badge<Download>, Download&);
 | |
| 
 | |
| private:
 | |
|     virtual void handle(const ProtocolClient::DownloadProgress&) override;
 | |
|     virtual void handle(const ProtocolClient::DownloadFinished&) override;
 | |
| 
 | |
|     HashMap<i32, RefPtr<Download>> m_downloads;
 | |
| };
 | |
| 
 | |
| }
 |