2011-01-05 Pratik Solanki <psolanki@apple.com>
authorpsolanki@apple.com <psolanki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Jan 2011 21:55:45 +0000 (21:55 +0000)
committerpsolanki@apple.com <psolanki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Jan 2011 21:55:45 +0000 (21:55 +0000)
        Reviewed by Darin Adler.

        Merge cf and mac header files with same name
        https://bugs.webkit.org/show_bug.cgi?id=51916

        Since most of the code in the header files is identical, we can merge them and have #if
        USE(CFNETWORK) to separate out the network specific parts.

        * WebCore.xcodeproj/project.pbxproj:
        * platform/network/cf/AuthenticationChallenge.h:
        (WebCore::AuthenticationChallenge::sender):
        (WebCore::AuthenticationChallenge::nsURLAuthenticationChallenge):
        * platform/network/cf/ResourceError.h:
        (WebCore::ResourceError::ResourceError):
        * platform/network/cf/ResourceRequest.h:
        (WebCore::ResourceRequest::ResourceRequest):
        * platform/network/cf/ResourceResponse.h:
        (WebCore::ResourceResponse::ResourceResponse):
        * platform/network/mac/AuthenticationChallenge.h: Removed.
        * platform/network/mac/ResourceError.h: Removed.
        * platform/network/mac/ResourceRequest.h: Removed.
        * platform/network/mac/ResourceResponse.h: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@75103 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/platform/network/cf/AuthenticationChallenge.h
WebCore/platform/network/cf/ResourceError.h
WebCore/platform/network/cf/ResourceRequest.h
WebCore/platform/network/cf/ResourceResponse.h
WebCore/platform/network/mac/AuthenticationChallenge.h [deleted file]
WebCore/platform/network/mac/ResourceError.h [deleted file]
WebCore/platform/network/mac/ResourceRequest.h [deleted file]
WebCore/platform/network/mac/ResourceResponse.h [deleted file]

index bcc73bb..47fedc9 100644 (file)
@@ -1,3 +1,28 @@
+2011-01-05  Pratik Solanki  <psolanki@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Merge cf and mac header files with same name
+        https://bugs.webkit.org/show_bug.cgi?id=51916
+
+        Since most of the code in the header files is identical, we can merge them and have #if
+        USE(CFNETWORK) to separate out the network specific parts.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/network/cf/AuthenticationChallenge.h:
+        (WebCore::AuthenticationChallenge::sender):
+        (WebCore::AuthenticationChallenge::nsURLAuthenticationChallenge):
+        * platform/network/cf/ResourceError.h:
+        (WebCore::ResourceError::ResourceError):
+        * platform/network/cf/ResourceRequest.h:
+        (WebCore::ResourceRequest::ResourceRequest):
+        * platform/network/cf/ResourceResponse.h:
+        (WebCore::ResourceResponse::ResourceResponse):
+        * platform/network/mac/AuthenticationChallenge.h: Removed.
+        * platform/network/mac/ResourceError.h: Removed.
+        * platform/network/mac/ResourceRequest.h: Removed.
+        * platform/network/mac/ResourceResponse.h: Removed.
+
 2011-01-05  Anders Carlsson  <andersca@apple.com>
 
         Reviewed by Adele Peterson.
index 5519043..41c2532 100644 (file)
                514C764F0CE9234E007EF3CD /* FormDataStreamMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514C76450CE9234E007EF3CD /* FormDataStreamMac.mm */; };
                514C76500CE9234E007EF3CD /* ResourceErrorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514C76460CE9234E007EF3CD /* ResourceErrorMac.mm */; };
                514C76510CE9234E007EF3CD /* ResourceHandleMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514C76470CE9234E007EF3CD /* ResourceHandleMac.mm */; };
-               514C76520CE9234E007EF3CD /* ResourceRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C76480CE9234E007EF3CD /* ResourceRequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
                514C76530CE9234E007EF3CD /* ResourceRequestMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514C76490CE9234E007EF3CD /* ResourceRequestMac.mm */; };
