Add URLRequest API for WebKit2
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Aug 2010 00:51:30 +0000 (00:51 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Aug 2010 00:51:30 +0000 (00:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=44910

Reviewed by Anders Carlsson.

Add WebURLRequest class and WKURLRequestRef C API to go with it. Right now,
instance of WKURLRequestRef are manipulated via platform types, a la the
WKStringRef and WKURLRef types.

- Pipes WKPageLoadURLRequest through to the WebProcess.

* Shared/APIObject.h:
* Shared/CoreIPCSupport/WebPageMessageKinds.h:
* Shared/WebCoreArgumentCoders.h:
* Shared/WebURLRequest.cpp: Added.
(WebKit::WebURLRequest::WebURLRequest):
* Shared/WebURLRequest.h: Added.
(WebKit::WebURLRequest::create):
(WebKit::WebURLRequest::resourceRequest):
(WebKit::WebURLRequest::type):
* Shared/mac/WebCoreArgumentCodersMac.mm: Added.
(CoreIPC::encodeResourceRequest):
(CoreIPC::decodeResourceRequest):
* Shared/mac/WebURLRequestMac.mm: Added.
(WebKit::WebURLRequest::WebURLRequest):
(WebKit::WebURLRequest::platformRequest):
* Shared/qt/WebCoreArgumentCodersQt.cpp: Added.
(CoreIPC::encodeResourceRequest):
(CoreIPC::decodeResourceRequest):
* Shared/qt/WebURLRequestQt.cpp: Added.
(WebKit::WebURLRequest::WebURLRequest):
(WebKit::WebURLRequest::platformRequest):
* Shared/win/WebCoreArgumentCodersWin.cpp: Added.
(CoreIPC::encodeResourceRequest):
(CoreIPC::decodeResourceRequest):
* Shared/win/WebURLRequestWin.cpp: Added.
(WebKit::WebURLRequest::WebURLRequest):
(WebKit::WebURLRequest::platformRequest):
* UIProcess/API/C/WKAPICast.h:
* UIProcess/API/C/WKBase.h:
* UIProcess/API/C/WKPage.cpp:
(WKPageLoadURLRequest):
* UIProcess/API/C/WKPage.h:
* UIProcess/API/C/WKURLRequest.cpp: Added.
(WKURLRequestGetTypeID):
* UIProcess/API/C/WKURLRequest.h: Added.
* UIProcess/API/C/WebKit2.h:
* UIProcess/API/C/cf/WKURLRequestCF.cpp: Added.
(WKURLRequestCreateWithCFURLRequest):
(WKURLRequestCopyCFURLRequest):
* UIProcess/API/C/cf/WKURLRequestCF.h: Added.
* UIProcess/API/C/mac: Added.
* UIProcess/API/C/mac/WKURLRequestNS.h: Added.
* UIProcess/API/C/mac/WKURLRequestNS.mm: Added.
(WKURLRequestCreateWithNSURLRequest):
(WKURLRequestCopyNSURLRequest):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadURL):
(WebKit::WebPageProxy::loadURLRequest):
* UIProcess/WebPageProxy.h:
* WebKit2.pro:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadURL):
(WebKit::WebPage::loadURLRequest):
(WebKit::WebPage::didReceiveMessage):
* WebProcess/WebPage/WebPage.h:
* win/WebKit2.vcproj:
* win/WebKit2Generated.make:

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

31 files changed:
WebKit2/ChangeLog
WebKit2/Shared/APIObject.h
WebKit2/Shared/CoreIPCSupport/WebPageMessageKinds.h
WebKit2/Shared/WebCoreArgumentCoders.h
WebKit2/Shared/WebURLRequest.cpp [new file with mode: 0644]
WebKit2/Shared/WebURLRequest.h [new file with mode: 0644]
WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm [new file with mode: 0644]
WebKit2/Shared/mac/WebURLRequestMac.mm [new file with mode: 0644]
WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp [new file with mode: 0644]
WebKit2/Shared/qt/WebURLRequestQt.cpp [new file with mode: 0644]
WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp [new file with mode: 0644]
WebKit2/Shared/win/WebURLRequestWin.cpp [new file with mode: 0644]
WebKit2/UIProcess/API/C/WKAPICast.h
WebKit2/UIProcess/API/C/WKBase.h
WebKit2/UIProcess/API/C/WKPage.cpp
WebKit2/UIProcess/API/C/WKPage.h
WebKit2/UIProcess/API/C/WKURLRequest.cpp [new file with mode: 0644]
WebKit2/UIProcess/API/C/WKURLRequest.h [new file with mode: 0644]
WebKit2/UIProcess/API/C/WebKit2.h
WebKit2/UIProcess/API/C/cf/WKURLRequestCF.cpp [new file with mode: 0644]
WebKit2/UIProcess/API/C/cf/WKURLRequestCF.h [new file with mode: 0644]
WebKit2/UIProcess/API/C/mac/WKURLRequestNS.h [new file with mode: 0644]
WebKit2/UIProcess/API/C/mac/WKURLRequestNS.mm [new file with mode: 0644]
WebKit2/UIProcess/WebPageProxy.cpp
WebKit2/UIProcess/WebPageProxy.h
WebKit2/WebKit2.pro
WebKit2/WebKit2.xcodeproj/project.pbxproj
WebKit2/WebProcess/WebPage/WebPage.cpp
WebKit2/WebProcess/WebPage/WebPage.h
WebKit2/win/WebKit2.vcproj
WebKit2/win/WebKit2Generated.make

