Diff
Modified: trunk/Source/WebKit2/ChangeLog (163404 => 163405)
--- trunk/Source/WebKit2/ChangeLog 2014-02-04 22:41:13 UTC (rev 163404)
+++ trunk/Source/WebKit2/ChangeLog 2014-02-04 23:21:23 UTC (rev 163405)
@@ -1,5 +1,21 @@
2014-02-04 Anders Carlsson <[email protected]>
+ Add a WKNavigationAction object
+ https://bugs.webkit.org/show_bug.cgi?id=128212
+
+ Reviewed by Dan Bernstein.
+
+ * UIProcess/API/Cocoa/WKNavigationAction.h: Added.
+ (NS_ENUM):
+ * UIProcess/API/Cocoa/WKNavigationAction.mm: Added.
+ * UIProcess/API/Cocoa/WKNavigationActionInternal.h: Added.
+ * UIProcess/Cocoa/NavigationState.mm:
+ (WebKit::toWKNavigationType):
+ (WebKit::NavigationState::PolicyClient::decidePolicyForNavigationAction):
+ * WebKit2.xcodeproj/project.pbxproj:
+
+2014-02-04 Anders Carlsson <[email protected]>
+
Add back/forward related methods to WKWebView
https://bugs.webkit.org/show_bug.cgi?id=128209
Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.h (0 => 163405)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.h 2014-02-04 23:21:23 UTC (rev 163405)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2014 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 <Foundation/Foundation.h>
+#import <WebKit2/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+typedef NS_ENUM(NSInteger, WKNavigationType) {
+ WKNavigationTypeLinkActivated,
+ WKNavigationTypeFormSubmitted,
+ WKNavigationTypeBackForward,
+ WKNavigationTypeReload,
+ WKNavigationTypeFormResubmitted,
+ WKNavigationTypeOther = -1,
+};
+
+WK_API_CLASS
+@interface WKNavigationAction : NSObject
+
+@property (nonatomic, readonly) WKNavigationType navigationType;
+
+@end
+
+#endif
Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.mm (0 => 163405)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.mm (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.mm 2014-02-04 23:21:23 UTC (rev 163405)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2014 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 "WKNavigationAction.h"
+
+#if WK_API_ENABLED
+
+@implementation WKNavigationAction
+
+@end
+
+#endif
Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationActionInternal.h (0 => 163405)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationActionInternal.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationActionInternal.h 2014-02-04 23:21:23 UTC (rev 163405)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 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 "WKNavigationAction.h"
+
+#if WK_API_ENABLED
+
+@interface WKNavigationAction ()
+
+@property (nonatomic, readwrite) WKNavigationType navigationType;
+
+@end
+
+#endif
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (163404 => 163405)
--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm 2014-02-04 22:41:13 UTC (rev 163404)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm 2014-02-04 23:21:23 UTC (rev 163405)
@@ -28,7 +28,9 @@
#if WK_API_ENABLED
+#import "NavigationActionData.h"
#import "PageLoadState.h"
+#import "WKNavigationActionInternal.h"
#import "WKNavigationDelegate.h"
#import "WKNavigationInternal.h"
#import "WKWebViewInternal.h"
@@ -103,8 +105,29 @@
{
}
-void NavigationState::PolicyClient::decidePolicyForNavigationAction(WebPageProxy*, WebFrameProxy* destinationFrame, const NavigationActionData&, WebFrameProxy* sourceFrame, const WebCore::ResourceRequest& originalRequest, const WebCore::ResourceRequest&, RefPtr<WebFramePolicyListenerProxy> listener, API::Object* userData)
+static WKNavigationType toWKNavigationType(WebCore::NavigationType navigationType)
{
+ switch (navigationType) {
+ case WebCore::NavigationTypeLinkClicked:
+ return WKNavigationTypeLinkActivated;
+ case WebCore::NavigationTypeFormSubmitted:
+ return WKNavigationTypeFormSubmitted;
+ case WebCore::NavigationTypeBackForward:
+ return WKNavigationTypeBackForward;
+ case WebCore::NavigationTypeReload:
+ return WKNavigationTypeReload;
+ case WebCore::NavigationTypeFormResubmitted:
+ return WKNavigationTypeFormResubmitted;
+ case WebCore::NavigationTypeOther:
+ return WKNavigationTypeOther;
+ }
+
+ ASSERT_NOT_REACHED();
+ return WKNavigationTypeOther;
+}
+
+void NavigationState::PolicyClient::decidePolicyForNavigationAction(WebPageProxy*, WebFrameProxy* destinationFrame, const NavigationActionData& navigationActionData, WebFrameProxy* sourceFrame, const WebCore::ResourceRequest& originalRequest, const WebCore::ResourceRequest&, RefPtr<WebFramePolicyListenerProxy> listener, API::Object* userData)
+{
if (!m_navigationState.m_navigationDelegateMethods.webViewDecidePolicyForNavigationActionDecisionHandler) {
// FIXME: <rdar://problem/15949822> Figure out what the "default delegate behavior" should be here.
listener->use();
@@ -116,9 +139,11 @@
return;
// FIXME: Set up the navigation action object.
- WKNavigationAction *navigationAction = nil;
+ auto navigationAction = adoptNS([[WKNavigationAction alloc] init]);
- [navigationDelegate webView:m_navigationState.m_webView decidePolicyForNavigationAction:navigationAction decisionHandler:[listener](WKNavigationPolicyDecision policyDecision) {
+ [navigationAction setNavigationType:toWKNavigationType(navigationActionData.navigationType)];
+
+ [navigationDelegate webView:m_navigationState.m_webView decidePolicyForNavigationAction:navigationAction.get() decisionHandler:[listener](WKNavigationPolicyDecision policyDecision) {
switch (policyDecision) {
case WKNavigationPolicyDecisionAllow:
listener->use();
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (163404 => 163405)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-02-04 22:41:13 UTC (rev 163404)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-02-04 23:21:23 UTC (rev 163405)
@@ -117,6 +117,9 @@
1A24B5F311F531E800C38269 /* MachUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A24B5F111F531E800C38269 /* MachUtilities.h */; };
1A24BED5120894D100FBB059 /* SharedMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A24BED3120894D100FBB059 /* SharedMemory.h */; };
1A24BF3A120896A600FBB059 /* SharedMemoryMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A24BF39120896A600FBB059 /* SharedMemoryMac.cpp */; };
+ 1A256E3718A1A788006FB922 /* WKNavigationAction.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A256E3518A1A788006FB922 /* WKNavigationAction.mm */; };
+ 1A256E3818A1A788006FB922 /* WKNavigationAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A256E3618A1A788006FB922 /* WKNavigationAction.h */; };
+ 1A256E3A18A1A7DF006FB922 /* WKNavigationActionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A256E3918A1A7DF006FB922 /* WKNavigationActionInternal.h */; };
1A2A4B0E1586A2240090C9E9 /* ColorSpaceData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A4AFD158693920090C9E9 /* ColorSpaceData.mm */; };
1A2BB6D014117B4D000F35D4 /* PluginProcessConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2BB6CE14117B4D000F35D4 /* PluginProcessConnectionMessageReceiver.cpp */; };
1A2BB6D114117B4D000F35D4 /* PluginProcessConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2BB6CF14117B4D000F35D4 /* PluginProcessConnectionMessages.h */; };
@@ -1762,6 +1765,9 @@
1A24B5F111F531E800C38269 /* MachUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachUtilities.h; sourceTree = "<group>"; };
1A24BED3120894D100FBB059 /* SharedMemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedMemory.h; sourceTree = "<group>"; };
1A24BF39120896A600FBB059 /* SharedMemoryMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedMemoryMac.cpp; sourceTree = "<group>"; };
+ 1A256E3518A1A788006FB922 /* WKNavigationAction.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNavigationAction.mm; sourceTree = "<group>"; };
+ 1A256E3618A1A788006FB922 /* WKNavigationAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationAction.h; sourceTree = "<group>"; };
+ 1A256E3918A1A7DF006FB922 /* WKNavigationActionInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationActionInternal.h; sourceTree = "<group>"; };
1A2A4AFD158693920090C9E9 /* ColorSpaceData.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ColorSpaceData.mm; sourceTree = "<group>"; };
1A2A4AFE158693920090C9E9 /* ColorSpaceData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorSpaceData.h; sourceTree = "<group>"; };
1A2BB6CC14117A5F000F35D4 /* PluginProcessConnection.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PluginProcessConnection.messages.in; sourceTree = "<group>"; };
@@ -4283,6 +4289,9 @@
1A43E826188F38E2009E4D30 /* Deprecated */,
1A5B1C4F1898606F004FCF9B /* WKNavigation.h */,
1A5B1C4E1898606F004FCF9B /* WKNavigation.mm */,
+ 1A256E3618A1A788006FB922 /* WKNavigationAction.h */,
+ 1A256E3518A1A788006FB922 /* WKNavigationAction.mm */,
+ 1A256E3918A1A7DF006FB922 /* WKNavigationActionInternal.h */,
1ABC3DFB1899F51C004F0626 /* WKNavigationDelegate.h */,
1ABC3DF01899C6B6004F0626 /* WKNavigationInternal.h */,
1AFDD3161891C94700153970 /* WKPreferences.h */,
@@ -6432,6 +6441,7 @@
1AB474DE184D44590051B622 /* WKBundlePageUIClient.h in Headers */,
CEDA12E3152CD1B300D9E08D /* WebAlternativeTextClient.h in Headers */,
512E352F130B55AF00ABD19A /* WebApplicationCacheManager.h in Headers */,
+ 1A256E3A18A1A7DF006FB922 /* WKNavigationActionInternal.h in Headers */,
512E356B130B57F000ABD19A /* WebApplicationCacheManagerMessages.h in Headers */,
512E3525130B550600ABD19A /* WebApplicationCacheManagerProxy.h in Headers */,
512E35F9130B642E00ABD19A /* WebApplicationCacheManagerProxyMessages.h in Headers */,
@@ -6794,6 +6804,7 @@
BC40762B124FF0400068F20A /* WKURLResponseNS.h in Headers */,
F6113E29126CE19B0057D0A7 /* WKUserContentURLPattern.h in Headers */,
BC8699B7116AADAA002A925B /* WKViewInternal.h in Headers */,
+ 1A256E3818A1A788006FB922 /* WKNavigationAction.h in Headers */,
BFA6179F12F0B99D0033E0CA /* WKViewPrivate.h in Headers */,
755422CC180773CE0046F6A8 /* WebOriginDataManager.h in Headers */,
C5245391189C6B85003DF476 /* WKActionSheetAssistant.h in Headers */,
@@ -8042,6 +8053,7 @@
512F58F712A88A5400629530 /* WKAuthenticationDecisionListener.cpp in Sources */,
BC646C1A11DD399F006455B0 /* WKBackForwardListRef.cpp in Sources */,
BC646C1C11DD399F006455B0 /* WKBackForwardListItemRef.cpp in Sources */,
+ 1A256E3718A1A788006FB922 /* WKNavigationAction.mm in Sources */,
BCBAAC72144E61990053F82F /* WKBrowsingContextController.mm in Sources */,
BCBAACF51452324F0053F82F /* WKBrowsingContextGroup.mm in Sources */,
51290992183ACEAF005522A6 /* WebIDBServerConnection.cpp in Sources */,