ResourceResponse.h [plain text]
#pragma once
#include "ResourceResponseBase.h"
#include <wtf/RetainPtr.h>
#if USE(CFNETWORK)
#include "CFNetworkSPI.h"
#endif
OBJC_CLASS NSURLResponse;
namespace WebCore {
class ResourceResponse : public ResourceResponseBase {
public:
ResourceResponse()
: m_initLevel(AllFields)
{
}
#if USE(CFNETWORK)
ResourceResponse(CFURLResponseRef cfResponse)
: m_initLevel(Uninitialized)
, m_cfResponse(cfResponse)
{
m_isNull = !cfResponse;
}
#if PLATFORM(COCOA)
WEBCORE_EXPORT ResourceResponse(NSURLResponse *);
#endif
#else
ResourceResponse(NSURLResponse *nsResponse)
: m_initLevel(Uninitialized)
, m_nsResponse(nsResponse)
{
m_isNull = !nsResponse;
}
#endif
ResourceResponse(const URL& url, const String& mimeType, long long expectedLength, const String& textEncodingName)
: ResourceResponseBase(url, mimeType, expectedLength, textEncodingName)
, m_initLevel(AllFields)
{
}
#if PLATFORM(COCOA)
WEBCORE_EXPORT void disableLazyInitialization();
#endif
unsigned memoryUsage() const
{
return 3800;
}
#if USE(CFNETWORK)
WEBCORE_EXPORT CFURLResponseRef cfURLResponse() const;
#endif
#if PLATFORM(COCOA)
WEBCORE_EXPORT NSURLResponse *nsURLResponse() const;
#endif
#if USE(QUICK_LOOK)
bool isQuickLook() const { return m_isQuickLook; }
void setIsQuickLook(bool isQuickLook) { m_isQuickLook = isQuickLook; }
#endif
private:
friend class ResourceResponseBase;
void platformLazyInit(InitLevel);
String platformSuggestedFilename() const;
CertificateInfo platformCertificateInfo() const;
void doPlatformSetAsIsolatedCopy(const ResourceResponse&) const;
#if PLATFORM(COCOA)
void initNSURLResponse() const;
#endif
static bool platformCompare(const ResourceResponse& a, const ResourceResponse& b);
unsigned m_initLevel : 3;
#if USE(QUICK_LOOK)
bool m_isQuickLook { false };
#endif
#if USE(CFNETWORK)
mutable RetainPtr<CFURLResponseRef> m_cfResponse;
#endif
#if PLATFORM(COCOA)
mutable RetainPtr<NSURLResponse> m_nsResponse;
#endif
};
}