Add WKPageNavigationClient as C SPI around API::NavigationClient, and adopt in WKTR
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Feb 2015 04:02:50 +0000 (04:02 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Feb 2015 04:02:50 +0000 (04:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=141217

Reviewed by Sam Weinig.

* Shared/API/c/WKBase.h:
* UIProcess/API/C/WKAPICast.h:
* UIProcess/API/C/WKFrameInfoRef.cpp: Added.
(WKFrameInfoGetTypeID):
* UIProcess/API/C/WKFrameInfoRef.h: Added.
* UIProcess/API/C/WKNavigationActionRef.cpp: Added.
(WKNavigationActionGetTypeID):
* UIProcess/API/C/WKNavigationActionRef.h: Added.
* UIProcess/API/C/WKNavigationRef.cpp: Added.
(WKNavigationGetTypeID):
* UIProcess/API/C/WKNavigationRef.h: Added.
* UIProcess/API/C/WKNavigationResponseRef.cpp: Added.
(WKNavigationResponseGetTypeID):
(WKNavigationResponseCanShowMIMEType):
* UIProcess/API/C/WKNavigationResponseRef.h: Added.
Add tiny C wrappers around API::{FrameInfo, NavigationAction, Navigation, NavigationResponse}.

* UIProcess/API/APINavigationClient.h:
(API::NavigationClient::decidePolicyForPluginLoad):
Add a default implementation of decidePolicyForPluginLoad.

* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageNavigationClient):
* UIProcess/API/C/WKPage.h:
Add WKPageSetPageNavigationClient, which connects API::NavigationClient to
the new WKPageNavigationClient C SPI.

* UIProcess/API/C/WKPageNavigationClient.h: Added.
Add WKPageNavigationClient, which one can use in place of WKPageLoaderClient
and WKPagePolicyClient and which has the same semantics as the Modern ObjC API
(including things like API::Navigation as WKNavigationRef, etc.)

* UIProcess/API/C/WKPageLoaderClient.h:
* UIProcess/API/C/WKPageRenderingProgressEvents.h: Added.
* UIProcess/API/C/WKPageRenderingProgressEventsInternal.h: Added.
(pageRenderingProgressEvents):
* UIProcess/API/C/WKPluginLoadPolicy.h: Added.
Pull some enums out into their own files (WKPageRenderingProgressEvents is
duplicated from the Modern ObjC API's _WKRenderingProgressEvents, WKPluginLoadPolicy
is pulled out of WKPageLoaderClient).

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::findPlugin):
Add an equivalent of pluginLoadPolicy to the NavigationClient.

* WebKit2.xcodeproj/project.pbxproj:

* WebKitTestRunner/TestController.cpp:
(WTR::copyWebCryptoMasterKey):
(WTR::TestController::createOtherPage):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::ensureViewSupportsOptions):
(WTR::TestController::didCommitNavigation):
(WTR::TestController::didFinishNavigation):
(WTR::TestController::canAuthenticateAgainstProtectionSpace):
(WTR::TestController::didReceiveAuthenticationChallenge):
(WTR::TestController::decidePolicyForPluginLoad):
(WTR::TestController::decidePolicyForNavigationAction):
(WTR::TestController::decidePolicyForNavigationResponse):
(WTR::TestController::didCommitLoadForFrame): Deleted.
(WTR::TestController::didFinishLoadForFrame): Deleted.
* WebKitTestRunner/TestController.h:
Adopt WKPageNavigationClient and adjust to its semantics (navigations are main-frame-only, etc.)

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

24 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/c/WKBase.h
Source/WebKit2/UIProcess/API/APINavigationClient.h
Source/WebKit2/UIProcess/API/C/WKAPICast.h
Source/WebKit2/UIProcess/API/C/WKFrameInfoRef.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/WKFrameInfoRef.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/WKNavigationActionRef.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/WKNavigationActionRef.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/WKNavigationRef.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/WKNavigationRef.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/WKNavigationResponseRef.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/WKNavigationResponseRef.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/WKPage.cpp
Source/WebKit2/UIProcess/API/C/WKPage.h
Source/WebKit2/UIProcess/API/C/WKPageLoaderClient.h
Source/WebKit2/UIProcess/API/C/WKPageNavigationClient.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/WKPageRenderingProgressEvents.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/WKPageRenderingProgressEventsInternal.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/WKPluginLoadPolicy.h [new file with mode: 0644]
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Tools/ChangeLog
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h

index 807b5b435d82f068c955dd78c64d319773419e31..93ead54ed804d121030965438c783704857a6e50 100644 (file)
@@ -1,3 +1,57 @@
+2015-02-03  Tim Horton  <timothy_horton@apple.com>
+
+        Add WKPageNavigationClient as C SPI around API::NavigationClient, and adopt in WKTR
+        https://bugs.webkit.org/show_bug.cgi?id=141217
+
+        Reviewed by Sam Weinig.
+
+        * Shared/API/c/WKBase.h:
+        * UIProcess/API/C/WKAPICast.h:
+        * UIProcess/API/C/WKFrameInfoRef.cpp: Added.
+        (WKFrameInfoGetTypeID):
+        * UIProcess/API/C/WKFrameInfoRef.h: Added.
+        * UIProcess/API/C/WKNavigationActionRef.cpp: Added.
+        (WKNavigationActionGetTypeID):
+        * UIProcess/API/C/WKNavigationActionRef.h: Added.
+        * UIProcess/API/C/WKNavigationRef.cpp: Added.
+        (WKNavigationGetTypeID):
+        * UIProcess/API/C/WKNavigationRef.h: Added.
+        * UIProcess/API/C/WKNavigationResponseRef.cpp: Added.
+        (WKNavigationResponseGetTypeID):
+        (WKNavigationResponseCanShowMIMEType):
+        * UIProcess/API/C/WKNavigationResponseRef.h: Added.
+        Add tiny C wrappers around API::{FrameInfo, NavigationAction, Navigation, NavigationResponse}.
+
+        * UIProcess/API/APINavigationClient.h:
+        (API::NavigationClient::decidePolicyForPluginLoad):
+        Add a default implementation of decidePolicyForPluginLoad.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageSetPageNavigationClient):
+        * UIProcess/API/C/WKPage.h:
+        Add WKPageSetPageNavigationClient, which connects API::NavigationClient to
+        the new WKPageNavigationClient C SPI.
+        
+        * UIProcess/API/C/WKPageNavigationClient.h: Added.
+        Add WKPageNavigationClient, which one can use in place of WKPageLoaderClient
+        and WKPagePolicyClient and which has the same semantics as the Modern ObjC API
+        (including things like API::Navigation as WKNavigationRef, etc.)
+
+        * UIProcess/API/C/WKPageLoaderClient.h:
+        * UIProcess/API/C/WKPageRenderingProgressEvents.h: Added.
+        * UIProcess/API/C/WKPageRenderingProgressEventsInternal.h: Added.
+        (pageRenderingProgressEvents):
+        * UIProcess/API/C/WKPluginLoadPolicy.h: Added.
+        Pull some enums out into their own files (WKPageRenderingProgressEvents is
+        duplicated from the Modern ObjC API's _WKRenderingProgressEvents, WKPluginLoadPolicy
+        is pulled out of WKPageLoaderClient).
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::findPlugin):
+        Add an equivalent of pluginLoadPolicy to the NavigationClient.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+
 2015-02-03  Timothy Horton  <timothy_horton@apple.com>
 
         Every PageOverlayClientImpl leaks
index c4dce01ca52f5d6c8724cb6384687897b5805ed7..13af154eb4d2b9b381edef4b1f31038dc6490693 100644 (file)
@@ -100,6 +100,7 @@ typedef const struct OpaqueWKCredential* WKCredentialRef;
 typedef const struct OpaqueWKDatabaseManager* WKDatabaseManagerRef;
 typedef const struct OpaqueWKDownload* WKDownloadRef;
 typedef const struct OpaqueWKFormSubmissionListener* WKFormSubmissionListenerRef;
+typedef const struct OpaqueWKFrameInfo* WKFrameInfoRef;
 typedef const struct OpaqueWKFrame* WKFrameRef;
 typedef const struct OpaqueWKFramePolicyListener* WKFramePolicyListenerRef;
 typedef const struct OpaqueWKGeolocationManager* WKGeolocationManagerRef;
@@ -111,7 +112,10 @@ typedef const struct OpaqueWKIconDatabase* WKIconDatabaseRef;
 typedef const struct OpaqueWKInspector* WKInspectorRef;
 typedef const struct OpaqueWKKeyValueStorageManager* WKKeyValueStorageManagerRef;
 typedef const struct OpaqueWKMediaCacheManager* WKMediaCacheManagerRef;
+typedef const struct OpaqueWKNavigationAction* WKNavigationActionRef;
 typedef const struct OpaqueWKNavigationData* WKNavigationDataRef;
+typedef const struct OpaqueWKNavigation* WKNavigationRef;
+typedef const struct OpaqueWKNavigationResponse* WKNavigationResponseRef;
 typedef const struct OpaqueWKNotification* WKNotificationRef;
 typedef const struct OpaqueWKNotificationManager* WKNotificationManagerRef;
 typedef const struct OpaqueWKNotificationPermissionRequest* WKNotificationPermissionRequestRef;
index b8fe9d13c4ba865b09ea0c90cef10d9abb06da97..875e8cc0d9187ae14764dc4578529d0a32c9262a 100644 (file)
@@ -104,6 +104,13 @@ public:
     {
         listener->use();
     }
+    
+#if ENABLE(NETSCAPE_PLUGIN_API)
+    virtual WebKit::PluginModuleLoadPolicy decidePolicyForPluginLoad(WebKit::WebPageProxy&, WebKit::PluginModuleLoadPolicy currentPluginLoadPolicy, API::Dictionary*, WTF::String&)
+    {
+        return currentPluginLoadPolicy;
+    }
+#endif
 };
 
 } // namespace API