-               514C76540CE9234E007EF3CD /* ResourceResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C764A0CE9234E007EF3CD /* ResourceResponse.h */; settings = {ATTRIBUTES = (Private, ); }; };
                514C76550CE9234F007EF3CD /* ResourceResponseMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514C764B0CE9234E007EF3CD /* ResourceResponseMac.mm */; };
                514C766D0CE923A1007EF3CD /* Credential.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C76580CE923A1007EF3CD /* Credential.cpp */; };
                514C766E0CE923A1007EF3CD /* Credential.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C76590CE923A1007EF3CD /* Credential.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7E33CD01127F340D00BE8F17 /* PurgePriority.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E33CD00127F340D00BE8F17 /* PurgePriority.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7EE6845F12D26E3800E79415 /* AuthenticationCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6844C12D26E3800E79415 /* AuthenticationCF.cpp */; };
                7EE6846012D26E3800E79415 /* AuthenticationCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6844D12D26E3800E79415 /* AuthenticationCF.h */; };
-               7EE6846112D26E3800E79415 /* AuthenticationChallenge.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6844E12D26E3800E79415 /* AuthenticationChallenge.h */; };
+               7EE6846112D26E3800E79415 /* AuthenticationChallenge.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6844E12D26E3800E79415 /* AuthenticationChallenge.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7EE6846212D26E3800E79415 /* CookieJarCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6844F12D26E3800E79415 /* CookieJarCFNet.cpp */; };
                7EE6846312D26E3800E79415 /* CookieStorageCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6845012D26E3800E79415 /* CookieStorageCFNet.cpp */; };
                7EE6846412D26E3800E79415 /* CookieStorageCFNet.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6845112D26E3800E79415 /* CookieStorageCFNet.h */; };
                7EE6846712D26E3800E79415 /* FormDataStreamCFNet.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6845412D26E3800E79415 /* FormDataStreamCFNet.h */; };
                7EE6846812D26E3800E79415 /* LoaderRunLoopCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6845512D26E3800E79415 /* LoaderRunLoopCF.cpp */; };
                7EE6846912D26E3800E79415 /* LoaderRunLoopCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6845612D26E3800E79415 /* LoaderRunLoopCF.h */; };
-               7EE6846A12D26E3800E79415 /* ResourceError.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6845712D26E3800E79415 /* ResourceError.h */; };
+               7EE6846A12D26E3800E79415 /* ResourceError.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6845712D26E3800E79415 /* ResourceError.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7EE6846B12D26E3800E79415 /* ResourceErrorCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6845812D26E3800E79415 /* ResourceErrorCF.cpp */; };
                7EE6846C12D26E3800E79415 /* ResourceHandleCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6845912D26E3800E79415 /* ResourceHandleCFNet.cpp */; };
-               7EE6846D12D26E3800E79415 /* ResourceRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6845A12D26E3800E79415 /* ResourceRequest.h */; };
+               7EE6846D12D26E3800E79415 /* ResourceRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6845A12D26E3800E79415 /* ResourceRequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7EE6846E12D26E3800E79415 /* ResourceRequestCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6845B12D26E3800E79415 /* ResourceRequestCFNet.cpp */; };
                7EE6846F12D26E3800E79415 /* ResourceRequestCFNet.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6845C12D26E3800E79415 /* ResourceRequestCFNet.h */; };
