Core - Add IBrowserHost.TryCloseBrowser

This commit is contained in:
amaitland
2020-02-11 06:57:50 +10:00
parent 891e5c539b
commit bc466ef434
3 changed files with 17 additions and 0 deletions
@@ -150,6 +150,13 @@ void CefBrowserHostWrapper::CloseBrowser(bool forceClose)
_browserHost->CloseBrowser(forceClose);
}
bool CefBrowserHostWrapper::TryCloseBrowser()
{
ThrowIfDisposed();
return _browserHost->TryCloseBrowser();
}
void CefBrowserHostWrapper::ShowDevTools(IWindowInfo^ windowInfo, int inspectElementAtX, int inspectElementAtY)
{
ThrowIfDisposed();
@@ -50,6 +50,7 @@ namespace CefSharp
virtual Task<double>^ GetZoomLevelAsync();
virtual IntPtr GetWindowHandle();
virtual void CloseBrowser(bool forceClose);
virtual bool TryCloseBrowser();
virtual void DragTargetDragEnter(IDragData^ dragData, MouseEvent mouseEvent, DragOperationsMask allowedOperations);
virtual void DragTargetDragOver(MouseEvent mouseEvent, DragOperationsMask allowedOperations);
+9
View File
@@ -36,6 +36,15 @@ namespace CefSharp
/// </param>
void CloseBrowser(bool forceClose);
/// <summary>
/// Helper for closing a browser. Call this method from the top-level window close handler. Internally this calls CloseBrowser(false) if the close has not yet been initiated. This method returns false while the close is pending and true after the close has completed.
/// See <see cref="CloseBrowser(bool)"/> and <see cref="ILifeSpanHandler.DoClose(IWebBrowser, IBrowser)"/> documentation for additional usage information. This method must be called on the CEF UI thread.
/// </summary>
/// <returns>
/// This method returns false while the close is pending and true after the close has completed
/// </returns>
bool TryCloseBrowser();
/// <summary>
/// Explicitly close the developer tools window if one exists for this browser instance.
/// </summary>