index f8f1b83eca33382a48db8fd01411ab8c44d92d5f..dc47fbe3e370493d76b4cb28d4dc2099c909e3ac 100644 (file)
 #include <WebCore/Settings.h>
 
 namespace API {
+class FrameInfo;
+class Navigation;
+class NavigationAction;
 class NavigationData;
+class NavigationResponse;
 class PageConfiguration;
 class ProcessPoolConfiguration;
 class SessionState;
@@ -125,6 +129,7 @@ WK_ADD_API_MAPPING(WKDatabaseManagerRef, WebDatabaseManagerProxy)
 WK_ADD_API_MAPPING(WKDownloadRef, DownloadProxy)
 WK_ADD_API_MAPPING(WKFormSubmissionListenerRef, WebFormSubmissionListenerProxy)
 WK_ADD_API_MAPPING(WKFramePolicyListenerRef, WebFramePolicyListenerProxy)
+WK_ADD_API_MAPPING(WKFrameInfoRef, API::FrameInfo)
 WK_ADD_API_MAPPING(WKFrameRef, WebFrameProxy)
 WK_ADD_API_MAPPING(WKGeolocationManagerRef, WebGeolocationManagerProxy)
 WK_ADD_API_MAPPING(WKGeolocationPermissionRequestRef, GeolocationPermissionRequestProxy)
@@ -134,7 +139,10 @@ WK_ADD_API_MAPPING(WKHitTestResultRef, WebHitTestResult)
 WK_ADD_API_MAPPING(WKIconDatabaseRef, WebIconDatabase)
 WK_ADD_API_MAPPING(WKKeyValueStorageManagerRef, WebKeyValueStorageManager)
 WK_ADD_API_MAPPING(WKMediaCacheManagerRef, WebMediaCacheManagerProxy)
+WK_ADD_API_MAPPING(WKNavigationActionRef, API::NavigationAction)
 WK_ADD_API_MAPPING(WKNavigationDataRef, API::NavigationData)
+WK_ADD_API_MAPPING(WKNavigationRef, API::Navigation)
+WK_ADD_API_MAPPING(WKNavigationResponseRef, API::NavigationResponse)
 WK_ADD_API_MAPPING(WKNotificationManagerRef, WebNotificationManagerProxy)
 WK_ADD_API_MAPPING(WKNotificationPermissionRequestRef, NotificationPermissionRequest)
 WK_ADD_API_MAPPING(WKNotificationProviderRef, WebNotificationProvider)
diff --git a/Source/WebKit2/UIProcess/API/C/WKFrameInfoRef.cpp b/Source/WebKit2/UIProcess/API/C/WKFrameInfoRef.cpp
new file mode 100644 (file)
index 0000000..dbdd101
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2015 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 "config.h"
+#include "WKFrameInfoRef.h"
+
+#include "APIFrameInfo.h"
+#include "WKAPICast.h"
+
+using namespace WebKit;
+
+WKTypeID WKFrameInfoGetTypeID()
+{
+    return toAPI(API::FrameInfo::APIType);
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKFrameInfoRef.h b/Source/WebKit2/UIProcess/API/C/WKFrameInfoRef.h
new file mode 100644 (file)
index 0000000..f7ddadd
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 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 WKFrameInfoRef_h
+#define WKFrameInfoRef_h
+
+#include <WebKit/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKFrameInfoGetTypeID();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKFrameInfoRef_h
diff --git a/Source/WebKit2/UIProcess/API/C/WKNavigationActionRef.cpp b/Source/WebKit2/UIProcess/API/C/WKNavigationActionRef.cpp
new file mode 100644 (file)
index 0000000..14a2351
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2015 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 "config.h"
+#include "WKNavigationActionRef.h"
+
+#include "APINavigationAction.h"
+#include "WKAPICast.h"
+
+using namespace WebKit;
+
+WKTypeID WKNavigationActionGetTypeID()
+{
+    return toAPI(API::NavigationAction::APIType);
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKNavigationActionRef.h b/Source/WebKit2/UIProcess/API/C/WKNavigationActionRef.h
new file mode 100644 (file)
index 0000000..5691eab
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 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 WKNavigationActionRef_h
+#define WKNavigationActionRef_h
+
+#include <WebKit/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKNavigationActionGetTypeID();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKNavigationActionRef_h
diff --git a/Source/WebKit2/UIProcess/API/C/WKNavigationRef.cpp b/Source/WebKit2/UIProcess/API/C/WKNavigationRef.cpp
new file mode 100644 (file)
index 0000000..591c146
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2015 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 "config.h"
+#include "WKNavigationRef.h"
+
+#include "APINavigation.h"
+#include "WKAPICast.h"
+
+using namespace WebKit;
+
+WKTypeID WKNavigationGetTypeID()
+{
+    return toAPI(API::Navigation::APIType);
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKNavigationRef.h b/Source/WebKit2/UIProcess/API/C/WKNavigationRef.h
new file mode 100644 (file)
index 0000000..ae9a190
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 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 WKNavigationRef_h
+#define WKNavigationRef_h
+
+#include <WebKit/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKNavigationGetTypeID();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKNavigationRef_h
diff --git a/Source/WebKit2/UIProcess/API/C/WKNavigationResponseRef.cpp b/Source/WebKit2/UIProcess/API/C/WKNavigationResponseRef.cpp
new file mode 100644 (file)
index 0000000..ed6f21b
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2015 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 "config.h"
+#include "WKNavigationResponseRef.h"
+
+#include "APINavigationResponse.h"
+#include "WKAPICast.h"
+
+using namespace WebKit;
+
+WKTypeID WKNavigationResponseGetTypeID()
+{
+    return toAPI(API::NavigationResponse::APIType);
+}
+
+bool WKNavigationResponseCanShowMIMEType(WKNavigationResponseRef response)
+{
+    return toImpl(response)->canShowMIMEType();
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKNavigationResponseRef.h b/Source/WebKit2/UIProcess/API/C/WKNavigationResponseRef.h
new file mode 100644 (file)
index 0000000..c82b14d
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2015 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 WKNavigationResponseRef_h
+#define WKNavigationResponseRef_h
+
+#include <WebKit/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKNavigationResponseGetTypeID();
+    
+WK_EXPORT bool WKNavigationResponseCanShowMIMEType(WKNavigationResponseRef);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKNavigationResponseRef_h
index 278bf9a89f9058e7ea40ace5c6dd2c90fc6c3b42..48434078fce0a75a5f256374d60da93d560817db 100644 (file)
@@ -32,7 +32,9 @@
 #include "APIData.h"
 #include "APIDictionary.h"
 #include "APIFindClient.h"
+#include "APIFrameInfo.h"
 #include "APILoaderClient.h"
+#include "APINavigationClient.h"
 #include "APIPolicyClient.h"
 #include "APISessionState.h"
 #include "APIUIClient.h"
@@ -46,6 +48,7 @@
 #include "PrintInfo.h"
 #include "WKAPICast.h"
 #include "WKPagePolicyClientInternal.h"
+#include "WKPageRenderingProgressEventsInternal.h"
 #include "WKPluginInformation.h"
 #include "WebBackForwardList.h"
 #include "WebFormClient.h"
@@ -77,6 +80,10 @@ template<> struct ClientTraits<WKPageLoaderClientBase> {
     typedef std::tuple<WKPageLoaderClientV0, WKPageLoaderClientV1, WKPageLoaderClientV2, WKPageLoaderClientV3, WKPageLoaderClientV4, WKPageLoaderClientV5> Versions;
 };
 
+template<> struct ClientTraits<WKPageNavigationClientBase> {
+    typedef std::tuple<WKPageNavigationClientV0> Versions;
+};
+
 template<> struct ClientTraits<WKPagePolicyClientBase> {
     typedef std::tuple<WKPagePolicyClientV0, WKPagePolicyClientV1, WKPagePolicyClientInternal> Versions;
 };
@@ -1736,6 +1743,153 @@ void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClientBase* wkClient
     toImpl(pageRef)->setUIClient(std::make_unique<UIClient>(wkClient));
 }
 
+void WKPageSetPageNavigationClient(WKPageRef pageRef, const WKPageNavigationClientBase* wkClient)
+{
+    class NavigationClient : public API::Client<WKPageNavigationClientBase>, public API::NavigationClient {
+    public:
+        explicit NavigationClient(const WKPageNavigationClientBase* client)
+        {
+            initialize(client);
+        }
+
+    private:
+        virtual void decidePolicyForNavigationAction(WebPageProxy& page, API::NavigationAction& navigationAction, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, API::Object* userData) override
+        {
+            if (!m_client.decidePolicyForNavigationAction)
+                return;
+            m_client.decidePolicyForNavigationAction(toAPI(&page), toAPI(&navigationAction), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
+        }
+
+        virtual void decidePolicyForNavigationResponse(WebPageProxy& page, API::NavigationResponse& navigationResponse, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, API::Object* userData) override
+        {
+            if (!m_client.decidePolicyForNavigationResponse)
+                return;
+            m_client.decidePolicyForNavigationResponse(toAPI(&page), toAPI(&navigationResponse), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
+        }
+
+        virtual void didStartProvisionalNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object* userData) override
+        {
+            if (!m_client.didStartProvisionalNavigation)
+                return;
+            m_client.didStartProvisionalNavigation(toAPI(&page), toAPI(navigation), toAPI(userData), m_client.base.clientInfo);
+        }
+
+        virtual void didReceiveServerRedirectForProvisionalNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object* userData) override
+        {
+            if (!m_client.didReceiveServerRedirectForProvisionalNavigation)
+                return;
+            m_client.didReceiveServerRedirectForProvisionalNavigation(toAPI(&page), toAPI(navigation), toAPI(userData), m_client.base.clientInfo);
+        }
+
+        virtual void didFailProvisionalNavigationWithError(WebPageProxy& page, WebFrameProxy&, API::Navigation* navigation, const WebCore::ResourceError& error, API::Object* userData) override
+        {
+            if (!m_client.didFailProvisionalNavigation)
+                return;
+            m_client.didFailProvisionalNavigation(toAPI(&page), toAPI(navigation), toAPI(error), toAPI(userData), m_client.base.clientInfo);
+        }
+
+        virtual void didCommitNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object* userData) override
+        {
+            if (!m_client.didCommitNavigation)
+                return;
+            m_client.didCommitNavigation(toAPI(&page), toAPI(navigation), toAPI(userData), m_client.base.clientInfo);
+        }
+
+        virtual void didFinishNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object* userData) override
+        {
+            if (!m_client.didFinishNavigation)
+                return;
+            m_client.didFinishNavigation(toAPI(&page), toAPI(navigation), toAPI(userData), m_client.base.clientInfo);
+        }
+
+        virtual void didFailNavigationWithError(WebPageProxy& page, WebFrameProxy&, API::Navigation* navigation, const WebCore::ResourceError& error, API::Object* userData) override
+        {
+            if (!m_client.didFailNavigation)
+                return;
+            m_client.didFailNavigation(toAPI(&page), toAPI(navigation), toAPI(error), toAPI(userData), m_client.base.clientInfo);
+        }
+
+        virtual void didFailProvisionalLoadInSubframeWithError(WebPageProxy& page, WebFrameProxy& subframe, API::Navigation* navigation, const WebCore::ResourceError& error, API::Object* userData) override
+        {
+            if (!m_client.didFailProvisionalLoadInSubframe)
+                return;
+            m_client.didFailProvisionalLoadInSubframe(toAPI(&page), toAPI(navigation), toAPI(API::FrameInfo::create(subframe).ptr()), toAPI(error), toAPI(userData), m_client.base.clientInfo);
+        }
+
+        virtual void didFinishDocumentLoad(WebPageProxy& page, API::Navigation* navigation, API::Object* userData) override
+        {
+            if (!m_client.didFinishDocumentLoad)
+                return;
+            m_client.didFinishDocumentLoad(toAPI(&page), toAPI(navigation), toAPI(userData), m_client.base.clientInfo);
+        }
+
+        virtual void didSameDocumentNavigation(WebPageProxy& page, API::Navigation* navigation, WebKit::SameDocumentNavigationType navigationType, API::Object* userData) override
+        {
+            if (!m_client.didSameDocumentNavigation)
+                return;
+            m_client.didSameDocumentNavigation(toAPI(&page), toAPI(navigation), toAPI(navigationType), toAPI(userData), m_client.base.clientInfo);
+        }
+        
+        virtual void renderingProgressDidChange(WebPageProxy& page, WebCore::LayoutMilestones milestones, API::Object* userData) override
+        {
+            if (!m_client.renderingProgressDidChange)
+                return;
+            m_client.renderingProgressDidChange(toAPI(&page), pageRenderingProgressEvents(milestones), toAPI(userData), m_client.base.clientInfo);
+        }
+        
+        virtual bool canAuthenticateAgainstProtectionSpace(WebPageProxy& page, WebProtectionSpace* protectionSpace) override
+        {
+            if (!m_client.canAuthenticateAgainstProtectionSpace)
+                return false;
+            return m_client.canAuthenticateAgainstProtectionSpace(toAPI(&page), toAPI(protectionSpace), m_client.base.clientInfo);
+        }
+        
+        virtual void didReceiveAuthenticationChallenge(WebPageProxy& page, AuthenticationChallengeProxy* authenticationChallenge) override
+        {
+            if (!m_client.didReceiveAuthenticationChallenge)
+                return;
+            m_client.didReceiveAuthenticationChallenge(toAPI(&page), toAPI(authenticationChallenge), m_client.base.clientInfo);
+        }
+
+        virtual void processDidCrash(WebPageProxy& page) override
+        {
+            if (!m_client.webProcessDidCrash)
+                return;
+            m_client.webProcessDidCrash(toAPI(&page), m_client.base.clientInfo);
+        }
+
+        virtual PassRefPtr<API::Data> webCryptoMasterKey(WebPageProxy& page) override
+        {
+            if (!m_client.copyWebCryptoMasterKey)
+                return nullptr;
+            return adoptRef(toImpl(m_client.copyWebCryptoMasterKey(toAPI(&page), m_client.base.clientInfo)));
+        }
+        
+#if ENABLE(NETSCAPE_PLUGIN_API)
+        virtual PluginModuleLoadPolicy decidePolicyForPluginLoad(WebPageProxy& page, PluginModuleLoadPolicy currentPluginLoadPolicy, API::Dictionary* pluginInformation, String& unavailabilityDescription) override
+        {
+            WKStringRef unavailabilityDescriptionOut = 0;
+            PluginModuleLoadPolicy loadPolicy = currentPluginLoadPolicy;
+            
+            if (m_client.decidePolicyForPluginLoad)
+                loadPolicy = toPluginModuleLoadPolicy(m_client.decidePolicyForPluginLoad(toAPI(&page), toWKPluginLoadPolicy(currentPluginLoadPolicy), toAPI(pluginInformation), &unavailabilityDescriptionOut, m_client.base.clientInfo));
+            
+            if (unavailabilityDescriptionOut) {
+                RefPtr<API::String> webUnavailabilityDescription = adoptRef(toImpl(unavailabilityDescriptionOut));
+                unavailabilityDescription = webUnavailabilityDescription->string();
+            }
+            
+            return loadPolicy;
+        }
+#endif
+    };
+
+    WebPageProxy* webPageProxy = toImpl(pageRef);
+
+    auto navigationClient = std::make_unique<NavigationClient>(wkClient);
+    webPageProxy->setNavigationClient(WTF::move(navigationClient));
+}
+
 void WKPageSetSession(WKPageRef pageRef, WKSessionRef session)
 {
     toImpl(pageRef)->setSessionID(toImpl(session)->getID());
index eb0889d0feb75960e9d1573841545ed0c4fbfa99..5134a066b27e0d967ea94e76fd4ef14caa8052ac 100644 (file)
@@ -39,6 +39,7 @@
 #include <WebKit/WKPageFormClient.h>
 #include <WebKit/WKPageLoadTypes.h>
 #include <WebKit/WKPageLoaderClient.h>
+#include <WebKit/WKPageNavigationClient.h>
 #include <WebKit/WKPagePolicyClient.h>
 #include <WebKit/WKPageUIClient.h>
 #include <WebKit/WKPageVisibilityTypes.h>
@@ -212,9 +213,12 @@ WK_EXPORT void WKPageSetPageDiagnosticLoggingClient(WKPageRef page, const WKPage
 WK_EXPORT void WKPageSetPageFindClient(WKPageRef page, const WKPageFindClientBase* client);
 WK_EXPORT void WKPageSetPageFindMatchesClient(WKPageRef page, const WKPageFindMatchesClientBase* client);
 WK_EXPORT void WKPageSetPageFormClient(WKPageRef page, const WKPageFormClientBase* client);
+WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, const WKPageUIClientBase* client);
+
+// A client can implement either a navigation client or loader and policy clients, but never both.
 WK_EXPORT void WKPageSetPageLoaderClient(WKPageRef page, const WKPageLoaderClientBase* client);
 WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, const WKPagePolicyClientBase* client);
-WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, const WKPageUIClientBase* client);
+WK_EXPORT void WKPageSetPageNavigationClient(WKPageRef page, const WKPageNavigationClientBase* client);
 
 WK_EXPORT void WKPageSetSession(WKPageRef page, WKSessionRef session);
 
index a7b3c30b5f37c4b073cfb807859a9a2cef94fc29..3b3243272402e3769fc3b45917e9224f36e4083e 100644 (file)
 #include <WebKit/WKBase.h>
 #include <WebKit/WKErrorRef.h>
 #include <WebKit/WKPageLoadTypes.h>
+#include <WebKit/WKPluginLoadPolicy.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-enum {
-    kWKPluginLoadPolicyLoadNormally = 0,
-    kWKPluginLoadPolicyBlocked,
-    kWKPluginLoadPolicyInactive,
-    kWKPluginLoadPolicyLoadUnsandboxed,
-};
-typedef uint32_t WKPluginLoadPolicy;
-
 enum {
     kWKWebGLLoadPolicyBlocked = 0,
     kWKWebGLLoadPolicyLoadNormally,
diff --git a/Source/WebKit2/UIProcess/API/C/WKPageNavigationClient.h b/Source/WebKit2/UIProcess/API/C/WKPageNavigationClient.h
new file mode 100644 (file)
index 0000000..cb9b2f5
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2015 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 WKPageNavigationClient_h
+#define WKPageNavigationClient_h
+
+#include <WebKit/WKBase.h>
+#include <WebKit/WKPageLoadTypes.h>
+#include <WebKit/WKPageRenderingProgressEvents.h>
+#include <WebKit/WKPluginLoadPolicy.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void (*WKPageNavigationDecidePolicyForNavigationActionCallback)(WKPageRef page, WKNavigationActionRef navigationAction, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
+
+typedef void (*WKPageNavigationDecidePolicyForNavigationResponseCallback)(WKPageRef page, WKNavigationResponseRef navigationResponse, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
+
+typedef void (*WKPageNavigationDidStartProvisionalNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo);
+
+typedef void (*WKPageNavigationDidReceiveServerRedirectForProvisionalNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo);
+
+typedef void (*WKPageNavigationDidFailProvisionalNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKErrorRef error, WKTypeRef userData, const void* clientInfo);
+
+typedef void (*WKPageNavigationDidCommitNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo);
+
+typedef void (*WKPageNavigationDidFinishNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo);
+
+typedef void (*WKPageNavigationDidFailNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKErrorRef error, WKTypeRef userData, const void* clientInfo);
+
+typedef void (*WKPageNavigationDidFailProvisionalLoadInSubframeCallback)(WKPageRef page, WKNavigationRef navigation, WKFrameInfoRef subframe, WKErrorRef error, WKTypeRef userData, const void* clientInfo);
+
+typedef void (*WKPageNavigationDidFinishDocumentLoadCallback)(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo);
+
+typedef void (*WKPageNavigationDidSameDocumentNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKSameDocumentNavigationType navigationType, WKTypeRef userData, const void* clientInfo);
+
+typedef void (*WKPageNavigationRenderingProgressDidChangeCallback)(WKPageRef page, WKPageRenderingProgressEvents progressEvents, WKTypeRef userData, const void* clientInfo);
+    
+typedef bool (*WKPageNavigationCanAuthenticateAgainstProtectionSpaceCallback)(WKPageRef page, WKProtectionSpaceRef protectionSpace, const void* clientInfo);
+
+typedef void (*WKPageNavigationDidReceiveAuthenticationChallengeCallback)(WKPageRef page, WKAuthenticationChallengeRef challenge, const void* clientInfo);
+
+typedef void (*WKPageNavigationWebProcessDidCrashCallback)(WKPageRef page, const void* clientInfo);
+
+typedef WKDataRef (*WKPageNavigationCopyWebCryptoMasterKeyCallback)(WKPageRef page, const void* clientInfo);
+    
+typedef WKPluginLoadPolicy (*WKPageNavigationDecidePolicyForPluginLoadCallback)(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInfoDictionary, WKStringRef* unavailabilityDescription, const void* clientInfo);
+
+typedef struct WKPageNavigationClientBase {
+    int version;
+    const void* clientInfo;
+} WKPageNavigationClientBase;
+
+typedef struct WKPageNavigationClientV0 {
+    WKPageNavigationClientBase base;
+
+    // Version 0.
+    WKPageNavigationDecidePolicyForNavigationActionCallback decidePolicyForNavigationAction;
+    WKPageNavigationDecidePolicyForNavigationResponseCallback decidePolicyForNavigationResponse;
+    WKPageNavigationDecidePolicyForPluginLoadCallback decidePolicyForPluginLoad;
+    WKPageNavigationDidStartProvisionalNavigationCallback didStartProvisionalNavigation;
+    WKPageNavigationDidReceiveServerRedirectForProvisionalNavigationCallback didReceiveServerRedirectForProvisionalNavigation;
+    WKPageNavigationDidFailProvisionalNavigationCallback didFailProvisionalNavigation;
+    WKPageNavigationDidCommitNavigationCallback didCommitNavigation;
+    WKPageNavigationDidFinishNavigationCallback didFinishNavigation;
+    WKPageNavigationDidFailNavigationCallback didFailNavigation;
+    WKPageNavigationDidFailProvisionalLoadInSubframeCallback didFailProvisionalLoadInSubframe;
+    WKPageNavigationDidFinishDocumentLoadCallback didFinishDocumentLoad;
+    WKPageNavigationDidSameDocumentNavigationCallback didSameDocumentNavigation;
+    WKPageNavigationRenderingProgressDidChangeCallback renderingProgressDidChange;
+    WKPageNavigationCanAuthenticateAgainstProtectionSpaceCallback canAuthenticateAgainstProtectionSpace;
+    WKPageNavigationDidReceiveAuthenticationChallengeCallback didReceiveAuthenticationChallenge;
+    WKPageNavigationWebProcessDidCrashCallback webProcessDidCrash;
+    WKPageNavigationCopyWebCryptoMasterKeyCallback copyWebCryptoMasterKey;
+} WKPageNavigationClientV0;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKPageNavigationClient_h
diff --git a/Source/WebKit2/UIProcess/API/C/WKPageRenderingProgressEvents.h b/Source/WebKit2/UIProcess/API/C/WKPageRenderingProgressEvents.h
new file mode 100644 (file)
index 0000000..6d258ed
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2015 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 WKPageRenderingProgressEvents_h
+#define WKPageRenderingProgressEvents_h
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+    WKPageRenderingProgressEventFirstLayout = 1 << 0,
+    WKPageRenderingProgressEventFirstVisuallyNonEmptyLayout = 1 << 1,
+    WKPageRenderingProgressEventFirstPaintWithSignificantArea = 1 << 2,
+    WKPageRenderingProgressEventReachedSessionRestorationRenderTreeSizeThreshold = 1 << 3
+};
+typedef uint32_t WKPageRenderingProgressEvents;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKPageRenderingProgressEvents_h */
diff --git a/Source/WebKit2/UIProcess/API/C/WKPageRenderingProgressEventsInternal.h b/Source/WebKit2/UIProcess/API/C/WKPageRenderingProgressEventsInternal.h
new file mode 100644 (file)
index 0000000..3144a36
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#import "WKPageRenderingProgressEvents.h"
+
+#import <WebCore/LayoutMilestones.h>
+
+static inline WKPageRenderingProgressEvents pageRenderingProgressEvents(WebCore::LayoutMilestones milestones)
+{
+    WKPageRenderingProgressEvents events = 0;
+    
+    if (milestones & WebCore::DidFirstLayout)
+        events |= WKPageRenderingProgressEventFirstLayout;
+    
+    if (milestones & WebCore::DidFirstVisuallyNonEmptyLayout)
+        events |= WKPageRenderingProgressEventFirstVisuallyNonEmptyLayout;
+    
+    if (milestones & WebCore::DidHitRelevantRepaintedObjectsAreaThreshold)
+        events |= WKPageRenderingProgressEventFirstPaintWithSignificantArea;
+    
+    if (milestones & WebCore::ReachedSessionRestorationRenderTreeSizeThreshold)
+        events |= WKPageRenderingProgressEventReachedSessionRestorationRenderTreeSizeThreshold;
+    
+    return events;
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKPluginLoadPolicy.h b/Source/WebKit2/UIProcess/API/C/WKPluginLoadPolicy.h
new file mode 100644 (file)
index 0000000..715935a
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2015 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 WKPluginLoadPolicy_h
+#define WKPluginLoadPolicy_h
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+    kWKPluginLoadPolicyLoadNormally = 0,
+    kWKPluginLoadPolicyBlocked,
+    kWKPluginLoadPolicyInactive,
+    kWKPluginLoadPolicyLoadUnsandboxed,
+};
+typedef uint32_t WKPluginLoadPolicy;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKPluginLoadPolicy_h */
index c2c031a67c174ab00a52fbf8d887b889c7a0d892..19bf05fd137f9b20147d3b7935efdadd31a94383 100644 (file)
@@ -1741,7 +1741,10 @@ void WebPageProxy::findPlugin(const String& mimeType, uint32_t processType, cons
 
 #if PLATFORM(COCOA)
     RefPtr<API::Dictionary> pluginInformation = createPluginInformationDictionary(plugin, frameURLString, String(), pageURLString, String(), String());
-    pluginLoadPolicy = m_loaderClient->pluginLoadPolicy(*this, static_cast<PluginModuleLoadPolicy>(pluginLoadPolicy), pluginInformation.get(), unavailabilityDescription);
+    if (m_navigationClient)
+        pluginLoadPolicy = m_navigationClient->decidePolicyForPluginLoad(*this, static_cast<PluginModuleLoadPolicy>(pluginLoadPolicy), pluginInformation.get(), unavailabilityDescription);
+    else
+        pluginLoadPolicy = m_loaderClient->pluginLoadPolicy(*this, static_cast<PluginModuleLoadPolicy>(pluginLoadPolicy), pluginInformation.get(), unavailabilityDescription);
 #else
     UNUSED_PARAM(frameURLString);
     UNUSED_PARAM(pageURLString);
index af464bc0e6bd4d1a616b706ad9e4ff8836f3f998..8d55807ac8d4e4cd61b0940a948f83ab1c11d089 100644 (file)
                2D2ADF1016364D8200197E47 /* PDFPluginChoiceAnnotation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2ADF0E16364D8200197E47 /* PDFPluginChoiceAnnotation.mm */; };
                2D353B1219F8305D000EEACD /* ActionMenuHitTestResult.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D353B1019F8305D000EEACD /* ActionMenuHitTestResult.mm */; };
                2D353B1319F8305D000EEACD /* ActionMenuHitTestResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D353B1119F8305D000EEACD /* ActionMenuHitTestResult.h */; };
