Skip to content

Commit 6030c3e

Browse files
committed
Add IBrowserHost.HasDevTools
1 parent b11e8ea commit 6030c3e

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

CefSharp.Core/Internals/CefBrowserHostWrapper.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,13 @@ void CefBrowserHostWrapper::CloseDevTools()
169169
_browserHost->CloseDevTools();
170170
}
171171

172+
bool CefBrowserHostWrapper::HasDevTools::get()
173+
{
174+
ThrowIfDisposed();
175+
176+
return _browserHost->HasDevTools();
177+
}
178+
172179
void CefBrowserHostWrapper::AddWordToDictionary(String^ word)
173180
{
174181
ThrowIfDisposed();

CefSharp.Core/Internals/CefBrowserHostWrapper.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ namespace CefSharp
5757

5858
virtual void ShowDevTools(IWindowInfo^ windowInfo, int inspectElementAtX, int inspectElementAtY);
5959
virtual void CloseDevTools();
60+
///
61+
// Returns true if this browser currently has an associated DevTools browser.
62+
// Must be called on the browser process UI thread.
63+
///
64+
/*--cef()--*/
65+
virtual property bool HasDevTools
66+
{
67+
bool get();
68+
}
6069

6170
virtual void AddWordToDictionary(String^ word);
6271
virtual void ReplaceMisspelling(String^ word);

CefSharp/IBrowserHost.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ public interface IBrowserHost : IDisposable
3636
/// </summary>
3737
void CloseDevTools();
3838

39+
/// <summary>
40+
/// Returns true if this browser currently has an associated DevTools browser.
41+
/// Must be called on the CEF UI thread.
42+
/// </summary>
43+
bool HasDevTools { get; }
44+
3945
/// <summary>
4046
/// Call this method when the user drags the mouse into the web view (before calling <see cref="DragTargetDragOver"/>/<see cref="DragTargetDragLeave"/>/<see cref="DragTargetDragDrop"/>).
4147
/// </summary>

0 commit comments

Comments
 (0)