Diff
Modified: trunk/Source/WebKit2/ChangeLog (218320 => 218321)
--- trunk/Source/WebKit2/ChangeLog 2017-06-15 07:18:32 UTC (rev 218320)
+++ trunk/Source/WebKit2/ChangeLog 2017-06-15 08:20:34 UTC (rev 218321)
@@ -1,5 +1,55 @@
2017-06-14 Carlos Garcia Campos <[email protected]>
+ Add API::InjectedBundle::ResourceLoadClient
+ https://bugs.webkit.org/show_bug.cgi?id=173362
+
+ Reviewed by Alex Christensen.
+
+ It will be used by the GTK+ port instead of the C API.
+
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/InjectedBundle/API/APIInjectedBundlePageResourceLoadClient.h: Copied from Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h.
+ (API::InjectedBundle::ResourceLoadClient::didInitiateLoadForResource):
+ (API::InjectedBundle::ResourceLoadClient::willSendRequestForFrame):
+ (API::InjectedBundle::ResourceLoadClient::didReceiveResponseForResource):
+ (API::InjectedBundle::ResourceLoadClient::didReceiveContentLengthForResource):
+ (API::InjectedBundle::ResourceLoadClient::didFinishLoadForResource):
+ (API::InjectedBundle::ResourceLoadClient::didFailLoadForResource):
+ (API::InjectedBundle::ResourceLoadClient::shouldCacheResponse):
+ (API::InjectedBundle::ResourceLoadClient::shouldUseCredentialStorage):
+ * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+ (WKBundlePageSetResourceLoadClient):
+ * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
+ (setUpResourceLoadClient):
+ (-[WKWebProcessPlugInBrowserContextController setLoadDelegate:]):
+ * WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp:
+ (WebKit::InjectedBundlePageResourceLoadClient::InjectedBundlePageResourceLoadClient):
+ (WebKit::InjectedBundlePageResourceLoadClient::didInitiateLoadForResource):
+ (WebKit::InjectedBundlePageResourceLoadClient::willSendRequestForFrame):
+ (WebKit::InjectedBundlePageResourceLoadClient::didReceiveResponseForResource):
+ (WebKit::InjectedBundlePageResourceLoadClient::didReceiveContentLengthForResource):
+ (WebKit::InjectedBundlePageResourceLoadClient::didFinishLoadForResource):
+ (WebKit::InjectedBundlePageResourceLoadClient::didFailLoadForResource):
+ (WebKit::InjectedBundlePageResourceLoadClient::shouldCacheResponse):
+ (WebKit::InjectedBundlePageResourceLoadClient::shouldUseCredentialStorage):
+ * WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h:
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::assignIdentifierToInitialRequest):
+ (WebKit::WebFrameLoaderClient::dispatchWillSendRequest):
+ (WebKit::WebFrameLoaderClient::shouldUseCredentialStorage):
+ (WebKit::WebFrameLoaderClient::dispatchDidReceiveResponse):
+ (WebKit::WebFrameLoaderClient::dispatchDidReceiveContentLength):
+ (WebKit::WebFrameLoaderClient::dispatchDidFinishLoading):
+ (WebKit::WebFrameLoaderClient::dispatchDidFailLoading):
+ (WebKit::WebFrameLoaderClient::willCacheResponse):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::setInjectedBundleResourceLoadClient):
+ (WebKit::WebPage::close):
+ * WebProcess/WebPage/WebPage.h:
+ (WebKit::WebPage::injectedBundleResourceLoadClient):
+
+2017-06-14 Carlos Garcia Campos <[email protected]>
+
Add API::InjectedBundle::Client
https://bugs.webkit.org/show_bug.cgi?id=173357
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (218320 => 218321)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2017-06-15 07:18:32 UTC (rev 218320)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2017-06-15 08:20:34 UTC (rev 218321)
@@ -1219,6 +1219,7 @@
7A821F501E2F7A7500604577 /* APICustomProtocolManagerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A821F4F1E2F7A5C00604577 /* APICustomProtocolManagerClient.h */; };
7A8A9D581EF119B0009801AE /* APIInjectedBundleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A8A9D571EF119AA009801AE /* APIInjectedBundleClient.h */; };
7A8A9D5A1EF13029009801AE /* APIInjectedBundleBundleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A8A9D591EF13020009801AE /* APIInjectedBundleBundleClient.h */; };
+ 7A8A9D5C1EF14598009801AE /* APIInjectedBundlePageResourceLoadClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A8A9D5B1EF1458E009801AE /* APIInjectedBundlePageResourceLoadClient.h */; };
7AAD175F1EA6AF99003B0894 /* WebResourceLoadStatisticsStoreCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7AAD175E1EA6AF37003B0894 /* WebResourceLoadStatisticsStoreCocoa.mm */; };
7AB6EA451EEAAE3800037B2B /* APIIconDatabaseClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AB6EA441EEAAE2300037B2B /* APIIconDatabaseClient.h */; };
7AB6EA471EEAB6B800037B2B /* APIGeolocationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AB6EA461EEAB6B000037B2B /* APIGeolocationProvider.h */; };
@@ -3508,6 +3509,7 @@
7A821F4F1E2F7A5C00604577 /* APICustomProtocolManagerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APICustomProtocolManagerClient.h; sourceTree = "<group>"; };
7A8A9D571EF119AA009801AE /* APIInjectedBundleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIInjectedBundleClient.h; sourceTree = "<group>"; };
7A8A9D591EF13020009801AE /* APIInjectedBundleBundleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIInjectedBundleBundleClient.h; sourceTree = "<group>"; };
+ 7A8A9D5B1EF1458E009801AE /* APIInjectedBundlePageResourceLoadClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIInjectedBundlePageResourceLoadClient.h; sourceTree = "<group>"; };
7A9CD8C01C77984900D9F6C7 /* WebResourceLoadStatisticsStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebResourceLoadStatisticsStore.cpp; sourceTree = "<group>"; };
7A9CD8C11C77984900D9F6C7 /* WebResourceLoadStatisticsStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebResourceLoadStatisticsStore.h; sourceTree = "<group>"; };
7A9CD8C21C779AD600D9F6C7 /* WebResourceLoadStatisticsStore.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebResourceLoadStatisticsStore.messages.in; sourceTree = "<group>"; };
@@ -7258,6 +7260,7 @@
7A8A9D591EF13020009801AE /* APIInjectedBundleBundleClient.h */,
076E884F1A13CBC6005E90FC /* APIInjectedBundlePageContextMenuClient.h */,
7A3ACE1A1EEEF78C00A864A4 /* APIInjectedBundlePageLoaderClient.h */,
+ 7A8A9D5B1EF1458E009801AE /* APIInjectedBundlePageResourceLoadClient.h */,
);
path = API;
sourceTree = "<group>";
@@ -8717,6 +8720,7 @@
1CA8B946127C882A00576C2B /* WebInspectorProxyMessages.h in Headers */,
1C891D6619B124FF00BA79DD /* WebInspectorUI.h in Headers */,
1CBBE4A119B66C53006B7D81 /* WebInspectorUIMessages.h in Headers */,
+ 7A8A9D5C1EF14598009801AE /* APIInjectedBundlePageResourceLoadClient.h in Headers */,
A55BA82B1BA38E61007CD33D /* WebInspectorUtilities.h in Headers */,
2DA944A01884E4F000ED86DB /* WebIOSEventFactory.h in Headers */,
1A85E4721E303F3700914599 /* WebKit.apinotes in Headers */,
Copied: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/APIInjectedBundlePageResourceLoadClient.h (from rev 218320, trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h) (0 => 218321)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/APIInjectedBundlePageResourceLoadClient.h (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/APIInjectedBundlePageResourceLoadClient.h 2017-06-15 08:20:34 UTC (rev 218321)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * 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.
+ */
+
+#pragma once
+
+namespace WebKit {
+class WebFrame;
+class WebPage;
+}
+
+namespace WebCore {
+class ResourceError;
+class ResourceRequest;
+class ResourceResponse;
+}
+
+namespace API {
+
+namespace InjectedBundle {
+
+class ResourceLoadClient {
+public:
+ virtual ~ResourceLoadClient() = default;
+
+ virtual void didInitiateLoadForResource(WebKit::WebPage&, WebKit::WebFrame&, uint64_t /*identifier*/, const WebCore::ResourceRequest&, bool /*pageIsProvisionallyLoading*/) { }
+ virtual void willSendRequestForFrame(WebKit::WebPage&, WebKit::WebFrame&, uint64_t /*identifier*/, WebCore::ResourceRequest&, const WebCore::ResourceResponse&) { }
+ virtual void didReceiveResponseForResource(WebKit::WebPage&, WebKit::WebFrame&, uint64_t /*identifier*/, const WebCore::ResourceResponse&) { }
+ virtual void didReceiveContentLengthForResource(WebKit::WebPage&, WebKit::WebFrame&, uint64_t /*identifier*/, uint64_t contentLength) { }
+ virtual void didFinishLoadForResource(WebKit::WebPage&, WebKit::WebFrame&, uint64_t /*identifier*/) { }
+ virtual void didFailLoadForResource(WebKit::WebPage&, WebKit::WebFrame&, uint64_t /*identifier*/, const WebCore::ResourceError&) { }
+ virtual bool shouldCacheResponse(WebKit::WebPage&, WebKit::WebFrame&, uint64_t /*identifier*/) { return true; }
+ virtual bool shouldUseCredentialStorage(WebKit::WebPage&, WebKit::WebFrame&, uint64_t /*identifier*/) { return true; }
+};
+
+} // namespace InjectedBundle
+
+} // namespace API
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp (218320 => 218321)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp 2017-06-15 07:18:32 UTC (rev 218320)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp 2017-06-15 08:20:34 UTC (rev 218321)
@@ -36,6 +36,7 @@
#include "InjectedBundlePageEditorClient.h"
#include "InjectedBundlePageFormClient.h"
#include "InjectedBundlePageLoaderClient.h"
+#include "InjectedBundlePageResourceLoadClient.h"
#include "InjectedBundlePageUIClient.h"
#include "PageBanner.h"
#include "WKAPICast.h"
@@ -100,7 +101,7 @@
void WKBundlePageSetResourceLoadClient(WKBundlePageRef pageRef, WKBundlePageResourceLoadClientBase* wkClient)
{
- toImpl(pageRef)->initializeInjectedBundleResourceLoadClient(wkClient);
+ toImpl(pageRef)->setInjectedBundleResourceLoadClient(std::make_unique<InjectedBundlePageResourceLoadClient>(wkClient));
}
void WKBundlePageSetPolicyClient(WKBundlePageRef pageRef, WKBundlePagePolicyClientBase* wkClient)
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm (218320 => 218321)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm 2017-06-15 07:18:32 UTC (rev 218320)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm 2017-06-15 08:20:34 UTC (rev 218321)
@@ -333,7 +333,7 @@
client.didFinishLoadForResource = didFinishLoadForResource;
client.didFailLoadForResource = didFailLoadForResource;
- page.initializeInjectedBundleResourceLoadClient(&client.base);
+ WKBundlePageSetResourceLoadClient(toAPI(&page), &client.base);
}
- (id <WKWebProcessPlugInLoadDelegate>)loadDelegate
@@ -350,7 +350,7 @@
setUpResourceLoadClient(self, *_page);
} else {
WKBundlePageSetPageLoaderClient(toAPI(_page.get()), nullptr);
- _page->initializeInjectedBundleResourceLoadClient(nullptr);
+ WKBundlePageSetResourceLoadClient(toAPI(_page.get()), nullptr);
}
}
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp (218320 => 218321)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp 2017-06-15 07:18:32 UTC (rev 218320)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp 2017-06-15 08:20:34 UTC (rev 218321)
@@ -35,20 +35,25 @@
namespace WebKit {
-void InjectedBundlePageResourceLoadClient::didInitiateLoadForResource(WebPage* page, WebFrame* frame, uint64_t identifier, const WebCore::ResourceRequest& request, bool pageIsProvisionallyLoading)
+InjectedBundlePageResourceLoadClient::InjectedBundlePageResourceLoadClient(const WKBundlePageResourceLoadClientBase* client)
{
+ initialize(client);
+}
+
+void InjectedBundlePageResourceLoadClient::didInitiateLoadForResource(WebPage& page, WebFrame& frame, uint64_t identifier, const ResourceRequest& request, bool pageIsProvisionallyLoading)
+{
if (!m_client.didInitiateLoadForResource)
return;
- m_client.didInitiateLoadForResource(toAPI(page), toAPI(frame), identifier, toAPI(request), pageIsProvisionallyLoading, m_client.base.clientInfo);
+ m_client.didInitiateLoadForResource(toAPI(&page), toAPI(&frame), identifier, toAPI(request), pageIsProvisionallyLoading, m_client.base.clientInfo);
}
-void InjectedBundlePageResourceLoadClient::willSendRequestForFrame(WebPage* page, WebFrame* frame, uint64_t identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
+void InjectedBundlePageResourceLoadClient::willSendRequestForFrame(WebPage& page, WebFrame& frame, uint64_t identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
if (!m_client.willSendRequestForFrame)
return;
- RefPtr<API::URLRequest> returnedRequest = adoptRef(toImpl(m_client.willSendRequestForFrame(toAPI(page), toAPI(frame), identifier, toAPI(request), toAPI(redirectResponse), m_client.base.clientInfo)));
+ RefPtr<API::URLRequest> returnedRequest = adoptRef(toImpl(m_client.willSendRequestForFrame(toAPI(&page), toAPI(&frame), identifier, toAPI(request), toAPI(redirectResponse), m_client.base.clientInfo)));
if (returnedRequest) {
// If the client returned an HTTP body, we want to use that http body. This is needed to fix <rdar://problem/23763584>
auto& returnedResourceRequest = returnedRequest->resourceRequest();
@@ -60,52 +65,52 @@
request = { };
}
-void InjectedBundlePageResourceLoadClient::didReceiveResponseForResource(WebPage* page, WebFrame* frame, uint64_t identifier, const WebCore::ResourceResponse& response)
+void InjectedBundlePageResourceLoadClient::didReceiveResponseForResource(WebPage& page, WebFrame& frame, uint64_t identifier, const ResourceResponse& response)
{
if (!m_client.didReceiveResponseForResource)
return;
- m_client.didReceiveResponseForResource(toAPI(page), toAPI(frame), identifier, toAPI(response), m_client.base.clientInfo);
+ m_client.didReceiveResponseForResource(toAPI(&page), toAPI(&frame), identifier, toAPI(response), m_client.base.clientInfo);
}
-void InjectedBundlePageResourceLoadClient::didReceiveContentLengthForResource(WebPage* page, WebFrame* frame, uint64_t identifier, uint64_t contentLength)
+void InjectedBundlePageResourceLoadClient::didReceiveContentLengthForResource(WebPage& page, WebFrame& frame, uint64_t identifier, uint64_t contentLength)
{
if (!m_client.didReceiveContentLengthForResource)
return;
- m_client.didReceiveContentLengthForResource(toAPI(page), toAPI(frame), identifier, contentLength, m_client.base.clientInfo);
+ m_client.didReceiveContentLengthForResource(toAPI(&page), toAPI(&frame), identifier, contentLength, m_client.base.clientInfo);
}
-void InjectedBundlePageResourceLoadClient::didFinishLoadForResource(WebPage* page, WebFrame* frame, uint64_t identifier)
+void InjectedBundlePageResourceLoadClient::didFinishLoadForResource(WebPage& page, WebFrame& frame, uint64_t identifier)
{
if (!m_client.didFinishLoadForResource)
return;
- m_client.didFinishLoadForResource(toAPI(page), toAPI(frame), identifier, m_client.base.clientInfo);
+ m_client.didFinishLoadForResource(toAPI(&page), toAPI(&frame), identifier, m_client.base.clientInfo);
}
-void InjectedBundlePageResourceLoadClient::didFailLoadForResource(WebPage* page, WebFrame* frame, uint64_t identifier, const WebCore::ResourceError& error)
+void InjectedBundlePageResourceLoadClient::didFailLoadForResource(WebPage& page, WebFrame& frame, uint64_t identifier, const ResourceError& error)
{
if (!m_client.didFailLoadForResource)
return;
- m_client.didFailLoadForResource(toAPI(page), toAPI(frame), identifier, toAPI(error), m_client.base.clientInfo);
+ m_client.didFailLoadForResource(toAPI(&page), toAPI(&frame), identifier, toAPI(error), m_client.base.clientInfo);
}
-bool InjectedBundlePageResourceLoadClient::shouldCacheResponse(WebPage* page, WebFrame* frame, uint64_t identifier)
+bool InjectedBundlePageResourceLoadClient::shouldCacheResponse(WebPage& page, WebFrame& frame, uint64_t identifier)
{
if (!m_client.shouldCacheResponse)
return true;
- return m_client.shouldCacheResponse(toAPI(page), toAPI(frame), identifier, m_client.base.clientInfo);
+ return m_client.shouldCacheResponse(toAPI(&page), toAPI(&frame), identifier, m_client.base.clientInfo);
}
-bool InjectedBundlePageResourceLoadClient::shouldUseCredentialStorage(WebPage* page, WebFrame* frame, uint64_t identifier)
+bool InjectedBundlePageResourceLoadClient::shouldUseCredentialStorage(WebPage& page, WebFrame& frame, uint64_t identifier)
{
if (!m_client.shouldUseCredentialStorage)
return true;
- return m_client.shouldUseCredentialStorage(toAPI(page), toAPI(frame), identifier, m_client.base.clientInfo);
+ return m_client.shouldUseCredentialStorage(toAPI(&page), toAPI(&frame), identifier, m_client.base.clientInfo);
}
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h (218320 => 218321)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h 2017-06-15 07:18:32 UTC (rev 218320)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h 2017-06-15 08:20:34 UTC (rev 218321)
@@ -27,9 +27,8 @@
#define InjectedBundlePageResourceLoadClient_h
#include "APIClient.h"
-#include "SameDocumentNavigationType.h"
+#include "APIInjectedBundlePageResourceLoadClient.h"
#include "WKBundlePageResourceLoadClient.h"
-#include <wtf/Forward.h>
namespace API {
template<> struct ClientTraits<WKBundlePageResourceLoadClientBase> {
@@ -48,16 +47,18 @@
class WebPage;
class WebFrame;
-class InjectedBundlePageResourceLoadClient : public API::Client<WKBundlePageResourceLoadClientBase> {
+class InjectedBundlePageResourceLoadClient : public API::InjectedBundle::ResourceLoadClient, public API::Client<WKBundlePageResourceLoadClientBase> {
public:
- void didInitiateLoadForResource(WebPage*, WebFrame*, uint64_t identifier, const WebCore::ResourceRequest&, bool pageIsProvisionallyLoading);
- void willSendRequestForFrame(WebPage*, WebFrame*, uint64_t identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
- void didReceiveResponseForResource(WebPage*, WebFrame*, uint64_t identifier, const WebCore::ResourceResponse&);
- void didReceiveContentLengthForResource(WebPage*, WebFrame*, uint64_t identifier, uint64_t contentLength);
- void didFinishLoadForResource(WebPage*, WebFrame*, uint64_t identifier);
- void didFailLoadForResource(WebPage*, WebFrame*, uint64_t identifier, const WebCore::ResourceError&);
- bool shouldCacheResponse(WebPage*, WebFrame*, uint64_t identifier);
- bool shouldUseCredentialStorage(WebPage*, WebFrame*, uint64_t identifier);
+ explicit InjectedBundlePageResourceLoadClient(const WKBundlePageResourceLoadClientBase*);
+
+ void didInitiateLoadForResource(WebPage&, WebFrame&, uint64_t identifier, const WebCore::ResourceRequest&, bool /*pageIsProvisionallyLoading*/) override;
+ void willSendRequestForFrame(WebPage&, WebFrame&, uint64_t identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse&) override;
+ void didReceiveResponseForResource(WebPage&, WebFrame&, uint64_t identifier, const WebCore::ResourceResponse&) override;
+ void didReceiveContentLengthForResource(WebPage&, WebFrame&, uint64_t identifier, uint64_t contentLength) override;
+ void didFinishLoadForResource(WebPage&, WebFrame&, uint64_t identifier) override;
+ void didFailLoadForResource(WebPage&, WebFrame&, uint64_t identifier, const WebCore::ResourceError&) override;
+ bool shouldCacheResponse(WebPage&, WebFrame&, uint64_t identifier) override;
+ bool shouldUseCredentialStorage(WebPage&, WebFrame&, uint64_t identifier) override;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (218320 => 218321)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2017-06-15 07:18:32 UTC (rev 218320)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2017-06-15 08:20:34 UTC (rev 218321)
@@ -165,7 +165,7 @@
if (FrameLoader* frameLoader = loader->frameLoader())
pageIsProvisionallyLoading = frameLoader->provisionalDocumentLoader() == loader;
- webPage->injectedBundleResourceLoadClient().didInitiateLoadForResource(webPage, m_frame, identifier, request, pageIsProvisionallyLoading);
+ webPage->injectedBundleResourceLoadClient().didInitiateLoadForResource(*webPage, *m_frame, identifier, request, pageIsProvisionallyLoading);
webPage->addResourceRequest(identifier, request);
}
@@ -175,7 +175,7 @@
if (!webPage)
return;
- webPage->injectedBundleResourceLoadClient().willSendRequestForFrame(webPage, m_frame, identifier, request, redirectResponse);
+ webPage->injectedBundleResourceLoadClient().willSendRequestForFrame(*webPage, *m_frame, identifier, request, redirectResponse);
}
bool WebFrameLoaderClient::shouldUseCredentialStorage(DocumentLoader*, unsigned long identifier)
@@ -184,7 +184,7 @@
if (!webPage)
return true;
- return webPage->injectedBundleResourceLoadClient().shouldUseCredentialStorage(webPage, m_frame, identifier);
+ return webPage->injectedBundleResourceLoadClient().shouldUseCredentialStorage(*webPage, *m_frame, identifier);
}
void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge& challenge)
@@ -214,7 +214,7 @@
if (!webPage)
return;
- webPage->injectedBundleResourceLoadClient().didReceiveResponseForResource(webPage, m_frame, identifier, response);
+ webPage->injectedBundleResourceLoadClient().didReceiveResponseForResource(*webPage, *m_frame, identifier, response);
}
void WebFrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int dataLength)
@@ -223,7 +223,7 @@
if (!webPage)
return;
- webPage->injectedBundleResourceLoadClient().didReceiveContentLengthForResource(webPage, m_frame, identifier, dataLength);
+ webPage->injectedBundleResourceLoadClient().didReceiveContentLengthForResource(*webPage, *m_frame, identifier, dataLength);
}
#if ENABLE(DATA_DETECTION)
@@ -242,7 +242,7 @@
if (!webPage)
return;
- webPage->injectedBundleResourceLoadClient().didFinishLoadForResource(webPage, m_frame, identifier);
+ webPage->injectedBundleResourceLoadClient().didFinishLoadForResource(*webPage, *m_frame, identifier);
webPage->removeResourceRequest(identifier);
}
@@ -252,7 +252,7 @@
if (!webPage)
return;
- webPage->injectedBundleResourceLoadClient().didFailLoadForResource(webPage, m_frame, identifier, error);
+ webPage->injectedBundleResourceLoadClient().didFailLoadForResource(*webPage, *m_frame, identifier, error);
webPage->removeResourceRequest(identifier);
}
@@ -1701,7 +1701,7 @@
if (!webPage)
return response;
- return webPage->injectedBundleResourceLoadClient().shouldCacheResponse(webPage, m_frame, identifier) ? response : nil;
+ return webPage->injectedBundleResourceLoadClient().shouldCacheResponse(*webPage, *m_frame, identifier) ? response : nil;
}
NSDictionary *WebFrameLoaderClient::dataDetectionContext()
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (218320 => 218321)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2017-06-15 07:18:32 UTC (rev 218320)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2017-06-15 08:20:34 UTC (rev 218321)
@@ -332,6 +332,7 @@
, m_editorClient { std::make_unique<API::InjectedBundle::EditorClient>() }
, m_formClient(std::make_unique<API::InjectedBundle::FormClient>())
, m_loaderClient(std::make_unique<API::InjectedBundle::PageLoaderClient>())
+ , m_resourceLoadClient(std::make_unique<API::InjectedBundle::ResourceLoadClient>())
, m_uiClient(std::make_unique<API::InjectedBundle::PageUIClient>())
, m_findController(makeUniqueRef<FindController>(this))
, m_userContentController(WebUserContentController::getOrCreate(parameters.userContentControllerID))
@@ -739,9 +740,12 @@
m_policyClient.initialize(client);
}
-void WebPage::initializeInjectedBundleResourceLoadClient(WKBundlePageResourceLoadClientBase* client)
+void WebPage::setInjectedBundleResourceLoadClient(std::unique_ptr<API::InjectedBundle::ResourceLoadClient>&& client)
{
- m_resourceLoadClient.initialize(client);
+ if (!m_resourceLoadClient)
+ m_resourceLoadClient = std::make_unique<API::InjectedBundle::ResourceLoadClient>();
+ else
+ m_resourceLoadClient = WTFMove(client);
}
void WebPage::setInjectedBundleUIClient(std::unique_ptr<API::InjectedBundle::PageUIClient>&& uiClient)
@@ -1142,7 +1146,7 @@
m_formClient = std::make_unique<API::InjectedBundle::FormClient>();
m_loaderClient = std::make_unique<API::InjectedBundle::PageLoaderClient>();
m_policyClient.initialize(0);
- m_resourceLoadClient.initialize(0);
+ m_resourceLoadClient = std::make_unique<API::InjectedBundle::ResourceLoadClient>();
m_uiClient = std::make_unique<API::InjectedBundle::PageUIClient>();
#if ENABLE(FULLSCREEN_API)
m_fullScreenClient.initialize(0);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (218320 => 218321)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2017-06-15 07:18:32 UTC (rev 218320)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2017-06-15 08:20:34 UTC (rev 218321)
@@ -29,6 +29,7 @@
#include "APIInjectedBundleFormClient.h"
#include "APIInjectedBundlePageContextMenuClient.h"
#include "APIInjectedBundlePageLoaderClient.h"
+#include "APIInjectedBundlePageResourceLoadClient.h"
#include "APIInjectedBundlePageUIClient.h"
#include "APIObject.h"
#include "EditingRange.h"
@@ -35,7 +36,6 @@
#include "InjectedBundlePageContextMenuClient.h"
#include "InjectedBundlePageFullScreenClient.h"
#include "InjectedBundlePagePolicyClient.h"
-#include "InjectedBundlePageResourceLoadClient.h"
#include "LayerTreeContext.h"
#include "MessageReceiver.h"
#include "MessageSender.h"
@@ -332,7 +332,7 @@
void setInjectedBundleFormClient(std::unique_ptr<API::InjectedBundle::FormClient>&&);
void setInjectedBundlePageLoaderClient(std::unique_ptr<API::InjectedBundle::PageLoaderClient>&&);
void initializeInjectedBundlePolicyClient(WKBundlePagePolicyClientBase*);
- void initializeInjectedBundleResourceLoadClient(WKBundlePageResourceLoadClientBase*);
+ void setInjectedBundleResourceLoadClient(std::unique_ptr<API::InjectedBundle::ResourceLoadClient>&&);
void setInjectedBundleUIClient(std::unique_ptr<API::InjectedBundle::PageUIClient>&&);
#if ENABLE(FULLSCREEN_API)
void initializeInjectedBundleFullScreenClient(WKBundlePageFullScreenClientBase*);
@@ -345,7 +345,7 @@
API::InjectedBundle::FormClient& injectedBundleFormClient() { return *m_formClient.get(); }
API::InjectedBundle::PageLoaderClient& injectedBundleLoaderClient() { return *m_loaderClient; }
InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; }
- InjectedBundlePageResourceLoadClient& injectedBundleResourceLoadClient() { return m_resourceLoadClient; }
+ API::InjectedBundle::ResourceLoadClient& injectedBundleResourceLoadClient() { return *m_resourceLoadClient; }
API::InjectedBundle::PageUIClient& injectedBundleUIClient() { return *m_uiClient.get(); }
#if ENABLE(FULLSCREEN_API)
InjectedBundlePageFullScreenClient& injectedBundleFullScreenClient() { return m_fullScreenClient; }
@@ -1384,7 +1384,7 @@
std::unique_ptr<API::InjectedBundle::FormClient> m_formClient;
std::unique_ptr<API::InjectedBundle::PageLoaderClient> m_loaderClient;
InjectedBundlePagePolicyClient m_policyClient;
- InjectedBundlePageResourceLoadClient m_resourceLoadClient;
+ std::unique_ptr<API::InjectedBundle::ResourceLoadClient> m_resourceLoadClient;
std::unique_ptr<API::InjectedBundle::PageUIClient> m_uiClient;
#if ENABLE(FULLSCREEN_API)
InjectedBundlePageFullScreenClient m_fullScreenClient;