/// <summary> /// Visits a subset of the cookies. The results are filtered by the given url scheme, host, domain and path. /// If <paramref name="includeHttpOnly"/> is true, HTTP-only cookies will also be included in the results. The returned cookies /// are sorted by longest path, then by earliest creation date. /// </summary> /// <param name="cookieManager">cookie manager</param> /// <param name="url">The URL to use for filtering a subset of the cookies available.</param> /// <param name="includeHttpOnly">A flag that determines whether HTTP-only cookies will be shown in results.</param> /// <returns>A task that represents the VisitUrlCookies operation. The value of the TResult parameter contains a List of cookies. /// or null if cookies cannot be accessed.</returns> public static Task <List <Cookie> > VisitUrlCookiesAsync(this ICookieManager cookieManager, string url, bool includeHttpOnly) { var cookieVisitor = new TaskCookieVisitor(); if (cookieManager.VisitUrlCookies(url, includeHttpOnly, cookieVisitor)) { return(cookieVisitor.Task); } return(Task.FromResult <List <Cookie> >(null)); }
/// <summary> /// Visits all cookies. The returned cookies are sorted by longest path, then by earliest creation date. /// </summary> /// <param name="cookieManager">cookie manager</param> /// <returns>A task that represents the VisitAllCookies operation. The value of the TResult parameter contains a List of cookies /// or null if cookies cannot be accessed.</returns> public static Task <List <Cookie> > VisitAllCookiesAsync(this ICookieManager cookieManager) { var cookieVisitor = new TaskCookieVisitor(); if (cookieManager.VisitAllCookies(cookieVisitor)) { return(cookieVisitor.Task); } return(Task.FromResult <List <Cookie> >(null)); }
/// <summary> /// Visits all cookies. The returned cookies are sorted by longest path, then by earliest creation date. /// </summary> /// <param name="cookieManager">cookie manager</param> /// <returns>A task that represents the VisitAllCookies operation. The value of the TResult parameter contains a List of cookies /// or null if cookies cannot be accessed.</returns> public static Task <List <Cookie> > VisitAllCookiesAsync(this ICookieManager cookieManager) { var cookieVisitor = new TaskCookieVisitor(); if (cookieManager.VisitAllCookies(cookieVisitor)) { return(cookieVisitor.Task); } return(CefSharp.Internals.TaskExtensions.FromResult <List <Cookie> >(null)); }