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