+               2D3A65DA1A7C3A1F00CAC637 /* WKNavigationActionRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D3A65D81A7C3A1F00CAC637 /* WKNavigationActionRef.cpp */; };
+               2D3A65DB1A7C3A1F00CAC637 /* WKNavigationActionRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D3A65D91A7C3A1F00CAC637 /* WKNavigationActionRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               2D3A65DE1A7C3A7D00CAC637 /* WKNavigationResponseRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D3A65DC1A7C3A7D00CAC637 /* WKNavigationResponseRef.cpp */; };
+               2D3A65DF1A7C3A7D00CAC637 /* WKNavigationResponseRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D3A65DD1A7C3A7D00CAC637 /* WKNavigationResponseRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               2D3A65E21A7C3A9300CAC637 /* WKNavigationRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D3A65E01A7C3A9300CAC637 /* WKNavigationRef.cpp */; };
+               2D3A65E31A7C3A9300CAC637 /* WKNavigationRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D3A65E11A7C3A9300CAC637 /* WKNavigationRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               2D3A65E61A7C3AA700CAC637 /* WKFrameInfoRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D3A65E41A7C3AA700CAC637 /* WKFrameInfoRef.cpp */; };
+               2D3A65E71A7C3AA700CAC637 /* WKFrameInfoRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D3A65E51A7C3AA700CAC637 /* WKFrameInfoRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2D3EF4421917646300034184 /* WebMemoryPressureHandlerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D3EF4401917646300034184 /* WebMemoryPressureHandlerIOS.mm */; };
                2D3EF4431917646300034184 /* WebMemoryPressureHandlerIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D3EF4411917646300034184 /* WebMemoryPressureHandlerIOS.h */; };
                2D429BFD1721E2C700EC681F /* PDFPluginPasswordField.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D429BFB1721E2BA00EC681F /* PDFPluginPasswordField.mm */; };
                2D6B371C18A967AD0042AE80 /* _WKThumbnailView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D6B371A18A967AD0042AE80 /* _WKThumbnailView.mm */; };
                2D6CD119189058A500E5A4A0 /* ViewSnapshotStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6CD117189058A500E5A4A0 /* ViewSnapshotStore.h */; };
                2D6CD11A189058A500E5A4A0 /* ViewSnapshotStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D6CD118189058A500E5A4A0 /* ViewSnapshotStore.mm */; };
