From bc6feedd20c9a7d5437d0a5e4a78f68978a1eb2a Mon Sep 17 00:00:00 2001 From: huayongxu <49056704+huayongxu@users.noreply.github.com> Date: Wed, 21 Apr 2021 16:31:17 +0800 Subject: [PATCH] [NUI] Implement certificate & authentication APIs of WebView. (#2893) This patch is to implement ssl certificate & http authentication of WebView. Co-authored-by: Jiyun Yang --- .../Interop/Interop.WebCertificate.cs | 38 ++++++ .../Interop/Interop.WebHttpAuthHandler.cs | 38 ++++++ .../src/internal/Interop/Interop.WebView.cs | 27 ++++ .../src/internal/WebView/WebCertificate.cs | 86 +++++++++++++ .../internal/WebView/WebHttpAuthHandler.cs | 78 ++++++++++++ src/Tizen.NUI/src/internal/WebView/WebView.cs | 117 ++++++++++++++++++ .../WebViewCertificateReceivedEventArgs.cs | 40 ++++++ .../WebViewCertificateReceivedSignal.cs | 55 ++++++++ .../WebViewHttpAuthRequestedEventArgs.cs | 40 ++++++ .../WebView/WebViewHttpAuthRequestedSignal.cs | 55 ++++++++ 10 files changed, 574 insertions(+) create mode 100755 src/Tizen.NUI/src/internal/Interop/Interop.WebCertificate.cs create mode 100755 src/Tizen.NUI/src/internal/Interop/Interop.WebHttpAuthHandler.cs create mode 100755 src/Tizen.NUI/src/internal/WebView/WebCertificate.cs create mode 100755 src/Tizen.NUI/src/internal/WebView/WebHttpAuthHandler.cs create mode 100755 src/Tizen.NUI/src/internal/WebView/WebViewCertificateReceivedEventArgs.cs create mode 100755 src/Tizen.NUI/src/internal/WebView/WebViewCertificateReceivedSignal.cs create mode 100755 src/Tizen.NUI/src/internal/WebView/WebViewHttpAuthRequestedEventArgs.cs create mode 100755 src/Tizen.NUI/src/internal/WebView/WebViewHttpAuthRequestedSignal.cs diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WebCertificate.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebCertificate.cs new file mode 100755 index 000000000..c6ebec76f --- /dev/null +++ b/src/Tizen.NUI/src/internal/Interop/Interop.WebCertificate.cs @@ -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 WebCertificate + { + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebCertificate_Allow")] + public static extern void Allow(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebCertificate_IsFromMainFrame")] + public static extern bool IsFromMainFrame(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebCertificate_GetPem")] + public static extern string GetPem(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebCertificate_IsContextSecure")] + public static extern bool IsContextSecure(global::System.Runtime.InteropServices.HandleRef jarg1); + } + } +} + diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WebHttpAuthHandler.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebHttpAuthHandler.cs new file mode 100755 index 000000000..8c6eced49 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Interop/Interop.WebHttpAuthHandler.cs @@ -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 WebHttpAuthHandler + { + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebHttpAuthHandler_GetRealm")] + public static extern string GetRealm(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebHttpAuthHandler_Suspend")] + public static extern void Suspend(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebHttpAuthHandler_UseCredential")] + public static extern void UseCredential(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebHttpAuthHandler_CancelCredential")] + public static extern void CancelCredential(global::System.Runtime.InteropServices.HandleRef jarg1); + } + } +} + diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs index f42246681..f01935db3 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs @@ -317,6 +317,33 @@ namespace Tizen.NUI [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); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebViewCertificateSignal_CertificateConfirm")] + public static extern global::System.IntPtr NewWebViewCertificateSignalCertificateConfirm(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebViewCertificateSignal_SslCertificateChanged")] + public static extern global::System.IntPtr NewWebViewCertificateSignalSslCertificateChanged(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_WebViewCertificateSignal")] + public static extern void DeleteWebViewCertificateSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewCertificateSignal_Connect")] + public static extern void WebViewCertificateSignalConnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewCertificateSignal_Disconnect")] + public static extern void WebViewCertificateSignalDisconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebViewHttpAuthHandlerSignal_HttpAuthHandler")] + public static extern global::System.IntPtr NewWebViewHttpAuthHandlerSignalHttpAuthHandler(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_WebViewHttpAuthHandlerSignal")] + public static extern void DeleteWebViewHttpAuthHandlerSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewHttpAuthHandlerSignal_Connect")] + public static extern void WebViewHttpAuthHandlerSignalConnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [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); } } } diff --git a/src/Tizen.NUI/src/internal/WebView/WebCertificate.cs b/src/Tizen.NUI/src/internal/WebView/WebCertificate.cs new file mode 100755 index 000000000..8af790590 --- /dev/null +++ b/src/Tizen.NUI/src/internal/WebView/WebCertificate.cs @@ -0,0 +1,86 @@ +/* + * 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 +{ + /// + /// It is a class for certificate of web view. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class WebCertificate : Disposable + { + internal WebCertificate(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) + { + } + + /// + /// Checks whether the certificate comes from main frame. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsFromMainFrame + { + get + { + bool result = Interop.WebCertificate.IsFromMainFrame(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) return false; + return result; + } + } + + /// + /// Queries certificate's PEM data. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public string PemData + { + get + { + string result = Interop.WebCertificate.GetPem(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) return null; + return result; + } + } + + /// + /// Queries if the context loaded with a given certificate is secure. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsContextSecure + { + get + { + bool result = Interop.WebCertificate.IsContextSecure(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) return false; + return result; + } + } + + /// + /// Allows the site access about certificate error. + /// allowed or not + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void Allow(bool allowed) + { + Interop.WebCertificate.Allow(SwigCPtr, allowed); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } +} diff --git a/src/Tizen.NUI/src/internal/WebView/WebHttpAuthHandler.cs b/src/Tizen.NUI/src/internal/WebView/WebHttpAuthHandler.cs new file mode 100755 index 000000000..da0b67a23 --- /dev/null +++ b/src/Tizen.NUI/src/internal/WebView/WebHttpAuthHandler.cs @@ -0,0 +1,78 @@ +/* + * 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 +{ + /// + /// It is a class for http authencation handler of web view. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class WebHttpAuthHandler : Disposable + { + internal WebHttpAuthHandler(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) + { + } + + /// + /// Gets the realm of authentication challenge received. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public string Realm + { + get + { + string result = Interop.WebHttpAuthHandler.GetRealm(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) return null; + return result; + } + } + + /// + /// Suspends the operation for authentication challenge. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void Suspend() + { + Interop.WebHttpAuthHandler.Suspend(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sends credential for authentication challenge. + /// user id from user input. + /// user password from user input. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void UseCredential(string userId, string password) + { + Interop.WebHttpAuthHandler.UseCredential(SwigCPtr, userId, password); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sends cancellation notification for authentication challenge. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void CancelCredential() + { + Interop.WebHttpAuthHandler.CancelCredential(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } +} diff --git a/src/Tizen.NUI/src/internal/WebView/WebView.cs b/src/Tizen.NUI/src/internal/WebView/WebView.cs index 400ee0193..1deee2e4e 100755 --- a/src/Tizen.NUI/src/internal/WebView/WebView.cs +++ b/src/Tizen.NUI/src/internal/WebView/WebView.cs @@ -74,6 +74,18 @@ namespace Tizen.NUI private EventHandler newWindowPolicyDecidedEventHandler; private WebViewNewWindowPolicyDecidedCallbackDelegate newWindowPolicyDecidedCallback; + private readonly WebViewCertificateReceivedSignal certificateConfirmedSignal; + private EventHandler certificateConfirmedEventHandler; + private WebViewCertificateReceivedCallbackDelegate certificateConfirmedCallback; + + private readonly WebViewCertificateReceivedSignal sslCertificateChangedSignal; + private EventHandler sslCertificateChangedEventHandler; + private WebViewCertificateReceivedCallbackDelegate sslCertificateChangedCallback; + + private readonly WebViewHttpAuthRequestedSignal httpAuthRequestedSignal; + private EventHandler httpAuthRequestedEventHandler; + private WebViewHttpAuthRequestedCallbackDelegate httpAuthRequestedCallback; + /// /// Creates a WebView. /// @@ -125,6 +137,9 @@ namespace Tizen.NUI formRepostPolicyDecidedSignal = new WebViewFormRepostPolicyDecidedSignal(Interop.WebView.NewWebViewFormRepostDecisionSignalFormRepostDecision(SwigCPtr)); frameRenderedSignal = new WebViewFrameRenderedSignal(Interop.WebView.WebViewFrameRenderedSignalFrameRenderedGet(SwigCPtr)); newWindowPolicyDecidedSignal = new WebViewNewWindowPolicyDecidedSignal(Interop.WebView.NewWebViewPolicyDecisionSignalPolicyDecision(SwigCPtr)); + certificateConfirmedSignal = new WebViewCertificateReceivedSignal(Interop.WebView.NewWebViewCertificateSignalCertificateConfirm(SwigCPtr)); + sslCertificateChangedSignal = new WebViewCertificateReceivedSignal(Interop.WebView.NewWebViewCertificateSignalSslCertificateChanged(SwigCPtr)); + httpAuthRequestedSignal = new WebViewHttpAuthRequestedSignal(Interop.WebView.NewWebViewHttpAuthHandlerSignalHttpAuthHandler(SwigCPtr)); screenshotAcquiredProxyCallback = OnScreenshotAcquired; @@ -159,6 +174,9 @@ namespace Tizen.NUI formRepostPolicyDecidedSignal.Dispose(); frameRenderedSignal.Dispose(); newWindowPolicyDecidedSignal.Dispose(); + certificateConfirmedSignal.Dispose(); + sslCertificateChangedSignal.Dispose(); + httpAuthRequestedSignal.Dispose(); BackForwardList.Dispose(); Context.Dispose(); @@ -242,6 +260,12 @@ namespace Tizen.NUI [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void WebViewNewWindowPolicyDecidedCallbackDelegate(IntPtr data, IntPtr maker); + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WebViewCertificateReceivedCallbackDelegate(IntPtr data, IntPtr certificate); + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WebViewHttpAuthRequestedCallbackDelegate(IntPtr data, IntPtr handler); + /// /// Event for the PageLoadStarted signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when page loading has started.
@@ -476,6 +500,84 @@ namespace Tizen.NUI } } + /// + /// Event for the CertificateConfirmed signal which can be used to subscribe or unsubscribe the event handler.
+ /// This signal is emitted when certificate would be confirmed.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler CertificateConfirmed + { + add + { + if (certificateConfirmedEventHandler == null) + { + certificateConfirmedCallback = OnCertificateConfirmed; + certificateConfirmedSignal.Connect(certificateConfirmedCallback); + } + certificateConfirmedEventHandler += value; + } + remove + { + certificateConfirmedEventHandler -= value; + if (certificateConfirmedEventHandler == null && certificateConfirmedCallback != null) + { + certificateConfirmedSignal.Disconnect(certificateConfirmedCallback); + } + } + } + + /// + /// Event for the SslCertificateChanged signal which can be used to subscribe or unsubscribe the event handler.
+ /// This signal is emitted when SSL certificate is changed.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler SslCertificateChanged + { + add + { + if (sslCertificateChangedEventHandler == null) + { + sslCertificateChangedCallback = OnSslCertificateChanged; + sslCertificateChangedSignal.Connect(sslCertificateChangedCallback); + } + sslCertificateChangedEventHandler += value; + } + remove + { + sslCertificateChangedEventHandler -= value; + if (sslCertificateChangedEventHandler == null && sslCertificateChangedCallback != null) + { + sslCertificateChangedSignal.Disconnect(sslCertificateChangedCallback); + } + } + } + + /// + /// Event for the HttpAuthRequested signal which can be used to subscribe or unsubscribe the event handler.
+ /// This signal is emitted when http authentication is requested.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler HttpAuthRequested + { + add + { + if (httpAuthRequestedEventHandler == null) + { + httpAuthRequestedCallback = OnHttpAuthRequested; + httpAuthRequestedSignal.Connect(httpAuthRequestedCallback); + } + httpAuthRequestedEventHandler += value; + } + remove + { + httpAuthRequestedEventHandler -= value; + if (httpAuthRequestedEventHandler == null && httpAuthRequestedCallback != null) + { + httpAuthRequestedSignal.Disconnect(httpAuthRequestedCallback); + } + } + } + /// /// Options for searching texts. /// @@ -1801,5 +1903,20 @@ namespace Tizen.NUI { newWindowPolicyDecidedEventHandler?.Invoke(this, new WebViewNewWindowPolicyDecidedEventArgs(new WebNewWindowPolicyDecisionMaker(maker, false))); } + + private void OnCertificateConfirmed(IntPtr data, IntPtr certificate) + { + certificateConfirmedEventHandler?.Invoke(this, new WebViewCertificateReceivedEventArgs(new WebCertificate(certificate, false))); + } + + private void OnSslCertificateChanged(IntPtr data, IntPtr certificate) + { + sslCertificateChangedEventHandler?.Invoke(this, new WebViewCertificateReceivedEventArgs(new WebCertificate(certificate, false))); + } + + private void OnHttpAuthRequested(IntPtr data, IntPtr handler) + { + httpAuthRequestedEventHandler?.Invoke(this, new WebViewHttpAuthRequestedEventArgs(new WebHttpAuthHandler(handler, false))); + } } } diff --git a/src/Tizen.NUI/src/internal/WebView/WebViewCertificateReceivedEventArgs.cs b/src/Tizen.NUI/src/internal/WebView/WebViewCertificateReceivedEventArgs.cs new file mode 100755 index 000000000..32807c233 --- /dev/null +++ b/src/Tizen.NUI/src/internal/WebView/WebViewCertificateReceivedEventArgs.cs @@ -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 +{ + /// + /// Event arguments that passed via the WebView.CertificateConfirmed / WebView.SslCertificateChanged. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class WebViewCertificateReceivedEventArgs : EventArgs + { + internal WebViewCertificateReceivedEventArgs(WebCertificate certificate) + { + Certificate = certificate; + } + + /// + /// The certificate of web view. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public WebCertificate Certificate { get; } + } +} diff --git a/src/Tizen.NUI/src/internal/WebView/WebViewCertificateReceivedSignal.cs b/src/Tizen.NUI/src/internal/WebView/WebViewCertificateReceivedSignal.cs new file mode 100755 index 000000000..c0dc00a21 --- /dev/null +++ b/src/Tizen.NUI/src/internal/WebView/WebViewCertificateReceivedSignal.cs @@ -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 WebViewCertificateReceivedSignal : Disposable + { + public WebViewCertificateReceivedSignal(global::System.IntPtr cPtr) : base(cPtr, true) + { + } + + protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) + { + Interop.WebView.DeleteWebViewCertificateSignal(swigCPtr); + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + Interop.WebView.WebViewCertificateSignalConnect(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(func); + { + Interop.WebView.WebViewCertificateSignalDisconnect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + { + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + } + } +} diff --git a/src/Tizen.NUI/src/internal/WebView/WebViewHttpAuthRequestedEventArgs.cs b/src/Tizen.NUI/src/internal/WebView/WebViewHttpAuthRequestedEventArgs.cs new file mode 100755 index 000000000..a24657fda --- /dev/null +++ b/src/Tizen.NUI/src/internal/WebView/WebViewHttpAuthRequestedEventArgs.cs @@ -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 +{ + /// + /// Event arguments that passed via the WebView.HttpAuthRequested. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class WebViewHttpAuthRequestedEventArgs : EventArgs + { + internal WebViewHttpAuthRequestedEventArgs(WebHttpAuthHandler handler) + { + HttpAuthHandler = handler; + } + + /// + /// The http auth handler of web view. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public WebHttpAuthHandler HttpAuthHandler { get; } + } +} diff --git a/src/Tizen.NUI/src/internal/WebView/WebViewHttpAuthRequestedSignal.cs b/src/Tizen.NUI/src/internal/WebView/WebViewHttpAuthRequestedSignal.cs new file mode 100755 index 000000000..372e74b5f --- /dev/null +++ b/src/Tizen.NUI/src/internal/WebView/WebViewHttpAuthRequestedSignal.cs @@ -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 WebViewHttpAuthRequestedSignal : Disposable + { + public WebViewHttpAuthRequestedSignal(global::System.IntPtr cPtr) : base(cPtr, true) + { + } + + protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) + { + Interop.WebView.DeleteWebViewHttpAuthHandlerSignal(swigCPtr); + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + Interop.WebView.WebViewHttpAuthHandlerSignalConnect(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(func); + { + Interop.WebView.WebViewHttpAuthHandlerSignalDisconnect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + { + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + } + } +} -- 2.34.1