index 585176e..7c4e700 100644 (file)
@@ -1,3 +1,75 @@
+2010-08-30  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        Add URLRequest API for WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=44910
+
+        Add WebURLRequest class and WKURLRequestRef C API to go with it. Right now,
+        instance of WKURLRequestRef are manipulated via platform types, a la the
+        WKStringRef and WKURLRef types.
+
+        - Pipes WKPageLoadURLRequest through to the WebProcess.
+
+        * Shared/APIObject.h:
+        * Shared/CoreIPCSupport/WebPageMessageKinds.h:
+        * Shared/WebCoreArgumentCoders.h:
+        * Shared/WebURLRequest.cpp: Added.
+        (WebKit::WebURLRequest::WebURLRequest):
+        * Shared/WebURLRequest.h: Added.
+        (WebKit::WebURLRequest::create):
+        (WebKit::WebURLRequest::resourceRequest):
+        (WebKit::WebURLRequest::type):
+        * Shared/mac/WebCoreArgumentCodersMac.mm: Added.
+        (CoreIPC::encodeResourceRequest):
+        (CoreIPC::decodeResourceRequest):
+        * Shared/mac/WebURLRequestMac.mm: Added.
+        (WebKit::WebURLRequest::WebURLRequest):
+        (WebKit::WebURLRequest::platformRequest):
+        * Shared/qt/WebCoreArgumentCodersQt.cpp: Added.
+        (CoreIPC::encodeResourceRequest):
+        (CoreIPC::decodeResourceRequest):
+        * Shared/qt/WebURLRequestQt.cpp: Added.
+        (WebKit::WebURLRequest::WebURLRequest):
+        (WebKit::WebURLRequest::platformRequest):
+        * Shared/win/WebCoreArgumentCodersWin.cpp: Added.
+        (CoreIPC::encodeResourceRequest):
+        (CoreIPC::decodeResourceRequest):
+        * Shared/win/WebURLRequestWin.cpp: Added.
+        (WebKit::WebURLRequest::WebURLRequest):
+        (WebKit::WebURLRequest::platformRequest):
+        * UIProcess/API/C/WKAPICast.h:
+        * UIProcess/API/C/WKBase.h:
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageLoadURLRequest):
+        * UIProcess/API/C/WKPage.h:
+        * UIProcess/API/C/WKURLRequest.cpp: Added.
+        (WKURLRequestGetTypeID):
+        * UIProcess/API/C/WKURLRequest.h: Added.
+        * UIProcess/API/C/WebKit2.h:
+        * UIProcess/API/C/cf/WKURLRequestCF.cpp: Added.
+        (WKURLRequestCreateWithCFURLRequest):
+        (WKURLRequestCopyCFURLRequest):
+        * UIProcess/API/C/cf/WKURLRequestCF.h: Added.
+        * UIProcess/API/C/mac: Added.
+        * UIProcess/API/C/mac/WKURLRequestNS.h: Added.
+        * UIProcess/API/C/mac/WKURLRequestNS.mm: Added.
+        (WKURLRequestCreateWithNSURLRequest):
+        (WKURLRequestCopyNSURLRequest):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::loadURL):
+        (WebKit::WebPageProxy::loadURLRequest):
+        * UIProcess/WebPageProxy.h:
+        * WebKit2.pro:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::loadURL):
+        (WebKit::WebPage::loadURLRequest):
+        (WebKit::WebPage::didReceiveMessage):
+        * WebProcess/WebPage/WebPage.h:
+        * win/WebKit2.vcproj:
+        * win/WebKit2Generated.make:
+
 2010-08-30  Anders Carlsson  <andersca@apple.com>
 
         Reviewed by Sam Weinig.
