Skip to content

Commit 5e3f05b

Browse files
committed
OffScreen - Add HtmlString constructor overload to ChromiumWebBrowser
1 parent 3f285d5 commit 5e3f05b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

CefSharp.OffScreen/ChromiumWebBrowser.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using CefSharp.Enums;
1111
using CefSharp.Internals;
1212
using CefSharp.Structs;
13+
using CefSharp.Web;
1314
using Point = System.Drawing.Point;
1415
using Size = System.Drawing.Size;
1516

@@ -290,6 +291,20 @@ public bool IsDisposed
290291
/// </summary>
291292
public bool CanExecuteJavascriptInMainFrame { get; private set; }
292293

294+
/// <summary>
295+
/// Create a new OffScreen Chromium Browser. If you use <see cref="CefSharpSettings.LegacyJavascriptBindingEnabled"/> = true then you must
296+
/// set <paramref name="automaticallyCreateBrowser"/> to false and call <see cref="CreateBrowser"/> after the objects are registered.
297+
/// </summary>
298+
/// <param name="html">html string to be initially loaded in the browser.</param>
299+
/// <param name="browserSettings">The browser settings to use. If null, the default settings are used.</param>
300+
/// <param name="requestContext">See <see cref="RequestContext" /> for more details. Defaults to null</param>
301+
/// <param name="automaticallyCreateBrowser">automatically create the underlying Browser</param>
302+
/// <exception cref="System.InvalidOperationException">Cef::Initialize() failed</exception>
303+
public ChromiumWebBrowser(HtmlString html, BrowserSettings browserSettings = null,
304+
IRequestContext requestContext = null, bool automaticallyCreateBrowser = true) : this(html.ToDataUriString(), browserSettings, requestContext, automaticallyCreateBrowser)
305+
{
306+
}
307+
293308
/// <summary>
294309
/// Create a new OffScreen Chromium Browser. If you use <see cref="CefSharpSettings.LegacyJavascriptBindingEnabled"/> = true then you must
295310
/// set <paramref name="automaticallyCreateBrowser"/> to false and call <see cref="CreateBrowser"/> after the objects are registered.

0 commit comments

Comments
 (0)