1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2024-11-23 17:42:46 +01:00
TweetDuck/linux/TweetImpl.CefGlue/Handlers/DownloadRequestClient.cs
2022-02-19 18:19:13 +01:00

35 lines
1.2 KiB
C#

using System.IO;
using TweetLib.Browser.CEF.Data;
using TweetLib.Browser.CEF.Logic;
using Xilium.CefGlue;
using static TweetLib.Browser.CEF.Logic.DownloadRequestClientLogic.RequestStatus;
namespace TweetImpl.CefGlue.Handlers {
sealed class DownloadRequestClient : CefUrlRequestClient {
private readonly DownloadRequestClientLogic logic;
public DownloadRequestClient(DownloadCallbacks callbacks) {
this.logic = new DownloadRequestClientLogic(callbacks);
}
protected override bool GetAuthCredentials(bool isProxy, string host, int port, string realm, string scheme, CefAuthCallback callback) {
return logic.GetAuthCredentials(callback);
}
protected override void OnDownloadData(CefUrlRequest request, Stream data) {
logic.OnDownloadData(data);
}
protected override void OnRequestComplete(CefUrlRequest request) {
logic.OnRequestComplete(request.RequestStatus switch {
CefUrlRequestStatus.Success => Success,
CefUrlRequestStatus.Failed => Failed,
_ => Unknown
});
}
protected override void OnDownloadProgress(CefUrlRequest request, long current, long total) {}
protected override void OnUploadProgress(CefUrlRequest request, long current, long total) {}
}
}