blob: da266ba290806c454f7205672e3c0d3fd3fc8451 [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_WEB_DOWNLOAD_DOWNLOAD_SESSION_COOKIE_STORAGE_H_
#define IOS_WEB_DOWNLOAD_DOWNLOAD_SESSION_COOKIE_STORAGE_H_
#include <Foundation/Foundation.h>
// Cookie Storage that only save cookies in memory. It assumes that all cookies
// set calls will have valid cookies and conform to the global cookies accept
// policy. This cookie store class expects setting & getting cookies methods
// calls and setting cookies accept policy calls. Other methods of the class are
// no op.
// This Cookie store is solely used by the download session, which will only
// retrieve cookies using |cookiesForURL:| when creating the retrieve request.
// After that these cookies are not useful, and it'll be safe to discard them
// and only have the version kept by the WebSiteDataStore internal cookie store.
// The reason why an instance of NSHTTPCookieStorage class (shared or newly
// created) can not be used directly in the download session is that it takes
// too long blocking UI thread when setting large number of cookies.
@interface DownloadSessionCookieStorage : NSHTTPCookieStorage
@property(nullable, readonly, copy) NSMutableArray<NSHTTPCookie*>* cookies;
@property NSHTTPCookieAcceptPolicy cookieAcceptPolicy;
@end
#endif // IOS_WEB_DOWNLOAD_DOWNLOAD_SESSION_COOKIE_STORAGE_H_