mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-06 04:00:07 +00:00
@@ -670,6 +670,7 @@ namespace CefSharp.Wpf.HwndHost
|
||||
PresentationSource.AddSourceChangedHandler(this, PresentationSourceChangedHandler);
|
||||
|
||||
FocusHandler = new FocusHandler();
|
||||
LifeSpanHandler = new NoCloseLifespanHandler();
|
||||
|
||||
UseLayoutRounding = true;
|
||||
}
|
||||
@@ -753,7 +754,6 @@ namespace CefSharp.Wpf.HwndHost
|
||||
if (browserSettings.AutoDispose)
|
||||
{
|
||||
browserSettings.Dispose();
|
||||
browserSettings = null;
|
||||
}
|
||||
|
||||
browserSettings = null;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright © 2022 The CefSharp Authors. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
namespace CefSharp.Wpf.HwndHost.Internals
|
||||
{
|
||||
/// <summary>
|
||||
/// LifeSpanHandler used internally
|
||||
/// - Cancels sending of WM_CLOSE message for main browser
|
||||
/// - Allows popups to close
|
||||
/// </summary>
|
||||
public class NoCloseLifespanHandler
|
||||
: CefSharp.Handler.LifeSpanHandler
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
protected override bool DoClose(IWebBrowser chromiumWebBrowser, IBrowser browser)
|
||||
{
|
||||
if(browser.IsPopup)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user