*/
using System;
+using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.InteropServices;
private string appVersion;
private float timeOffset;
private ApplicationType applicationType;
- private SecurityOriginListAcquiredCallback securityOriginListAcquiredCallback;
+ private WebSecurityOriginList securityOriginList;
+ private SecurityOriginListAcquiredCallback securityOriginsAcquiredCallback;
private readonly WebContextSecurityOriginListAcquiredProxyCallback securityOriginListAcquiredProxyCallback;
+ private WebPasswordDataList passwordList;
private PasswordDataListAcquiredCallback passwordDataListAcquiredCallback;
private readonly WebContextPasswordDataListAcquiredProxyCallback passwordDataListAcquiredProxyCallback;
}
/// <summary>
+ /// Dispose for IDisposable pattern
+ /// </summary>
+ [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.
+ if (passwordList != null)
+ {
+ passwordList.Dispose();
+ }
+ if (securityOriginList != null)
+ {
+ securityOriginList.Dispose();
+ }
+ }
+
+ base.Dispose(type);
+ }
+
+ /// <summary>
/// The callback function that is invoked when security origin list is acquired.
/// </summary>
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
[EditorBrowsable(EditorBrowsableState.Never)]
- public delegate void SecurityOriginListAcquiredCallback(WebSecurityOriginList list);
+ public delegate void SecurityOriginListAcquiredCallback(IList<WebSecurityOrigin> list);
/// <summary>
/// The callback function that is invoked when storage usage is acquired.
public delegate void StorageUsageAcquiredCallback(ulong usage);
/// <summary>
- /// The callback function that is invoked when security origin list is acquired.
+ /// The callback function that is invoked when password data list is acquired.
/// </summary>
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
[EditorBrowsable(EditorBrowsableState.Never)]
- public delegate void PasswordDataListAcquiredCallback(WebPasswordDataList list);
+ public delegate void PasswordDataListAcquiredCallback(IList<WebPasswordData> list);
/// <summary>
/// The callback function that is invoked when download is started.
[EditorBrowsable(EditorBrowsableState.Never)]
public bool GetWebDatabaseOrigins(SecurityOriginListAcquiredCallback callback)
{
- securityOriginListAcquiredCallback = callback;
+ securityOriginsAcquiredCallback = callback;
IntPtr ip = Marshal.GetFunctionPointerForDelegate(securityOriginListAcquiredProxyCallback);
bool result = Interop.WebContext.GetWebDatabaseOrigins(SwigCPtr, new HandleRef(this, ip));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
[EditorBrowsable(EditorBrowsableState.Never)]
public bool GetWebStorageOrigins(SecurityOriginListAcquiredCallback callback)
{
- securityOriginListAcquiredCallback = callback;
+ securityOriginsAcquiredCallback = callback;
IntPtr ip = Marshal.GetFunctionPointerForDelegate(securityOriginListAcquiredProxyCallback);
bool result = Interop.WebContext.GetWebStorageOrigins(SwigCPtr, new HandleRef(this, ip));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
- private void OnSecurityOriginListAcquired(IntPtr list)
+ private void OnSecurityOriginListAcquired(IntPtr alist)
{
- WebSecurityOriginList originList = new WebSecurityOriginList(list, true);
- securityOriginListAcquiredCallback?.Invoke(originList);
- originList.Dispose();
+ if (securityOriginList != null)
+ {
+ securityOriginList.Dispose();
+ }
+ securityOriginList = new WebSecurityOriginList(alist, true);
+ List<WebSecurityOrigin> originList = new List<WebSecurityOrigin>();
+ for (uint i = 0; i < securityOriginList.ItemCount; i++)
+ {
+ originList.Add(securityOriginList.GetItemAtIndex(i));
+ }
+ securityOriginsAcquiredCallback?.Invoke(originList);
}
- private void OnPasswordDataListAcquired(IntPtr list)
+ private void OnPasswordDataListAcquired(IntPtr alist)
{
- WebPasswordDataList passwordList = new WebPasswordDataList(list, true);
- passwordDataListAcquiredCallback?.Invoke(passwordList);
- passwordList.Dispose();
+ if (passwordList != null)
+ {
+ passwordList.Dispose();
+ }
+ passwordList = new WebPasswordDataList(alist, true);
+ List<WebPasswordData> passwordDataList = new List<WebPasswordData>();
+ for(uint i = 0; i < passwordList.ItemCount; i++)
+ {
+ passwordDataList.Add(passwordList.GetItemAtIndex(i));
+ }
+ passwordDataListAcquiredCallback?.Invoke(passwordDataList);
}
}
}