From: huayongxu <49056704+huayongxu@users.noreply.github.com> Date: Tue, 26 Jan 2021 11:35:05 +0000 (+0800) Subject: Add some APIS into WebView. (#2564) X-Git-Tag: submit/tizen_6.0/20210127.005231~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d1d35d63f79ff1341bbe05cdf32b543543317ba7;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Add some APIS into WebView. (#2564) Title, Favicon, ClearAllTilesResources are added. Meanwhile WebView can be created by arguments argc & args that will be delivered into web engine. Co-authored-by: Jiyun Yang --- diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs index b12a2a873..3e46570d7 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs @@ -15,6 +15,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_New_2")] public static extern global::System.IntPtr WebView_New_2(string jarg1, string jarg2); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_New_3")] + public static extern global::System.IntPtr WebView_New_3(int jarg1, string[] jarg2); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebView__SWIG_1")] public static extern global::System.IntPtr new_WebView__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); @@ -42,6 +45,12 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_CONTENT_SIZE_get")] public static extern int ContentSizeGet(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_TITLE_get")] + public static extern int WebView_Property_TITLE_get(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_GetFavicon")] + public static extern global::System.IntPtr WebView_GetFavicon(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_GetBackForwardList")] public static extern global::System.IntPtr GetWebBackForwardList(global::System.Runtime.InteropServices.HandleRef jarg1); @@ -93,6 +102,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_AddJavaScriptMessageHandler")] public static extern void WebView_AddJavaScriptMessageHandler(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_ClearAllTilesResources")] + public static extern void WebView_ClearAllTilesResources(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_ClearHistory")] public static extern void WebView_ClearHistory(global::System.Runtime.InteropServices.HandleRef jarg1); diff --git a/src/Tizen.NUI/src/internal/WebView.cs b/src/Tizen.NUI/src/internal/WebView.cs index 72d18daab..2220cdb53 100755 --- a/src/Tizen.NUI/src/internal/WebView.cs +++ b/src/Tizen.NUI/src/internal/WebView.cs @@ -167,6 +167,7 @@ namespace Tizen.NUI internal static readonly int ScrollPosition = Interop.WebView.ScrollPositionGet(); internal static readonly int ScrollSize = Interop.WebView.ScrollSizeGet(); internal static readonly int ContentSize = Interop.WebView.ContentSizeGet(); + internal static readonly int Title = Interop.WebView.WebView_Property_TITLE_get(); } private static readonly BindableProperty UrlProperty = BindableProperty.Create(nameof(Url), typeof(string), typeof(WebView), string.Empty, propertyChanged: (bindable, oldValue, newValue) => @@ -212,7 +213,7 @@ namespace Tizen.NUI defaultValueCreator: (bindable) => { var webview = (WebView)bindable; - Vector2 temp = new Vector2(0.0f, 0.0f); ; + Vector2 temp = new Vector2(0.0f, 0.0f); Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollPosition).Get(temp); return temp; }); @@ -220,7 +221,7 @@ namespace Tizen.NUI private static readonly BindableProperty ScrollSizeProperty = BindableProperty.Create(nameof(ScrollSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) => { var webview = (WebView)bindable; - Vector2 temp = new Vector2(0.0f, 0.0f); ; + Vector2 temp = new Vector2(0.0f, 0.0f); Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollSize).Get(temp); return temp; }); @@ -228,11 +229,19 @@ namespace Tizen.NUI private static readonly BindableProperty ContentSizeProperty = BindableProperty.Create(nameof(ContentSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) => { var webview = (WebView)bindable; - Vector2 temp = new Vector2(0.0f, 0.0f); ; + Vector2 temp = new Vector2(0.0f, 0.0f); Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ContentSize).Get(temp); return temp; }); + private static readonly BindableProperty TitleProperty = BindableProperty.Create(nameof(Title), typeof(string), typeof(WebView), null, defaultValueCreator: (bindable) => + { + var webview = (WebView)bindable; + string title; + Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.Title).Get(out title); + return title; + }); + /// /// Creates an uninitialized WebView. /// @@ -253,6 +262,17 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Creates an uninitialized WebView. + /// count of args + /// args array + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public WebView(int argc, string[] args) : this(Interop.WebView.WebView_New_3(argc, args), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + /// /// Copy constructor. /// WebView to copy. The copied WebView will point at the same implementation @@ -571,6 +591,31 @@ namespace Tizen.NUI } } + /// + /// Gets title of web page. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public string Title + { + get + { + return (string)GetValue(TitleProperty); + } + } + + /// + /// Gets fav icon. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public ImageView Favicon + { + get + { + global::System.IntPtr imageView = Interop.WebView.WebView_GetFavicon(swigCPtr); + return new ImageView(imageView, false); + } + } + /// /// Loads a html. /// The path of Web @@ -742,6 +787,16 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Clears title resources of current WebView. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void ClearAllTilesResources() + { + Interop.WebView.WebView_ClearAllTilesResources(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + /// /// Clears the history of current WebView. ///