[NUI] Implement APIs for request interceptor, console message, etc (#2881)
authorhuayongxu <49056704+huayongxu@users.noreply.github.com>
Wed, 21 Apr 2021 09:51:26 +0000 (17:51 +0800)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 28 Apr 2021 03:36:30 +0000 (12:36 +0900)
* [NUI] Implement APIs for request interceptor, console message, etc

This patch is to implement WebView APIs for http request
interceptor, console message and page loading error.

* change GetXXX to XXX.

14 files changed:
src/Tizen.NUI/src/internal/Interop/Interop.WebConsoleMessage.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/Interop/Interop.WebHttpRequestInterceptor.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/Interop/Interop.WebPageLoadError.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs
src/Tizen.NUI/src/internal/WebView/WebConsoleMessage.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/WebView/WebHttpRequestInterceptor.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/WebView/WebPageLoadError.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/WebView/WebView.cs
src/Tizen.NUI/src/internal/WebView/WebViewConsoleMessageReceivedEventArgs.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/WebView/WebViewConsoleMessageReceivedSignal.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/WebView/WebViewFormRepostPolicyDecidedEventArgs.cs
src/Tizen.NUI/src/internal/WebView/WebViewHttpRequestInterceptedEventArgs.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/WebView/WebViewHttpRequestInterceptedSignal.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/WebView/WebViewPageLoadErrorEventArgs.cs

diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WebConsoleMessage.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebConsoleMessage.cs
new file mode 100755 (executable)
index 0000000..55edf68
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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 WebConsoleMessage
+        {
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebConsoleMessage_GetSource")]
+            public static extern string GetSource(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebConsoleMessage_GetLine")]
+            public static extern uint GetLine(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebConsoleMessage_GetSeverityLevel")]
+            public static extern int GetSeverityLevel(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebConsoleMessage_GetText")]
+            public static extern string GetText(global::System.Runtime.InteropServices.HandleRef jarg1);
+        }
+    }
+}
+
diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WebHttpRequestInterceptor.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebHttpRequestInterceptor.cs
new file mode 100755 (executable)
index 0000000..52406c6
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * 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 WebHttpRequestInterceptor
+        {
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebRequestInterceptor_GetUrl")]
+            public static extern string GetUrl(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebRequestInterceptor_Ignore")]
+            public static extern bool Ignore(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebRequestInterceptor_SetResponseStatus")]
+            public static extern bool SetResponseStatus(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, string jarg3);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebRequestInterceptor_AddResponseHeader")]
+            public static extern bool AddResponseHeader(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebRequestInterceptor_AddResponseBody")]
+            public static extern bool AddResponseBody(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, uint jarg3);
+        }
+    }
+}
+
diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WebPageLoadError.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebPageLoadError.cs
new file mode 100755 (executable)
index 0000000..919075c
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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 WebPageLoadError
+        {
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebLoadError_GetUrl")]
+            public static extern string GetUrl(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebLoadError_GetCode")]
+            public static extern int GetCode(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebLoadError_GetDescription")]
+            public static extern string GetDescription(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebLoadError_GetType")]
+            public static extern int GetType(global::System.Runtime.InteropServices.HandleRef jarg1);
+        }
+    }
+}
+
index f01935d..6352aba 100755 (executable)
@@ -344,6 +344,30 @@ namespace Tizen.NUI
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewHttpAuthHandlerSignal_Disconnect")]
             public static extern void WebViewHttpAuthHandlerSignalDisconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebViewRequestInterceptorSignal_RequestInterceptor")]
+            public static extern global::System.IntPtr NewWebViewRequestInterceptorSignalRequestInterceptor(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_WebViewRequestInterceptorSignal")]
+            public static extern void DeleteWebViewRequestInterceptorSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewRequestInterceptorSignal_Connect")]
+            public static extern void WebViewRequestInterceptorSignalConnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewRequestInterceptorSignal_Disconnect")]
+            public static extern void WebViewRequestInterceptorSignalDisconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebViewConsoleMessageSignal_ConsoleMessage")]
+            public static extern global::System.IntPtr NewWebViewConsoleMessageSignalConsoleMessage(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_WebViewConsoleMessageSignal")]
+            public static extern void DeleteWebViewConsoleMessageSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewConsoleMessageSignal_Connect")]
+            public static extern void WebViewConsoleMessageSignalConnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewConsoleMessageSignal_Disconnect")]
+            public static extern void WebViewConsoleMessageSignalDisconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
         }
     }
 }
diff --git a/src/Tizen.NUI/src/internal/WebView/WebConsoleMessage.cs b/src/Tizen.NUI/src/internal/WebView/WebConsoleMessage.cs
new file mode 100755 (executable)
index 0000000..256ec43
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * 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 console message of web view.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class WebConsoleMessage : Disposable
+    {
+        internal WebConsoleMessage(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        {
+        }
+
+        /// <summary>
+        /// Enumeration for level of log severity.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public enum SeverityLevel
+        {
+            /// <summary>
+            /// Empty.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Empty,
+
+            /// <summary>
+            /// Log level.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Log,
+
+            /// <summary>
+            /// Warning level.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Warning,
+
+            /// <summary>
+            /// Error level.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Error,
+
+            /// <summary>
+            /// Debug level.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Debug,
+
+            /// <summary>
+            /// Info level.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Info,
+        }
+
+        /// <summary>
+        /// Queries the source of the console message.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string Source
+        {
+            get
+            {
+                return Interop.WebConsoleMessage.GetSource(SwigCPtr);
+            }
+        }
+
+        /// <summary>
+        /// Queries line no of the console message.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public uint Line
+        {
+            get
+            {
+                return Interop.WebConsoleMessage.GetLine(SwigCPtr);
+            }
+        }
+
+        /// <summary>
+        /// Queries the log severity of the console message.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public SeverityLevel Level
+        {
+            get
+            {
+                return (SeverityLevel)Interop.WebConsoleMessage.GetSeverityLevel(SwigCPtr);
+            }
+        }
+
+        /// <summary>
+        /// Queries the text of console message.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string Text
+        {
+            get
+            {
+                return Interop.WebConsoleMessage.GetText(SwigCPtr);
+            }
+        }
+    }
+}
diff --git a/src/Tizen.NUI/src/internal/WebView/WebHttpRequestInterceptor.cs b/src/Tizen.NUI/src/internal/WebView/WebHttpRequestInterceptor.cs
new file mode 100755 (executable)
index 0000000..9e3545b
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * 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 http request interceptor of web view.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class WebHttpRequestInterceptor : Disposable
+    {
+        internal WebHttpRequestInterceptor(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        {
+        }
+
+        /// <summary>
+        /// Gets url of intercepted request.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string Url
+        {
+            get
+            {
+                return Interop.WebHttpRequestInterceptor.GetUrl(SwigCPtr);
+            }
+        }
+
+        /// <summary>
+        /// Ignores this request.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool Ignore()
+        {
+            bool result = Interop.WebHttpRequestInterceptor.Ignore(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return result;
+        }
+
+        /// <summary>
+        /// Sets status code and status text of response for intercepted request.
+        /// <param name="statusCode">Status code of response</param>
+        /// <param name="customStatusText">Status text of response</param>
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool SetResponseStatus(int statusCode, string customStatusText)
+        {
+            bool result = Interop.WebHttpRequestInterceptor.SetResponseStatus(SwigCPtr, statusCode, customStatusText);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return result;
+        }
+
+        /// <summary>
+        /// Adds HTTP header to response for intercepted request.
+        /// <param name="fieldName">Key of response header</param>
+        /// <param name="fieldValue">Value of response header</param>
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool AddResponseHeader(string fieldName, string fieldValue)
+        {
+            bool result = Interop.WebHttpRequestInterceptor.AddResponseHeader(SwigCPtr, fieldName, fieldValue);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return result;
+        }
+
+        /// <summary>
+        /// Writes whole response body at once.
+        /// <param name="body">Contents of response</param>
+        /// <param name="length">Length of Contents of response</param>
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool AddResponseBody(string body, uint length)
+        {
+            bool result = Interop.WebHttpRequestInterceptor.AddResponseBody(SwigCPtr, body, length);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return result;
+        }
+    }
+}
diff --git a/src/Tizen.NUI/src/internal/WebView/WebPageLoadError.cs b/src/Tizen.NUI/src/internal/WebView/WebPageLoadError.cs
new file mode 100755 (executable)
index 0000000..f10a0a1
--- /dev/null
@@ -0,0 +1,233 @@
+/*
+ * 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 load error of page of web view.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class WebPageLoadError : Disposable
+    {
+        internal WebPageLoadError(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        {
+        }
+
+        /// <summary>
+        /// Enumeration for the load error type
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public enum ErrorType
+        {
+            /// <summary>
+            /// None.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            None,
+
+            /// <summary>
+            /// Internal error.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Internal,
+
+            /// <summary>
+            /// Network error.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Network,
+
+            /// <summary>
+            /// Policy error.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Policy,
+
+            /// <summary>
+            /// Plugin error.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Plugin,
+
+            /// <summary>
+            /// Download error.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Download,
+
+            /// <summary>
+            /// Print error.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Print,
+        }
+
+        /// <summary>
+        /// Enumeration for the load error code
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public enum ErrorCode
+        {
+            /// <summary>
+            /// Unknown.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Unknown,
+
+            /// <summary>
+            /// User canceled.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Canceled,
+
+            /// <summary>
+            /// Can't show the page for this MIME type.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            CantSupportMimetype,
+
+            /// <summary>
+            /// File IO error.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            FailedFileIo,
+
+            /// <summary>
+            /// Cannot connect to the network.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            CannotConnect,
+
+            /// <summary>
+            /// Fail to look up host from the DNS.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            CannotLookupHost,
+
+            /// <summary>
+            /// Fail to SSL/TLS handshake.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            FailedTlsHandshake,
+
+            /// <summary>
+            /// Received certificate is invalid.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            InvalidCertificate,
+
+            /// <summary>
+            /// Connection timeout.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            RequestTimeout,
+
+            /// <summary>
+            /// Too many redirects.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            TooManyRedirects,
+
+            /// <summary>
+            /// Too many requests during this load.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            TooManyRequests,
+
+            /// <summary>
+            /// Malformed URL.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            BadUrl,
+
+            /// <summary>
+            /// Unsupported scheme.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            UnsupportedScheme,
+
+            /// <summary>
+            /// User authentication failed on the server.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Authentication,
+
+            /// <summary>
+            /// Web server has an internal server error.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            InternalServer,
+
+            /// <summary>
+            /// Other error.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Other,
+        }
+
+        /// <summary>
+        /// Queries failing URL for this error.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string Url
+        {
+            get
+            {
+                return Interop.WebPageLoadError.GetUrl(SwigCPtr);
+            }
+        }
+
+        /// <summary>
+        /// Queries code for this error.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public ErrorCode Code
+        {
+            get
+            {
+                return (ErrorCode)Interop.WebPageLoadError.GetCode(SwigCPtr);
+            }
+        }
+
+        /// <summary>
+        /// Queries description for this error.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string Description
+        {
+            get
+            {
+                return Interop.WebPageLoadError.GetDescription(SwigCPtr);
+            }
+        }
+
+        /// <summary>
+        /// Queries type for this error.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public ErrorType Type
+        {
+            get
+            {
+                return (ErrorType)Interop.WebPageLoadError.GetType(SwigCPtr);
+            }
+        }
+    }
+}
index 1deee2e..e93fb17 100755 (executable)
@@ -86,6 +86,14 @@ namespace Tizen.NUI
         private EventHandler<WebViewHttpAuthRequestedEventArgs> httpAuthRequestedEventHandler;
         private WebViewHttpAuthRequestedCallbackDelegate httpAuthRequestedCallback;
 
+        private readonly WebViewHttpRequestInterceptedSignal httpRequestInterceptedSignal;
+        private EventHandler<WebViewHttpRequestInterceptedEventArgs> httpRequestInterceptedEventHandler;
+        private WebViewHttpRequestInterceptedCallbackDelegate httpRequestInterceptedCallback;
+
+        private readonly WebViewConsoleMessageReceivedSignal consoleMessageReceivedSignal;
+        private EventHandler<WebViewConsoleMessageReceivedEventArgs> consoleMessageReceivedEventHandler;
+        private WebViewConsoleMessageReceivedCallbackDelegate consoleMessageReceivedCallback;
+
         /// <summary>
         /// Creates a WebView.
         /// </summary>
@@ -140,6 +148,8 @@ namespace Tizen.NUI
             certificateConfirmedSignal = new WebViewCertificateReceivedSignal(Interop.WebView.NewWebViewCertificateSignalCertificateConfirm(SwigCPtr));
             sslCertificateChangedSignal = new WebViewCertificateReceivedSignal(Interop.WebView.NewWebViewCertificateSignalSslCertificateChanged(SwigCPtr));
             httpAuthRequestedSignal = new WebViewHttpAuthRequestedSignal(Interop.WebView.NewWebViewHttpAuthHandlerSignalHttpAuthHandler(SwigCPtr));
+            httpRequestInterceptedSignal = new WebViewHttpRequestInterceptedSignal(Interop.WebView.NewWebViewRequestInterceptorSignalRequestInterceptor(SwigCPtr));
+            consoleMessageReceivedSignal = new WebViewConsoleMessageReceivedSignal(Interop.WebView.NewWebViewConsoleMessageSignalConsoleMessage(SwigCPtr));
 
             screenshotAcquiredProxyCallback = OnScreenshotAcquired;
 
@@ -177,6 +187,8 @@ namespace Tizen.NUI
                 certificateConfirmedSignal.Dispose();
                 sslCertificateChangedSignal.Dispose();
                 httpAuthRequestedSignal.Dispose();
+                httpRequestInterceptedSignal.Dispose();
+                consoleMessageReceivedSignal.Dispose();
 
                 BackForwardList.Dispose();
                 Context.Dispose();
@@ -240,7 +252,7 @@ namespace Tizen.NUI
         private delegate void WebViewPageLoadCallbackDelegate(IntPtr data, string pageUrl);
 
         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
-        private delegate void WebViewPageLoadErrorCallbackDelegate(IntPtr data, string pageUrl, int errorCode);
+        private delegate void WebViewPageLoadErrorCallbackDelegate(IntPtr data, IntPtr error);
 
         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
         private delegate void WebViewScrollEdgeReachedCallbackDelegate(IntPtr data, int edge);
@@ -266,6 +278,12 @@ namespace Tizen.NUI
         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
         private delegate void WebViewHttpAuthRequestedCallbackDelegate(IntPtr data, IntPtr handler);
 
+        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        private delegate void WebViewHttpRequestInterceptedCallbackDelegate(IntPtr data, IntPtr interceptor);
+
+        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        private delegate void WebViewConsoleMessageReceivedCallbackDelegate(IntPtr data, IntPtr message);
+
         /// <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 />
@@ -355,7 +373,7 @@ namespace Tizen.NUI
             {
                 if (pageLoadErrorEventHandler == null)
                 {
-                    pageLoadErrorCallback = (OnPageLoadError);
+                    pageLoadErrorCallback = OnPageLoadError;
                     pageLoadErrorSignal.Connect(pageLoadErrorCallback);
                 }
                 pageLoadErrorEventHandler += value;
@@ -527,6 +545,32 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// Event for the HttpRequestIntercepted signal which can be used to subscribe or unsubscribe the event handler.<br />
+        /// This signal is emitted when http request would be intercepted.<br />
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public event EventHandler<WebViewHttpRequestInterceptedEventArgs> HttpRequestIntercepted
+        {
+            add
+            {
+                if (httpRequestInterceptedEventHandler == null)
+                {
+                    httpRequestInterceptedCallback = OnHttpRequestIntercepted;
+                    httpRequestInterceptedSignal.Connect(httpRequestInterceptedCallback);
+                }
+                httpRequestInterceptedEventHandler += value;
+            }
+            remove
+            {
+                httpRequestInterceptedEventHandler -= value;
+                if (httpRequestInterceptedEventHandler == null && httpRequestInterceptedCallback != null)
+                {
+                    httpRequestInterceptedSignal.Disconnect(httpRequestInterceptedCallback);
+                }
+            }
+        }
+
+        /// <summary>
         /// Event for the SslCertificateChanged signal which can be used to subscribe or unsubscribe the event handler.<br />
         /// This signal is emitted when SSL certificate is changed.<br />
         /// </summary>
@@ -579,6 +623,32 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// Event for the ConsoleMessageReceived signal which can be used to subscribe or unsubscribe the event handler.<br />
+        /// This signal is emitted when console message is received.<br />
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public event EventHandler<WebViewConsoleMessageReceivedEventArgs> ConsoleMessageReceived
+        {
+            add
+            {
+                if (consoleMessageReceivedEventHandler == null)
+                {
+                    consoleMessageReceivedCallback = OnConsoleMessageReceived;
+                    consoleMessageReceivedSignal.Connect(consoleMessageReceivedCallback);
+                }
+                consoleMessageReceivedEventHandler += value;
+            }
+            remove
+            {
+                consoleMessageReceivedEventHandler -= value;
+                if (consoleMessageReceivedEventHandler == null && consoleMessageReceivedCallback != null)
+                {
+                    consoleMessageReceivedSignal.Disconnect(consoleMessageReceivedCallback);
+                }
+            }
+        }
+
+        /// <summary>
         /// Options for searching texts.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
@@ -1858,15 +1928,9 @@ namespace Tizen.NUI
             pageLoadFinishedEventHandler?.Invoke(this, e);
         }
 
-        private void OnPageLoadError(IntPtr data, string pageUrl, int errorCode)
+        private void OnPageLoadError(IntPtr data, IntPtr error)
         {
-            WebViewPageLoadErrorEventArgs e = new WebViewPageLoadErrorEventArgs();
-
-            e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
-            e.PageUrl = pageUrl;
-            e.ErrorCode = (WebViewPageLoadErrorEventArgs.LoadErrorCode)errorCode;
-
-            pageLoadErrorEventHandler?.Invoke(this, e);
+            pageLoadErrorEventHandler?.Invoke(this, new WebViewPageLoadErrorEventArgs(new WebPageLoadError(error, false)));
         }
 
         private void OnScrollEdgeReached(IntPtr data, int edge)
@@ -1918,5 +1982,15 @@ namespace Tizen.NUI
         {
             httpAuthRequestedEventHandler?.Invoke(this, new WebViewHttpAuthRequestedEventArgs(new WebHttpAuthHandler(handler, false)));
         }
+
+        private void OnHttpRequestIntercepted(IntPtr data, IntPtr interceptor)
+        {
+            httpRequestInterceptedEventHandler?.Invoke(this, new WebViewHttpRequestInterceptedEventArgs(new WebHttpRequestInterceptor(interceptor, false)));
+        }
+
+        private void OnConsoleMessageReceived(IntPtr data, IntPtr message)
+        {
+            consoleMessageReceivedEventHandler?.Invoke(this, new WebViewConsoleMessageReceivedEventArgs(new WebConsoleMessage(message, false)));
+        }
     }
 }
diff --git a/src/Tizen.NUI/src/internal/WebView/WebViewConsoleMessageReceivedEventArgs.cs b/src/Tizen.NUI/src/internal/WebView/WebViewConsoleMessageReceivedEventArgs.cs
new file mode 100755 (executable)
index 0000000..c7ee6d8
--- /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.ConsoleMessageReceived.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class WebViewConsoleMessageReceivedEventArgs : EventArgs
+    {
+        internal WebViewConsoleMessageReceivedEventArgs(WebConsoleMessage message)
+        {
+            ConsoleMessage = message;
+        }
+
+        /// <summary>
+        /// The console message of current webpage.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public WebConsoleMessage ConsoleMessage { get; }
+    }
+}
diff --git a/src/Tizen.NUI/src/internal/WebView/WebViewConsoleMessageReceivedSignal.cs b/src/Tizen.NUI/src/internal/WebView/WebViewConsoleMessageReceivedSignal.cs
new file mode 100755 (executable)
index 0000000..40ca921
--- /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 WebViewConsoleMessageReceivedSignal : Disposable
+    {
+        public WebViewConsoleMessageReceivedSignal(global::System.IntPtr cPtr) : base(cPtr, true)
+        {
+        }
+
+        protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
+        {
+            Interop.WebView.DeleteWebViewConsoleMessageSignal(swigCPtr);
+        }
+
+        public void Connect(System.Delegate func)
+        {
+            System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
+            {
+                Interop.WebView.WebViewConsoleMessageSignalConnect(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.WebViewConsoleMessageSignalDisconnect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
+                if (NDalicPINVOKE.SWIGPendingException.Pending)
+                {
+                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                }
+            }
+        }
+    }
+}
index 73e4607..aa4019e 100755 (executable)
@@ -21,7 +21,7 @@ using System.ComponentModel;
 namespace Tizen.NUI
 {
     /// <summary>
-    /// Event arguments that passed via the WebView.WebFormRepostDecision.
+    /// Event arguments that passed via the WebView.FormRepostPolicyDecided.
     /// </summary>
     [EditorBrowsable(EditorBrowsableState.Never)]
     public class WebViewFormRepostPolicyDecidedEventArgs : EventArgs
diff --git a/src/Tizen.NUI/src/internal/WebView/WebViewHttpRequestInterceptedEventArgs.cs b/src/Tizen.NUI/src/internal/WebView/WebViewHttpRequestInterceptedEventArgs.cs
new file mode 100755 (executable)
index 0000000..80a967c
--- /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.HttpRequestIntercepted.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class WebViewHttpRequestInterceptedEventArgs : EventArgs
+    {
+        internal WebViewHttpRequestInterceptedEventArgs(WebHttpRequestInterceptor interceptor)
+        {
+            HttpRequestInterceptor = interceptor;
+        }
+
+        /// <summary>
+        /// The http request interceptor.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public WebHttpRequestInterceptor HttpRequestInterceptor { get; }
+    }
+}
diff --git a/src/Tizen.NUI/src/internal/WebView/WebViewHttpRequestInterceptedSignal.cs b/src/Tizen.NUI/src/internal/WebView/WebViewHttpRequestInterceptedSignal.cs
new file mode 100755 (executable)
index 0000000..0d66a06
--- /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 WebViewHttpRequestInterceptedSignal : Disposable
+    {
+        public WebViewHttpRequestInterceptedSignal(global::System.IntPtr cPtr) : base(cPtr, true)
+        {
+        }
+
+        protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
+        {
+            Interop.WebView.DeleteWebViewRequestInterceptorSignal(swigCPtr);
+        }
+
+        public void Connect(System.Delegate func)
+        {
+            System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
+            {
+                Interop.WebView.WebViewRequestInterceptorSignalConnect(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.WebViewRequestInterceptorSignalDisconnect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
+                if (NDalicPINVOKE.SWIGPendingException.Pending)
+                {
+                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                }
+            }
+        }
+    }
+}
index b6099c7..54ed03f 100755 (executable)
@@ -26,124 +26,15 @@ namespace Tizen.NUI
     [EditorBrowsable(EditorBrowsableState.Never)]
     public class WebViewPageLoadErrorEventArgs : EventArgs
     {
-        private WebView _webView;
-        private string _pageUrl;
-        private LoadErrorCode _errorCode;
-
-        /// <summary>
-        /// Enumeration for the load error code
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public enum LoadErrorCode
-        {
-            /// <summary>
-            /// Unknown.
-            /// </summary>
-            Unknown,
-            /// <summary>
-            /// User canceled.
-            /// </summary>
-            Canceled,
-            /// <summary>
-            /// Can't show the page for this MIME type.
-            /// </summary>
-            CantSupportMimetype,
-            /// <summary>
-            /// File IO error.
-            /// </summary>
-            FailedFileIo,
-            /// <summary>
-            /// Cannot connect to the network.
-            /// </summary>
-            CantConnect,
-            /// <summary>
-            /// Fail to look up host from the DNS.
-            /// </summary>
-            CantLookupHost,
-            /// <summary>
-            /// Fail to SSL/TLS handshake.
-            /// </summary>
-            FailedTlsHandshake,
-            /// <summary>
-            /// Received certificate is invalid.
-            /// </summary>
-            InvalidCertificate,
-            /// <summary>
-            /// Connection timeout.
-            /// </summary>
-            RequestTimeout,
-            /// <summary>
-            /// Too many redirects.
-            /// </summary>
-            TooManyRedirects,
-            /// <summary>
-            /// Too many requests during this load.
-            /// </summary>
-            TooManyRequests,
-            /// <summary>
-            /// Malformed URL.
-            /// </summary>
-            BadUrl,
-            /// <summary>
-            /// Unsupported scheme.
-            /// </summary>
-            UnsupportedScheme,
-            /// <summary>
-            /// User authentication failed on the server.
-            /// </summary>
-            Authentication,
-            /// <summary>
-            /// Web server has an internal server error.
-            /// </summary>
-            InternalServer,
-        }
-
-        /// <summary>
-        /// The view for displaying webpages.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public WebView WebView
+        internal WebViewPageLoadErrorEventArgs(WebPageLoadError error)
         {
-            get
-            {
-                return _webView;
-            }
-            set
-            {
-                _webView = value;
-            }
+            PageLoadError = error;
         }
 
         /// <summary>
-        /// The url string of current webpage.
+        /// The load error of current web page.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public string PageUrl
-        {
-            get
-            {
-                return _pageUrl;
-            }
-            set
-            {
-                _pageUrl = value;
-            }
-        }
-
-        /// <summary>
-        /// The code for the current error.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public LoadErrorCode ErrorCode
-        {
-            get
-            {
-                return _errorCode;
-            }
-            set
-            {
-                _errorCode = value;
-            }
-        }
+        public WebPageLoadError PageLoadError { get; }
     }
 }