-               7EE6847012D26E3800E79415 /* ResourceResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6845D12D26E3800E79415 /* ResourceResponse.h */; };
+               7EE6847012D26E3800E79415 /* ResourceResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6845D12D26E3800E79415 /* ResourceResponse.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7EE6847112D26E3800E79415 /* ResourceResponseCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6845E12D26E3800E79415 /* ResourceResponseCFNet.cpp */; };
                7EE6847512D26E7000E79415 /* ResourceLoaderCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6847412D26E7000E79415 /* ResourceLoaderCFNet.cpp */; };
                81A7325E1210189B00FC0D9E /* IDBCursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 81A7325D1210189B00FC0D9E /* IDBCursor.h */; };
                934F713A0D5A6F1000018D69 /* AuthenticationChallengeBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 934F71390D5A6F1000018D69 /* AuthenticationChallengeBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
                934F713C0D5A6F1900018D69 /* ResourceErrorBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 934F713B0D5A6F1900018D69 /* ResourceErrorBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
                934F713E0D5A6F2800018D69 /* ResourceErrorBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 934F713D0D5A6F2800018D69 /* ResourceErrorBase.cpp */; };
-               934F71420D5A6F4400018D69 /* ResourceError.h in Headers */ = {isa = PBXBuildFile; fileRef = 934F71410D5A6F4400018D69 /* ResourceError.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               934F71440D5A6F5300018D69 /* AuthenticationChallenge.h in Headers */ = {isa = PBXBuildFile; fileRef = 934F71430D5A6F5300018D69 /* AuthenticationChallenge.h */; settings = {ATTRIBUTES = (Private, ); }; };
                934FE9E50B5CA539003E4A73 /* FileChooser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 934FE9E40B5CA539003E4A73 /* FileChooser.cpp */; };
                935207BE09BD410A00F2038D /* LocalizedStrings.h in Headers */ = {isa = PBXBuildFile; fileRef = 935207BD09BD410A00F2038D /* LocalizedStrings.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9352084509BD43B900F2038D /* Language.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9352084409BD43B900F2038D /* Language.mm */; };
                514C76450CE9234E007EF3CD /* FormDataStreamMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FormDataStreamMac.mm; sourceTree = "<group>"; };
                514C76460CE9234E007EF3CD /* ResourceErrorMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceErrorMac.mm; sourceTree = "<group>"; };
                514C76470CE9234E007EF3CD /* ResourceHandleMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceHandleMac.mm; sourceTree = "<group>"; };
-               514C76480CE9234E007EF3CD /* ResourceRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceRequest.h; sourceTree = "<group>"; };
                514C76490CE9234E007EF3CD /* ResourceRequestMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceRequestMac.mm; sourceTree = "<group>"; };
-               514C764A0CE9234E007EF3CD /* ResourceResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceResponse.h; sourceTree = "<group>"; };
                514C764B0CE9234E007EF3CD /* ResourceResponseMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceResponseMac.mm; sourceTree = "<group>"; };
                514C76580CE923A1007EF3CD /* Credential.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Credential.cpp; sourceTree = "<group>"; };
                514C76590CE923A1007EF3CD /* Credential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Credential.h; sourceTree = "<group>"; };
                934F71390D5A6F1000018D69 /* AuthenticationChallengeBase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AuthenticationChallengeBase.h; sourceTree = "<group>"; };
                934F713B0D5A6F1900018D69 /* ResourceErrorBase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ResourceErrorBase.h; sourceTree = "<group>"; };
                934F713D0D5A6F2800018D69 /* ResourceErrorBase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceErrorBase.cpp; sourceTree = "<group>"; };
-               934F71410D5A6F4400018D69 /* ResourceError.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ResourceError.h; sourceTree = "<group>"; };
-               934F71430D5A6F5300018D69 /* AuthenticationChallenge.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AuthenticationChallenge.h; sourceTree = "<group>"; };
                934FE9E40B5CA539003E4A73 /* FileChooser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileChooser.cpp; sourceTree = "<group>"; };
                935207BD09BD410A00F2038D /* LocalizedStrings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalizedStrings.h; sourceTree = "<group>"; };
                9352084409BD43B900F2038D /* Language.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Language.mm; sourceTree = "<group>"; };
                656B84E70AEA1DAE00A095B4 /* mac */ = {
                        isa = PBXGroup;
                        children = (
-                               934F71430D5A6F5300018D69 /* AuthenticationChallenge.h */,
                                514C76420CE9234E007EF3CD /* AuthenticationMac.h */,
                                514C76430CE9234E007EF3CD /* AuthenticationMac.mm */,
                                E13F01F01270E19000DFBA71 /* CookieStorageMac.mm */,
                                514C76440CE9234E007EF3CD /* FormDataStreamMac.h */,
                                514C76450CE9234E007EF3CD /* FormDataStreamMac.mm */,
                                1A7FA6470DDA3CBA0028F8A5 /* NetworkStateNotifierMac.cpp */,
-                               934F71410D5A6F4400018D69 /* ResourceError.h */,
                                514C76460CE9234E007EF3CD /* ResourceErrorMac.mm */,
                                514C76470CE9234E007EF3CD /* ResourceHandleMac.mm */,
-                               514C76480CE9234E007EF3CD /* ResourceRequest.h */,
                                514C76490CE9234E007EF3CD /* ResourceRequestMac.mm */,
-                               514C764A0CE9234E007EF3CD /* ResourceResponse.h */,
                                514C764B0CE9234E007EF3CD /* ResourceResponseMac.mm */,
                                37F818FB0D657606005E1F05 /* WebCoreURLResponse.h */,
                                37F818FC0D657606005E1F05 /* WebCoreURLResponse.mm */,
                                FD31602212B0267600C1A359 /* AudioSourceNode.h in Headers */,
                                FD31608912B026F700C1A359 /* AudioSourceProvider.h in Headers */,
                                FD31608B12B026F700C1A359 /* AudioUtilities.h in Headers */,
-                               934F71440D5A6F5300018D69 /* AuthenticationChallenge.h in Headers */,
                                934F713A0D5A6F1000018D69 /* AuthenticationChallengeBase.h in Headers */,
                                E124748410AA161D00B79493 /* AuthenticationClient.h in Headers */,
                                514C764C0CE9234E007EF3CD /* AuthenticationMac.h in Headers */,
                                A89CCC530F44E98100B5DA10 /* ReplaceNodeWithSpanCommand.h in Headers */,
                                93309E0A099E64920056E581 /* ReplaceSelectionCommand.h in Headers */,
                                F55B3DD01251F12D003EF269 /* ResetInputType.h in Headers */,
-                               934F71420D5A6F4400018D69 /* ResourceError.h in Headers */,
                                934F713C0D5A6F1900018D69 /* ResourceErrorBase.h in Headers */,
                                514C76790CE923A1007EF3CD /* ResourceHandle.h in Headers */,
                                514C767A0CE923A1007EF3CD /* ResourceHandleClient.h in Headers */,
                                E4295FA412B0614E00D1ACE0 /* ResourceLoadPriority.h in Headers */,
                                D0CE58F9125E4CC200F3F199 /* ResourceLoadScheduler.h in Headers */,
                                8A81BF8511DCFD9000DA2B98 /* ResourceLoadTiming.h in Headers */,
-                               514C76520CE9234E007EF3CD /* ResourceRequest.h in Headers */,
                                514C767D0CE923A1007EF3CD /* ResourceRequestBase.h in Headers */,
-                               514C76540CE9234E007EF3CD /* ResourceResponse.h in Headers */,
                                514C767F0CE923A1007EF3CD /* ResourceResponseBase.h in Headers */,
                                FD3160A512B026F700C1A359 /* Reverb.h in Headers */,
                                FD3160A712B026F700C1A359 /* ReverbAccumulationBuffer.h in Headers */,
index e7d66de..f396b54 100644 (file)
 #include "AuthenticationClient.h"
 #include <wtf/RefPtr.h>
 
+#if USE(CFNETWORK)
 typedef struct _CFURLAuthChallenge* CFURLAuthChallengeRef;
+#else
+#ifndef __OBJC__
+typedef struct objc_object *id;
+class NSURLAuthenticationChallenge;
+#else
+@class NSURLAuthenticationChallenge;
+#endif
+#endif
 
 namespace WebCore {
 
@@ -38,19 +47,34 @@ class AuthenticationChallenge : public AuthenticationChallengeBase {
 public:
     AuthenticationChallenge() {}
     AuthenticationChallenge(const ProtectionSpace& protectionSpace, const Credential& proposedCredential, unsigned previousFailureCount, const ResourceResponse& response, const ResourceError& error);
+#if USE(CFNETWORK)
     AuthenticationChallenge(CFURLAuthChallengeRef, AuthenticationClient*);
 
     AuthenticationClient* authenticationClient() const { return m_authenticationClient.get(); }
     void setAuthenticationClient(AuthenticationClient* client) { m_authenticationClient = client; }
 
     CFURLAuthChallengeRef cfURLAuthChallengeRef() const { return m_cfChallenge.get(); }
+#else
+    AuthenticationChallenge(NSURLAuthenticationChallenge *);
+
+    id sender() const { return m_sender.get(); }
+    NSURLAuthenticationChallenge *nsURLAuthenticationChallenge() const { return m_nsChallenge.get(); }
+
+    void setAuthenticationClient(AuthenticationClient*); // Changes sender to one that invokes client methods.
+    AuthenticationClient* authenticationClient() const;
+#endif
 
 private:
     friend class AuthenticationChallengeBase;
     static bool platformCompare(const AuthenticationChallenge& a, const AuthenticationChallenge& b);
 
+#if USE(CFNETWORK)
     RefPtr<AuthenticationClient> m_authenticationClient;
     RetainPtr<CFURLAuthChallengeRef> m_cfChallenge;
+#else
+    RetainPtr<id> m_sender; // Always the same as [m_macChallenge.get() sender], cached here for performance.
+    RetainPtr<NSURLAuthenticationChallenge *> m_nsChallenge;
+#endif
 };
 
 }
index 70c3fa5..aae9a4a 100644 (file)
 #ifndef ResourceError_h
 #define ResourceError_h
 
-#if USE(CFNETWORK)
-
 #include "ResourceErrorBase.h"
 
 #include <wtf/RetainPtr.h>
+#if USE(CFNETWORK)
 #include <CoreFoundation/CFStream.h>
+#else
+#ifdef __OBJC__
+@class NSError;
+#else
+class NSError;
+#endif
+#endif
 
 namespace WebCore {
 
@@ -48,6 +54,7 @@ public:
     {
     }
 
+#if USE(CFNETWORK)
     ResourceError(CFStreamError error);
 
     ResourceError(CFErrorRef error)
@@ -59,6 +66,16 @@ public:
 
     operator CFErrorRef() const;
     operator CFStreamError() const;
+#else
+    ResourceError(NSError* error)
+        : m_dataIsUpToDate(false)
+        , m_platformError(error)
+    {
+        m_isNull = !error;
+    }
+
+    operator NSError*() const;
+#endif
 
 private:
     friend class ResourceErrorBase;
@@ -67,11 +84,13 @@ private:
     static bool platformCompare(const ResourceError& a, const ResourceError& b);
 
     bool m_dataIsUpToDate;
+#if USE(CFNETWORK)
     mutable RetainPtr<CFErrorRef> m_platformError;
+#else
+    mutable RetainPtr<NSError> m_platformError;
+#endif
 };
 
 } // namespace WebCore
 
-#endif // USE(CFNETWORK)
-
 #endif // ResourceError_h
index ac1fb6b..172ebe1 100644 (file)
 #ifndef ResourceRequest_h
 #define ResourceRequest_h
 
-#if USE(CFNETWORK)
-
 #include "ResourceRequestBase.h"
 
 #include <wtf/RetainPtr.h>
+#if USE(CFNETWORK)
 typedef const struct _CFURLRequest* CFURLRequestRef;
+#else
+#ifdef __OBJC__
+@class NSURLRequest;
+#else
+class NSURLRequest;
+#endif
+#endif
 
 namespace WebCore {
 
@@ -59,11 +65,20 @@ namespace WebCore {
         {
         }
         
+#if USE(CFNETWORK)
         ResourceRequest(CFURLRequestRef cfRequest)
             : ResourceRequestBase()
             , m_cfRequest(cfRequest) { }
-        
-        CFURLRequestRef cfURLRequest() const;       
+
+        CFURLRequestRef cfURLRequest() const;
+#else
+        ResourceRequest(NSURLRequest* nsRequest)
+            : ResourceRequestBase()
+            , m_nsRequest(nsRequest) { }
+
+        void applyWebArchiveHackForMail();
+        NSURLRequest* nsURLRequest() const;
+#endif
 
     private:
         friend class ResourceRequestBase;
@@ -74,7 +89,11 @@ namespace WebCore {
         PassOwnPtr<CrossThreadResourceRequestData> doPlatformCopyData(PassOwnPtr<CrossThreadResourceRequestData> data) const { return data; }
         void doPlatformAdopt(PassOwnPtr<CrossThreadResourceRequestData>) { }
 
-        RetainPtr<CFURLRequestRef> m_cfRequest;      
+#if USE(CFNETWORK)
+        RetainPtr<CFURLRequestRef> m_cfRequest;
+#else
+        RetainPtr<NSURLRequest> m_nsRequest;
+#endif
     };
 
     struct CrossThreadResourceRequestData : public CrossThreadResourceRequestDataBase {
@@ -82,6 +101,4 @@ namespace WebCore {
 
 } // namespace WebCore
 
-#endif // USE(CFNETWORK)
-
 #endif // ResourceRequest_h
index a46fc6f..33b6ddc 100644 (file)
 #ifndef ResourceResponse_h
 #define ResourceResponse_h
 
-#if USE(CFNETWORK)
-
 #include "ResourceResponseBase.h"
 #include <wtf/RetainPtr.h>
 
+#if USE(CFNETWORK)
 typedef struct _CFURLResponse* CFURLResponseRef;
+#else
+#ifdef __OBJC__
+@class NSURLResponse;
+#else
+class NSURLResponse;
+#endif
+#endif
 
 namespace WebCore {
 
@@ -42,12 +48,21 @@ public:
     {
     }
 
+#if USE(CFNETWORK)
     ResourceResponse(CFURLResponseRef cfResponse)
         : m_cfResponse(cfResponse)
         , m_isUpToDate(false)
     {
         m_isNull = !cfResponse;
     }
+#else
+    ResourceResponse(NSURLResponse* nsResponse)
+        : m_nsResponse(nsResponse)
+        , m_isUpToDate(false)
+    {
+        m_isNull = !nsResponse;
+    }
+#endif
 
     ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename)
         : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename)
@@ -67,7 +82,11 @@ public:
          */
     }
 
+#if USE(CFNETWORK)
     CFURLResponseRef cfURLResponse() const;
+#else
+    NSURLResponse *nsURLResponse() const;
+#endif
 
 private:
     friend class ResourceResponseBase;
@@ -78,7 +97,11 @@ private:
 
     static bool platformCompare(const ResourceResponse& a, const ResourceResponse& b);
 
+#if USE(CFNETWORK)
     RetainPtr<CFURLResponseRef> m_cfResponse;
+#else
+    RetainPtr<NSURLResponse> m_nsResponse;
+#endif
     bool m_isUpToDate;
 };
 
@@ -87,6 +110,4 @@ struct CrossThreadResourceResponseData : public CrossThreadResourceResponseDataB
 
 } // namespace WebCore
 
