CookieRequestHeaderFieldProxy.h [plain text]
#pragma once
#include "CookiesStrategy.h"
#include "SameSiteInfo.h"
#include <pal/SessionID.h>
#include <wtf/URL.h>
namespace WebCore {
struct CookieRequestHeaderFieldProxy {
PAL::SessionID sessionID;
URL firstParty;
SameSiteInfo sameSiteInfo;
URL url;
Optional<uint64_t> frameID;
Optional<uint64_t> pageID;
IncludeSecureCookies includeSecureCookies { IncludeSecureCookies::No };
template<class Encoder> void encode(Encoder&) const;
template<class Decoder> static Optional<CookieRequestHeaderFieldProxy> decode(Decoder&);
};
template<class Encoder>
void CookieRequestHeaderFieldProxy::encode(Encoder& encoder) const
{
encoder << sessionID;
encoder << firstParty;
encoder << sameSiteInfo;
encoder << url;
encoder << frameID;
encoder << pageID;
encoder << includeSecureCookies;
}
template<class Decoder>
Optional<CookieRequestHeaderFieldProxy> CookieRequestHeaderFieldProxy::decode(Decoder& decoder)
{
CookieRequestHeaderFieldProxy result;
if (!decoder.decode(result.sessionID))
return WTF::nullopt;
if (!decoder.decode(result.firstParty))
return WTF::nullopt;
if (!decoder.decode(result.sameSiteInfo))
return WTF::nullopt;
if (!decoder.decode(result.url))
return WTF::nullopt;
if (!decoder.decode(result.frameID))
return WTF::nullopt;
if (!decoder.decode(result.pageID))
return WTF::nullopt;
if (!decoder.decode(result.includeSecureCookies))
return WTF::nullopt;
return WTFMove(result);
}
}