index 54d6685..4f7cdf0 100644 (file)
@@ -35,11 +35,12 @@ public:
     enum Type {
         // Base types
         TypeArray,
-        TypeDictionary,
         TypeData,
+        TypeDictionary,
         TypeError,
         TypeString,
         TypeURL,
+        TypeURLRequest,
         
         // UIProcess types
         TypeBackForwardList,
index 810c442..b92cc75 100644 (file)
@@ -41,6 +41,7 @@ enum Kind {
     GoToBackForwardItem,
     KeyEvent,
     LoadURL,
+    LoadURLRequest,
     MouseEvent,
     PreferencesDidChange,
     Reload,
index 0c20f32..85369e6 100644 (file)
@@ -34,6 +34,8 @@
 #include <WebCore/FloatRect.h>
 #include <WebCore/IntRect.h>
 #include <WebCore/PluginData.h>
+#include <WebCore/ResourceRequest.h>
+#include <WebCore/ResourceResponse.h>
 #include <wtf/text/WTFString.h>
 
 namespace CoreIPC {
@@ -137,6 +139,22 @@ template<> struct ArgumentCoder<WebCore::Cursor> {
 };
 #endif
 
+// These two functions are implemented in a platform specific manner.
+void encodeResourceRequest(ArgumentEncoder*, const WebCore::ResourceRequest&);
+bool decodeResourceRequest(ArgumentDecoder*, WebCore::ResourceRequest&);
+
+template<> struct ArgumentCoder<WebCore::ResourceRequest> {
+    static void encode(ArgumentEncoder* encoder, const WebCore::ResourceRequest& resourceRequest)
+    {
+        encodeResourceRequest(encoder, resourceRequest);
+    }
+    
+    static bool decode(ArgumentDecoder* decoder, WebCore::ResourceRequest& resourceRequest)
+    {
+        return decodeResourceRequest(decoder, resourceRequest);
+    }
+};
+
 } // namespace CoreIPC
 
 #endif // WebCoreArgumentCoders_h
diff --git a/WebKit2/Shared/WebURLRequest.cpp b/WebKit2/Shared/WebURLRequest.cpp
new file mode 100644 (file)
index 0000000..27a5e05
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ *  WebURLRequest.cpp
+ *  WebKit2
+ *
+ *  Created by Sam Weinig on 8/30/10.
+ *  Copyright 2010 Apple Inc. All rights reserved.
+ *
+ */
+
+#include "WebURLRequest.h"
+
+namespace WebKit {
+
+WebURLRequest::WebURLRequest(const WebCore::KURL& url)
+    : m_request(url)
+{
+}
+
+} // namespace WebKit
diff --git a/WebKit2/Shared/WebURLRequest.h b/WebKit2/Shared/WebURLRequest.h
new file mode 100644 (file)
index 0000000..a35b994
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 WebURLRequest_h
+#define WebURLRequest_h
+
+#include "APIObject.h"
+#include <WebCore/ResourceRequest.h>
+#include <wtf/Forward.h>
+
+#if PLATFORM(MAC)
+typedef NSURLRequest* PlatformRequest;
+#elif PLATFORM(WIN)
+typedef CFURLRequestRef PlatformRequest;
+#else
+typedef void* PlatformRequest;
+#endif
+
+namespace WebKit {
+
+class WebURLRequest : public APIObject {
+public:
+    static const Type APIType = TypeURLRequest;
+
+    static PassRefPtr<WebURLRequest> create(const WebCore::KURL& url)
+    {
+        return adoptRef(new WebURLRequest(url));
+    }
+
+    static PassRefPtr<WebURLRequest> create(PlatformRequest platformRequest)
+    {
+        return adoptRef(new WebURLRequest(platformRequest));
+    }
+
+    PlatformRequest platformRequest() const;
+    const WebCore::ResourceRequest& resourceRequest() const { return m_request; }
+
+private:
+    explicit WebURLRequest(const WebCore::KURL&);
+    explicit WebURLRequest(PlatformRequest);
+
+    virtual Type type() const { return APIType; }
+
+    WebCore::ResourceRequest m_request;
+};
+
+} // namespace WebKit
+
+#endif // WebURLRequest_h
diff --git a/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm b/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm
new file mode 100644 (file)
index 0000000..2f33cd1
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#include "WebCoreArgumentCoders.h"
+
+namespace CoreIPC {
+
+void encodeResourceRequest(ArgumentEncoder* encoder, const WebCore::ResourceRequest& resourceRequest)
+{
+    NSURLRequest *nsURLRequest = resourceRequest.nsURLRequest();
+    NSData *data = [NSKeyedArchiver archivedDataWithRootObject:nsURLRequest];
+
+    encoder->encodeBytes(static_cast<const uint8_t*>([data bytes]), [data length]);
+}
+
+bool decodeResourceRequest(ArgumentDecoder* decoder, WebCore::ResourceRequest& resourceRequest)
+{
+    Vector<uint8_t> bytes;
+    if (!decoder->decodeBytes(bytes))
+        return false;
+
+    NSData *nsData = [[NSData alloc] initWithBytesNoCopy:bytes.data() length:bytes.size() freeWhenDone:NO];
+    NSURLRequest *nsURLRequest = [NSKeyedUnarchiver unarchiveObjectWithData:nsData];
+    if (!nsURLRequest)
+        return false;
+
+    resourceRequest = WebCore::ResourceRequest(nsURLRequest);
+
+    return true;
+}
+
+} // namespace CoreIPC
diff --git a/WebKit2/Shared/mac/WebURLRequestMac.mm b/WebKit2/Shared/mac/WebURLRequestMac.mm
new file mode 100644 (file)
index 0000000..a7196f7
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#include "WebURLRequest.h"
+
+namespace WebKit {
+
+WebURLRequest::WebURLRequest(PlatformRequest platformRequest)
+    : m_request(platformRequest)
+{
+}
+
+PlatformRequest WebURLRequest::platformRequest() const
+{
+    return m_request.nsURLRequest();
+}
+
+} // namespace WebKit
diff --git a/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp b/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp
new file mode 100644 (file)
index 0000000..a661914
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#include "WebCoreArgumentCoders.h"
+#include "NotImplemented.h"
+
+namespace CoreIPC {
+
+void encodeResourceRequest(ArgumentEncoder* encoder, const WebCore::ResourceRequest& resourceRequest)
+{
+    notImplemented();
+}
+
+bool decodeResourceRequest(ArgumentDecoder* decoder, WebCore::ResourceRequest& resourceRequest)
+{
+    notImplemented();
+    return false;
+}
+
+} // namespace CoreIPC
diff --git a/WebKit2/Shared/qt/WebURLRequestQt.cpp b/WebKit2/Shared/qt/WebURLRequestQt.cpp
new file mode 100644 (file)
index 0000000..834353a
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#include "WebURLRequest.h"
+
+namespace WebKit {
+
+WebURLRequest::WebURLRequest(PlatformRequest)
+{
+    ASSERT_NOT_REACHED();
+}
+
+PlatformRequest WebURLRequest::platformRequest() const
+{
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
+} // namespace WebKit
diff --git a/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp b/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp
new file mode 100644 (file)
index 0000000..cea7913
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#include "WebCoreArgumentCoders.h"
+
+#include "NotImplemented.h"
+
+namespace CoreIPC {
+
+void encodeResourceRequest(ArgumentEncoder* encoder, const WebCore::ResourceRequest& resourceRequest)
+{
+    notImplemented();
+}
+
+bool decodeResourceRequest(ArgumentDecoder* decoder, WebCore::ResourceRequest& resourceRequest)
+{
+    notImplemented();
+    return false;
+}
+
+} // namespace CoreIPC
diff --git a/WebKit2/Shared/win/WebURLRequestWin.cpp b/WebKit2/Shared/win/WebURLRequestWin.cpp
new file mode 100644 (file)
index 0000000..e64d451
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#include "WebURLRequest.h"
+
+namespace WebKit {
+
+WebURLRequest::WebURLRequest(PlatformRequest platformRequest)
+    : m_request(platformRequest)
+{
+}
+
+PlatformRequest WebURLRequest::platformRequest() const
+{
+    return m_request.cfURLRequest();
+}
+
+} // namespace WebKit
index dc76f85..b25e523 100644 (file)
@@ -53,7 +53,8 @@ class WebNavigationData;
 class WebPageNamespace;
 class WebPageProxy;
 class WebPreferences;
-class WebString;
+class WebURLRequest;
+class WebURLResponse;
 
 template<typename APIType> struct APITypeInfo { };
 template<> struct APITypeInfo<WKTypeRef>                        { typedef APIObject* ImplType; };
@@ -72,6 +73,8 @@ template<> struct APITypeInfo<WKPageRef>                        { typedef WebPag
 template<> struct APITypeInfo<WKPreferencesRef>                 { typedef WebPreferences* ImplType; };
 template<> struct APITypeInfo<WKStringRef>                      { typedef WebString* ImplType; };
 template<> struct APITypeInfo<WKURLRef>                         { typedef WebURL* ImplType; };
+template<> struct APITypeInfo<WKURLRequestRef>                  { typedef WebURLRequest* ImplType; };
+template<> struct APITypeInfo<WKURLResponseRef>                 { typedef WebURLResponse* ImplType; };
 
 
 template<typename ImplType> struct ImplTypeInfo { };
@@ -92,6 +95,8 @@ template<> struct ImplTypeInfo<WebPageProxy*>                   { typedef WKPage
 template<> struct ImplTypeInfo<WebPreferences*>                 { typedef WKPreferencesRef APIType; };
 template<> struct ImplTypeInfo<WebString*>                      { typedef WKStringRef APIType; };
 template<> struct ImplTypeInfo<WebURL*>                         { typedef WKURLRef APIType; };
+template<> struct ImplTypeInfo<WebURLRequest*>                  { typedef WKURLRequestRef APIType; };
+template<> struct ImplTypeInfo<WebURLResponse*>                 { typedef WKURLResponseRef APIType; };
 
 
 template<typename ImplType, typename APIType = typename ImplTypeInfo<ImplType*>::APIType>
index 81948ee..ac52360 100644 (file)
@@ -51,6 +51,8 @@ typedef struct OpaqueWKPageNamespace* WKPageNamespaceRef;
 typedef struct OpaqueWKPreferences* WKPreferencesRef;
 typedef struct OpaqueWKString* WKStringRef;
 typedef struct OpaqueWKURL* WKURLRef;
+typedef struct OpaqueWKURLRequest* WKURLRequestRef;
+typedef struct OpaqueWKURLResponse* WKURLResponseRef;
 
 #undef WK_EXPORT
 #if defined(WK_NO_EXPORT)
index 99e1aea..ee21029 100644 (file)
@@ -52,6 +52,11 @@ void WKPageLoadURL(WKPageRef pageRef, WKURLRef URLRef)
     toWK(pageRef)->loadURL(toWK(URLRef)->string());
 }
 
+void WKPageLoadURLRequest(WKPageRef pageRef, WKURLRequestRef urlRequestRef)
+{
+    toWK(pageRef)->loadURLRequest(toWK(urlRequestRef));    
+}
+
 void WKPageStopLoading(WKPageRef pageRef)
 {
     toWK(pageRef)->stopLoading();
index 184443e..44209cf 100644 (file)
@@ -158,6 +158,8 @@ WK_EXPORT WKTypeID WKPageGetTypeID();
 WK_EXPORT WKPageNamespaceRef WKPageGetPageNamespace(WKPageRef page);
 
 WK_EXPORT void WKPageLoadURL(WKPageRef page, WKURLRef url);
+WK_EXPORT void WKPageLoadURLRequest(WKPageRef page, WKURLRequestRef urlRequest);
+
 WK_EXPORT void WKPageStopLoading(WKPageRef page);
 WK_EXPORT void WKPageReload(WKPageRef page);
 WK_EXPORT void WKPageReloadFromOrigin(WKPageRef page);
diff --git a/WebKit2/UIProcess/API/C/WKURLRequest.cpp b/WebKit2/UIProcess/API/C/WKURLRequest.cpp
new file mode 100644 (file)
index 0000000..dc07730
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#include "WKURLRequest.h"
+
+#include "WKAPICast.h"
+#include "WebURLRequest.h"
+
+using namespace WebKit;
+
+WKTypeID WKURLRequestGetTypeID()
+{
+    return toRef(WebURLRequest::APIType);
+}
diff --git a/WebKit2/UIProcess/API/C/WKURLRequest.h b/WebKit2/UIProcess/API/C/WKURLRequest.h
new file mode 100644 (file)
index 0000000..cb9d003
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 WKURLRequest_h
+#define WKURLRequest_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKURLRequestGetTypeID();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKURLRequest_h */
index e84c0c5..59393c3 100644 (file)
@@ -45,6 +45,7 @@
 #include <WebKit2/WKPreferences.h>
 #include <WebKit2/WKString.h>
 #include <WebKit2/WKURL.h>
+#include <WebKit2/WKURLRequest.h>
 
 #if !__APPLE__ || __OBJC__
 #include <WebKit2/WKView.h>
diff --git a/WebKit2/UIProcess/API/C/cf/WKURLRequestCF.cpp b/WebKit2/UIProcess/API/C/cf/WKURLRequestCF.cpp
new file mode 100644 (file)
index 0000000..d9c127f
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#include "WKURLRequestCF.h"
+
+#include "WKAPICast.h"
+#include "WebURLRequest.h"
+
+using namespace WebKit;
+
+WKURLRequestRef WKURLRequestCreateWithCFURLRequest(CFURLRequestRef urlRequest)
+{
+    CFURLRequestRef copiedURLRequest = CFURLRequestCreateCopy(kCFAllocatorDefault, urlRequest);
+    RefPtr<WebURLRequest> request = WebURLRequest::create(copiedURLRequest);
+    return toRef(request.release().releaseRef());
+}
+
+CFURLRequestRef WKURLRequestCopyCFURLRequest(CFAllocatorRef alloc, WKURLRequestRef urlRequest)
+{
+    return CFURLRequestCreateCopy(alloc, toWK(urlRequest)->platformRequest());
+}
diff --git a/WebKit2/UIProcess/API/C/cf/WKURLRequestCF.h b/WebKit2/UIProcess/API/C/cf/WKURLRequestCF.h
new file mode 100644 (file)
index 0000000..fb7dab2
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 WKURLRequestCF_h
+#define WKURLRequestCF_h
+
+#include <CFNetwork/CFURLRequestPriv.h>
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKURLRequestRef WKURLRequestCreateWithCFURLRequest(CFURLRequestRef urlRequest);
+WK_EXPORT CFURLRequestRef WKURLRequestCopyCFURLRequest(CFAllocatorRef alloc, WKURLRequestRef urlRequest);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKURLRequestCF_h */
diff --git a/WebKit2/UIProcess/API/C/mac/WKURLRequestNS.h b/WebKit2/UIProcess/API/C/mac/WKURLRequestNS.h
new file mode 100644 (file)
index 0000000..0b9ebfb
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 WKURLRequestNS_h
+#define WKURLRequestNS_h
+
+#include <Foundation/Foundation.h>
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKURLRequestRef WKURLRequestCreateWithNSURLRequest(NSURLRequest* urlRequest);
+WK_EXPORT NSURLRequest* WKURLRequestCopyNSURLRequest(CFAllocatorRef alloc, WKURLRequestRef urlRequest);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKURLRequestNS_h */
diff --git a/WebKit2/UIProcess/API/C/mac/WKURLRequestNS.mm b/WebKit2/UIProcess/API/C/mac/WKURLRequestNS.mm
new file mode 100644 (file)
index 0000000..67a8257
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#include "WKURLRequestNS.h"
+
+#include "WKAPICast.h"
+#include "WebURLRequest.h"
+
+using namespace WebKit;
+
+WKURLRequestRef WKURLRequestCreateWithNSURLRequest(NSURLRequest* urlRequest)
+{
+    RetainPtr<NSURLRequest> copiedURLRequest(AdoptNS, [urlRequest copy]);
+    RefPtr<WebURLRequest> request = WebURLRequest::create(copiedURLRequest.get());
+    return toRef(request.release().releaseRef());
+}
+
+NSURLRequest* WKURLRequestCopyNSURLRequest(CFAllocatorRef alloc, WKURLRequestRef urlRequest)
+{
+    return [toWK(urlRequest)->platformRequest() copy];
+}
index 0517a69..6d41c09 100644 (file)
@@ -43,6 +43,7 @@
 #include "WebProcessManager.h"
 #include "WebProcessMessageKinds.h"
 #include "WebProcessProxy.h"
+#include "WebURLRequest.h"
 
 #include "WKContextPrivate.h"
 #include <stdio.h>
@@ -212,9 +213,20 @@ void WebPageProxy::loadURL(const String& url)
         puts("loadURL called with a dead WebProcess");
         revive();
     }
+
     process()->send(WebPageMessage::LoadURL, m_pageID, CoreIPC::In(url));
 }
 
+void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest)
+{
+    if (!isValid()) {
+        puts("loadURLRequest called with a dead WebProcess");
+        revive();
+    }
+
+    process()->send(WebPageMessage::LoadURLRequest, m_pageID, CoreIPC::In(urlRequest->resourceRequest()));
+}
+
 void WebPageProxy::stopLoading()
 {
     if (!isValid())
index 6e41822..3b7c881 100644 (file)
@@ -69,6 +69,7 @@ class WebKeyboardEvent;
 class WebMouseEvent;
 class WebPageNamespace;
 class WebProcessProxy;
+class WebURLRequest;
 class WebWheelEvent;
 struct WebNavigationDataStore;
 
@@ -107,6 +108,8 @@ public:
     bool isClosed() const { return m_closed; }
 
     void loadURL(const WTF::String&);
+    void loadURLRequest(WebURLRequest*);
+
     void stopLoading();
     void reload(bool reloadFromOrigin);
 
index 95d4328..c7e72fa 100644 (file)
@@ -165,6 +165,7 @@ HEADERS += \
     Shared/WebEvent.h \
     Shared/WebNavigationDataStore.h \
     Shared/WebPreferencesStore.h \
+    Shared/WebURLRequest.h \
     UIProcess/API/cpp/WKRetainPtr.h \
     UIProcess/API/cpp/qt/WKStringQt.h \
     UIProcess/API/cpp/qt/WKURLQt.h \
@@ -183,6 +184,7 @@ HEADERS += \
     UIProcess/API/C/WKString.h \
     UIProcess/API/C/WKType.h \
     UIProcess/API/C/WKURL.h \
+    UIProcess/API/C/WKURLRequest.h \
     UIProcess/API/qt/qgraphicswkview.h \
     UIProcess/API/qt/qwkpage.h \
     UIProcess/API/qt/qwkpage_p.h \
@@ -266,8 +268,11 @@ SOURCES += \
     Shared/VisitedLinkTable.cpp \
     Shared/WebEventConversion.cpp \
     Shared/WebPreferencesStore.cpp \
+    Shared/WebURLRequest.cpp \
     Shared/qt/UpdateChunk.cpp \
     Shared/qt/WebEventFactoryQt.cpp \
+    Shared/qt/WebCoreArgumentCodersQt.cpp \
+    Shared/qt/WebURLRequestQt.cpp \
     UIProcess/API/C/WKContext.cpp \
     UIProcess/API/C/WKFrame.cpp \
     UIProcess/API/C/WKFramePolicyListener.cpp \
@@ -278,6 +283,7 @@ SOURCES += \
     UIProcess/API/C/WKString.cpp \
     UIProcess/API/C/WKType.cpp \
     UIProcess/API/C/WKURL.cpp \
+    UIProcess/API/C/WKURLRequest.cpp \
     UIProcess/API/qt/ClientImpl.cpp \
     UIProcess/API/qt/qgraphicswkview.cpp \
     UIProcess/API/qt/qwkpage.cpp \
index 66b9b32..6c8a590 100644 (file)
                BCDB86C11200FB97007254BE /* WebURL.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDB86C01200FB97007254BE /* WebURL.h */; };
                BCDE059B11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDE059911CDA8AE00E41AF1 /* WebContextInjectedBundleClient.h */; };
                BCDE059C11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCDE059A11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.cpp */; };