+               2D7303791A7C2B7500F8F487 /* WKPageNavigationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D7303781A7C2B7500F8F487 /* WKPageNavigationClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2D7AAFD318C8640600A7ACD4 /* WKWebViewContentProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D7AAFD218C8640600A7ACD4 /* WKWebViewContentProvider.h */; };
                2D7AAFD618C956AF00A7ACD4 /* WKWebViewConfigurationInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D7AAFD518C956AF00A7ACD4 /* WKWebViewConfigurationInternal.h */; };
                2D7F13101A702FBA009A6FBD /* ProcessType.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D7F130F1A702FBA009A6FBD /* ProcessType.h */; };
                2DA944B91884EA3900ED86DB /* WebBackForwardListProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944B51884EA3500ED86DB /* WebBackForwardListProxyIOS.mm */; };
                2DA944BA1884EA3C00ED86DB /* WebPageIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944B61884EA3500ED86DB /* WebPageIOS.mm */; };
                2DA944BD188511E700ED86DB /* NetworkProcessIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944BC188511E700ED86DB /* NetworkProcessIOS.mm */; };
+               2DABA7721A817B1700EF0F1A /* WKPageRenderingProgressEventsInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DABA7711A817B1700EF0F1A /* WKPageRenderingProgressEventsInternal.h */; };
+               2DABA7741A817EE600EF0F1A /* WKPluginLoadPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DABA7731A817EE600EF0F1A /* WKPluginLoadPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2DACE64E18ADBFF000E4CA76 /* _WKThumbnailViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DACE64D18ADBFF000E4CA76 /* _WKThumbnailViewInternal.h */; };
                2DAF06D618BD1A470081CEB1 /* SmartMagnificationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DAF06D418BD1A470081CEB1 /* SmartMagnificationController.h */; };
                2DAF06D718BD1A470081CEB1 /* SmartMagnificationController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DAF06D518BD1A470081CEB1 /* SmartMagnificationController.mm */; };
                2DC6D9C318C44A610043BAD4 /* WKWebViewContentProviderRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DC6D9C118C44A610043BAD4 /* WKWebViewContentProviderRegistry.h */; };
                2DC6D9C418C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DC6D9C218C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm */; };
