1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2024-11-23 17:42:46 +01:00
TweetDuck/windows/TweetImpl.CefSharp/Handlers/CefDownloadRequestClient.cs

32 lines
1.0 KiB
C#

using System.IO;
using CefSharp;
using TweetLib.Browser.CEF.Data;
using TweetLib.Browser.CEF.Logic;
using static TweetLib.Browser.CEF.Logic.DownloadRequestClientLogic.RequestStatus;
namespace TweetImpl.CefSharp.Handlers {
sealed class CefDownloadRequestClient : UrlRequestClient {
private readonly DownloadRequestClientLogic logic;
public CefDownloadRequestClient(DownloadCallbacks callbacks) {
this.logic = new DownloadRequestClientLogic(callbacks);
}
protected override bool GetAuthCredentials(bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback) {
return logic.GetAuthCredentials(callback);
}
protected override void OnDownloadData(IUrlRequest request, Stream data) {
logic.OnDownloadData(data);
}
protected override void OnRequestComplete(IUrlRequest request) {
logic.OnRequestComplete(request.RequestStatus switch {
UrlRequestStatus.Success => Success,
UrlRequestStatus.Failed => Failed,
_ => Unknown
});
}
}
}