+               BCE2315D122C30CA00D5C35A /* WebURLRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE2315B122C30CA00D5C35A /* WebURLRequest.h */; };
+               BCE2315E122C30CA00D5C35A /* WebURLRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE2315C122C30CA00D5C35A /* WebURLRequest.cpp */; };
+               BCE231C2122C466E00D5C35A /* WebURLRequestMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCE231C0122C466E00D5C35A /* WebURLRequestMac.mm */; };
+               BCE231C7122C492300D5C35A /* WKURLRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE231C5122C492300D5C35A /* WKURLRequest.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               BCE231C8122C492300D5C35A /* WKURLRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE231C6122C492300D5C35A /* WKURLRequest.cpp */; };
+               BCE23263122C6CF300D5C35A /* WebCoreArgumentCodersMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCE23262122C6CF300D5C35A /* WebCoreArgumentCodersMac.mm */; };
+               BCE23279122C71AC00D5C35A /* WKURLRequestNS.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE23277122C71AC00D5C35A /* WKURLRequestNS.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               BCE2327A122C71AC00D5C35A /* WKURLRequestNS.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCE23278122C71AC00D5C35A /* WKURLRequestNS.mm */; };
                BCE469531214E6CB000B98EB /* WebFormClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE4694F1214E6CB000B98EB /* WebFormClient.cpp */; };
                BCE469541214E6CB000B98EB /* WebFormClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE469501214E6CB000B98EB /* WebFormClient.h */; };
                BCE469551214E6CB000B98EB /* WebFormSubmissionListenerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE469511214E6CB000B98EB /* WebFormSubmissionListenerProxy.cpp */; };
                BCDB86C01200FB97007254BE /* WebURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebURL.h; sourceTree = "<group>"; };
                BCDE059911CDA8AE00E41AF1 /* WebContextInjectedBundleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextInjectedBundleClient.h; sourceTree = "<group>"; };
                BCDE059A11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextInjectedBundleClient.cpp; sourceTree = "<group>"; };
+               BCE2315B122C30CA00D5C35A /* WebURLRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebURLRequest.h; sourceTree = "<group>"; };
+               BCE2315C122C30CA00D5C35A /* WebURLRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebURLRequest.cpp; sourceTree = "<group>"; };
+               BCE231C0122C466E00D5C35A /* WebURLRequestMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebURLRequestMac.mm; sourceTree = "<group>"; };
+               BCE231C5122C492300D5C35A /* WKURLRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKURLRequest.h; sourceTree = "<group>"; };
+               BCE231C6122C492300D5C35A /* WKURLRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKURLRequest.cpp; sourceTree = "<group>"; };
+               BCE23262122C6CF300D5C35A /* WebCoreArgumentCodersMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreArgumentCodersMac.mm; sourceTree = "<group>"; };
+               BCE23277122C71AC00D5C35A /* WKURLRequestNS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKURLRequestNS.h; sourceTree = "<group>"; };
+               BCE23278122C71AC00D5C35A /* WKURLRequestNS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKURLRequestNS.mm; sourceTree = "<group>"; };
                BCE4694F1214E6CB000B98EB /* WebFormClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFormClient.cpp; sourceTree = "<group>"; };
                BCE469501214E6CB000B98EB /* WebFormClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFormClient.h; sourceTree = "<group>"; };
                BCE469511214E6CB000B98EB /* WebFormSubmissionListenerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFormSubmissionListenerProxy.cpp; sourceTree = "<group>"; };
                                BC111B5F112F635E00337BAB /* CoreIPCSupport */,
                                BC111B5A112F628200337BAB /* mac */,
                                BCF04C8C11FF9B7D00F86A58 /* APIObject.h */,
