From: huayongxu <49056704+huayongxu@users.noreply.github.com>
Date: Tue, 26 Jan 2021 09:39:54 +0000 (+0800)
Subject: Add some new APIs like Context, Settings, etc. (#2419)
X-Git-Tag: accepted/tizen/unified/20210219.040944~52
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=375ff9cc63b4e76776e19a76a69244c4498e8ff5;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git
Add some new APIs like Context, Settings, etc. (#2419)
Originally only WebView is used to add new APIs, it will become
bigger, and be hard to maintain.
This patch is to move some related APIs into a class like WebContext,
WebSettings, etc.
And it also adds some new APIs like WebBackForwardList, etc.
---
diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WebBackForwardList.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebBackForwardList.cs
new file mode 100755
index 0000000..b52e380
--- /dev/null
+++ b/src/Tizen.NUI/src/internal/Interop/Interop.WebBackForwardList.cs
@@ -0,0 +1,31 @@
+
+namespace Tizen.NUI
+{
+ internal static partial class Interop
+ {
+ internal static partial class WebBackForwardListItem
+ {
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebBackForwardListItem_GetUrl")]
+ public static extern string GetUrl(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebBackForwardListItem_GetTitle")]
+ public static extern string GetTitle(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebBackForwardListItem_GetOriginalUrl")]
+ public static extern string GetOriginalUrl(global::System.Runtime.InteropServices.HandleRef jarg1);
+ }
+
+ internal static partial class WebBackForwardList
+ {
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebBackForwardList_GetItemCount")]
+ public static extern int GetItemCount(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebBackForwardList_GetCurrentItem")]
+ public static extern global::System.IntPtr GetCurrentItem(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebBackForwardList_GetItemAtIndex")]
+ public static extern global::System.IntPtr GetItemAtIndex(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
+ }
+ }
+}
+
diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WebContext.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebContext.cs
new file mode 100755
index 0000000..00724a9
--- /dev/null
+++ b/src/Tizen.NUI/src/internal/Interop/Interop.WebContext.cs
@@ -0,0 +1,40 @@
+
+namespace Tizen.NUI
+{
+ internal static partial class Interop
+ {
+ internal static partial class WebContext
+ {
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_GetCacheModel")]
+ public static extern int GetCacheModel(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_SetCacheModel")]
+ public static extern void SetCacheModel(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_SetProxyUri")]
+ public static extern void SetProxyUri(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_SetCertificateFilePath")]
+ public static extern void SetCertificateFilePath(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_DisableCache")]
+ public static extern void DisableCache(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_SetDefaultProxyAuth")]
+ public static extern void SetDefaultProxyAuth(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_DeleteWebDatabase")]
+ public static extern void DeleteWebDatabase(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_DeleteWebStorage")]
+ public static extern void DeleteWebStorage(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_DeleteLocalFileSystem")]
+ public static extern void DeleteLocalFileSystem(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_ClearCache")]
+ public static extern void ClearCache(global::System.Runtime.InteropServices.HandleRef jarg1);
+ }
+ }
+}
+
diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WebCookieManager.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebCookieManager.cs
new file mode 100755
index 0000000..561ee1f
--- /dev/null
+++ b/src/Tizen.NUI/src/internal/Interop/Interop.WebCookieManager.cs
@@ -0,0 +1,22 @@
+
+namespace Tizen.NUI
+{
+ internal static partial class Interop
+ {
+ internal static partial class WebCookieManager
+ {
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebCookieManager_GetCookieAcceptPolicy")]
+ public static extern int GetCookieAcceptPolicy(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebCookieManager_SetCookieAcceptPolicy")]
+ public static extern void SetCookieAcceptPolicy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebCookieManager_SetPersistentStorage")]
+ public static extern void SetPersistentStorage(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, int jarg3);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebCookieManager_ClearCookies")]
+ public static extern void ClearCookies(global::System.Runtime.InteropServices.HandleRef jarg1);
+ }
+ }
+}
+
diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WebSettings.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebSettings.cs
new file mode 100755
index 0000000..1346440
--- /dev/null
+++ b/src/Tizen.NUI/src/internal/Interop/Interop.WebSettings.cs
@@ -0,0 +1,49 @@
+
+namespace Tizen.NUI
+{
+ internal static partial class Interop
+ {
+ internal static partial class WebSettings
+ {
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebSettings_AllowMixedContents")]
+ public static extern void AllowMixedContents(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebSettings_EnableSpatialNavigation")]
+ public static extern void EnableSpatialNavigation(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebSettings_GetDefaultFontSize")]
+ public static extern int GetDefaultFontSize(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebSettings_SetDefaultFontSize")]
+ public static extern void SetDefaultFontSize(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebSettings_EnableWebSecurity")]
+ public static extern void EnableWebSecurity(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebSettings_AllowFileAccessFromExternalUrl")]
+ public static extern void AllowFileAccessFromExternalUrl(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebSettings_IsJavaScriptEnabled")]
+ public static extern bool IsJavaScriptEnabled(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebSettings_EnableJavaScript")]
+ public static extern void EnableJavaScript(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebSettings_AllowScriptsOpenWindows")]
+ public static extern void AllowScriptsOpenWindows(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebSettings_AreImagesAutomaticallyLoaded")]
+ public static extern bool AreImagesAutomaticallyLoaded(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebSettings_AllowImagesLoadAutomatically")]
+ public static extern void AllowImagesLoadAutomatically(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebSettings_GetDefaultTextEncodingName")]
+ public static extern string GetDefaultTextEncodingName(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebSettings_SetDefaultTextEncodingName")]
+ public static extern void SetDefaultTextEncodingName(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
+ }
+ }
+}
+
diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs
index 34308f2..47f48cb 100755
--- a/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs
+++ b/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs
@@ -30,32 +30,26 @@ namespace Tizen.NUI
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_URL_get")]
public static extern int UrlGet();
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_CACHE_MODEL_get")]
- public static extern int CacheModelGet();
-
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_COOKIE_ACCEPT_POLICY_get")]
- public static extern int CookieAcceptPolicyGet();
-
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_USER_AGENT_get")]
public static extern int UserAgentGet();
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_ENABLE_JAVASCRIPT_get")]
- public static extern int EnableJavascriptGet();
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_GetBackForwardList")]
+ public static extern global::System.IntPtr GetWebBackForwardList(global::System.Runtime.InteropServices.HandleRef jarg1);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_LOAD_IMAGES_AUTOMATICALLY_get")]
- public static extern int LoadImagesAutomaticallyGet();
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_GetContext")]
+ public static extern global::System.IntPtr GetWebContext(global::System.Runtime.InteropServices.HandleRef jarg1);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_DEFAULT_TEXT_ENCODING_NAME_get")]
- public static extern int DefaultTextEncodingNameGet();
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_GetCookieManager")]
+ public static extern global::System.IntPtr GetWebCookieManager(global::System.Runtime.InteropServices.HandleRef jarg1);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_DEFAULT_FONT_SIZE_get")]
- public static extern int DefaultFontSizeGet();
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_GetSettings")]
+ public static extern global::System.IntPtr GetWebSettings(global::System.Runtime.InteropServices.HandleRef jarg1);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_LoadUrl")]
public static extern void LoadUrl(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_LoadHTMLString")]
- public static extern void LoadHTMLString(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_LoadHtmlString")]
+ public static extern void LoadHtmlString(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Reload")]
public static extern void Reload(global::System.Runtime.InteropServices.HandleRef jarg1);
@@ -90,12 +84,6 @@ namespace Tizen.NUI
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_ClearHistory")]
public static extern void ClearHistory(global::System.Runtime.InteropServices.HandleRef jarg1);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_ClearCache")]
- public static extern void ClearCache(global::System.Runtime.InteropServices.HandleRef jarg1);
-
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_ClearCookies")]
- public static extern void ClearCookies(global::System.Runtime.InteropServices.HandleRef jarg1);
-
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_SWIGUpcast")]
public static extern global::System.IntPtr Upcast(global::System.IntPtr jarg1);
diff --git a/src/Tizen.NUI/src/internal/WebBackForwardList.cs b/src/Tizen.NUI/src/internal/WebBackForwardList.cs
new file mode 100755
index 0000000..ea05f96
--- /dev/null
+++ b/src/Tizen.NUI/src/internal/WebBackForwardList.cs
@@ -0,0 +1,165 @@
+/*
+ * 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
+{
+ ///
+ /// WebBackForwardListItem is a class for back-forward list item of web view.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class WebBackForwardListItem : Disposable
+ {
+ ///
+ /// Get uri.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Uri Url
+ {
+ get
+ {
+ return new Uri(Interop.WebBackForwardListItem.GetUrl(SwigCPtr));
+ }
+ }
+
+ ///
+ /// Get title.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Title
+ {
+ get
+ {
+ return Interop.WebBackForwardListItem.GetTitle(SwigCPtr);
+ }
+ }
+
+ ///
+ /// Get original url.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Uri OriginalUrl
+ {
+ get
+ {
+ return new Uri(Interop.WebBackForwardListItem.GetOriginalUrl(SwigCPtr));
+ }
+ }
+
+ internal WebBackForwardListItem(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+ {
+ }
+
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WebBackForwardListItem obj)
+ {
+ return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
+ }
+
+ ///
+ /// Dispose for IDisposable pattern
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ }
+
+ base.Dispose(type);
+ }
+ }
+
+ ///
+ /// WebBackForwardList is a class for back-forward list of web view.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class WebBackForwardList : Disposable
+ {
+ ///
+ /// Get item count.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int ItemCount
+ {
+ get
+ {
+ return Interop.WebBackForwardList.GetItemCount(SwigCPtr);
+ }
+ }
+
+ ///
+ /// Get current item.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public WebBackForwardListItem GetCurrentItem()
+ {
+ System.IntPtr itemPtr = Interop.WebBackForwardList.GetCurrentItem(SwigCPtr);
+ return new WebBackForwardListItem(itemPtr, false);
+ }
+
+ ///
+ /// Get current item.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public WebBackForwardListItem GetItemAtIndex(int index)
+ {
+ System.IntPtr itemPtr = Interop.WebBackForwardList.GetItemAtIndex(SwigCPtr, index);
+ return new WebBackForwardListItem(itemPtr, false);
+ }
+
+ internal WebBackForwardList(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+ {
+ }
+
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WebBackForwardList obj)
+ {
+ return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
+ }
+
+ ///
+ /// Dispose for IDisposable pattern
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ }
+
+ base.Dispose(type);
+ }
+ }
+}
+
diff --git a/src/Tizen.NUI/src/internal/WebContext.cs b/src/Tizen.NUI/src/internal/WebContext.cs
new file mode 100755
index 0000000..97d6708
--- /dev/null
+++ b/src/Tizen.NUI/src/internal/WebContext.cs
@@ -0,0 +1,209 @@
+/*
+ * 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
+{
+ ///
+ /// WebContext is a class for context of web view.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class WebContext : Disposable
+ {
+ ///
+ /// Cache model
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public enum CacheModelType
+ {
+ ///
+ /// The smallest cache capacity
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ DocumentViewer,
+
+ ///
+ /// The bigger cache capacity than DocumentBrowser
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ DocumentBrowser,
+
+ ///
+ /// The biggest cache capacity.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ PrimaryWebBrowser,
+ }
+
+ ///
+ /// Cache model
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public CacheModelType CacheModel
+ {
+ get
+ {
+ return (CacheModelType)Interop.WebContext.GetCacheModel(SwigCPtr);
+ }
+ set
+ {
+ Interop.WebContext.SetCacheModel(SwigCPtr, (int)value);
+ }
+ }
+
+ ///
+ /// Set the proxy uri.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Uri ProxyUri
+ {
+ get
+ {
+ return new Uri(proxyUri);
+ }
+ set
+ {
+ if (value != null)
+ {
+ proxyUri = value.AbsoluteUri;
+ Interop.WebContext.SetProxyUri(SwigCPtr, proxyUri);
+ }
+ }
+ }
+
+ ///
+ /// Set the Certificate File Path.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string CertificateFilePath
+ {
+ get
+ {
+ return certificateFilePath;
+ }
+ set
+ {
+ certificateFilePath = value;
+ Interop.WebContext.SetCertificateFilePath(SwigCPtr, value);
+ }
+ }
+
+ ///
+ /// Disable cache or not.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool DisableCache
+ {
+ get
+ {
+ return disableCache;
+ }
+ set
+ {
+ disableCache = value;
+ Interop.WebContext.DisableCache(SwigCPtr, value);
+ }
+ }
+
+ ///
+ /// Set Default Proxy Auth.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetDefaultProxyAuth(string username, string password)
+ {
+ Interop.WebContext.SetDefaultProxyAuth(SwigCPtr, username, password);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ ///
+ /// Delete Web Database.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void DeleteWebDatabase()
+ {
+ Interop.WebContext.DeleteWebDatabase(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ ///
+ /// Delete Web Storage.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void DeleteWebStorage()
+ {
+ Interop.WebContext.DeleteWebStorage(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ ///
+ /// Delete Local FileSystem.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void DeleteLocalFileSystem()
+ {
+ Interop.WebContext.DeleteLocalFileSystem(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ ///
+ /// Clear cache.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ClearCache()
+ {
+ Interop.WebContext.ClearCache(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ internal WebContext(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+ {
+ }
+
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WebContext obj)
+ {
+ return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
+ }
+
+ ///
+ /// Dispose for IDisposable pattern
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ }
+
+ base.Dispose(type);
+ }
+
+ // private
+ private string proxyUri;
+ private string certificateFilePath;
+ private bool disableCache;
+ }
+}
diff --git a/src/Tizen.NUI/src/internal/WebCookieManager.cs b/src/Tizen.NUI/src/internal/WebCookieManager.cs
new file mode 100755
index 0000000..842363d
--- /dev/null
+++ b/src/Tizen.NUI/src/internal/WebCookieManager.cs
@@ -0,0 +1,138 @@
+/*
+ * 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
+{
+ ///
+ /// WebCookieManager is a class for cookie manager of web view.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class WebCookieManager : Disposable
+ {
+ ///
+ /// Cookie Accept Policy
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public enum CookieAcceptPolicyType
+ {
+ ///
+ /// Always
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Always,
+
+ ///
+ /// Never
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Never,
+
+ ///
+ /// No third party.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ NoThirdParty,
+ }
+
+ ///
+ /// Cookie accept policy
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public CookieAcceptPolicyType CookieAcceptPolicy
+ {
+ get
+ {
+ return (CookieAcceptPolicyType)Interop.WebCookieManager.GetCookieAcceptPolicy(SwigCPtr);
+ }
+ set
+ {
+ Interop.WebCookieManager.SetCookieAcceptPolicy(SwigCPtr, (int)value);
+ }
+ }
+
+ ///
+ /// Cookie persistent storage type.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public enum CookiePersistentStorageType
+ {
+ ///
+ /// @deprecated Cookies are stored in a text file.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Text,
+
+ ///
+ /// stored in a SQLite file
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ SqlLite,
+ }
+
+ ///
+ /// Set the proxy uri.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetPersistentStorage(string path, CookiePersistentStorageType storageType)
+ {
+ Interop.WebCookieManager.SetPersistentStorage(SwigCPtr, path, (int)storageType);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ ///
+ /// Set Default Proxy Auth.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ClearCookies()
+ {
+ Interop.WebCookieManager.ClearCookies(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ internal WebCookieManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+ {
+ }
+
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WebCookieManager obj)
+ {
+ return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
+ }
+
+ ///
+ /// Dispose for IDisposable pattern
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ }
+
+ base.Dispose(type);
+ }
+ }
+}
diff --git a/src/Tizen.NUI/src/internal/WebSettings.cs b/src/Tizen.NUI/src/internal/WebSettings.cs
new file mode 100755
index 0000000..25360f3
--- /dev/null
+++ b/src/Tizen.NUI/src/internal/WebSettings.cs
@@ -0,0 +1,214 @@
+/*
+ * 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
+{
+ ///
+ /// WebSettings is a class for settings of web view.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class WebSettings : Disposable
+ {
+ ///
+ /// Allow Mixed Contents
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool AllowMixedContents
+ {
+ get
+ {
+ return allowMixedContents;
+ }
+ set
+ {
+ allowMixedContents = value;
+ Interop.WebSettings.AllowMixedContents(SwigCPtr, value);
+ }
+ }
+
+ ///
+ /// Enable Spatial Navigation.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EnableSpatialNavigation
+ {
+ get
+ {
+ return enableSpatialNavigation;
+ }
+ set
+ {
+ enableSpatialNavigation = value;
+ Interop.WebSettings.EnableSpatialNavigation(SwigCPtr, value);
+ }
+ }
+
+ ///
+ /// Default Font Size.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int DefaultFontSize
+ {
+ get
+ {
+ return Interop.WebSettings.GetDefaultFontSize(SwigCPtr);
+ }
+ set
+ {
+ Interop.WebSettings.SetDefaultFontSize(SwigCPtr, value);
+ }
+ }
+
+ ///
+ /// Enable web security.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EnableWebSecurity
+ {
+ get
+ {
+ return enableWebSecurity;
+ }
+ set
+ {
+ enableWebSecurity = value;
+ Interop.WebSettings.EnableWebSecurity(SwigCPtr, value);
+ }
+ }
+
+ ///
+ /// Allow File Access From External Url.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool AllowFileAccessFromExternalUrl
+ {
+ get
+ {
+ return allowFileAccessFromExternalUrl;
+ }
+ set
+ {
+ allowFileAccessFromExternalUrl = value;
+ Interop.WebSettings.AllowFileAccessFromExternalUrl(SwigCPtr, value);
+ }
+ }
+
+ ///
+ /// Enable JavaScript.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EnableJavaScript
+ {
+ get
+ {
+ return Interop.WebSettings.IsJavaScriptEnabled(SwigCPtr);
+ }
+ set
+ {
+ Interop.WebSettings.EnableJavaScript(SwigCPtr, value);
+ }
+ }
+
+ ///
+ /// Allow Scripts Open Windows.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool AllowScriptsOpenWindows
+ {
+ get
+ {
+ return allowScriptsOpenWindows;
+ }
+ set
+ {
+ allowScriptsOpenWindows = value;
+ Interop.WebSettings.AllowScriptsOpenWindows(SwigCPtr, value);
+ }
+ }
+
+ ///
+ /// Allow Images Load Automatically.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool AllowImagesLoadAutomatically
+ {
+ get
+ {
+ return Interop.WebSettings.AreImagesAutomaticallyLoaded(SwigCPtr);
+ }
+ set
+ {
+ Interop.WebSettings.AllowImagesLoadAutomatically(SwigCPtr, value);
+ }
+ }
+
+ ///
+ /// Default Text Encoding Name.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string DefaultTextEncodingName
+ {
+ get
+ {
+ return Interop.WebSettings.GetDefaultTextEncodingName(SwigCPtr);
+ }
+ set
+ {
+ Interop.WebSettings.SetDefaultTextEncodingName(SwigCPtr, value);
+ }
+ }
+
+ internal WebSettings(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+ {
+ }
+
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WebSettings obj)
+ {
+ return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
+ }
+
+ ///
+ /// Dispose for IDisposable pattern
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ }
+
+ base.Dispose(type);
+ }
+
+ // private.
+ private bool allowMixedContents;
+ private bool enableSpatialNavigation;
+ private bool enableWebSecurity;
+ private bool allowFileAccessFromExternalUrl;
+ private bool allowScriptsOpenWindows;
+ }
+}
diff --git a/src/Tizen.NUI/src/internal/WebView.cs b/src/Tizen.NUI/src/internal/WebView.cs
index 92b15fb..f425005 100755
--- a/src/Tizen.NUI/src/internal/WebView.cs
+++ b/src/Tizen.NUI/src/internal/WebView.cs
@@ -30,7 +30,6 @@ namespace Tizen.NUI
[EditorBrowsable(EditorBrowsableState.Never)]
public class WebView : View
{
-
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewPageLoadCallbackDelegate(IntPtr data, string pageUrl);
@@ -51,10 +50,14 @@ namespace Tizen.NUI
internal WebView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.WebView.Upcast(cPtr), cMemoryOwn)
{
-
pageLoadStartedSignal = new WebViewPageLoadSignal(Interop.WebView.NewWebViewPageLoadSignalPageLoadStarted(SwigCPtr));
pageLoadFinishedSignal = new WebViewPageLoadSignal(Interop.WebView.NewWebViewPageLoadSignalPageLoadFinished(SwigCPtr));
pageLoadErrorSignal = new WebViewPageLoadErrorSignal(Interop.WebView.NewWebViewPageLoadErrorSignalPageLoadError(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);
+ Settings = new WebSettings(Interop.WebView.GetWebSettings(SwigCPtr), false);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WebView obj)
@@ -95,6 +98,11 @@ namespace Tizen.NUI
pageLoadStartedSignal.Dispose();
pageLoadFinishedSignal.Dispose();
pageLoadErrorSignal.Dispose();
+
+ BackForwardList.Dispose();
+ Context.Dispose();
+ CookieManager.Dispose();
+ Settings.Dispose();
}
base.Dispose(type);
@@ -115,10 +123,7 @@ namespace Tizen.NUI
e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
e.PageUrl = pageUrl;
- if (pageLoadStartedEventHandler != null)
- {
- pageLoadStartedEventHandler(this, e);
- }
+ pageLoadStartedEventHandler?.Invoke(this, e);
}
private void OnPageLoadFinished(IntPtr data, string pageUrl)
@@ -128,10 +133,7 @@ namespace Tizen.NUI
e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
e.PageUrl = pageUrl;
- if (pageLoadFinishedEventHandler != null)
- {
- pageLoadFinishedEventHandler(this, e);
- }
+ pageLoadFinishedEventHandler?.Invoke(this, e);
}
private void OnPageLoadError(IntPtr data, string pageUrl, int errorCode)
@@ -142,22 +144,13 @@ namespace Tizen.NUI
e.PageUrl = pageUrl;
e.ErrorCode = (WebViewPageLoadErrorEventArgs.LoadErrorCode)errorCode;
- if (pageLoadErrorEventHandler != null)
- {
- pageLoadErrorEventHandler(this, e);
- }
+ pageLoadErrorEventHandler?.Invoke(this, e);
}
internal static new class Property
{
- internal static readonly int URL = Interop.WebView.UrlGet();
- internal static readonly int CacheModel = Interop.WebView.CacheModelGet();
- internal static readonly int CookieAcceptPolicy = Interop.WebView.CookieAcceptPolicyGet();
+ internal static readonly int Url = Interop.WebView.UrlGet();
internal static readonly int UserAgent = Interop.WebView.UserAgentGet();
- internal static readonly int EnableJavascript = Interop.WebView.EnableJavascriptGet();
- internal static readonly int LoadImagesAutomatically = Interop.WebView.LoadImagesAutomaticallyGet();
- internal static readonly int DefaultTextEncodingName = Interop.WebView.DefaultTextEncodingNameGet();
- internal static readonly int DefaultFontSize = Interop.WebView.DefaultFontSizeGet();
}
private static readonly BindableProperty UrlProperty = BindableProperty.Create(nameof(Url), typeof(string), typeof(WebView), string.Empty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
@@ -165,65 +158,17 @@ namespace Tizen.NUI
var webview = (WebView)bindable;
if (newValue != null)
{
- Tizen.NUI.Object.SetProperty((HandleRef)webview.SwigCPtr, WebView.Property.URL, new Tizen.NUI.PropertyValue((string)newValue));
+ Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.Url, new Tizen.NUI.PropertyValue((string)newValue));
}
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
{
var webview = (WebView)bindable;
string temp;
- Tizen.NUI.Object.GetProperty((HandleRef)webview.SwigCPtr, WebView.Property.URL).Get(out temp);
+ Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.Url).Get(out temp);
return temp;
}));
- private static readonly BindableProperty CacheModelProperty = BindableProperty.Create(nameof(CacheModel), typeof(CacheModel), typeof(WebView), CacheModel.DocumentViewer, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
- {
- var webview = (WebView)bindable;
- if (newValue != null)
- {
- Tizen.NUI.Object.SetProperty((HandleRef)webview.SwigCPtr, WebView.Property.CacheModel, new Tizen.NUI.PropertyValue((int)newValue));
- }
- }),
- defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
- {
- var webview = (WebView)bindable;
- string temp;
- if (Tizen.NUI.Object.GetProperty((HandleRef)webview.SwigCPtr, WebView.Property.CacheModel).Get(out temp) == false)
- {
- NUILog.Error("CacheModel get error!");
- }
- switch (temp)
- {
- case "DOCUMENT_VIEWER": return CacheModel.DocumentViewer;
- case "DOCUMENT_BROWSER": return CacheModel.DocumentBrowser;
- default: return CacheModel.PrimaryWebBrowser;
- }
- }));
-
- private static readonly BindableProperty CookieAcceptPolicyProperty = BindableProperty.Create(nameof(CookieAcceptPolicy), typeof(CookieAcceptPolicy), typeof(WebView), CookieAcceptPolicy.NoThirdParty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
- {
- var webview = (WebView)bindable;
- if (newValue != null)
- {
- Tizen.NUI.Object.SetProperty((HandleRef)webview.SwigCPtr, WebView.Property.CookieAcceptPolicy, new Tizen.NUI.PropertyValue((int)newValue));
- }
- }),
- defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
- {
- var webview = (WebView)bindable;
- string temp;
- if (Tizen.NUI.Object.GetProperty((HandleRef)webview.SwigCPtr, WebView.Property.CookieAcceptPolicy).Get(out temp) == false)
- {
- NUILog.Error("CookieAcceptPolicy get error!");
- }
- switch (temp)
- {
- case "ALWAYS": return CookieAcceptPolicy.Always;
- case "NEVER": return CookieAcceptPolicy.Never;
- default: return CookieAcceptPolicy.NoThirdParty;
- }
- }));
-
private static readonly BindableProperty UserAgentProperty = BindableProperty.Create(nameof(UserAgent), typeof(string), typeof(WebView), string.Empty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
{
var webview = (WebView)bindable;
@@ -240,70 +185,6 @@ namespace Tizen.NUI
return temp;
}));
- private static readonly BindableProperty EnableJavaScriptProperty = BindableProperty.Create(nameof(EnableJavaScript), typeof(bool), typeof(WebView), true, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
- {
- var webview = (WebView)bindable;
- if (newValue != null)
- {
- Tizen.NUI.Object.SetProperty((HandleRef)webview.SwigCPtr, WebView.Property.EnableJavascript, new Tizen.NUI.PropertyValue((bool)newValue));
- }
- }),
- defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
- {
- var webview = (WebView)bindable;
- bool temp;
- Tizen.NUI.Object.GetProperty((HandleRef)webview.SwigCPtr, WebView.Property.EnableJavascript).Get(out temp);
- return temp;
- }));
-
- private static readonly BindableProperty LoadImagesAutomaticallyProperty = BindableProperty.Create(nameof(LoadImagesAutomatically), typeof(bool), typeof(WebView), true, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
- {
- var webview = (WebView)bindable;
- if (newValue != null)
- {
- Tizen.NUI.Object.SetProperty((HandleRef)webview.SwigCPtr, WebView.Property.LoadImagesAutomatically, new Tizen.NUI.PropertyValue((bool)newValue));
- }
- }),
- defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
- {
- var webview = (WebView)bindable;
- bool temp;
- Tizen.NUI.Object.GetProperty((HandleRef)webview.SwigCPtr, WebView.Property.LoadImagesAutomatically).Get(out temp);
- return temp;
- }));
-
- private static readonly BindableProperty DefaultTextEncodingNameProperty = BindableProperty.Create(nameof(DefaultTextEncodingName), typeof(string), typeof(WebView), string.Empty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
- {
- var webview = (WebView)bindable;
- if (newValue != null)
- {
- Tizen.NUI.Object.SetProperty((HandleRef)webview.SwigCPtr, WebView.Property.DefaultTextEncodingName, new Tizen.NUI.PropertyValue((string)newValue));
- }
- }),
- defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
- {
- var webview = (WebView)bindable;
- string temp;
- Tizen.NUI.Object.GetProperty((HandleRef)webview.SwigCPtr, WebView.Property.DefaultTextEncodingName).Get(out temp);
- return temp;
- }));
-
- private static readonly BindableProperty DefaultFontSizeProperty = BindableProperty.Create(nameof(DefaultFontSize), typeof(int), typeof(WebView), 16, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
- {
- var webview = (WebView)bindable;
- if (newValue != null)
- {
- Tizen.NUI.Object.SetProperty((HandleRef)webview.SwigCPtr, WebView.Property.DefaultFontSize, new Tizen.NUI.PropertyValue((int)newValue));
- }
- }),
- defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
- {
- var webview = (WebView)bindable;
- int temp;
- Tizen.NUI.Object.GetProperty((HandleRef)webview.SwigCPtr, WebView.Property.DefaultFontSize).Get(out temp);
- return temp;
- }));
-
///
/// Creates an uninitialized WebView.
///
@@ -311,7 +192,6 @@ namespace Tizen.NUI
public WebView() : this(Interop.WebView.New(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
}
///
@@ -336,6 +216,30 @@ namespace Tizen.NUI
}
///
+ /// BackForwardList.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public WebBackForwardList BackForwardList { get; }
+
+ ///
+ /// Context.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public WebContext Context { get; }
+
+ ///
+ /// CookieManager.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public WebCookieManager CookieManager { get; }
+
+ ///
+ /// BackForwardList.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public WebSettings Settings { get; }
+
+ ///
/// The url to load.
///
[EditorBrowsable(EditorBrowsableState.Never)]
@@ -353,36 +257,34 @@ namespace Tizen.NUI
}
///
- /// The cache model of the current WebView.
+ /// Deprecated. The cache model of the current WebView.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public CacheModel CacheModel
{
get
{
- return (CacheModel)GetValue(CacheModelProperty);
+ return (CacheModel)Context.CacheModel;
}
set
{
- SetValue(CacheModelProperty, value);
- NotifyPropertyChanged();
+ Context.CacheModel = (WebContext.CacheModelType)value;
}
}
///
- /// The cookie acceptance policy.
+ /// Deprecated. The cookie acceptance policy.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public CookieAcceptPolicy CookieAcceptPolicy
{
get
{
- return (CookieAcceptPolicy)GetValue(CookieAcceptPolicyProperty);
+ return (CookieAcceptPolicy)CookieManager.CookieAcceptPolicy;
}
set
{
- SetValue(CookieAcceptPolicyProperty, value);
- NotifyPropertyChanged();
+ CookieManager.CookieAcceptPolicy = (WebCookieManager.CookieAcceptPolicyType)value;
}
}
@@ -404,36 +306,34 @@ namespace Tizen.NUI
}
///
- /// Whether JavaScript is enabled.
+ /// Deprecated. Whether JavaScript is enabled.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public bool EnableJavaScript
{
get
{
- return (bool)GetValue(EnableJavaScriptProperty);
+ return Settings.EnableJavaScript;
}
set
{
- SetValue(EnableJavaScriptProperty, value);
- NotifyPropertyChanged();
+ Settings.EnableJavaScript = value;
}
}
///
- /// Whether images can be loaded automatically.
+ /// Deprecated. Whether images can be loaded automatically.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public bool LoadImagesAutomatically
{
get
{
- return (bool)GetValue(LoadImagesAutomaticallyProperty);
+ return Settings.AllowImagesLoadAutomatically;
}
set
{
- SetValue(LoadImagesAutomaticallyProperty, value);
- NotifyPropertyChanged();
+ Settings.AllowImagesLoadAutomatically = value;
}
}
@@ -446,12 +346,11 @@ namespace Tizen.NUI
{
get
{
- return (string)GetValue(DefaultTextEncodingNameProperty);
+ return Settings.DefaultTextEncodingName;
}
set
{
- SetValue(DefaultTextEncodingNameProperty, value);
- NotifyPropertyChanged();
+ Settings.DefaultTextEncodingName = value;
}
}
@@ -463,12 +362,11 @@ namespace Tizen.NUI
{
get
{
- return (int)GetValue(DefaultFontSizeProperty);
+ return Settings.DefaultFontSize;
}
set
{
- SetValue(DefaultFontSizeProperty, value);
- NotifyPropertyChanged();
+ Settings.DefaultFontSize = value;
}
}
@@ -562,13 +460,24 @@ namespace Tizen.NUI
}
///
- /// Returns the URL of the Web
+ /// Deprecated. Loads a html by string.
/// The data of Web
///
[EditorBrowsable(EditorBrowsableState.Never)]
public void LoadHTMLString(string data)
{
- Interop.WebView.LoadHTMLString(SwigCPtr, data);
+ Interop.WebView.LoadHtmlString(SwigCPtr, data);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ ///
+ /// Loads a html by string.
+ /// The data of Web
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void LoadHtmlString(string data)
+ {
+ Interop.WebView.LoadHtmlString(SwigCPtr, data);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
@@ -709,23 +618,21 @@ namespace Tizen.NUI
}
///
- /// Clears the cache of current WebView.
+ /// Deprecated. Clears the cache of current WebView.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public void ClearCache()
{
- Interop.WebView.ClearCache(SwigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ Context.ClearCache();
}
///
- /// Clears all the cookies of current WebView.
+ /// Deprecated. Clears all the cookies of current WebView.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public void ClearCookies()
{
- Interop.WebView.ClearCookies(SwigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ CookieManager.ClearCookies();
}
}
}