using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Xilium.CefGlue; namespace Lskj.Control.BrowserSetting2 { public class BsLifeSpanHandler : CefLifeSpanHandler { private BsClient BsClient; public BsLifeSpanHandler(BsClient bsClient) { BsClient = bsClient; } protected override void OnAfterCreated(Xilium.CefGlue.CefBrowser browser) { base.OnAfterCreated(browser); BsClient.Created(browser); } protected override void OnBeforeClose(CefBrowser browser) { base.OnBeforeClose(browser); } protected override bool OnBeforePopup( CefBrowser browser, CefFrame frame, string targetUrl, string targetFrameName, CefWindowOpenDisposition targetDisposition, bool userGesture, CefPopupFeatures popupFeatures, CefWindowInfo windowInfo, ref CefClient client, CefBrowserSettings settings, ref CefDictionaryValue extraInfo, ref bool noJavascriptAccess) { if (BsExternalProtocolHandler.TryHandle(targetUrl)) return true; return base.OnBeforePopup(browser, frame, targetUrl, targetFrameName, targetDisposition, userGesture, popupFeatures, windowInfo, ref client, settings, ref extraInfo, ref noJavascriptAccess); } } }