+               2DD12A081A8177F3002C74E6 /* WKPageRenderingProgressEvents.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DD12A071A8177F3002C74E6 /* WKPageRenderingProgressEvents.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2DD13BD518F7DADD00E130A1 /* FindControllerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DD13BD318F7DADD00E130A1 /* FindControllerIOS.mm */; };
                2DD9EB2D1A6F012500BB1267 /* APINavigationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DD9EB2C1A6F012500BB1267 /* APINavigationClient.h */; };
                2DDE0AFA18298CC900F97EAA /* RemoteLayerTreePropertyApplier.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DDE0AF818298CC900F97EAA /* RemoteLayerTreePropertyApplier.h */; };
                2D2ADF0E16364D8200197E47 /* PDFPluginChoiceAnnotation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PDFPluginChoiceAnnotation.mm; path = PDF/PDFPluginChoiceAnnotation.mm; sourceTree = "<group>"; };
                2D353B1019F8305D000EEACD /* ActionMenuHitTestResult.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ActionMenuHitTestResult.mm; sourceTree = "<group>"; };
                2D353B1119F8305D000EEACD /* ActionMenuHitTestResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActionMenuHitTestResult.h; sourceTree = "<group>"; };
+               2D3A65D81A7C3A1F00CAC637 /* WKNavigationActionRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKNavigationActionRef.cpp; sourceTree = "<group>"; };
+               2D3A65D91A7C3A1F00CAC637 /* WKNavigationActionRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationActionRef.h; sourceTree = "<group>"; };
+               2D3A65DC1A7C3A7D00CAC637 /* WKNavigationResponseRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKNavigationResponseRef.cpp; sourceTree = "<group>"; };
+               2D3A65DD1A7C3A7D00CAC637 /* WKNavigationResponseRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationResponseRef.h; sourceTree = "<group>"; };
+               2D3A65E01A7C3A9300CAC637 /* WKNavigationRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKNavigationRef.cpp; sourceTree = "<group>"; };
+               2D3A65E11A7C3A9300CAC637 /* WKNavigationRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationRef.h; sourceTree = "<group>"; };
+               2D3A65E41A7C3AA700CAC637 /* WKFrameInfoRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKFrameInfoRef.cpp; sourceTree = "<group>"; };
+               2D3A65E51A7C3AA700CAC637 /* WKFrameInfoRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFrameInfoRef.h; sourceTree = "<group>"; };
                2D3EF4401917646300034184 /* WebMemoryPressureHandlerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebMemoryPressureHandlerIOS.mm; path = ios/WebMemoryPressureHandlerIOS.mm; sourceTree = "<group>"; };
                2D3EF4411917646300034184 /* WebMemoryPressureHandlerIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebMemoryPressureHandlerIOS.h; path = ios/WebMemoryPressureHandlerIOS.h; sourceTree = "<group>"; };
                2D429BFA1721E2BA00EC681F /* PDFPluginPasswordField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDFPluginPasswordField.h; path = PDF/PDFPluginPasswordField.h; sourceTree = "<group>"; };
                2D6CD118189058A500E5A4A0 /* ViewSnapshotStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewSnapshotStore.mm; sourceTree = "<group>"; };
                2D70AB1318A1D51A00026D6E /* Info-iOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = "<group>"; };
                2D70AB1418A1D57C00026D6E /* Info-iOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = "<group>"; };
+               2D7303781A7C2B7500F8F487 /* WKPageNavigationClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageNavigationClient.h; sourceTree = "<group>"; };
                2D7AAFD218C8640600A7ACD4 /* WKWebViewContentProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebViewContentProvider.h; sourceTree = "<group>"; };
                2D7AAFD518C956AF00A7ACD4 /* WKWebViewConfigurationInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebViewConfigurationInternal.h; sourceTree = "<group>"; };
                2D7F130F1A702FBA009A6FBD /* ProcessType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessType.h; sourceTree = "<group>"; };
                2DA944B51884EA3500ED86DB /* WebBackForwardListProxyIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebBackForwardListProxyIOS.mm; path = ios/WebBackForwardListProxyIOS.mm; sourceTree = "<group>"; };
                2DA944B61884EA3500ED86DB /* WebPageIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebPageIOS.mm; path = ios/WebPageIOS.mm; sourceTree = "<group>"; };
                2DA944BC188511E700ED86DB /* NetworkProcessIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NetworkProcessIOS.mm; path = NetworkProcess/ios/NetworkProcessIOS.mm; sourceTree = "<group>"; };
+               2DABA7711A817B1700EF0F1A /* WKPageRenderingProgressEventsInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageRenderingProgressEventsInternal.h; sourceTree = "<group>"; };
+               2DABA7731A817EE600EF0F1A /* WKPluginLoadPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPluginLoadPolicy.h; sourceTree = "<group>"; };
                2DACE64D18ADBFF000E4CA76 /* _WKThumbnailViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKThumbnailViewInternal.h; sourceTree = "<group>"; };
                2DAF06D418BD1A470081CEB1 /* SmartMagnificationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SmartMagnificationController.h; path = ios/SmartMagnificationController.h; sourceTree = "<group>"; };
                2DAF06D518BD1A470081CEB1 /* SmartMagnificationController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SmartMagnificationController.mm; path = ios/SmartMagnificationController.mm; sourceTree = "<group>"; };
                2DAF06D818BD23BA0081CEB1 /* SmartMagnificationController.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = SmartMagnificationController.messages.in; path = ios/SmartMagnificationController.messages.in; sourceTree = "<group>"; };
                2DC6D9C118C44A610043BAD4 /* WKWebViewContentProviderRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebViewContentProviderRegistry.h; sourceTree = "<group>"; };
                2DC6D9C218C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewContentProviderRegistry.mm; sourceTree = "<group>"; };
+               2DD12A071A8177F3002C74E6 /* WKPageRenderingProgressEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageRenderingProgressEvents.h; sourceTree = "<group>"; };
                2DD13BD318F7DADD00E130A1 /* FindControllerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = FindControllerIOS.mm; path = ios/FindControllerIOS.mm; sourceTree = "<group>"; };
                2DD9EB2C1A6F012500BB1267 /* APINavigationClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APINavigationClient.h; sourceTree = "<group>"; };
                2DDE0AF818298CC900F97EAA /* RemoteLayerTreePropertyApplier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreePropertyApplier.h; sourceTree = "<group>"; };
                                BCE469581214EDF4000B98EB /* WKFormSubmissionListener.h */,
                                BCD01398110FA420003B8A67 /* WKFrame.cpp */,
                                BCD01397110FA420003B8A67 /* WKFrame.h */,
+                               2D3A65E41A7C3AA700CAC637 /* WKFrameInfoRef.cpp */,
+                               2D3A65E51A7C3AA700CAC637 /* WKFrameInfoRef.h */,
                                BCB9F6A41123DD0D00A137E0 /* WKFramePolicyListener.cpp */,
                                BCB9F6A31123DD0D00A137E0 /* WKFramePolicyListener.h */,
                                BC54CC1112D674EE005C67B0 /* WKGeolocationManager.cpp */,
                                33D3A3B31339600B00709BE4 /* WKMediaCacheManager.cpp */,
                                33D3A3B41339600B00709BE4 /* WKMediaCacheManager.h */,
                                C09AE5E8125257C20025825D /* WKNativeEvent.h */,
+                               2D3A65D81A7C3A1F00CAC637 /* WKNavigationActionRef.cpp */,
+                               2D3A65D91A7C3A1F00CAC637 /* WKNavigationActionRef.h */,
                                BCF69FA81176D1CB00471A52 /* WKNavigationDataRef.cpp */,
                                BCF69FA71176D1CB00471A52 /* WKNavigationDataRef.h */,
