[NUI] Implement new window policy decision APIs of webview.
authorhuayong.xu <huayong.xu@samsung.com>
Tue, 13 Apr 2021 05:10:27 +0000 (13:10 +0800)
committerhuiyueun <35286162+huiyueun@users.noreply.github.com>
Tue, 20 Apr 2021 06:13:00 +0000 (15:13 +0900)
This patch is to implement WebView APIs for new window policy
decision.

src/Tizen.NUI/src/internal/Interop/Interop.WebFrame.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/Interop/Interop.WebNewWindowPolicyDecisionMaker.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs
src/Tizen.NUI/src/internal/WebView/WebFrame.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/WebView/WebNewWindowPolicyDecisionMaker.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/WebView/WebView.cs
src/Tizen.NUI/src/internal/WebView/WebViewFormRepostPolicyDecidedEventArgs.cs
src/Tizen.NUI/src/internal/WebView/WebViewFormRepostPolicyDecidedSignal.cs
src/Tizen.NUI/src/internal/WebView/WebViewNewWindowPolicyDecidedEventArgs.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/WebView/WebViewNewWindowPolicyDecidedSignal.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..5f85dd2
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * 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.WebNewWindowPolicyDecisionMaker.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebNewWindowPolicyDecisionMaker.cs
new file mode 100755 (executable)
index 0000000..bd7bbde
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * 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 WebNewWindowPolicyDecisionMaker
+        {
+            [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 d357a94..f422466 100755 (executable)
@@ -305,6 +305,18 @@ namespace Tizen.NUI
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewFrameRenderedSignal_Disconnect")]
             public static extern void WebViewFrameRenderedSignalDisconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebViewPolicyDecisionSignal_PolicyDecision")]
+            public static extern global::System.IntPtr NewWebViewPolicyDecisionSignalPolicyDecision(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_WebViewPolicyDecisionSignal")]
+            public static extern void DeleteWebViewPolicyDecisionSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewPolicyDecisionSignal_Connect")]
+            public static extern void WebViewPolicyDecisionSignalConnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewPolicyDecisionSignal_Disconnect")]
+            public static extern void WebViewPolicyDecisionSignalDisconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
         }
     }
 }