+                               1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */,
                                0FB659A51208B9EE0044816C /* DrawingAreaBase.cpp */,
                                0FB659221208B4DB0044816C /* DrawingAreaBase.h */,
-                               1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */,
                                762B7481120BBA0100819339 /* FontSmoothingLevel.h */,
                                BC64696D11DBE603006455B0 /* ImmutableArray.cpp */,
                                BC64696E11DBE603006455B0 /* ImmutableArray.h */,
                                BCD598AA112B7FDF00EC8C23 /* WebPreferencesStore.h */,
                                BCF04C8E11FF9F6E00F86A58 /* WebString.h */,
                                BCDB86C01200FB97007254BE /* WebURL.h */,
+                               BCE2315C122C30CA00D5C35A /* WebURLRequest.cpp */,
+                               BCE2315B122C30CA00D5C35A /* WebURLRequest.h */,
                        );
                        path = Shared;
                        sourceTree = "<group>";
                        isa = PBXGroup;
                        children = (
                                BC20EBD0116EF66700094A50 /* cf */,
+                               BCE23276122C718F00D5C35A /* mac */,
                                BCB63477116BF10600603215 /* WebKit2.h */,
                                BC0C376D10F808460076D7CB /* WKAPICast.h */,
                                BC64680A11DBBD69006455B0 /* WKArray.cpp */,
                                BCDB85801200EC57007254BE /* WKType.h */,
                                BC20EBB3116EEF7A00094A50 /* WKURL.cpp */,
                                BC20EBB2116EEF7A00094A50 /* WKURL.h */,
+                               BCE231C6122C492300D5C35A /* WKURLRequest.cpp */,
+                               BCE231C5122C492300D5C35A /* WKURLRequest.h */,
                        );
                        path = C;
                        sourceTree = "<group>";
                                1A6F9FB611E1408500DB1371 /* CommandLineMac.cpp */,
                                BC9E95D211449B0300870E71 /* UpdateChunk.cpp */,
                                BC9E95D111449B0300870E71 /* UpdateChunk.h */,
