[NUI] Added an option to select the web engine type in the WebView constructor
authordongsug.song <dongsug.song@samsung.com>
Thu, 19 Sep 2024 07:16:36 +0000 (16:16 +0900)
committerEunki Hong <h.pichulia@gmail.com>
Thu, 10 Oct 2024 10:57:23 +0000 (19:57 +0900)
src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs
src/Tizen.NUI/src/public/WebView/WebView.cs

index 93a471f79bb95a473e916008c4873e0e2105da8d..57882328105019375c561d5ada48b5d322122434 100755 (executable)
@@ -32,6 +32,9 @@ namespace Tizen.NUI
             [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();
 
index afa2f3751cf0cf64be714b6a591e8262a62d9849..719f96bad168d4d57671767de74f2810ad90a28c 100755 (executable)
@@ -83,9 +83,6 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
-        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;
@@ -193,6 +190,17 @@ namespace Tizen.NUI.BaseComponents
             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>
@@ -1073,6 +1081,25 @@ namespace Tizen.NUI.BaseComponents
             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>
+            /// Chromium Web Engine type.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Chromium = 0,
+
+            /// <summary>
+            /// LWE, Light Web Engine type.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            LWE = 1,
+        }
+
         /// <summary>
         /// Context.
         /// </summary>