mirror of
https://github.com/chylex/TweetDuck.git
synced 2024-11-23 17:42:46 +01:00
28 lines
904 B
C#
28 lines
904 B
C#
using System.Reflection;
|
|
using Lunixo.ChromiumGtk;
|
|
using Lunixo.ChromiumGtk.Core;
|
|
using TweetImpl.CefGlue.Handlers;
|
|
using TweetLib.Browser.CEF.Interfaces;
|
|
using Xilium.CefGlue;
|
|
|
|
namespace TweetImpl.CefGlue.Component {
|
|
public sealed class CustomWebClient : WebClient {
|
|
public static WebView CreateWebView(IPopupHandler popupHandler) {
|
|
WebView view = new WebView();
|
|
WebBrowser browser = view.Browser;
|
|
typeof(WebBrowser).GetField("<Client>k__BackingField", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(browser, new CustomWebClient(browser, popupHandler));
|
|
return view;
|
|
}
|
|
|
|
internal LifeSpanHandler LifeSpanHandler { get; }
|
|
|
|
private CustomWebClient(WebBrowser core, IPopupHandler popupHandler) : base(core) {
|
|
LifeSpanHandler = new LifeSpanHandler(core, popupHandler);
|
|
}
|
|
|
|
protected override CefLifeSpanHandler GetLifeSpanHandler() {
|
|
return LifeSpanHandler;
|
|
}
|
|
}
|
|
}
|