diff --git a/src/Tizen.NUI/src/internal/WebView/WebFrame.cs b/src/Tizen.NUI/src/internal/WebView/WebFrame.cs
new file mode 100755 (executable)
index 0000000..fe0cb0b
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * 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()
+        {
+            bool result = Interop.WebFrame.IsMainFrame(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return result;
+        }
+    }
+}
diff --git a/src/Tizen.NUI/src/internal/WebView/WebNewWindowPolicyDecisionMaker.cs b/src/Tizen.NUI/src/internal/WebView/WebNewWindowPolicyDecisionMaker.cs
new file mode 100755 (executable)
index 0000000..602e7f0
--- /dev/null
@@ -0,0 +1,222 @@
+/*
+ * 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 new window policy decision maker of web view.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class WebNewWindowPolicyDecisionMaker : Disposable
+    {
+        internal WebNewWindowPolicyDecisionMaker(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        {
+        }
+
+        /// <summary>
+        /// Decision type
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public enum DecisionType
+        {
+            /// <summary>
+            /// Use
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Use,
+
+            /// <summary>
+            /// Download
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Download,
+
+            /// <summary>
+            /// Ignore
+            /// </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 Uri GetUrl()
+        {
+            string result = Interop.WebNewWindowPolicyDecisionMaker.GetUrl(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return new Uri(result);
+        }
+
+        /// <summary>
+        /// Gets a cookie that web page has.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string GetCookie()
+        {
+            string result = Interop.WebNewWindowPolicyDecisionMaker.GetCookie(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return result;
+        }
+
+        /// <summary>
+        /// Gets a decision type.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public DecisionType GetDecisionType()
+        {
+            DecisionType result = (DecisionType)Interop.WebNewWindowPolicyDecisionMaker.GetDecisionType(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return result;
+        }
+
+        /// <summary>
+        /// Gets a MIME type for response data.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string GetResponseMime()
+        {
+            string result = Interop.WebNewWindowPolicyDecisionMaker.GetResponseMime(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return result;
+        }
+
+        /// <summary>
+        /// Gets a HTTP status code.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public int GetResponseStatusCode()
+        {
+            int result = Interop.WebNewWindowPolicyDecisionMaker.GetResponseStatusCode(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return result;
+        }
+
+        /// <summary>
+        /// Gets a navigation type.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public NavigationType GetNavigationType()
+        {
+            NavigationType result = (NavigationType)Interop.WebNewWindowPolicyDecisionMaker.GetNavigationType(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return result;
+        }
+
+        /// <summary>
+        /// Gets frame of web view.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public WebFrame GetFrame()
+        {
+            IntPtr result = Interop.WebNewWindowPolicyDecisionMaker.GetFrame(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return new WebFrame(result, false);
+        }
+
+        /// <summary>
+        /// Gets a scheme.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string GetScheme()
+        {
+            string result = Interop.WebNewWindowPolicyDecisionMaker.GetScheme(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return result;
+        }
+
+        /// <summary>
+        /// Accepts the action which triggers this decision.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool Use()
+        {
+            bool result = Interop.WebNewWindowPolicyDecisionMaker.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.WebNewWindowPolicyDecisionMaker.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.WebNewWindowPolicyDecisionMaker.Suspend(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return result;
+        }
+    }
+}
index 2c76833..062166c 100755 (executable)
@@ -59,7 +59,7 @@ namespace Tizen.NUI
         private EventHandler<WebViewUrlChangedEventArgs> urlChangedEventHandler;
         private WebViewUrlChangedCallbackDelegate urlChangedCallback;
 
-        private readonly WebViewFormRepostDecidedSignal formRepostPolicyDecidedSignal;
+        private readonly WebViewFormRepostPolicyDecidedSignal formRepostPolicyDecidedSignal;
         private EventHandler<WebViewFormRepostPolicyDecidedEventArgs> formRepostPolicyDecidedEventHandler;
         private WebViewFormRepostPolicyDecidedCallbackDelegate formRepostPolicyDecidedCallback;
 
@@ -70,6 +70,10 @@ namespace Tizen.NUI
         private ScreenshotAcquiredCallback screenshotAcquiredCallback;
         private readonly WebViewScreenshotAcquiredProxyCallback screenshotAcquiredProxyCallback;
 
+        private readonly WebViewNewWindowPolicyDecidedSignal newWindowPolicyDecidedSignal;
+        private EventHandler<WebViewNewWindowPolicyDecidedEventArgs> newWindowPolicyDecidedEventHandler;
+        private WebViewNewWindowPolicyDecidedCallbackDelegate newWindowPolicyDecidedCallback;
+
         /// <summary>
         /// Creates a WebView.
         /// </summary>
@@ -118,8 +122,9 @@ namespace Tizen.NUI
             pageLoadErrorSignal = new WebViewPageLoadErrorSignal(Interop.WebView.NewWebViewPageLoadErrorSignalPageLoadError(SwigCPtr));
             scrollEdgeReachedSignal = new WebViewScrollEdgeReachedSignal(Interop.WebView.NewWebViewScrollEdgeReachedSignalScrollEdgeReached(SwigCPtr));
             urlChangedSignal = new WebViewUrlChangedSignal(Interop.WebView.NewWebViewUrlChangedSignalUrlChanged(SwigCPtr));
-            formRepostPolicyDecidedSignal = new WebViewFormRepostDecidedSignal(Interop.WebView.NewWebViewFormRepostDecisionSignalFormRepostDecision(SwigCPtr));
+            formRepostPolicyDecidedSignal = new WebViewFormRepostPolicyDecidedSignal(Interop.WebView.NewWebViewFormRepostDecisionSignalFormRepostDecision(SwigCPtr));
             frameRenderedSignal = new WebViewFrameRenderedSignal(Interop.WebView.WebViewFrameRenderedSignalFrameRenderedGet(SwigCPtr));
+            newWindowPolicyDecidedSignal = new WebViewNewWindowPolicyDecidedSignal(Interop.WebView.NewWebViewPolicyDecisionSignalPolicyDecision(SwigCPtr));
 
             screenshotAcquiredProxyCallback = OnScreenshotAcquired;
 
@@ -153,6 +158,7 @@ namespace Tizen.NUI
                 urlChangedSignal.Dispose();
                 formRepostPolicyDecidedSignal.Dispose();
                 frameRenderedSignal.Dispose();
+                newWindowPolicyDecidedSignal.Dispose();
 
                 BackForwardList.Dispose();
                 Context.Dispose();
@@ -225,7 +231,7 @@ namespace Tizen.NUI
         private delegate void WebViewUrlChangedCallbackDelegate(IntPtr data, string pageUrl);
 
         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
-        private delegate void WebViewFormRepostPolicyDecidedCallbackDelegate(IntPtr data, IntPtr decision);
+        private delegate void WebViewFormRepostPolicyDecidedCallbackDelegate(IntPtr data, IntPtr maker);
 
         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
         private delegate void WebViewFrameRenderedCallbackDelegate(IntPtr data);
@@ -233,6 +239,9 @@ namespace Tizen.NUI
         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
         private delegate void WebViewScreenshotAcquiredProxyCallback(IntPtr data);
 
+        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        private delegate void WebViewNewWindowPolicyDecidedCallbackDelegate(IntPtr data, IntPtr maker);
+
         /// <summary>
         /// Event for the PageLoadStarted signal which can be used to subscribe or unsubscribe the event handler.<br />
         /// This signal is emitted when page loading has started.<br />
@@ -502,6 +511,31 @@ namespace Tizen.NUI
             ShowHighlight = 1 << 7,
         }
 
+        /// Event for the NewWindowPolicyDecided signal which can be used to subscribe or unsubscribe the event handler.<br />
+        /// This signal is emitted when new window policy would be decided.<br />
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public event EventHandler<WebViewNewWindowPolicyDecidedEventArgs> NewWindowPolicyDecided
+        {
+            add
+            {
+                if (newWindowPolicyDecidedEventHandler == null)
+                {
+                    newWindowPolicyDecidedCallback = OnNewWindowPolicyDecided;
+                    newWindowPolicyDecidedSignal.Connect(newWindowPolicyDecidedCallback);
+                }
+                newWindowPolicyDecidedEventHandler += value;
+            }
+            remove
+            {
+                newWindowPolicyDecidedEventHandler -= value;
+                if (newWindowPolicyDecidedEventHandler == null && newWindowPolicyDecidedCallback != null)
+                {
+                    newWindowPolicyDecidedSignal.Disconnect(newWindowPolicyDecidedCallback);
+                }
+            }
+        }
+
         /// <summary>
         /// BackForwardList.
         /// </summary>
@@ -1761,5 +1795,12 @@ namespace Tizen.NUI
             screenshotAcquiredCallback?.Invoke(image);
             image.Dispose();
         }
+
+        private void OnNewWindowPolicyDecided(IntPtr data, IntPtr maker)
+        {
+            WebNewWindowPolicyDecisionMaker decisionMaker = new WebNewWindowPolicyDecisionMaker(maker, false);
+            newWindowPolicyDecidedEventHandler?.Invoke(this, new WebViewNewWindowPolicyDecidedEventArgs(decisionMaker));
+            decisionMaker.Dispose();
+        }
     }
 }
index 137e0a1..73e4607 100755 (executable)
@@ -32,7 +32,7 @@ namespace Tizen.NUI
         }
 
         /// <summary>
-        /// The form repost decision.
+        /// The form repost policy decision maker.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public WebFormRepostPolicyDecisionMaker FormRepostPolicyDecisionMaker { get; }
index 37c1d6a..c3d7c8d 100755 (executable)
@@ -17,9 +17,9 @@
 
 namespace Tizen.NUI
 {
-    internal class WebViewFormRepostDecidedSignal : Disposable
+    internal class WebViewFormRepostPolicyDecidedSignal : Disposable
     {
-        public WebViewFormRepostDecidedSignal(global::System.IntPtr cPtr) : base(cPtr, true)
+        public WebViewFormRepostPolicyDecidedSignal(global::System.IntPtr cPtr) : base(cPtr, true)
         {
         }
 
diff --git a/src/Tizen.NUI/src/internal/WebView/WebViewNewWindowPolicyDecidedEventArgs.cs b/src/Tizen.NUI/src/internal/WebView/WebViewNewWindowPolicyDecidedEventArgs.cs
new file mode 100755 (executable)
index 0000000..568f5ce
--- /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.NewWindowPolicyDecided.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class WebViewNewWindowPolicyDecidedEventArgs : EventArgs
+    {
+        internal WebViewNewWindowPolicyDecidedEventArgs(WebNewWindowPolicyDecisionMaker maker)
+        {
+            NewWindowPolicyDecisionMaker = maker;
+        }
+
+        /// <summary>
+        /// The new window policy decision maker.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public WebNewWindowPolicyDecisionMaker NewWindowPolicyDecisionMaker { get; }
+    }
+}
diff --git a/src/Tizen.NUI/src/internal/WebView/WebViewNewWindowPolicyDecidedSignal.cs b/src/Tizen.NUI/src/internal/WebView/WebViewNewWindowPolicyDecidedSignal.cs
new file mode 100755 (executable)
index 0000000..8cd7848
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * 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 WebViewNewWindowPolicyDecidedSignal : Disposable
+    {
+        public WebViewNewWindowPolicyDecidedSignal(global::System.IntPtr cPtr) : base(cPtr, true)
+        {
+        }
+
+        protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
+        {
+            Interop.WebView.DeleteWebViewPolicyDecisionSignal(swigCPtr);
+        }
+
+        public void Connect(System.Delegate func)
+        {
+            System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
+            {
+                Interop.WebView.WebViewPolicyDecisionSignalConnect(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.WebViewPolicyDecisionSignalDisconnect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
+                if (NDalicPINVOKE.SWIGPendingException.Pending)
+                {
+                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                }
+            }
+        }
+    }
+}