Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NUI] Added an option to select the web engine type in the WebView constructor #6332

Merged
merged 3 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ internal static partial class WebView
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_New_3")]
public static extern global::System.IntPtr New3(int jarg1, string[] jarg2);

[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_New_4")]
public static extern global::System.IntPtr New4(int argc, string[] argv, int type);

[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_GetContext")]
public static extern global::System.IntPtr GetWebContext();

Expand Down
39 changes: 36 additions & 3 deletions src/Tizen.NUI/src/public/WebView/WebView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ static WebView()
}
}

private static readonly WebContext context = new WebContext(Interop.WebView.GetWebContext(), false);
private static readonly WebCookieManager cookieManager = new WebCookieManager(Interop.WebView.GetWebCookieManager(), false);

private Color contentBackgroundColor;
private bool tilesClearedWhenHidden;
private float tileCoverAreaMultiplier;
Expand Down Expand Up @@ -193,6 +190,17 @@ public WebView(string[] args) : this(Interop.WebView.New3(args?.Length ?? 0, arg
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}

/// <summary>
/// Creates a WebView with an args list and WebEngine type.
/// </summary>
/// <param name="args">Arguments passed into web engine. The first value of array must be program's name.</param>
/// <param name="webEngineType">Can select the plugin of Web Engine type. Chromium or LWE.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
public WebView(string[] args, WebEngineType webEngineType) : this(Interop.WebView.New4(args?.Length ?? 0, args, (int)webEngineType), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}

/// <summary>
/// Copy constructor.
/// </summary>
Expand Down Expand Up @@ -1073,6 +1081,31 @@ public enum HitTestMode
All = Default | NodeData | ImageData,
}

/// <summary>
/// WebEngine type which can be set by a specific constructor of this WebView.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public enum WebEngineType
{
/// <summary>
/// Depend on environement value setting. (default)
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
UseSystemSetting = -1,

/// <summary>
/// Chromium Web Engine type.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
Chromium = 0,
dongsug-song marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// LWE, Light Web Engine type.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
LWE = 1,
}

/// <summary>
/// Context.
/// </summary>
Expand Down
Loading