Commit dee0243d authored by mrowe@apple.com's avatar mrowe@apple.com

2007-11-12 Julien Chaffraix <julien.chaffraix@gmail.com>

        Reviewed by Darin.

        http://bugs.webkit.org/show_bug.cgi?id=15334
        Split ResourceResponse into platform specific files

        * WebCore.base.exp:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * platform/network/ResourceResponse.cpp: Removed.
        * platform/network/ResourceResponse.h: Removed.
        * platform/network/ResourceResponseBase.cpp: Copied from platform/network/ResourceResponse.cpp.
        (WebCore::ResourceResponseBase::asResourceResponse):
        (WebCore::ResourceResponseBase::isHTTP):
        (WebCore::ResourceResponseBase::url):
        (WebCore::ResourceResponseBase::setUrl):
        (WebCore::ResourceResponseBase::mimeType):
        (WebCore::ResourceResponseBase::setMimeType):
        (WebCore::ResourceResponseBase::expectedContentLength):
        (WebCore::ResourceResponseBase::setExpectedContentLength):
        (WebCore::ResourceResponseBase::textEncodingName):
        (WebCore::ResourceResponseBase::setTextEncodingName):
        (WebCore::ResourceResponseBase::suggestedFilename):
        (WebCore::ResourceResponseBase::setSuggestedFilename):
        (WebCore::ResourceResponseBase::httpStatusCode):
        (WebCore::ResourceResponseBase::setHTTPStatusCode):
        (WebCore::ResourceResponseBase::httpStatusText):
        (WebCore::ResourceResponseBase::setHTTPStatusText):
        (WebCore::ResourceResponseBase::httpHeaderField):
        (WebCore::ResourceResponseBase::setHTTPHeaderField):
        (WebCore::ResourceResponseBase::httpHeaderFields):
        (WebCore::ResourceResponseBase::isAttachment):
        (WebCore::ResourceResponseBase::setExpirationDate):
        (WebCore::ResourceResponseBase::expirationDate):
        (WebCore::ResourceResponseBase::setLastModifiedDate):
        (WebCore::ResourceResponseBase::lastModifiedDate):
        (WebCore::ResourceResponseBase::updateResourceResponse):
        * platform/network/ResourceResponseBase.h: Copied from platform/network/ResourceResponse.h.
        (WebCore::ResourceResponseBase::ResourceResponseBase):
        * platform/network/cf/ResourceResponse.h: Added.
        (WebCore::ResourceResponse::ResourceResponse):
        * platform/network/curl/ResourceResponse.h: Added.
        (WebCore::ResourceResponse::ResourceResponse):
        (WebCore::ResourceResponse::doUpdateResourceResponse):
        * platform/network/mac/ResourceResponse.h: Added.
        (WebCore::ResourceResponse::ResourceResponse):
        * platform/network/qt/ResourceResponse.h: Added.
        (WebCore::ResourceResponse::ResourceResponse):
        (WebCore::ResourceResponse::doUpdateResourceResponse):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27714 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f50ba2f5