+                               BCE23262122C6CF300D5C35A /* WebCoreArgumentCodersMac.mm */,
                                BC111B5B112F629800337BAB /* WebEventFactory.h */,
                                BC111B5C112F629800337BAB /* WebEventFactory.mm */,
+                               BCE231C0122C466E00D5C35A /* WebURLRequestMac.mm */,
                        );
                        path = mac;
                        sourceTree = "<group>";
                        path = mac;
                        sourceTree = "<group>";
                };
+               BCE23276122C718F00D5C35A /* mac */ = {
+                       isa = PBXGroup;
+                       children = (
+                               BCE23277122C71AC00D5C35A /* WKURLRequestNS.h */,
+                               BCE23278122C71AC00D5C35A /* WKURLRequestNS.mm */,
+                       );
+                       path = mac;
+                       sourceTree = "<group>";
+               };
 /* End PBXGroup section */
 
 /* Begin PBXHeadersBuildPhase section */
                                BCBCB0CB1215E32100DE59CA /* ImmutableDictionary.h in Headers */,
                                BCBCB0E31215E54D00DE59CA /* WKDictionary.h in Headers */,
                                9391F2CB121B67AD00EBF7E8 /* WebFrameNetworkingContext.h in Headers */,
+                               BCE2315D122C30CA00D5C35A /* WebURLRequest.h in Headers */,
+                               BCE231C7122C492300D5C35A /* WKURLRequest.h in Headers */,
+                               BCE23279122C71AC00D5C35A /* WKURLRequestNS.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                BCBCB0CD1215E33A00DE59CA /* ImmutableDictionary.cpp in Sources */,
                                BCBCB0E41215E54D00DE59CA /* WKDictionary.cpp in Sources */,
                                9391F2CA121B679A00EBF7E8 /* WebFrameNetworkingContext.mm in Sources */,
