Implement navigation decision policy.
authorhuayong.xu <huayong.xu@samsung.com>
Thu, 8 Sep 2022 12:05:07 +0000 (20:05 +0800)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 15 Sep 2022 01:18:45 +0000 (10:18 +0900)
src/Tizen.NUI/src/internal/Interop/Interop.WebFrame.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/Interop/Interop.WebPolicyDecisionMaker.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs
src/Tizen.NUI/src/internal/WebFrame.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/WebPolicyDecisionMaker.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/WebView.cs
src/Tizen.NUI/src/internal/WebViewPageLoadErrorSignal.cs [deleted file]
src/Tizen.NUI/src/internal/WebViewPageLoadSignal.cs [deleted file]
src/Tizen.NUI/src/internal/WebViewPolicyDecidedEventArgs.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/WebViewScrollEdgeReachedSignal.cs [deleted file]
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/WebViewNavigationPolicyTest.cs [new file with mode: 0755]

diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WebFrame.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebFrame.cs
new file mode 100755 (executable)
index 0000000..a6129df
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright(c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Tizen.NUI
+{
+    internal static partial class Interop
+    {
+        internal static partial class WebFrame
+        {
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebFrame_IsMainFrame")]
+            public static extern bool IsMainFrame(global::System.Runtime.InteropServices.HandleRef jarg1);
+        }
+    }
+}
diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WebPolicyDecisionMaker.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebPolicyDecisionMaker.cs
new file mode 100755 (executable)
index 0000000..6e9e7f8
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright(c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Tizen.NUI
+{
+    internal static partial class Interop
+    {
+        internal static partial class WebPolicyDecisionMaker
+        {
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_WebPolicyDecision")]
+            public static extern void DeleteWebPolicyDecision(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebPolicyDecision_GetUrl")]
+            public static extern string GetUrl(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebPolicyDecision_GetCookie")]
+            public static extern string GetCookie(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebPolicyDecision_GetDecisionType")]
+            public static extern int GetDecisionType(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebPolicyDecision_GetResponseMime")]
+            public static extern string GetResponseMime(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebPolicyDecision_GetResponseStatusCode")]
+            public static extern int GetResponseStatusCode(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebPolicyDecision_GetNavigationType")]
+            public static extern int GetNavigationType(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebPolicyDecision_GetFrame")]
+            public static extern System.IntPtr GetFrame(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebPolicyDecision_GetScheme")]
+            public static extern string GetScheme(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebPolicyDecision_Use")]
+            public static extern bool Use(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebPolicyDecision_Ignore")]
+            public static extern bool Ignore(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebPolicyDecision_Suspend")]
+            public static extern bool Suspend(global::System.Runtime.InteropServices.HandleRef jarg1);
+        }
+    }
+}
index 1642a13..088266c 100755 (executable)
@@ -117,44 +117,20 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_SWIGUpcast")]
             public static extern global::System.IntPtr WebView_SWIGUpcast(global::System.IntPtr jarg1);
 
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebViewPageLoadSignal_PageLoadStarted")]
-            public static extern global::System.IntPtr new_WebViewPageLoadSignal_PageLoadStarted(global::System.Runtime.InteropServices.HandleRef jarg1);
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_RegisterPageLoadStartedCallback")]
+            public static extern void RegisterPageLoadStartedCallback(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
 
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebViewPageLoadSignal_PageLoadFinished")]
-            public static extern global::System.IntPtr new_WebViewPageLoadSignal_PageLoadFinished(global::System.Runtime.InteropServices.HandleRef jarg1);
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_RegisterPageLoadFinishedCallback")]
+            public static extern void RegisterPageLoadFinishedCallback(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
 
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_WebViewPageLoadSignal")]
-            public static extern void delete_WebViewPageLoadSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_RegisterPageLoadErrorCallback")]
+            public static extern void RegisterPageLoadErrorCallback(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
 
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewPageLoadSignal_Connect")]
-            public static extern void WebViewPageLoadSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_RegisterScrollEdgeReachedCallback")]
+            public static extern void RegisterScrollEdgeReachedCallback(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
 
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewPageLoadSignal_Disconnect")]
-            public static extern void WebViewPageLoadSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
-
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebViewPageLoadErrorSignal_PageLoadError")]
-            public static extern global::System.IntPtr new_WebViewPageLoadErrorSignal_PageLoadError(global::System.Runtime.InteropServices.HandleRef jarg1);
-
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_WebViewPageLoadErrorSignal")]
-            public static extern void delete_WebViewPageLoadErrorSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
-
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewPageLoadErrorSignal_Connect")]
-            public static extern void WebViewPageLoadErrorSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
-
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewPageLoadErrorSignal_Disconnect")]
-            public static extern void WebViewPageLoadErrorSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
-
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebViewScrollEdgeReachedSignal_ScrollEdgeReached")]
-            public static extern global::System.IntPtr NewWebViewScrollEdgeReachedSignalScrollEdgeReached(global::System.Runtime.InteropServices.HandleRef jarg1);
-
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_WebViewScrollEdgeReachedSignal")]
-            public static extern void DeleteWebViewScrollEdgeReachedSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
-
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewScrollEdgeReachedSignal_Connect")]
-            public static extern void WebViewScrollEdgeReachedSignalConnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
-
-            [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_RegisterNavigationPolicyDecidedCallback")]
+            public static extern void RegisterNavigationPolicyDecidedCallback(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/WebFrame.cs b/src/Tizen.NUI/src/internal/WebFrame.cs
new file mode 100755 (executable)
index 0000000..ada7c2e
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System.ComponentModel;
+
+namespace Tizen.NUI
+{
+    /// <summary>
+    /// It is a class for frame of web view.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class WebFrame : Disposable
+    {
+        internal WebFrame(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        {
+        }
+
+        /// <summary>
+        /// Checks whether the frame is main frame or not.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool IsMainFrame
+        {
+            get
+            {
+                return Interop.WebFrame.IsMainFrame(SwigCPtr);
+            }
+        }
+    }
+}
diff --git a/src/Tizen.NUI/src/internal/WebPolicyDecisionMaker.cs b/src/Tizen.NUI/src/internal/WebPolicyDecisionMaker.cs
new file mode 100755 (executable)
index 0000000..5b682f9
--- /dev/null
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.ComponentModel;
+
+namespace Tizen.NUI
+{
+    /// <summary>
+    /// It is a class for policy decision maker of web view.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class WebPolicyDecisionMaker : Disposable
+    {
+        internal WebPolicyDecisionMaker(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        {
+        }
+
+        /// This will not be public opened.
+        /// <param name="swigCPtr"></param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
+        {
+            Interop.WebPolicyDecisionMaker.DeleteWebPolicyDecision(swigCPtr);
+        }
+
+        /// <summary>
+        /// Decision type
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public enum DecisionType
+        {
+            /// <summary>
+            /// Accepts the decision.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Use,
+
+            /// <summary>
+            /// Decides to download something.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Download,
+
+            /// <summary>
+            /// Ignores the decision.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Ignore,
+        }
+
+        /// <summary>
+        /// Policy navigation type
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public enum NavigationType
+        {
+            /// <summary>
+            /// Link clicked
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            LinkClicked,
+
+            /// <summary>
+            /// Form submitted
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            FormSubmitted,
+
+            /// <summary>
+            /// Back forward
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            BackForward,
+
+            /// <summary>
+            /// Reload
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Reload,
+
+            /// <summary>
+            /// Form resubmitted
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            FormResubmitted,
+
+            /// <summary>
+            /// Other
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Other,
+        }
+
+        /// <summary>
+        /// Gets the URL that request policy decision.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string Url
+        {
+            get
+            {
+                return Interop.WebPolicyDecisionMaker.GetUrl(SwigCPtr);
+            }
+        }
+
+        /// <summary>
+        /// Gets a cookie that web page has.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string Cookie
+        {
+            get
+            {
+                return Interop.WebPolicyDecisionMaker.GetCookie(SwigCPtr);
+            }
+        }
+
+        /// <summary>
+        /// Gets a decision type.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public DecisionType PolicyDecisionType
+        {
+            get
+            {
+                return (DecisionType)Interop.WebPolicyDecisionMaker.GetDecisionType(SwigCPtr);
+            }
+        }
+
+        /// <summary>
+        /// Gets a MIME type for response data.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string ResponseMime
+        {
+            get
+            {
+                return Interop.WebPolicyDecisionMaker.GetResponseMime(SwigCPtr);
+            }
+        }
+
+        /// <summary>
+        /// Gets a HTTP status code.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public int ResponseStatusCode
+        {
+            get
+            {
+                return Interop.WebPolicyDecisionMaker.GetResponseStatusCode(SwigCPtr);
+            }
+        }
+
+        /// <summary>
+        /// Gets a navigation type.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public NavigationType DecisionNavigationType
+        {
+            get
+            {
+                return (NavigationType)Interop.WebPolicyDecisionMaker.GetNavigationType(SwigCPtr);
+            }
+        }
+
+        /// <summary>
+        /// Gets frame of web view.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public WebFrame Frame
+        {
+            get
+            {
+                IntPtr result = Interop.WebPolicyDecisionMaker.GetFrame(SwigCPtr);
+                return new WebFrame(result, false);
+            }
+        }
+
+        /// <summary>
+        /// Gets a scheme.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string Scheme
+        {
+            get
+            {
+                return Interop.WebPolicyDecisionMaker.GetScheme(SwigCPtr);
+            }
+        }
+
+        /// <summary>
+        /// Accepts the action which triggers this decision.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool Use()
+        {
+            bool result = Interop.WebPolicyDecisionMaker.Use(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return result;
+        }
+
+        /// <summary>
+        /// Ignores the action which triggers this decision.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool Ignore()
+        {
+            bool result = Interop.WebPolicyDecisionMaker.Ignore(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return result;
+        }
+
+        /// <summary>
+        /// Suspends the operation for policy decision.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool Suspend()
+        {
+            bool result = Interop.WebPolicyDecisionMaker.Suspend(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return result;
+        }
+    }
+}
index 53aad81..236ffe3 100755 (executable)
@@ -31,28 +31,32 @@ namespace Tizen.NUI
     public class WebView : View
     {
         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
-        private delegate void WebViewPageLoadCallbackDelegate(IntPtr data, string pageUrl);
+        private delegate void WebViewPageLoadCallback(string pageUrl);
 
         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
-        private delegate void WebViewPageLoadErrorCallbackDelegate(IntPtr data, string pageUrl, int errorCode);
+        private delegate void WebViewPageLoadErrorCallback(string pageUrl, int errorCode);
 
         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
-        private delegate void WebViewScrollEdgeReachedCallbackDelegate(IntPtr data, int edge);
+        private delegate void WebViewScrollEdgeReachedCallback(int edge);
+
+        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        private delegate void WebViewPolicyDecidedCallback(IntPtr maker);
 
-        private readonly WebViewPageLoadSignal pageLoadStartedSignal;
         private EventHandler<WebViewPageLoadEventArgs> pageLoadStartedEventHandler;
-        private WebViewPageLoadCallbackDelegate pageLoadStartedCallback;
+        private WebViewPageLoadCallback pageLoadStartedCallback;
 
-        private readonly WebViewPageLoadSignal pageLoadFinishedSignal;
         private EventHandler<WebViewPageLoadEventArgs> pageLoadFinishedEventHandler;
-        private WebViewPageLoadCallbackDelegate pageLoadFinishedCallback;
+        private WebViewPageLoadCallback pageLoadFinishedCallback;
 
-        private readonly WebViewPageLoadErrorSignal pageLoadErrorSignal;
         private EventHandler<WebViewPageLoadErrorEventArgs> pageLoadErrorEventHandler;
-        private WebViewPageLoadErrorCallbackDelegate pageLoadErrorCallback;
-        private readonly WebViewScrollEdgeReachedSignal scrollEdgeReachedSignal;
+        private WebViewPageLoadErrorCallback pageLoadErrorCallback;
+
         private EventHandler<WebViewScrollEdgeReachedEventArgs> scrollEdgeReachedEventHandler;
-        private WebViewScrollEdgeReachedCallbackDelegate scrollEdgeReachedCallback;
+        private WebViewScrollEdgeReachedCallback scrollEdgeReachedCallback;
+
+        private EventHandler<WebViewPolicyDecidedEventArgs> navigationPolicyDecidedEventHandler;
+        private WebViewPolicyDecidedCallback navigationPolicyDecidedCallback;
+
         private PlainTextReceivedCallback plainTextReceivedCallback;
 
         /// <summary>
@@ -64,11 +68,6 @@ namespace Tizen.NUI
 
         internal WebView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.WebView.WebView_SWIGUpcast(cPtr), cMemoryOwn)
         {
-            pageLoadStartedSignal = new WebViewPageLoadSignal(Interop.WebView.new_WebViewPageLoadSignal_PageLoadStarted(swigCPtr));
-            pageLoadFinishedSignal = new WebViewPageLoadSignal(Interop.WebView.new_WebViewPageLoadSignal_PageLoadFinished(swigCPtr));
-            pageLoadErrorSignal = new WebViewPageLoadErrorSignal(Interop.WebView.new_WebViewPageLoadErrorSignal_PageLoadError(swigCPtr));
-            scrollEdgeReachedSignal = new WebViewScrollEdgeReachedSignal(Interop.WebView.NewWebViewScrollEdgeReachedSignalScrollEdgeReached(swigCPtr));
-
             BackForwardList = new WebBackForwardList(Interop.WebView.GetWebBackForwardList(SwigCPtr), false);
             Context = new WebContext(Interop.WebView.GetWebContext(SwigCPtr), false);
             CookieManager = new WebCookieManager(Interop.WebView.GetWebCookieManager(SwigCPtr), false);
@@ -110,10 +109,6 @@ namespace Tizen.NUI
                 //Called by User
                 //Release your own managed resources here.
                 //You should release all of your own disposable objects here.
-                pageLoadStartedSignal.Dispose();
-                pageLoadFinishedSignal.Dispose();
-                pageLoadErrorSignal.Dispose();
-
                 BackForwardList.Dispose();
                 Context.Dispose();
                 CookieManager.Dispose();
@@ -131,41 +126,45 @@ namespace Tizen.NUI
             Interop.WebView.delete_WebView(swigCPtr);
         }
 
-        private void OnPageLoadStarted(IntPtr data, string pageUrl)
+        private void OnPageLoadStarted(string pageUrl)
         {
             WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
 
-            e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
+            e.WebView = this;
             e.PageUrl = pageUrl;
 
             pageLoadStartedEventHandler?.Invoke(this, e);
         }
 
-        private void OnPageLoadFinished(IntPtr data, string pageUrl)
+        private void OnPageLoadFinished(string pageUrl)
         {
             WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
 
-            e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
+            e.WebView = this;
             e.PageUrl = pageUrl;
 
             pageLoadFinishedEventHandler?.Invoke(this, e);
         }
 
-        private void OnPageLoadError(IntPtr data, string pageUrl, int errorCode)
+        private void OnPageLoadError(string pageUrl, int errorCode)
         {
             WebViewPageLoadErrorEventArgs e = new WebViewPageLoadErrorEventArgs();
 
-            e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
+            e.WebView = this;
             e.PageUrl = pageUrl;
             e.ErrorCode = (WebViewPageLoadErrorEventArgs.LoadErrorCode)errorCode;
 
             pageLoadErrorEventHandler?.Invoke(this, e);
         }
 
-        private void OnScrollEdgeReached(IntPtr data, int edge)
+        private void OnScrollEdgeReached(int edge)
+        {
+            scrollEdgeReachedEventHandler?.Invoke(this, new WebViewScrollEdgeReachedEventArgs((WebViewScrollEdgeReachedEventArgs.Edge)edge));
+        }
+
+        private void OnNavigationPolicyDecided(IntPtr maker)
         {
-            WebViewScrollEdgeReachedEventArgs arg = new WebViewScrollEdgeReachedEventArgs((WebViewScrollEdgeReachedEventArgs.Edge)edge);
-            scrollEdgeReachedEventHandler?.Invoke(this, arg);
+            navigationPolicyDecidedEventHandler?.Invoke(this, new WebViewPolicyDecidedEventArgs(new WebPolicyDecisionMaker(maker, true)));
         }
 
         internal static new class Property
@@ -539,18 +538,15 @@ namespace Tizen.NUI
             {
                 if (pageLoadStartedEventHandler == null)
                 {
-                    pageLoadStartedCallback = (OnPageLoadStarted);
-                    pageLoadStartedSignal.Connect(pageLoadStartedCallback);
+                    pageLoadStartedCallback = OnPageLoadStarted;
+                    IntPtr ip = Marshal.GetFunctionPointerForDelegate(pageLoadStartedCallback);
+                    Interop.WebView.RegisterPageLoadStartedCallback(SwigCPtr, new HandleRef(this, ip));
                 }
                 pageLoadStartedEventHandler += value;
             }
             remove
             {
                 pageLoadStartedEventHandler -= value;
-                if (pageLoadStartedEventHandler == null && pageLoadStartedCallback != null)
-                {
-                    pageLoadStartedSignal.Disconnect(pageLoadStartedCallback);
-                }
             }
         }
 
@@ -565,18 +561,15 @@ namespace Tizen.NUI
             {
                 if (pageLoadFinishedEventHandler == null)
                 {
-                    pageLoadFinishedCallback = (OnPageLoadFinished);
-                    pageLoadFinishedSignal.Connect(pageLoadFinishedCallback);
+                    pageLoadFinishedCallback = OnPageLoadFinished;
+                    IntPtr ip = Marshal.GetFunctionPointerForDelegate(pageLoadFinishedCallback);
+                    Interop.WebView.RegisterPageLoadFinishedCallback(SwigCPtr, new HandleRef(this, ip));
                 }
                 pageLoadFinishedEventHandler += value;
             }
             remove
             {
                 pageLoadFinishedEventHandler -= value;
-                if (pageLoadFinishedEventHandler == null && pageLoadFinishedCallback != null)
-                {
-                    pageLoadFinishedSignal.Disconnect(pageLoadFinishedCallback);
-                }
             }
         }
 
@@ -589,20 +582,13 @@ namespace Tizen.NUI
         {
             add
             {
-                if (pageLoadErrorEventHandler == null)
-                {
-                    pageLoadErrorCallback = (OnPageLoadError);
-                    pageLoadErrorSignal.Connect(pageLoadErrorCallback);
-                }
-                pageLoadErrorEventHandler += value;
+                pageLoadErrorCallback = OnPageLoadError;
+                IntPtr ip = Marshal.GetFunctionPointerForDelegate(pageLoadErrorCallback);
+                Interop.WebView.RegisterPageLoadErrorCallback(SwigCPtr, new HandleRef(this, ip));
             }
             remove
             {
                 pageLoadErrorEventHandler -= value;
-                if (pageLoadErrorEventHandler == null && pageLoadErrorCallback != null)
-                {
-                    pageLoadErrorSignal.Disconnect(pageLoadErrorCallback);
-                }
             }
         }
 
@@ -615,20 +601,36 @@ namespace Tizen.NUI
         {
             add
             {
-                if (scrollEdgeReachedEventHandler == null)
-                {
-                    scrollEdgeReachedCallback = OnScrollEdgeReached;
-                    scrollEdgeReachedSignal.Connect(scrollEdgeReachedCallback);
-                }
-                scrollEdgeReachedEventHandler += value;
+                scrollEdgeReachedCallback = OnScrollEdgeReached;
+                IntPtr ip = Marshal.GetFunctionPointerForDelegate(scrollEdgeReachedCallback);
+                Interop.WebView.RegisterScrollEdgeReachedCallback(SwigCPtr, new HandleRef(this, ip));
             }
             remove
             {
                 scrollEdgeReachedEventHandler -= value;
-                if (scrollEdgeReachedEventHandler == null && scrollEdgeReachedCallback != null)
+            }
+        }
+
+        /// <summary>
+        /// Event for the NavigationPolicyDecided signal which can be used to subscribe or unsubscribe the event handler.<br />
+        /// This signal is emitted when response policy would be decided.<br />
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public event EventHandler<WebViewPolicyDecidedEventArgs> NavigationPolicyDecided
+        {
+            add
+            {
+                if (navigationPolicyDecidedEventHandler == null)
                 {
-                    scrollEdgeReachedSignal.Disconnect(scrollEdgeReachedCallback);
+                    navigationPolicyDecidedCallback = OnNavigationPolicyDecided;
+                    IntPtr ip = Marshal.GetFunctionPointerForDelegate(navigationPolicyDecidedCallback);
+                    Interop.WebView.RegisterNavigationPolicyDecidedCallback(SwigCPtr, new HandleRef(this, ip));
                 }
+                navigationPolicyDecidedEventHandler += value;
+            }
+            remove
+            {
+                navigationPolicyDecidedEventHandler -= value;
             }
         }
 
diff --git a/src/Tizen.NUI/src/internal/WebViewPageLoadErrorSignal.cs b/src/Tizen.NUI/src/internal/WebViewPageLoadErrorSignal.cs
deleted file mode 100755 (executable)
index 8ace6d5..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-namespace Tizen.NUI
-{
-    internal class WebViewPageLoadErrorSignal : Disposable
-    {
-
-
-        protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
-        {
-            Interop.WebView.delete_WebViewPageLoadErrorSignal(swigCPtr);
-        }
-
-        public void Connect(System.Delegate func)
-        {
-            System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
-            {
-                Interop.WebView.WebViewPageLoadErrorSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
-                if (NDalicPINVOKE.SWIGPendingException.Pending)
-                {
-                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                }
-            }
-        }
-
-        public void Disconnect(System.Delegate func)
-        {
-            System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
-            {
-                Interop.WebView.WebViewPageLoadErrorSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
-                if (NDalicPINVOKE.SWIGPendingException.Pending)
-                {
-                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                }
-            }
-        }
-
-        public WebViewPageLoadErrorSignal(global::System.IntPtr cPtr) : base(cPtr, true)
-        {
-        }
-    }
-}
diff --git a/src/Tizen.NUI/src/internal/WebViewPageLoadSignal.cs b/src/Tizen.NUI/src/internal/WebViewPageLoadSignal.cs
deleted file mode 100755 (executable)
index 63875e5..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-namespace Tizen.NUI
-{
-    internal class WebViewPageLoadSignal : Disposable
-    {
-
-
-        protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
-        {
-            Interop.WebView.delete_WebViewPageLoadSignal(swigCPtr);
-        }
-
-        public void Connect(System.Delegate func)
-        {
-            System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
-            {
-                Interop.WebView.WebViewPageLoadSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
-                if (NDalicPINVOKE.SWIGPendingException.Pending)
-                {
-                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                }
-            }
-        }
-
-        public void Disconnect(System.Delegate func)
-        {
-            System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
-            {
-                Interop.WebView.WebViewPageLoadSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
-                if (NDalicPINVOKE.SWIGPendingException.Pending)
-                {
-                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                }
-            }
-        }
-
-        public WebViewPageLoadSignal(global::System.IntPtr cPtr) : base(cPtr, true)
-        {
-        }
-    }
-}
diff --git a/src/Tizen.NUI/src/internal/WebViewPolicyDecidedEventArgs.cs b/src/Tizen.NUI/src/internal/WebViewPolicyDecidedEventArgs.cs
new file mode 100755 (executable)
index 0000000..43e719b
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.ComponentModel;
+
+namespace Tizen.NUI
+{
+    /// <summary>
+    /// Event arguments that passed via the WebView.ResponsePolicyDecided.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class WebViewPolicyDecidedEventArgs : EventArgs
+    {
+        internal WebViewPolicyDecidedEventArgs(WebPolicyDecisionMaker maker)
+        {
+            ResponsePolicyDecisionMaker = maker;
+        }
+
+        /// <summary>
+        /// The response policy decision maker.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public WebPolicyDecisionMaker ResponsePolicyDecisionMaker { get; }
+    }
+}
diff --git a/src/Tizen.NUI/src/internal/WebViewScrollEdgeReachedSignal.cs b/src/Tizen.NUI/src/internal/WebViewScrollEdgeReachedSignal.cs
deleted file mode 100755 (executable)
index d04c921..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright(c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-namespace Tizen.NUI
-{
-    internal class WebViewScrollEdgeReachedSignal : Disposable
-    {
-        public WebViewScrollEdgeReachedSignal(global::System.IntPtr cPtr) : base(cPtr, true)
-        {
-        }
-
-        public void Connect(System.Delegate func)
-        {
-            System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
-            {
-                Interop.WebView.WebViewScrollEdgeReachedSignalConnect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
-                if (NDalicPINVOKE.SWIGPendingException.Pending)
-                {
-                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                }
-            }
-        }
-
-        public void Disconnect(System.Delegate func)
-        {
-            System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
-            {
-                Interop.WebView.WebViewScrollEdgeReachedSignalDisconnect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
-                if (NDalicPINVOKE.SWIGPendingException.Pending)
-                {
-                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                }
-            }
-        }
-
-        protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
-        {
-            Interop.WebView.DeleteWebViewScrollEdgeReachedSignal(swigCPtr);
-        }
-    }
-}
diff --git a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/WebViewNavigationPolicyTest.cs b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/WebViewNavigationPolicyTest.cs
new file mode 100755 (executable)
index 0000000..6e55f03
--- /dev/null
@@ -0,0 +1,60 @@
+
+using System;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+using System.IO;
+using System.Text;
+
+namespace Tizen.NUI.Samples
+{
+    using tlog = Tizen.Log;
+
+    public class WebViewInterceptTest : IExample
+    {
+        const string tag = "NUITEST";
+        private View root;
+        private Window win;
+        private WebView webView;
+
+        public void Activate()
+        {
+            win = NUIApplication.GetDefaultWindow();
+
+            root = new View()
+            {
+                Size = new Size(win.Size.Width, win.Size.Height, 0),
+                BackgroundColor = Color.Green,
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                    Padding = new Extents(3, 3, 3, 3),
+                },
+            };
+            win.Add(root);
+
+            webView = new WebView();
+            webView.Url = "https://www.google.com/";
+            webView.WidthSpecification = LayoutParamPolicies.MatchParent;
+            webView.HeightSpecification = LayoutParamPolicies.MatchParent;
+            root.Add(webView);
+
+            webView.NavigationPolicyDecided += OnCallback;
+        }
+
+        private void OnCallback(object sender, WebViewPolicyDecidedEventArgs e)
+        {
+            tlog.Debug(tag, $"callback: navigation policy decided, Url: {e.ResponsePolicyDecisionMaker.Url}");
+            e.ResponsePolicyDecisionMaker.Ignore();
+        }
+
+        public void Deactivate()
+        {
+            webView.Unparent();
+            root.Unparent();
+
+            webView.Dispose();
+            root.Dispose();
+        }
+    }
+}