+                               2D3A65E01A7C3A9300CAC637 /* WKNavigationRef.cpp */,
+                               2D3A65E11A7C3A9300CAC637 /* WKNavigationRef.h */,
+                               2D3A65DC1A7C3A7D00CAC637 /* WKNavigationResponseRef.cpp */,
+                               2D3A65DD1A7C3A7D00CAC637 /* WKNavigationResponseRef.h */,
                                318BE17614743E6000A8FBB2 /* WKNotification.cpp */,
                                318BE17814743E6A00A8FBB2 /* WKNotification.h */,
                                318BE17414743DD600A8FBB2 /* WKNotificationManager.cpp */,
                                BC7B633612A45ABA00D174A4 /* WKPageGroup.cpp */,
                                BC7B633512A45ABA00D174A4 /* WKPageGroup.h */,
                                1AB8A1EB1840080900E9AE69 /* WKPageLoaderClient.h */,
+                               2D7303781A7C2B7500F8F487 /* WKPageNavigationClient.h */,
                                1AB8A1ED18400ACB00E9AE69 /* WKPagePolicyClient.h */,
                                373CEAD71859553F008C363D /* WKPagePolicyClientInternal.h */,
                                BC177464118B9FF4007D9E9A /* WKPagePrivate.h */,
+                               2DD12A071A8177F3002C74E6 /* WKPageRenderingProgressEvents.h */,
+                               2DABA7711A817B1700EF0F1A /* WKPageRenderingProgressEventsInternal.h */,
                                1AB8A1F118400B6200E9AE69 /* WKPageUIClient.h */,
+                               2DABA7731A817EE600EF0F1A /* WKPluginLoadPolicy.h */,
                                1AC86FF1130B46D3002C1257 /* WKPluginSiteDataManager.cpp */,
                                1AC86FF2130B46D3002C1257 /* WKPluginSiteDataManager.h */,
                                BCD597CF112B56AC00EC8C23 /* WKPreferences.cpp */,
                                1AABFE3A1829C1ED005B070E /* _WKRemoteObjectInterfaceInternal.h in Headers */,
                                1A9E32891821636900F5D04C /* _WKRemoteObjectRegistry.h in Headers */,
                                1A9E32A11823018900F5D04C /* _WKRemoteObjectRegistryInternal.h in Headers */,
+                               2DABA7741A817EE600EF0F1A /* WKPluginLoadPolicy.h in Headers */,
+                               2DD12A081A8177F3002C74E6 /* WKPageRenderingProgressEvents.h in Headers */,
+                               2D7303791A7C2B7500F8F487 /* WKPageNavigationClient.h in Headers */,
                                377216B81A4E6BE000DCA718 /* _WKRenderingProgressEvents.h in Headers */,
                                1F604BAA1889FBB800EE0395 /* _WKRenderingProgressEventsInternal.h in Headers */,
                                376311FD1A3FB5F7005A2E51 /* _WKSameDocumentNavigationType.h in Headers */,
                                376311FE1A3FB600005A2E51 /* _WKSameDocumentNavigationTypeInternal.h in Headers */,
                                376C511A1957452E0007B0FA /* _WKSecurityOrigin.h in Headers */,
+                               2D3A65DB1A7C3A1F00CAC637 /* WKNavigationActionRef.h in Headers */,
+                               2D3A65DF1A7C3A7D00CAC637 /* WKNavigationResponseRef.h in Headers */,
+                               2D3A65E31A7C3A9300CAC637 /* WKNavigationRef.h in Headers */,
+                               2D3A65E71A7C3AA700CAC637 /* WKFrameInfoRef.h in Headers */,
                                376C511D19574F5F0007B0FA /* _WKSecurityOriginInternal.h in Headers */,
                                1A002D44196B338900B9AD44 /* _WKSessionState.h in Headers */,
                                1A002D43196B337000B9AD44 /* _WKSessionStateInternal.h in Headers */,
                                1A043F6A12514D8B00FFBFB5 /* WebProcessConnectionMessages.h in Headers */,
                                BC306824125A6B9400E71278 /* WebProcessCreationParameters.h in Headers */,
                                BC3066BF125A442100E71278 /* WebProcessMessages.h in Headers */,
+                               2DABA7721A817B1700EF0F1A /* WKPageRenderingProgressEventsInternal.h in Headers */,
                                7CE4D21B1A4914A300C7F152 /* WebProcessPool.h in Headers */,
                                7CE4D2281A4916C200C7F152 /* WebProcessPoolMessages.h in Headers */,
                                BC032DD510F4389F0058C15A /* WebProcessProxy.h in Headers */,
                                A7D792D61767CB6E00881CBE /* ActivityAssertion.cpp in Sources */,
                                8372DB281A67562800C697C5 /* WebPageDiagnosticLoggingClient.cpp in Sources */,
                                BC64696F11DBE603006455B0 /* APIArray.cpp in Sources */,
+                               2D3A65E21A7C3A9300CAC637 /* WKNavigationRef.cpp in Sources */,
                                1AAB037C185F99D800EDF501 /* APIData.cpp in Sources */,
                                1A1EF1991A1D5B420023200A /* APIDataCocoa.mm in Sources */,
                                7C1BA33D1A4A0E600043E249 /* APIDictionary.cpp in Sources */,
                                1A90C1F51264FD71003E44D4 /* FindController.cpp in Sources */,
                                2DD13BD518F7DADD00E130A1 /* FindControllerIOS.mm in Sources */,
                                BCE81D8C1319F7EF00241910 /* FontInfo.cpp in Sources */,
+                               2D3A65DE1A7C3A7D00CAC637 /* WKNavigationResponseRef.cpp in Sources */,
                                1AE00D601831792100087DD7 /* FrameLoadState.cpp in Sources */,
                                BC06F43012DBB9B6002D78DE /* GeolocationPermissionRequestManager.cpp in Sources */,
                                BC06F44B12DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.cpp in Sources */,
                                1AA4792312A59FD9008236C3 /* PluginProcessMac.mm in Sources */,
                                BC82838C16B45F0700A278FE /* PluginProcessMain.mm in Sources */,
                                1A0EC604124A9F2C007EF4A5 /* PluginProcessManager.cpp in Sources */,
+                               2D3A65E61A7C3AA700CAC637 /* WKFrameInfoRef.cpp in Sources */,
                                9F54F8951648AE0F007DF81A /* PluginProcessManagerMac.mm in Sources */,
                                1A043CEB124FE38F00FFBFB5 /* PluginProcessMessageReceiver.cpp in Sources */,
                                1A0EC75F124BC7B2007EF4A5 /* PluginProcessProxy.cpp in Sources */,
                                BC0E5FE612D697160012A72A /* WebGeolocationManager.cpp in Sources */,
                                BC0E606112D6BA910012A72A /* WebGeolocationManagerMessageReceiver.cpp in Sources */,
                                BC54CACC12D64291005C67B0 /* WebGeolocationManagerProxy.cpp in Sources */,
+                               2D3A65DA1A7C3A1F00CAC637 /* WKNavigationActionRef.cpp in Sources */,
                                BC0E618212D6CB1D0012A72A /* WebGeolocationManagerProxyMessageReceiver.cpp in Sources */,
                                BC0E607412D6BC200012A72A /* WebGeolocationPosition.cpp in Sources */,
                                BC1BE1F312D54DBD0004A228 /* WebGeolocationProvider.cpp in Sources */,
index 22826902a6aaa403f002dd870aec42b7a1ece9fd..617efef3ee4547c7179b7bcdb82f12985d60ee6c 100644 (file)
@@ -1,3 +1,27 @@
+2015-02-03  Tim Horton  <timothy_horton@apple.com>
+
+        Add WKPageNavigationClient as C SPI around API::NavigationClient, and adopt in WKTR
+        https://bugs.webkit.org/show_bug.cgi?id=141217
+
+        Reviewed by Sam Weinig.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::copyWebCryptoMasterKey):
+        (WTR::TestController::createOtherPage):
+        (WTR::TestController::createWebViewWithOptions):
+        (WTR::TestController::ensureViewSupportsOptions):
+        (WTR::TestController::didCommitNavigation):
+        (WTR::TestController::didFinishNavigation):
+        (WTR::TestController::canAuthenticateAgainstProtectionSpace):
+        (WTR::TestController::didReceiveAuthenticationChallenge):
+        (WTR::TestController::decidePolicyForPluginLoad):
+        (WTR::TestController::decidePolicyForNavigationAction):
+        (WTR::TestController::decidePolicyForNavigationResponse):
+        (WTR::TestController::didCommitLoadForFrame): Deleted.
+        (WTR::TestController::didFinishLoadForFrame): Deleted.
+        * WebKitTestRunner/TestController.h:
+        Adopt WKPageNavigationClient and adjust to its semantics (navigations are main-frame-only, etc.)
+
 2015-02-03  Dhi Aurrahman  <diorahman@rockybars.com>
 
         Unreviewed. Add myself as a committer.
index 3fed5ba02c1defa3bcdfe5cc91c4a85354e24bd9..2716711091ca141c5234da988adbbb8ac5d81ad2 100644 (file)
@@ -38,6 +38,7 @@
 #include <WebKit/WKCookieManager.h>
 #include <WebKit/WKCredential.h>
 #include <WebKit/WKIconDatabase.h>
+#include <WebKit/WKNavigationResponseRef.h>
 #include <WebKit/WKNotification.h>
 #include <WebKit/WKNotificationManager.h>
 #include <WebKit/WKNotificationPermissionRequest.h>
@@ -84,7 +85,7 @@ static WKURLRef blankURL()
     return staticBlankURL;
 }
 
-static WKDataRef copyWebCryptoMasterKey(WKContextRef, const void*)
+static WKDataRef copyWebCryptoMasterKey(WKPageRef, const void*)
 {
     // Any 128 bit key would do, all we need for testing is to implement the callback.
     return WKDataCreate((const uint8_t*)"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", 16);
@@ -256,61 +257,28 @@ WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKURLRequestRef, WK
         decidePolicyForUserMediaPermissionRequest,
     };
     WKPageSetPageUIClient(newPage, &otherPageUIClient.base);
