2007-11-12 Julien Chaffraix <julien.chaffraix@gmail.com>
authormrowe@apple.com <mrowe@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Nov 2007 10:33:11 +0000 (10:33 +0000)
committermrowe@apple.com <mrowe@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Nov 2007 10:33:11 +0000 (10:33 +0000)
        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: https://svn.webkit.org/repository/webkit/trunk@27714 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.base.exp
WebCore/WebCore.pro
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/platform/network/ResourceResponseBase.cpp [moved from WebCore/platform/network/ResourceResponse.cpp with 70% similarity]
WebCore/platform/network/ResourceResponseBase.h [moved from WebCore/platform/network/ResourceResponse.h with 74% similarity]
WebCore/platform/network/cf/ResourceResponse.h [new file with mode: 0644]
WebCore/platform/network/curl/ResourceResponse.h [new file with mode: 0644]
WebCore/platform/network/mac/ResourceResponse.h [new file with mode: 0644]
WebCore/platform/network/qt/ResourceResponse.h [new file with mode: 0644]

index 9786619b582b5f42f00195a2aeefae760f4907e5..72c3f48f50fdc0bb486e9c6b29d3cc4ae7835dc1 100644 (file)
@@ -1,3 +1,55 @@
+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.
index 33046c1b7d313850b0d8dadb01f01adc84eb5063..3fcf5c4828984720ae5b9659e058fe4e5f6ab165 100644 (file)
@@ -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
index 89a39f7499c8810373d36f2fe4da53216428fdd9..ccff72b9bfa92b85c090e8d6d65f00da00d3bb2c 100644 (file)
@@ -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 \
index 5a0edeb34d69bf238492b4d679b83f4665ea0115..70cb9a3eac7008fbdcd0145a3590f0a376d9bbac 100644 (file)
                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 */; };
                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, ); }; };
                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>"; };
                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>"; };
                                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>";
                        isa = PBXGroup;
                        children = (
                                93CDDE270C239A4800CD57AE /* ResourceRequest.h */,
+                               F9541E5D0CE35B7800CB14EE /* ResourceResponse.h */,
                                6518888A0AFF3C1400164720 /* ResourceErrorMac.mm */,
                                65DAD9FE0AFD86BF00CE53ED /* FormDataStreamMac.h */,
                                65DAD9FF0AFD86BF00CE53ED /* FormDataStreamMac.mm */,
                                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 */,
                                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 */,
similarity index 70%
rename from WebCore/platform/network/ResourceResponse.cpp
rename to WebCore/platform/network/ResourceResponseBase.cpp
index 2296e77c2e50217593aea80bf063562ab989b8b2..06cc5ce99a7cd2b7501a2907bf4a7e783ff046f6 100644 (file)
  */
 
 #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)
similarity index 74%
rename from WebCore/platform/network/ResourceResponse.h
rename to WebCore/platform/network/ResourceResponseBase.h
index a1f03ef157fa56eccd28cc4b01e3b61c5924dc46..50b6c438db022c6b8e56b887f04c8214d62b7a76 100644 (file)
  * 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
diff --git a/WebCore/platform/network/cf/ResourceResponse.h b/WebCore/platform/network/cf/ResourceResponse.h
new file mode 100644 (file)
index 0000000..c930dfc
--- /dev/null
@@ -0,0 +1,65 @@
+// -*- 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
diff --git a/WebCore/platform/network/curl/ResourceResponse.h b/WebCore/platform/network/curl/ResourceResponse.h
new file mode 100644 (file)
index 0000000..3bb8a73
--- /dev/null
@@ -0,0 +1,57 @@
+// -*- 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)
+    {
+    }
+
+    ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename)
+        : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename)
+    {
+    }
+
+private:
+    friend class ResourceResponseBase;
+
+    void doUpdateResourceResponse()
+    {
+    }
+
+};
+
+} // namespace WebCore
+
+#endif // ResourceResponse_h
diff --git a/WebCore/platform/network/mac/ResourceResponse.h b/WebCore/platform/network/mac/ResourceResponse.h
new file mode 100644 (file)
index 0000000..be4f8dc
--- /dev/null
@@ -0,0 +1,70 @@
+// -*- 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>
+
+#ifdef __OBJC__
+@class NSURLResponse;
+#else
+class NSURLResponse;
+#endif
+
+namespace WebCore {
+
+class ResourceResponse : public ResourceResponseBase {
+public:
+    ResourceResponse()
+        : ResourceResponseBase()
+    {
+    }
+
+    ResourceResponse(NSURLResponse* nsResponse)
+        : ResourceResponseBase(!nsResponse)
+        , m_nsResponse(nsResponse) { }
+    
+    ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename)
+        : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename)
+    {
+    }
+
+    NSURLResponse *nsURLResponse() const;
+
+private:
+    friend class ResourceResponseBase;
+
+    void doUpdateResourceResponse();
+
+    RetainPtr<NSURLResponse> m_nsResponse;
+
+};
+
+} // namespace WebCore
+
+#endif // ResourceResponse_h
diff --git a/WebCore/platform/network/qt/ResourceResponse.h b/WebCore/platform/network/qt/ResourceResponse.h
new file mode 100644 (file)
index 0000000..fb658c9
--- /dev/null
@@ -0,0 +1,60 @@
+// -*- 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 "NotImplemented.h"
+
+namespace WebCore {
+
+class ResourceResponse : public ResourceResponseBase {
+public:
+    ResourceResponse()
+        : ResourceResponseBase(false)
+    {
+    }
+
+    ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename)
+        : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename)
+    {
+    }
+
+private:
+    friend class ResourceResponseBase;
+
+    void doUpdateResourceResponse()
+    {
+        notImplemented();
+    }
+
+};
+
+} // namespace WebCore
+
+#endif // ResourceResponse_h