+                               BCE2315E122C30CA00D5C35A /* WebURLRequest.cpp in Sources */,
+                               BCE231C2122C466E00D5C35A /* WebURLRequestMac.mm in Sources */,
+                               BCE231C8122C492300D5C35A /* WKURLRequest.cpp in Sources */,
+                               BCE23263122C6CF300D5C35A /* WebCoreArgumentCodersMac.mm in Sources */,
+                               BCE2327A122C71AC00D5C35A /* WKURLRequestNS.mm in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index f88941c..b66ccf3 100644 (file)
@@ -237,7 +237,12 @@ void WebPage::sendClose()
 
 void WebPage::loadURL(const String& url)
 {
-    m_mainFrame->coreFrame()->loader()->load(ResourceRequest(KURL(KURL(), url)), false);
+    loadURLRequest(ResourceRequest(KURL(KURL(), url)));
+}
+
+void WebPage::loadURLRequest(const ResourceRequest& request)
+{
+    m_mainFrame->coreFrame()->loader()->load(request, false);
 }
 
 void WebPage::stopLoading()
@@ -604,6 +609,14 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
             loadURL(url);
             return;
         }
+        case WebPageMessage::LoadURLRequest: {
+            ResourceRequest request;
+            if (!arguments->decode(request))
+                return;
+            
+            loadURLRequest(request);
+            return;
+        }
         case WebPageMessage::StopLoading:
             stopLoading();
             return;
index 5912286..0de7e53 100644 (file)
@@ -55,6 +55,7 @@ namespace WebCore {
     class GraphicsContext;
     class KeyboardEvent;
     class Page;
+    class ResourceRequest;
 }
 
 namespace WebKit {
@@ -144,7 +145,8 @@ private:
 
     // Actions
     void tryClose();
-    void loadURL(const WTF::String&);
+    void loadURL(const String&);
+    void loadURLRequest(const WebCore::ResourceRequest&);
     void reload(bool reloadFromOrigin);
     void goForward(uint64_t);
     void goBack(uint64_t);
index 7bf541d..b86a7d6 100755 (executable)
                                RelativePath="..\Shared\WebURL.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\Shared\WebURLRequest.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\Shared\WebURLRequest.h"\r
+                               >\r
+                       </File>\r
                        <Filter\r
                                Name="CoreIPCSupport"\r
                                >\r
                                        >\r
                                </File>\r
                                <File\r
+                                       RelativePath="..\Shared\win\WebCoreArgumentCodersWin.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
                                        RelativePath="..\Shared\win\WebEventFactory.cpp"\r
                                        >\r
                                </File>\r
                                        RelativePath="..\Shared\win\WebEventFactory.h"\r
                                        >\r
                                </File>\r
+                               <File\r
+                                       RelativePath="..\Shared\win\WebURLRequestWin.cpp"\r
+                                       >\r
+                               </File>\r
                        </Filter>\r
                </Filter>\r
                <Filter\r
                                                RelativePath="..\UIProcess\API\C\WKURL.h"\r
                                                >\r
                                        </File>\r
+                                       <File\r
+                                               RelativePath="..\UIProcess\API\C\WKURLRequest.cpp"\r
+                                               >\r
+                                       </File>\r
+                                       <File\r
+                                               RelativePath="..\UIProcess\API\C\WKURLRequest.h"\r
+                                               >\r
+                                       </File>\r
                                        <Filter\r
                                                Name="cf"\r
                                                >\r
                                                        RelativePath="..\UIProcess\API\C\cf\WKURLCF.h"\r
                                                        >\r
                                                </File>\r
+                                               <File\r
+                                                       RelativePath="..\UIProcess\API\C\cf\WKURLRequestCF.cpp"\r
+                                                       >\r
+                                               </File>\r
+                                               <File\r
+                                                       RelativePath="..\UIProcess\API\C\cf\WKURLRequestCF.h"\r
+                                                       >\r
+                                               </File>\r
                                        </Filter>\r
                                </Filter>\r
                                <Filter\r
index 015b2b2..6da81a1 100644 (file)
@@ -22,8 +22,10 @@ all:
     xcopy /y /d "..\UIProcess\API\C\WKString.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\WKType.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\WKURL.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
+    xcopy /y /d "..\UIProcess\API\C\WKURLRequest.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\cf\WKStringCF.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\cf\WKURLCF.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
+    xcopy /y /d "..\UIProcess\API\C\cf\WKURLRequestCF.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\win\WKContextPrivateWin.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\cpp\WKRetainPtr.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\win\WKBaseWin.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"