-
-    WKPageLoaderClientV5 pageLoaderClient = {
-        { 5, &TestController::singleton() },
-        0, // didStartProvisionalLoadForFrame
-        0, // didReceiveServerRedirectForProvisionalLoadForFrame
-        0, // didFailProvisionalLoadWithErrorForFrame
-        0, // didCommitLoadForFrame,
-        0, // didFinishDocumentLoadForFrame
-        0, // didFinishLoadForFrame,
-        0, // didFailLoadWithErrorForFrame
-        0, // didSameDocumentNavigationForFrame
-        0, // didReceiveTitleForFrame
-        0, // didFirstLayoutForFrame
-        0, // didFirstVisuallyNonEmptyLayoutForFrame
-        0, // didRemoveFrameFromHierarchy
-        0, // didFailToInitializePlugin
-        0, // didDisplayInsecureContentForFrame
-        canAuthenticateAgainstProtectionSpaceInFrame,
-        didReceiveAuthenticationChallengeInFrame,
-        0, // didStartProgress
-        0, // didChangeProgress
-        0, // didFinishProgress
-        0, // didBecomeUnresponsive
-        0, // didBecomeResponsive
-        processDidCrash,
-        0, // didChangeBackForwardList
-        0, // shouldGoToBackForwardListItem
-        0, // didRunInsecureContentForFrame
-        0, // didDetectXSSForFrame
-        0, // didNewFirstVisuallyNonEmptyLayout_unavailable
-        0, // willGoToBackForwardListItem
-        0, // interactionOccurredWhileProcessUnresponsive
-        0, // pluginDidFail_deprecatedForUseWithV1
-        0, // didReceiveIntentForFrame
-        0, // registerIntentServiceForFrame
-        0, // didLayout
-        0, // pluginLoadPolicy_deprecatedForUseWithV2
-        0, // pluginDidFail
-        pluginLoadPolicy, // pluginLoadPolicy
-        0, // webGLLoadPolicy
-        0, // resolveWebGLLoadPolicy
-        0, // shouldKeepCurrentBackForwardListItemInList
-    };
-    WKPageSetPageLoaderClient(view->page(), &pageLoaderClient.base);
-
-    WKPagePolicyClientV1 pagePolicyClient = {
-        { 1, &TestController::singleton() },
-        0, // decidePolicyForNavigationAction_deprecatedForUseWithV0
-        0, // decidePolicyForNewWindowAction
-        0, // decidePolicyForResponse_deprecatedForUseWithV0
-        0, // unableToImplementPolicy
+    
+    WKPageNavigationClientV0 pageNavigationClient = {
+        { 0, &TestController::singleton() },
         decidePolicyForNavigationAction,
-        decidePolicyForResponse,
+        decidePolicyForNavigationResponse,
+        decidePolicyForPluginLoad,
+        0, // didStartProvisionalNavigation
+        0, // didReceiveServerRedirectForProvisionalNavigation
+        0, // didFailProvisionalNavigation
+        0, // didCommitNavigation
+        0, // didFinishNavigation
+        0, // didFailNavigation
+        0, // didFailProvisionalLoadInSubframe
+        0, // didFinishDocumentLoad
+        0, // didSameDocumentNavigation
+        0, // renderingProgressDidChange
+        canAuthenticateAgainstProtectionSpace,
+        didReceiveAuthenticationChallenge,
+        processDidCrash,
+        copyWebCryptoMasterKey,
     };
-    WKPageSetPagePolicyClient(view->page(), &pagePolicyClient.base);
+    WKPageSetPageNavigationClient(newPage, &pageNavigationClient.base);
 
     view->didInitializeClients();
 
@@ -415,15 +383,6 @@ void TestController::initialize(int argc, const char* argv[])
 
     platformInitializeContext();
 
-    WKContextClientV1 contextClient = {
-        { 1, this },
-        nullptr, // plugInAutoStartOriginHashesChanged
-        nullptr, // networkProcessDidCrash,
-        nullptr, // plugInInformationBecameAvailable,
-        copyWebCryptoMasterKey
-    };
-    WKContextSetClient(m_context.get(), &contextClient.base);
-
     WKContextInjectedBundleClientV1 injectedBundleClient = {
         { 1, this },
         didReceiveMessageFromInjectedBundle,
@@ -526,60 +485,27 @@ void TestController::createWebViewWithOptions(WKDictionaryRef options)
     };
     WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient.base);
 
-    WKPageLoaderClientV5 pageLoaderClient = {
-        { 5, this },
-        0, // didStartProvisionalLoadForFrame
-        0, // didReceiveServerRedirectForProvisionalLoadForFrame
-        0, // didFailProvisionalLoadWithErrorForFrame
-        didCommitLoadForFrame,
-        0, // didFinishDocumentLoadForFrame
-        didFinishLoadForFrame,
-        0, // didFailLoadWithErrorForFrame
-        0, // didSameDocumentNavigationForFrame
-        0, // didReceiveTitleForFrame
-        0, // didFirstLayoutForFrame
-        0, // didFirstVisuallyNonEmptyLayoutForFrame
-        0, // didRemoveFrameFromHierarchy
-        0, // didFailToInitializePlugin
-        0, // didDisplayInsecureContentForFrame
-        canAuthenticateAgainstProtectionSpaceInFrame,
-        didReceiveAuthenticationChallengeInFrame,
-        0, // didStartProgress
-        0, // didChangeProgress
-        0, // didFinishProgress
-        0, // didBecomeUnresponsive
-        0, // didBecomeResponsive
-        processDidCrash,
-        0, // didChangeBackForwardList
-        0, // shouldGoToBackForwardListItem
-        0, // didRunInsecureContentForFrame
-        0, // didDetectXSSForFrame
-        0, // didNewFirstVisuallyNonEmptyLayout_unavailable
-        0, // willGoToBackForwardListItem
-        0, // interactionOccurredWhileProcessUnresponsive
-        0, // pluginDidFail_deprecatedForUseWithV1
-        0, // didReceiveIntentForFrame
-        0, // registerIntentServiceForFrame
-        0, // didLayout
-        0, // pluginLoadPolicy_deprecatedForUseWithV2
-        0, // pluginDidFail
-        pluginLoadPolicy, // pluginLoadPolicy
-        0, // webGLLoadPolicy
-        0, // resolveWebGLLoadPolicy
-        0, // shouldKeepCurrentBackForwardListItemInList
-    };
-    WKPageSetPageLoaderClient(m_mainWebView->page(), &pageLoaderClient.base);
-
-    WKPagePolicyClientV1 pagePolicyClient = {
-        { 1, this },
-        0, // decidePolicyForNavigationAction_deprecatedForUseWithV0
-        0, // decidePolicyForNewWindowAction
-        0, // decidePolicyForResponse_deprecatedForUseWithV0
-        0, // unableToImplementPolicy
+    WKPageNavigationClientV0 pageNavigationClient = {
+        { 0, this },
         decidePolicyForNavigationAction,
-        decidePolicyForResponse,
+        decidePolicyForNavigationResponse,
+        decidePolicyForPluginLoad,
+        0, // didStartProvisionalNavigation
+        0, // didReceiveServerRedirectForProvisionalNavigation
+        0, // didFailProvisionalNavigation
+        didCommitNavigation,
+        didFinishNavigation,
+        0, // didFailNavigation
+        0, // didFailProvisionalLoadInSubframe
+        0, // didFinishDocumentLoad
+        0, // didSameDocumentNavigation
+        0, // renderingProgressDidChange
+        canAuthenticateAgainstProtectionSpace,
+        didReceiveAuthenticationChallenge,
+        processDidCrash,
+        copyWebCryptoMasterKey,
     };
-    WKPageSetPagePolicyClient(m_mainWebView->page(), &pagePolicyClient.base);
+    WKPageSetPageNavigationClient(m_mainWebView->page(), &pageNavigationClient.base);
 
     m_mainWebView->didInitializeClients();
 
@@ -592,8 +518,7 @@ void TestController::ensureViewSupportsOptions(WKDictionaryRef options)
 {
     if (m_mainWebView && !m_mainWebView->viewSupportsOptions(options)) {
         WKPageSetPageUIClient(m_mainWebView->page(), 0);
-        WKPageSetPageLoaderClient(m_mainWebView->page(), 0);
-        WKPageSetPagePolicyClient(m_mainWebView->page(), 0);
+        WKPageSetPageNavigationClient(m_mainWebView->page(), 0);
         WKPageClose(m_mainWebView->page());
         
         m_mainWebView = nullptr;
@@ -1275,19 +1200,19 @@ WKRetainPtr<WKTypeRef> TestController::didReceiveSynchronousMessageFromInjectedB
     return m_currentInvocation->didReceiveSynchronousMessageFromInjectedBundle(messageName, messageBody);
 }
 
-// WKPageLoaderClient
+// WKPageNavigationClient
 
-void TestController::didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef, const void* clientInfo)
+void TestController::didCommitNavigation(WKPageRef page, WKNavigationRef navigation, WKTypeRef, const void* clientInfo)
 {
-    static_cast<TestController*>(const_cast<void*>(clientInfo))->didCommitLoadForFrame(page, frame);
+    static_cast<TestController*>(const_cast<void*>(clientInfo))->didCommitNavigation(page, navigation);
 }
 
-void TestController::didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef, const void* clientInfo)
+void TestController::didFinishNavigation(WKPageRef page, WKNavigationRef navigation, WKTypeRef, const void* clientInfo)
 {
-    static_cast<TestController*>(const_cast<void*>(clientInfo))->didFinishLoadForFrame(page, frame);
+    static_cast<TestController*>(const_cast<void*>(clientInfo))->didFinishNavigation(page, navigation);
 }
 
