mirror of
https://github.com/chylex/TweetDuck.git
synced 2024-12-22 10:42:45 +01:00
32 lines
875 B
C#
32 lines
875 B
C#
using CefSharp;
|
|
using CefSharp.WinForms;
|
|
using TweetImpl.CefSharp.Handlers;
|
|
using TweetLib.Browser.CEF.Data;
|
|
using TweetLib.Browser.CEF.Interfaces;
|
|
|
|
namespace TweetImpl.CefSharp.Adapters {
|
|
sealed class CefBrowserAdapter : IBrowserWrapper<IFrame, IRequest> {
|
|
public string Url => browser.Address;
|
|
public IFrame MainFrame => browser.GetMainFrame();
|
|
|
|
private readonly ChromiumWebBrowser browser;
|
|
|
|
public CefBrowserAdapter(ChromiumWebBrowser browser) {
|
|
this.browser = browser;
|
|
}
|
|
|
|
public void AddWordToDictionary(string word) {
|
|
browser.AddWordToDictionary(word);
|
|
}
|
|
|
|
public IRequest CreateGetRequest() {
|
|
using var frame = MainFrame;
|
|
return frame.CreateRequest(false);
|
|
}
|
|
|
|
public void RequestDownload(IFrame frame, IRequest request, DownloadCallbacks callbacks) {
|
|
frame.CreateUrlRequest(request, new CefDownloadRequestClient(callbacks));
|
|
}
|
|
}
|
|
}
|