-#endif // USE(CFNETWORK)
-
 #endif // ResourceResponse_h
diff --git a/WebCore/platform/network/mac/AuthenticationChallenge.h b/WebCore/platform/network/mac/AuthenticationChallenge.h
deleted file mode 100644 (file)
index 8f60933..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2007 Apple 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 AuthenticationChallenge_h
-#define AuthenticationChallenge_h
-
-#include "AuthenticationChallengeBase.h"
-
-#include <wtf/RetainPtr.h>
-#ifndef __OBJC__
-typedef struct objc_object *id;
-class NSURLAuthenticationChallenge;
-#else
-@class NSURLAuthenticationChallenge;
-#endif
-
-namespace WebCore {
-
-class AuthenticationClient;
-
-class AuthenticationChallenge : public AuthenticationChallengeBase {
-public:
-    AuthenticationChallenge() { }
-    AuthenticationChallenge(const ProtectionSpace& protectionSpace, const Credential& proposedCredential, unsigned previousFailureCount, const ResourceResponse& response, const ResourceError& error);
-    AuthenticationChallenge(NSURLAuthenticationChallenge *);
-
-    id sender() const { return m_sender.get(); }
-    NSURLAuthenticationChallenge *nsURLAuthenticationChallenge() const { return m_nsChallenge.get(); }
-
-    void setAuthenticationClient(AuthenticationClient*); // Changes sender to one that invokes client methods.
-    AuthenticationClient* authenticationClient() const;
-
-private:
-    friend class AuthenticationChallengeBase;
-    static bool platformCompare(const AuthenticationChallenge& a, const AuthenticationChallenge& b);
-
-    RetainPtr<id> m_sender; // Always the same as [m_macChallenge.get() sender], cached here for performance.
-    RetainPtr<NSURLAuthenticationChallenge *> m_nsChallenge;
-};
-
-}
-
-#endif
diff --git a/WebCore/platform/network/mac/ResourceError.h b/WebCore/platform/network/mac/ResourceError.h
deleted file mode 100644 (file)
index c05539e..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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 ResourceError_h
-#define ResourceError_h
-
-#if !USE(CFNETWORK)
-
-#include "ResourceErrorBase.h"
-#include <wtf/RetainPtr.h>
-
-#ifdef __OBJC__
-@class NSError;
-#else
-class NSError;
-#endif
-
-namespace WebCore {
-
-    class ResourceError : public ResourceErrorBase {
-    public:
-        ResourceError()
-            : m_dataIsUpToDate(true)
-        {
-        }
-
-        ResourceError(const String& domain, int errorCode, const String& failingURL, const String& localizedDescription)
-            : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription)
-            , m_dataIsUpToDate(true)
-        {
-        }
-
-        ResourceError(NSError* error)
-            : m_dataIsUpToDate(false)
-            , m_platformError(error)
-        {
-            m_isNull = !error;
-        }
-
-        operator NSError*() const;
-
-    private:
-        friend class ResourceErrorBase;
-
-        void platformLazyInit();
-        static bool platformCompare(const ResourceError& a, const ResourceError& b);
-
-        bool m_dataIsUpToDate;
-        mutable RetainPtr<NSError> m_platformError;
-};
-
-} // namespace WebCore
-
-#endif // !USE(CFNETWORK)
-
-#endif // ResourceError_h_
diff --git a/WebCore/platform/network/mac/ResourceRequest.h b/WebCore/platform/network/mac/ResourceRequest.h
deleted file mode 100644 (file)
index 9b1d788..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- *
- * 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 ResourceRequest_h
-#define ResourceRequest_h
-
-#if !USE(CFNETWORK)
-
-#include "ResourceRequestBase.h"
-
-#include <wtf/RetainPtr.h>
-#ifdef __OBJC__
-@class NSURLRequest;
-#else
-class NSURLRequest;
-#endif
-
-namespace WebCore {
-
-    class ResourceRequest : public ResourceRequestBase {
-    public:
-        ResourceRequest(const String& url) 
-            : ResourceRequestBase(KURL(ParsedURLString, url), UseProtocolCachePolicy)
-        {
-        }
-
-        ResourceRequest(const KURL& url) 
-            : ResourceRequestBase(url, UseProtocolCachePolicy)
-        {
-        }
-
-        ResourceRequest(const KURL& url, const String& referrer, ResourceRequestCachePolicy policy = UseProtocolCachePolicy) 
-            : ResourceRequestBase(url, policy)
-        {
-            setHTTPReferrer(referrer);
-        }
-        
-        ResourceRequest()
-            : ResourceRequestBase(KURL(), UseProtocolCachePolicy)
-        {
-        }
-        
-        ResourceRequest(NSURLRequest* nsRequest)
-            : ResourceRequestBase()
-            , m_nsRequest(nsRequest) { }
-        
-        void applyWebArchiveHackForMail();
-        NSURLRequest* nsURLRequest() const;
-
-    private:
-        friend class ResourceRequestBase;
-
-        void doUpdatePlatformRequest();
-        void doUpdateResourceRequest();
-
-        PassOwnPtr<CrossThreadResourceRequestData> doPlatformCopyData(PassOwnPtr<CrossThreadResourceRequestData> data) const { return data; }
-        void doPlatformAdopt(PassOwnPtr<CrossThreadResourceRequestData>) { }
-
-        RetainPtr<NSURLRequest> m_nsRequest;
-    };
-
-    struct CrossThreadResourceRequestData : public CrossThreadResourceRequestDataBase {
-    };
-
-} // namespace WebCore
-
-#endif // !USE(CFNETWORK)
-
-#endif // ResourceRequest_h
diff --git a/WebCore/platform/network/mac/ResourceResponse.h b/WebCore/platform/network/mac/ResourceResponse.h
deleted file mode 100644 (file)
index 7ef443b..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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
-
-#if !USE(CFNETWORK)
-
-#include "ResourceResponseBase.h"
-#include <wtf/RetainPtr.h>
-
-#ifdef __OBJC__
-@class NSURLResponse;
-#else
-class NSURLResponse;
-#endif
-
-namespace WebCore {
-
-class ResourceResponse : public ResourceResponseBase {
-public:
-    ResourceResponse()
-        : m_isUpToDate(true)
-    {
-    }
-
-    ResourceResponse(NSURLResponse* nsResponse)
-        : m_nsResponse(nsResponse)
-        , m_isUpToDate(false)
-    {
-        m_isNull = !nsResponse;
-    }
-    
-    ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename)
-        : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename)
-        , m_isUpToDate(true)
-    {
-    }
-
-    unsigned memoryUsage() const
-    {
-        // FIXME: Find some programmatic lighweight way to calculate ResourceResponse and associated classes.
-        // This is a rough estimate of resource overhead based on stats collected from the stress test.
-        return 3072;
-        /*  1280 * 2 +                // average size of ResourceResponse. Doubled to account for the WebCore copy and the CF copy.
-                                      // Mostly due to the size of the hash maps, the Header Map strings and the URL.
-            256 * 2                   // Overhead from ResourceRequest, doubled to account for WebCore copy and CF copy.
-                                      // Mostly due to the URL and Header Map.
-         */
-    }
-
-    NSURLResponse *nsURLResponse() const;
-
-private:
-    friend class ResourceResponseBase;
-
-    void platformLazyInit();
-
-    PassOwnPtr<CrossThreadResourceResponseData> doPlatformCopyData(PassOwnPtr<CrossThreadResourceResponseData> data) const { return data; }
-    void doPlatformAdopt(PassOwnPtr<CrossThreadResourceResponseData>) { }
-
-    static bool platformCompare(const ResourceResponse& a, const ResourceResponse& b);
-
-    RetainPtr<NSURLResponse> m_nsResponse;
-    bool m_isUpToDate;
-};
-
-struct CrossThreadResourceResponseData : public CrossThreadResourceResponseDataBase {
-};
-
-} // namespace WebCore
-
-#endif // !USE(CFNETWORK)
-
-#endif // ResourceResponse_h