-bool TestController::canAuthenticateAgainstProtectionSpaceInFrame(WKPageRef, WKFrameRef, WKProtectionSpaceRef protectionSpace, const void*)
+bool TestController::canAuthenticateAgainstProtectionSpace(WKPageRef, WKProtectionSpaceRef protectionSpace, const void*)
 {
     WKProtectionSpaceAuthenticationScheme authenticationScheme = WKProtectionSpaceGetAuthenticationScheme(protectionSpace);
 
@@ -1299,9 +1224,9 @@ bool TestController::canAuthenticateAgainstProtectionSpaceInFrame(WKPageRef, WKF
     return authenticationScheme <= kWKProtectionSpaceAuthenticationSchemeHTTPDigest;
 }
 
-void TestController::didReceiveAuthenticationChallengeInFrame(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo)
+void TestController::didReceiveAuthenticationChallenge(WKPageRef page, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo)
 {
-    static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveAuthenticationChallengeInFrame(page, frame, authenticationChallenge);
+    static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveAuthenticationChallenge(page, /*frame,*/ authenticationChallenge);
 }
 
 void TestController::processDidCrash(WKPageRef page, const void* clientInfo)
@@ -1309,35 +1234,29 @@ void TestController::processDidCrash(WKPageRef page, const void* clientInfo)
     static_cast<TestController*>(const_cast<void*>(clientInfo))->processDidCrash();
 }
 
-WKPluginLoadPolicy TestController::pluginLoadPolicy(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInformation, WKStringRef* unavailabilityDescription, const void* clientInfo)
+WKPluginLoadPolicy TestController::decidePolicyForPluginLoad(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInformation, WKStringRef* unavailabilityDescription, const void* clientInfo)
 {
-    return static_cast<TestController*>(const_cast<void*>(clientInfo))->pluginLoadPolicy(page, currentPluginLoadPolicy, pluginInformation, unavailabilityDescription);
+    return static_cast<TestController*>(const_cast<void*>(clientInfo))->decidePolicyForPluginLoad(page, currentPluginLoadPolicy, pluginInformation, unavailabilityDescription);
 }
 
-WKPluginLoadPolicy TestController::pluginLoadPolicy(WKPageRef, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInformation, WKStringRef* unavailabilityDescription)
+WKPluginLoadPolicy TestController::decidePolicyForPluginLoad(WKPageRef, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInformation, WKStringRef* unavailabilityDescription)
 {
     if (m_shouldBlockAllPlugins)
         return kWKPluginLoadPolicyBlocked;
     return currentPluginLoadPolicy;
 }
 
-void TestController::didCommitLoadForFrame(WKPageRef page, WKFrameRef frame)
+void TestController::didCommitNavigation(WKPageRef page, WKNavigationRef navigation)
 {
-    if (!WKFrameIsMainFrame(frame))
-        return;
-
     mainWebView()->focus();
 }
 
-void TestController::didFinishLoadForFrame(WKPageRef page, WKFrameRef frame)
+void TestController::didFinishNavigation(WKPageRef page, WKNavigationRef navigation)
 {
     if (m_state != Resetting)
         return;
 
-    if (!WKFrameIsMainFrame(frame))
-        return;
-
-    WKRetainPtr<WKURLRef> wkURL(AdoptWK, WKFrameCopyURL(frame));
+    WKRetainPtr<WKURLRef> wkURL(AdoptWK, WKFrameCopyURL(WKPageGetMainFrame(page)));
     if (!WKURLIsEqual(wkURL.get(), blankURL()))
         return;
 
@@ -1345,7 +1264,7 @@ void TestController::didFinishLoadForFrame(WKPageRef page, WKFrameRef frame)
     singleton().notifyDone();
 }
 
-void TestController::didReceiveAuthenticationChallengeInFrame(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge)
+void TestController::didReceiveAuthenticationChallenge(WKPageRef page, WKAuthenticationChallengeRef authenticationChallenge)
 {
     WKProtectionSpaceRef protectionSpace = WKAuthenticationChallengeGetProtectionSpace(authenticationChallenge);
     WKAuthenticationDecisionListenerRef decisionListener = WKAuthenticationChallengeGetDecisionListener(authenticationChallenge);
@@ -1488,7 +1407,7 @@ void TestController::unavailablePluginButtonClicked(WKPageRef, WKPluginUnavailab
     printf("MISSING PLUGIN BUTTON PRESSED\n");
 }
 
-void TestController::decidePolicyForNavigationAction(WKPageRef, WKFrameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKFrameRef, WKURLRequestRef, WKFramePolicyListenerRef listener, WKTypeRef, const void* clientInfo)
+void TestController::decidePolicyForNavigationAction(WKPageRef, WKNavigationActionRef navigationAction, WKFramePolicyListenerRef listener, WKTypeRef, const void* clientInfo)
 {
     static_cast<TestController*>(const_cast<void*>(clientInfo))->decidePolicyForNavigationAction(listener);
 }
@@ -1503,17 +1422,16 @@ void TestController::decidePolicyForNavigationAction(WKFramePolicyListenerRef li
     WKFramePolicyListenerUse(listener);
 }
 
-void TestController::decidePolicyForResponse(WKPageRef, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef, bool canShowMIMEType, WKFramePolicyListenerRef listener, WKTypeRef, const void* clientInfo)
+void TestController::decidePolicyForNavigationResponse(WKPageRef, WKNavigationResponseRef navigationResponse, WKFramePolicyListenerRef listener, WKTypeRef, const void* clientInfo)
 {
-    static_cast<TestController*>(const_cast<void*>(clientInfo))->decidePolicyForResponse(frame, response, listener);
+    static_cast<TestController*>(const_cast<void*>(clientInfo))->decidePolicyForNavigationResponse(navigationResponse, listener);
 }
 
-void TestController::decidePolicyForResponse(WKFrameRef frame, WKURLResponseRef response, WKFramePolicyListenerRef listener)
+void TestController::decidePolicyForNavigationResponse(WKNavigationResponseRef navigationResponse, WKFramePolicyListenerRef listener)
 {
     // Even though Response was already checked by WKBundlePagePolicyClient, the check did not include plugins
     // so we have to re-check again.
-    WKRetainPtr<WKStringRef> wkMIMEType(AdoptWK, WKURLResponseCopyMIMEType(response));
-    if (WKFrameCanShowMIMEType(frame, wkMIMEType.get())) {
+    if (WKNavigationResponseCanShowMIMEType(navigationResponse)) {
         WKFramePolicyListenerUse(listener);
         return;
     }
index 8265cd56c4990afa2b9d8475a473f0f58227681b..8107aca5b04984b4cc8581c80974bc016c202084 100644 (file)
@@ -150,18 +150,18 @@ private:
 
     void didReceiveKeyDownMessageFromInjectedBundle(WKDictionaryRef messageBodyDictionary, bool synchronous);
 
-    // WKPageLoaderClient
-    static void didCommitLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void*);
-    void didCommitLoadForFrame(WKPageRef, WKFrameRef);
+    // WKPageNavigationClient
+    static void didCommitNavigation(WKPageRef, WKNavigationRef, WKTypeRef userData, const void*);
+    void didCommitNavigation(WKPageRef, WKNavigationRef);
 
-    static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef userData, const void*);
-    void didFinishLoadForFrame(WKPageRef, WKFrameRef);
+    static void didFinishNavigation(WKPageRef, WKNavigationRef, WKTypeRef userData, const void*);
+    void didFinishNavigation(WKPageRef, WKNavigationRef);
 
     static void processDidCrash(WKPageRef, const void* clientInfo);
     void processDidCrash();
 
-    static WKPluginLoadPolicy pluginLoadPolicy(WKPageRef, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInformation, WKStringRef* unavailabilityDescription, const void* clientInfo);
-    WKPluginLoadPolicy pluginLoadPolicy(WKPageRef, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInformation, WKStringRef* unavailabilityDescription);
+    static WKPluginLoadPolicy decidePolicyForPluginLoad(WKPageRef, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInformation, WKStringRef* unavailabilityDescription, const void* clientInfo);
+    WKPluginLoadPolicy decidePolicyForPluginLoad(WKPageRef, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInformation, WKStringRef* unavailabilityDescription);
     
 
     static void decidePolicyForNotificationPermissionRequest(WKPageRef, WKSecurityOriginRef, WKNotificationPermissionRequestRef, const void*);
@@ -169,17 +169,16 @@ private:
 
     static void unavailablePluginButtonClicked(WKPageRef, WKPluginUnavailabilityReason, WKDictionaryRef, const void*);
 
-    static bool canAuthenticateAgainstProtectionSpaceInFrame(WKPageRef, WKFrameRef, WKProtectionSpaceRef, const void *clientInfo);
+    static bool canAuthenticateAgainstProtectionSpace(WKPageRef, WKProtectionSpaceRef, const void *clientInfo);
 
-    static void didReceiveAuthenticationChallengeInFrame(WKPageRef, WKFrameRef, WKAuthenticationChallengeRef, const void *clientInfo);
-    void didReceiveAuthenticationChallengeInFrame(WKPageRef, WKFrameRef, WKAuthenticationChallengeRef);
+    static void didReceiveAuthenticationChallenge(WKPageRef, WKAuthenticationChallengeRef, const void *clientInfo);
+    void didReceiveAuthenticationChallenge(WKPageRef, WKAuthenticationChallengeRef);
 
-    // WKPagePolicyClient
-    static void decidePolicyForNavigationAction(WKPageRef, WKFrameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKFrameRef, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef, const void*);
+    static void decidePolicyForNavigationAction(WKPageRef, WKNavigationActionRef, WKFramePolicyListenerRef, WKTypeRef, const void*);
     void decidePolicyForNavigationAction(WKFramePolicyListenerRef);
 
-    static void decidePolicyForResponse(WKPageRef, WKFrameRef, WKURLResponseRef, WKURLRequestRef, bool canShowMIMEType, WKFramePolicyListenerRef, WKTypeRef, const void*);
-    void decidePolicyForResponse(WKFrameRef, WKURLResponseRef, WKFramePolicyListenerRef);
+    static void decidePolicyForNavigationResponse(WKPageRef, WKNavigationResponseRef, WKFramePolicyListenerRef, WKTypeRef, const void*);
+    void decidePolicyForNavigationResponse(WKNavigationResponseRef, WKFramePolicyListenerRef);
 
     // WKContextHistoryClient
     static void didNavigateWithNavigationData(WKContextRef, WKPageRef, WKNavigationDataRef, WKFrameRef, const void*);