2007-11-12 Julien Chaffraix <julien.chaffraix@gmail.com>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=15334
Split ResourceResponse into platform specific files
* WebCore.base.exp:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* platform/network/ResourceResponse.cpp: Removed.
* platform/network/ResourceResponse.h: Removed.
* platform/network/ResourceResponseBase.cpp: Copied from platform/network/ResourceResponse.cpp.
(WebCore::ResourceResponseBase::asResourceResponse):
(WebCore::ResourceResponseBase::isHTTP):
(WebCore::ResourceResponseBase::url):
(WebCore::ResourceResponseBase::setUrl):
(WebCore::ResourceResponseBase::mimeType):
(WebCore::ResourceResponseBase::setMimeType):
(WebCore::ResourceResponseBase::expectedContentLength):
(WebCore::ResourceResponseBase::setExpectedContentLength):
(WebCore::ResourceResponseBase::textEncodingName):
(WebCore::ResourceResponseBase::setTextEncodingName):
(WebCore::ResourceResponseBase::suggestedFilename):
(WebCore::ResourceResponseBase::setSuggestedFilename):
(WebCore::ResourceResponseBase::httpStatusCode):
(WebCore::ResourceResponseBase::setHTTPStatusCode):
(WebCore::ResourceResponseBase::httpStatusText):
(WebCore::ResourceResponseBase::setHTTPStatusText):
(WebCore::ResourceResponseBase::httpHeaderField):
(WebCore::ResourceResponseBase::setHTTPHeaderField):
(WebCore::ResourceResponseBase::httpHeaderFields):
(WebCore::ResourceResponseBase::isAttachment):
(WebCore::ResourceResponseBase::setExpirationDate):
(WebCore::ResourceResponseBase::expirationDate):
(WebCore::ResourceResponseBase::setLastModifiedDate):
(WebCore::ResourceResponseBase::lastModifiedDate):
(WebCore::ResourceResponseBase::updateResourceResponse):
* platform/network/ResourceResponseBase.h: Copied from platform/network/ResourceResponse.h.
(WebCore::ResourceResponseBase::ResourceResponseBase):
* platform/network/cf/ResourceResponse.h: Added.
(WebCore::ResourceResponse::ResourceResponse):
* platform/network/curl/ResourceResponse.h: Added.
(WebCore::ResourceResponse::ResourceResponse):
(WebCore::ResourceResponse::doUpdateResourceResponse):
* platform/network/mac/ResourceResponse.h: Added.
(WebCore::ResourceResponse::ResourceResponse):
* platform/network/qt/ResourceResponse.h: Added.
(WebCore::ResourceResponse::ResourceResponse):
(WebCore::ResourceResponse::doUpdateResourceResponse):
2007-11-11 Justin Haygood <jhaygood@reaktix.com>
Reviewed by Adam Roben.
......
......@@ -617,14 +617,14 @@ __ZNK7WebCore16DeprecatedString2atEj
__ZNK7WebCore16DeprecatedString3midEjj
__ZNK7WebCore16DeprecatedString8endsWithERKS0_
__ZNK7WebCore16ResourceResponse13nsURLResponseEv
__ZNK7WebCore16ResourceResponse14httpStatusCodeEv
__ZNK7WebCore16ResourceResponse16httpHeaderFieldsEv
__ZNK7WebCore16ResourceResponse16textEncodingNameEv
__ZNK7WebCore16ResourceResponse17suggestedFilenameEv
__ZNK7WebCore16ResourceResponse21expectedContentLengthEv
__ZNK7WebCore16ResourceResponse3urlEv
__ZNK7WebCore16ResourceResponse8mimeTypeEv
__ZNK7WebCore19ResourceRequestBase16httpHeaderFieldsEv
__ZNK7WebCore20ResourceResponseBase14httpStatusCodeEv
__ZNK7WebCore20ResourceResponseBase16httpHeaderFieldsEv
__ZNK7WebCore20ResourceResponseBase16textEncodingNameEv
__ZNK7WebCore20ResourceResponseBase17suggestedFilenameEv
__ZN7WebCore20ResourceResponseBase24setExpectedContentLengthEx
__ZNK7WebCore20ResourceResponseBase3urlEv
__ZNK7WebCore20ResourceResponseBase8mimeTypeEv
__ZNK7WebCore20ResourceResponseBase16httpHeaderFieldsEv
__ZNK7WebCore19ResourceRequestBase3urlEv
__ZNK7WebCore19ResourceRequestBase7isEmptyEv
__ZNK7WebCore19SelectionController17isInPasswordFieldEv
......
......@@ -682,7 +682,7 @@ SOURCES += \
platform/network/ProtectionSpace.cpp \
platform/network/ResourceHandle.cpp \
platform/network/ResourceRequestBase.cpp \
platform/network/ResourceResponse.cpp \
platform/network/ResourceResponseBase.cpp \
platform/RegularExpression.cpp \
platform/ScrollBar.cpp \
# platform/SearchPopupMenu.cpp \
......
......@@ -161,7 +161,8 @@
1A7CCB250CD946FD00B7B64E /* SQLTransaction.idl in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CCB230CD946FD00B7B64E /* SQLTransaction.idl */; };
1A7CCB2E0CD9499700B7B64E /* JSSQLTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CCB2C0CD9499700B7B64E /* JSSQLTransaction.cpp */; };
1A7CCB2F0CD9499700B7B64E /* JSSQLTransaction.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7CCB2D0CD9499700B7B64E /* JSSQLTransaction.h */; };
1A8180A50B1D4E4300CE46C4 /* ResourceResponse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A8180A40B1D4E4300CE46C4 /* ResourceResponse.cpp */; };
F9B9A1AD0CE271DD009F992E /* ResourceResponseBase.h in Headers */ = {isa = PBXBuildFile; fileRef = F9B9A1AC0CE271DC009F992E /* ResourceResponseBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
F9B9A1AF0CE271F6009F992E /* ResourceResponseBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9B9A1AE0CE271F6009F992E /* ResourceResponseBase.cpp */; };
1A820D910A13EBA600AF843C /* ImageDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A820D8F0A13EBA600AF843C /* ImageDocument.cpp */; };
1A820D920A13EBA600AF843C /* ImageDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A820D900A13EBA600AF843C /* ImageDocument.h */; };
1A85B18F0A1B18A200D8C87C /* JSHTMLHtmlElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A85B18D0A1B18A200D8C87C /* JSHTMLHtmlElement.cpp */; };
......@@ -496,7 +497,7 @@
6582A16309999D6D00BEEB6D /* SystemTimeMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6582A15509999D6D00BEEB6D /* SystemTimeMac.cpp */; };
6582A17809999EA000BEEB6D /* DeprecatedStringMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6582A17709999EA000BEEB6D /* DeprecatedStringMac.mm */; };
658436860AE01B7400E53753 /* FrameLoadRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 658436850AE01B7400E53753 /* FrameLoadRequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
658821660AF4CDF700F01D1F /* ResourceResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 658821650AF4CDF700F01D1F /* ResourceResponse.h */; settings = {ATTRIBUTES = (Private, ); }; };
F9541E5E0CE35B7800CB14EE /* ResourceResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = F9541E5D0CE35B7800CB14EE /* ResourceResponse.h */; settings = {ATTRIBUTES = (Private, ); }; };
6588216C0AF4CE1200F01D1F /* ResourceResponseMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 658821690AF4CE1200F01D1F /* ResourceResponseMac.mm */; };
6593923709AE4346002C531F /* KURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6593923509AE4346002C531F /* KURL.cpp */; };
6593923809AE4346002C531F /* KURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 6593923609AE4346002C531F /* KURL.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -4309,7 +4310,8 @@
1A7CCB230CD946FD00B7B64E /* SQLTransaction.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SQLTransaction.idl; sourceTree = "<group>"; };
1A7CCB2C0CD9499700B7B64E /* JSSQLTransaction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransaction.cpp; sourceTree = "<group>"; };
1A7CCB2D0CD9499700B7B64E /* JSSQLTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLTransaction.h; sourceTree = "<group>"; };
1A8180A40B1D4E4300CE46C4 /* ResourceResponse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceResponse.cpp; sourceTree = "<group>"; };
F9B9A1AC0CE271DC009F992E /* ResourceResponseBase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ResourceResponseBase.h; sourceTree = "<group>"; };
F9B9A1AE0CE271F6009F992E /* ResourceResponseBase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceResponseBase.cpp; sourceTree = "<group>"; };
1A820D8F0A13EBA600AF843C /* ImageDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ImageDocument.cpp; sourceTree = "<group>"; };
1A820D900A13EBA600AF843C /* ImageDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ImageDocument.h; sourceTree = "<group>"; };
1A85B17D0A1B183600D8C87C /* HTMLHtmlElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLHtmlElement.idl; sourceTree = "<group>"; };
......@@ -4690,7 +4692,7 @@
6582A15509999D6D00BEEB6D /* SystemTimeMac.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SystemTimeMac.cpp; sourceTree = "<group>"; };
6582A17709999EA000BEEB6D /* DeprecatedStringMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DeprecatedStringMac.mm; sourceTree = "<group>"; };
658436850AE01B7400E53753 /* FrameLoadRequest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FrameLoadRequest.h; sourceTree = "<group>"; };
658821650AF4CDF700F01D1F /* ResourceResponse.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ResourceResponse.h; sourceTree = "<group>"; };
F9541E5D0CE35B7800CB14EE /* ResourceResponse.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ResourceResponse.h; sourceTree = "<group>"; };
658821690AF4CE1200F01D1F /* ResourceResponseMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceResponseMac.mm; sourceTree = "<group>"; };
6593923509AE4346002C531F /* KURL.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = KURL.cpp; sourceTree = "<group>"; };
6593923609AE4346002C531F /* KURL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KURL.h; sourceTree = "<group>"; };
......@@ -8100,8 +8102,8 @@
656B84DF0AEA1D3100A095B4 /* ResourceHandleInternal.h */,
93D82A470C28CF1E00FD703D /* ResourceRequestBase.cpp */,
93D82A480C28CF1E00FD703D /* ResourceRequestBase.h */,
658821650AF4CDF700F01D1F /* ResourceResponse.h */,
1A8180A40B1D4E4300CE46C4 /* ResourceResponse.cpp */,
F9B9A1AE0CE271F6009F992E /* ResourceResponseBase.cpp */,
F9B9A1AC0CE271DC009F992E /* ResourceResponseBase.h */,
);
path = network;
sourceTree = "<group>";
......@@ -8110,6 +8112,7 @@
isa = PBXGroup;
children = (
93CDDE270C239A4800CD57AE /* ResourceRequest.h */,
F9541E5D0CE35B7800CB14EE /* ResourceResponse.h */,
6518888A0AFF3C1400164720 /* ResourceErrorMac.mm */,
65DAD9FE0AFD86BF00CE53ED /* FormDataStreamMac.h */,
65DAD9FF0AFD86BF00CE53ED /* FormDataStreamMac.mm */,
......@@ -13585,7 +13588,8 @@
656D373F0ADBA5DE00A4554D /* ResourceLoader.h in Headers */,
93CDDE280C239A4800CD57AE /* ResourceRequest.h in Headers */,
93D82A4A0C28CF1E00FD703D /* ResourceRequestBase.h in Headers */,
658821660AF4CDF700F01D1F /* ResourceResponse.h in Headers */,
F9541E5E0CE35B7800CB14EE /* ResourceResponse.h in Headers */,
F9B9A1AD0CE271DD009F992E /* ResourceResponseBase.h in Headers */,
A8CFF5E10A155A05000A4234 /* RootInlineBox.h in Headers */,
519611710CAC56570010A80C /* SQLCallback.h in Headers */,
1A7CCAEA0CD901A100B7B64E /* SQLError.h in Headers */,
......@@ -15155,7 +15159,7 @@
51AA3F6F0BD5AA9E00892971 /* ResourceLoaderMac.mm in Sources */,
93D82A490C28CF1E00FD703D /* ResourceRequestBase.cpp in Sources */,
650E3F6A0AF6C168001FA3AD /* ResourceRequestMac.mm in Sources */,
1A8180A50B1D4E4300CE46C4 /* ResourceResponse.cpp in Sources */,
F9B9A1AF0CE271F6009F992E /* ResourceResponseBase.cpp in Sources */,
6588216C0AF4CE1200F01D1F /* ResourceResponseMac.mm in Sources */,
A8CFF5E70A155A05000A4234 /* RootInlineBox.cpp in Sources */,
519611730CAC56570010A80C /* SQLResultSet.cpp in Sources */,
......@@ -25,27 +25,33 @@
*/
#include "config.h"
#include "ResourceResponseBase.h"
#include "ResourceResponse.h"
namespace WebCore {
bool ResourceResponse::isHTTP() const
inline const ResourceResponse& ResourceResponseBase::asResourceResponse() const
{
return *static_cast<const ResourceResponse*>(this);
}
bool ResourceResponseBase::isHTTP() const
{
updateResourceResponse();
String protocol = m_url.protocol();
return equalIgnoringCase(protocol, "http") || equalIgnoringCase(protocol, "https");
}
const KURL& ResourceResponse::url() const
const KURL& ResourceResponseBase::url() const
{
updateResourceResponse();
return m_url;
}
void ResourceResponse::setUrl(const KURL& url)
void ResourceResponseBase::setUrl(const KURL& url)
{
updateResourceResponse();
m_isNull = false;
......@@ -53,14 +59,14 @@ void ResourceResponse::setUrl(const KURL& url)
m_url = url;
}
const String& ResourceResponse::mimeType() const
const String& ResourceResponseBase::mimeType() const
{
updateResourceResponse();
return m_mimeType;
}
void ResourceResponse::setMimeType(const String& mimeType)
void ResourceResponseBase::setMimeType(const String& mimeType)
{
updateResourceResponse();
m_isNull = false;
......@@ -68,14 +74,14 @@ void ResourceResponse::setMimeType(const String& mimeType)
m_mimeType = mimeType;
}
long long ResourceResponse::expectedContentLength() const
long long ResourceResponseBase::expectedContentLength() const
{
updateResourceResponse();
return m_expectedContentLength;
}
void ResourceResponse::setExpectedContentLength(long long expectedContentLength)
void ResourceResponseBase::setExpectedContentLength(long long expectedContentLength)
{
updateResourceResponse();
m_isNull = false;
......@@ -83,14 +89,14 @@ void ResourceResponse::setExpectedContentLength(long long expectedContentLength)
m_expectedContentLength = expectedContentLength;
}
const String& ResourceResponse::textEncodingName() const
const String& ResourceResponseBase::textEncodingName() const
{
updateResourceResponse();
return m_textEncodingName;
}
void ResourceResponse::setTextEncodingName(const String& encodingName)
void ResourceResponseBase::setTextEncodingName(const String& encodingName)
{
updateResourceResponse();
m_isNull = false;
......@@ -99,14 +105,14 @@ void ResourceResponse::setTextEncodingName(const String& encodingName)
}
// FIXME should compute this on the fly
const String& ResourceResponse::suggestedFilename() const
const String& ResourceResponseBase::suggestedFilename() const
{
updateResourceResponse();
return m_suggestedFilename;
}
void ResourceResponse::setSuggestedFilename(const String& suggestedName)
void ResourceResponseBase::setSuggestedFilename(const String& suggestedName)
{
updateResourceResponse();
m_isNull = false;
......@@ -114,56 +120,56 @@ void ResourceResponse::setSuggestedFilename(const String& suggestedName)
m_suggestedFilename = suggestedName;
}
int ResourceResponse::httpStatusCode() const
int ResourceResponseBase::httpStatusCode() const
{
updateResourceResponse();
return m_httpStatusCode;
return m_httpStatusCode;
}
void ResourceResponse::setHTTPStatusCode(int statusCode)
void ResourceResponseBase::setHTTPStatusCode(int statusCode)
{
updateResourceResponse();
m_httpStatusCode = statusCode;
}
const String& ResourceResponse::httpStatusText() const
const String& ResourceResponseBase::httpStatusText() const
{
updateResourceResponse();
return m_httpStatusText;
}
void ResourceResponse::setHTTPStatusText(const String& statusText)
void ResourceResponseBase::setHTTPStatusText(const String& statusText)
{
updateResourceResponse();
m_httpStatusText = statusText;
}
String ResourceResponse::httpHeaderField(const String& name) const
String ResourceResponseBase::httpHeaderField(const String& name) const
{
updateResourceResponse();
return m_httpHeaderFields.get(name);
}
void ResourceResponse::setHTTPHeaderField(const String& name, const String& value)
void ResourceResponseBase::setHTTPHeaderField(const String& name, const String& value)
{
updateResourceResponse();
m_httpHeaderFields.set(name, value);
}
const HTTPHeaderMap& ResourceResponse::httpHeaderFields() const
const HTTPHeaderMap& ResourceResponseBase::httpHeaderFields() const
{
updateResourceResponse();
return m_httpHeaderFields;
}
bool ResourceResponse::isAttachment() const
bool ResourceResponseBase::isAttachment() const
{
updateResourceResponse();
......@@ -175,43 +181,42 @@ bool ResourceResponse::isAttachment() const
return equalIgnoringCase(value, "attachment");
}
void ResourceResponse::setExpirationDate(time_t expirationDate)
void ResourceResponseBase::setExpirationDate(time_t expirationDate)
{
updateResourceResponse();
m_expirationDate = expirationDate;
}
time_t ResourceResponse::expirationDate() const
time_t ResourceResponseBase::expirationDate() const
{
updateResourceResponse();
return m_expirationDate;
}
void ResourceResponse::setLastModifiedDate(time_t lastModifiedDate)
void ResourceResponseBase::setLastModifiedDate(time_t lastModifiedDate)
{
updateResourceResponse();
m_lastModifiedDate = lastModifiedDate;
m_lastModifiedDate = lastModifiedDate;
}
time_t ResourceResponse::lastModifiedDate() const
time_t ResourceResponseBase::lastModifiedDate() const
{
updateResourceResponse();
return m_lastModifiedDate;
return m_lastModifiedDate;
}
void ResourceResponse::updateResourceResponse() const
void ResourceResponseBase::updateResourceResponse() const
{
#if PLATFORM(MAC) || USE(CFNETWORK)
if (m_isUpToDate)
return;
const_cast<ResourceResponse*>(this)->doUpdateResourceResponse();
const_cast<ResourceResponse&>(asResourceResponse()).doUpdateResourceResponse();
m_isUpToDate = true;
#endif
}
bool operator==(const ResourceResponse& a, const ResourceResponse& b)
......
......@@ -24,54 +24,23 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ResourceResponse_h
#define ResourceResponse_h
#ifndef ResourceResponseBase_h
#define ResourceResponseBase_h
#include "HTTPHeaderMap.h"
#include "KURL.h"
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
#ifdef __OBJC__
@class NSURLResponse;
#else
class NSURLResponse;
#endif
#elif USE(CFNETWORK)
#include <wtf/RetainPtr.h>
typedef struct _CFURLResponse* CFURLResponseRef;
#endif
namespace WebCore {
class ResourceResponse {
public:
class ResourceResponse;
ResourceResponse()
: m_expectedContentLength(0)
, m_httpStatusCode(0)
, m_expirationDate(0)
, m_isUpToDate(true)
, m_isNull(true)
{
}
// Do not use this class directly, use the class ResponseResponse instead
class ResourceResponseBase {
public:
ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename)
: m_url(url)
, m_mimeType(mimeType)
, m_expectedContentLength(expectedLength)
, m_textEncodingName(textEncodingName)
, m_suggestedFilename(filename)
, m_httpStatusCode(0)
, m_expirationDate(0)
, m_isUpToDate(true)
, m_isNull(false)
{
}
bool isNull() const { return m_isNull; }
bool isHTTP() const;
const KURL& url() const;
void setUrl(const KURL& url);
......@@ -108,47 +77,53 @@ public:
void setLastModifiedDate(time_t);
time_t lastModifiedDate() const;
#if PLATFORM(MAC)
ResourceResponse(NSURLResponse* nsResponse)
: m_isUpToDate(false)
, m_isNull(!nsResponse)
, m_nsResponse(nsResponse) { }
NSURLResponse *nsURLResponse() const;
#elif USE(CFNETWORK)
ResourceResponse(CFURLResponseRef cfResponse)
inline const ResourceResponse& asResourceResponse() const;
protected:
// Used when response is initialized from a platform representation
ResourceResponseBase(bool isNull)
: m_isUpToDate(false)
, m_isNull(!cfResponse)
, m_cfResponse(cfResponse) { }
CFURLResponseRef cfURLResponse() const;
#endif
private:
void updateResourceResponse() const;
#if PLATFORM(MAC) || USE(CFNETWORK)
void doUpdateResourceResponse();
#endif
, m_isNull(isNull)
{
}
ResourceResponseBase()
: m_expectedContentLength(0)
, m_httpStatusCode(0)
, m_expirationDate(0)
, m_isUpToDate(true)
, m_isNull(true)
{
}
ResourceResponseBase(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename)
: m_url(url)
, m_mimeType(mimeType)
, m_expectedContentLength(expectedLength)
, m_textEncodingName(textEncodingName)
, m_suggestedFilename(filename)
, m_httpStatusCode(0)
, m_expirationDate(0)
, m_isUpToDate(true)
, m_isNull(false)
{
}
void updateResourceResponse() const;
KURL m_url;
String m_mimeType;
long long m_expectedContentLength;
String m_textEncodingName;
String m_suggestedFilename;
int m_httpStatusCode;
mutable int m_httpStatusCode;
String m_httpStatusText;
HTTPHeaderMap m_httpHeaderFields;
time_t m_expirationDate;
time_t m_lastModifiedDate;
mutable bool m_isUpToDate;
bool m_isNull;
#if PLATFORM(MAC)
RetainPtr<NSURLResponse> m_nsResponse;
#elif USE(CFNETWORK)
RetainPtr<CFURLResponseRef> m_cfResponse;
#endif
};
bool operator==(const ResourceResponse& a, const ResourceResponse& b);
......@@ -156,4 +131,4 @@ inline bool operator!=(const ResourceResponse& a, const ResourceResponse& b) { r
} // namespace WebCore
#endif // ResourceResponse_h
#endif // ResourceResponseBase_h
// -*- mode: c++; c-basic-offset: 4 -*-
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ResourceResponse_h
#define ResourceResponse_h
#include "ResourceResponseBase.h"
#include <wtf/RetainPtr.h>
typedef struct _CFURLResponse* CFURLResponseRef;
namespace WebCore {
class ResourceResponse : public ResourceResponseBase {
public:
ResourceResponse()
: ResourceResponseBase()
{
}
ResourceResponse(CFURLResponseRef cfResponse)
: ResourceResponseBase(!cfResponse)
, m_cfResponse(cfResponse) { }
ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename)
: ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename)
{
}
CFURLResponseRef cfURLResponse() const;
private:
friend class ResourceResponseBase;
void doUpdateResourceResponse();
RetainPtr<CFURLResponseRef> m_cfResponse;
};
} // namespace WebCore
#endif // ResourceResponse_h
// -*- mode: c++; c-basic-offset: 4 -*-
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ResourceResponse_h
#define ResourceResponse_h
#include "ResourceResponseBase.h"
namespace WebCore {
class ResourceResponse : public ResourceResponseBase {
public:
ResourceResponse()
: ResourceResponseBase(false)