From: Jiyun Yang Date: Mon, 26 Jul 2021 01:23:09 +0000 (+0900) Subject: [NUI] Implement WebView.GetPlainTextAsynchronously method (#3344) X-Git-Tag: accepted/tizen/6.0/unified/20210730.125933~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=908c7bce9e08c2097b150d9fab4bde260f99e9be;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Implement WebView.GetPlainTextAsynchronously method (#3344) Signed-off-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 efb06bc..1642a13 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs @@ -155,6 +155,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewScrollEdgeReachedSignal_Disconnect")] public static extern void WebViewScrollEdgeReachedSignalDisconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_GetPlainTextAsynchronously")] + public static extern void GetPlainTextAsynchronously(global::System.Runtime.InteropServices.HandleRef webViewRef, global::System.Runtime.InteropServices.HandleRef callbackRef); } } } diff --git a/src/Tizen.NUI/src/internal/WebView.cs b/src/Tizen.NUI/src/internal/WebView.cs index 116334f..53aad81 100755 --- a/src/Tizen.NUI/src/internal/WebView.cs +++ b/src/Tizen.NUI/src/internal/WebView.cs @@ -53,6 +53,14 @@ namespace Tizen.NUI private readonly WebViewScrollEdgeReachedSignal scrollEdgeReachedSignal; private EventHandler scrollEdgeReachedEventHandler; private WebViewScrollEdgeReachedCallbackDelegate scrollEdgeReachedCallback; + private PlainTextReceivedCallback plainTextReceivedCallback; + + /// + /// The callback function that is invoked when the plain text of the current page is received. + /// + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + [EditorBrowsable(EditorBrowsableState.Never)] + public delegate void PlainTextReceivedCallback(string plainText); internal WebView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.WebView.WebView_SWIGUpcast(cPtr), cMemoryOwn) { @@ -871,5 +879,19 @@ namespace Tizen.NUI Interop.WebView.SetTtsFocus(SwigCPtr, focused); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + + /// + /// Get a plain text of current web page asynchronously. + /// Please note that it gets plain text of currently loaded page so please call this method after page load finished. + /// The callback for getting plain text + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void GetPlainTextAsynchronously(PlainTextReceivedCallback callback) + { + plainTextReceivedCallback = callback; + System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(plainTextReceivedCallback); + Interop.WebView.GetPlainTextAsynchronously(SwigCPtr, new HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } } }