// Copyright © 2020 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
namespace CefSharp.DevTools.Storage
{
using System.Linq;
///
/// Storage
///
public partial class Storage : DevToolsDomainBase
{
private CefSharp.DevTools.IDevToolsClient _client;
public Storage(CefSharp.DevTools.IDevToolsClient client)
{
_client = (client);
}
partial void ValidateClearDataForOrigin(string origin, string storageTypes);
///
/// Clears storage for origin.
///
/// Security origin.
/// Comma separated list of StorageType to clear.
/// returns System.Threading.Tasks.Task<DevToolsMethodResponse>
public async System.Threading.Tasks.Task ClearDataForOriginAsync(string origin, string storageTypes)
{
ValidateClearDataForOrigin(origin, storageTypes);
var dict = new System.Collections.Generic.Dictionary();
dict.Add("origin", origin);
dict.Add("storageTypes", storageTypes);
var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.clearDataForOrigin", dict);
return methodResult;
}
partial void ValidateGetCookies(string browserContextId = null);
///
/// Returns all browser cookies.
///
/// Browser context to use when called on the browser endpoint.
/// returns System.Threading.Tasks.Task<GetCookiesResponse>
public async System.Threading.Tasks.Task GetCookiesAsync(string browserContextId = null)
{
ValidateGetCookies(browserContextId);
var dict = new System.Collections.Generic.Dictionary();
if (!(string.IsNullOrEmpty(browserContextId)))
{
dict.Add("browserContextId", browserContextId);
}
var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.getCookies", dict);
return methodResult.DeserializeJson();
}
partial void ValidateSetCookies(System.Collections.Generic.IList cookies, string browserContextId = null);
///
/// Sets given cookies.
///
/// Cookies to be set.
/// Browser context to use when called on the browser endpoint.
/// returns System.Threading.Tasks.Task<DevToolsMethodResponse>
public async System.Threading.Tasks.Task SetCookiesAsync(System.Collections.Generic.IList cookies, string browserContextId = null)
{
ValidateSetCookies(cookies, browserContextId);
var dict = new System.Collections.Generic.Dictionary();
dict.Add("cookies", cookies.Select(x => x.ToDictionary()));
if (!(string.IsNullOrEmpty(browserContextId)))
{
dict.Add("browserContextId", browserContextId);
}
var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.setCookies", dict);
return methodResult;
}
partial void ValidateClearCookies(string browserContextId = null);
///
/// Clears cookies.
///
/// Browser context to use when called on the browser endpoint.
/// returns System.Threading.Tasks.Task<DevToolsMethodResponse>
public async System.Threading.Tasks.Task ClearCookiesAsync(string browserContextId = null)
{
ValidateClearCookies(browserContextId);
var dict = new System.Collections.Generic.Dictionary();
if (!(string.IsNullOrEmpty(browserContextId)))
{
dict.Add("browserContextId", browserContextId);
}
var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.clearCookies", dict);
return methodResult;
}
partial void ValidateGetUsageAndQuota(string origin);
///
/// Returns usage and quota in bytes.
///
/// Security origin.
/// returns System.Threading.Tasks.Task<GetUsageAndQuotaResponse>
public async System.Threading.Tasks.Task GetUsageAndQuotaAsync(string origin)
{
ValidateGetUsageAndQuota(origin);
var dict = new System.Collections.Generic.Dictionary();
dict.Add("origin", origin);
var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.getUsageAndQuota", dict);
return methodResult.DeserializeJson();
}
partial void ValidateTrackCacheStorageForOrigin(string origin);
///
/// Registers origin to be notified when an update occurs to its cache storage list.
///
/// Security origin.
/// returns System.Threading.Tasks.Task<DevToolsMethodResponse>
public async System.Threading.Tasks.Task TrackCacheStorageForOriginAsync(string origin)
{
ValidateTrackCacheStorageForOrigin(origin);
var dict = new System.Collections.Generic.Dictionary();
dict.Add("origin", origin);
var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.trackCacheStorageForOrigin", dict);
return methodResult;
}
partial void ValidateTrackIndexedDBForOrigin(string origin);
///
/// Registers origin to be notified when an update occurs to its IndexedDB.
///
/// Security origin.
/// returns System.Threading.Tasks.Task<DevToolsMethodResponse>
public async System.Threading.Tasks.Task TrackIndexedDBForOriginAsync(string origin)
{
ValidateTrackIndexedDBForOrigin(origin);
var dict = new System.Collections.Generic.Dictionary();
dict.Add("origin", origin);
var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.trackIndexedDBForOrigin", dict);
return methodResult;
}
partial void ValidateUntrackCacheStorageForOrigin(string origin);
///
/// Unregisters origin from receiving notifications for cache storage.
///
/// Security origin.
/// returns System.Threading.Tasks.Task<DevToolsMethodResponse>
public async System.Threading.Tasks.Task UntrackCacheStorageForOriginAsync(string origin)
{
ValidateUntrackCacheStorageForOrigin(origin);
var dict = new System.Collections.Generic.Dictionary();
dict.Add("origin", origin);
var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.untrackCacheStorageForOrigin", dict);
return methodResult;
}
partial void ValidateUntrackIndexedDBForOrigin(string origin);
///
/// Unregisters origin from receiving notifications for IndexedDB.
///
/// Security origin.
/// returns System.Threading.Tasks.Task<DevToolsMethodResponse>
public async System.Threading.Tasks.Task UntrackIndexedDBForOriginAsync(string origin)
{
ValidateUntrackIndexedDBForOrigin(origin);
var dict = new System.Collections.Generic.Dictionary();
dict.Add("origin", origin);
var methodResult = await _client.ExecuteDevToolsMethodAsync("Storage.untrackIndexedDBForOrigin", dict);
return methodResult;
}
}
}