1/*
2 * Copyright (C) 2015 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef WKPageNavigationClient_h
27#define WKPageNavigationClient_h
28
29#include <WebKit/WKBase.h>
30#include <WebKit/WKPageLoadTypes.h>
31#include <WebKit/WKPageRenderingProgressEvents.h>
32#include <WebKit/WKPluginLoadPolicy.h>
33#include <WebKit/WKProcessTerminationReason.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39typedef void (*WKPageNavigationDecidePolicyForNavigationActionCallback)(WKPageRef page, WKNavigationActionRef navigationAction, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
40
41typedef void (*WKPageNavigationDecidePolicyForNavigationResponseCallback)(WKPageRef page, WKNavigationResponseRef navigationResponse, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
42
43typedef void (*WKPageNavigationDidStartProvisionalNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo);
44
45typedef void (*WKPageNavigationDidReceiveServerRedirectForProvisionalNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo);
46
47typedef void (*WKPageNavigationDidFailProvisionalNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKErrorRef error, WKTypeRef userData, const void* clientInfo);
48
49typedef void (*WKPageNavigationDidCommitNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo);
50
51typedef void (*WKPageNavigationDidFinishNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo);
52
53typedef void (*WKPageNavigationDidFailNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKErrorRef error, WKTypeRef userData, const void* clientInfo);
54
55typedef void (*WKPageNavigationDidFailProvisionalLoadInSubframeCallback)(WKPageRef page, WKNavigationRef navigation, WKFrameInfoRef subframe, WKErrorRef error, WKTypeRef userData, const void* clientInfo);
56
57typedef void (*WKPageNavigationDidFinishDocumentLoadCallback)(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo);
58
59typedef void (*WKPageNavigationDidSameDocumentNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKSameDocumentNavigationType navigationType, WKTypeRef userData, const void* clientInfo);
60
61typedef void (*WKPageNavigationRenderingProgressDidChangeCallback)(WKPageRef page, WKPageRenderingProgressEvents progressEvents, WKTypeRef userData, const void* clientInfo);
62
63typedef bool (*WKPageNavigationCanAuthenticateAgainstProtectionSpaceCallback)(WKPageRef page, WKProtectionSpaceRef protectionSpace, const void* clientInfo);
64
65typedef void (*WKPageNavigationDidReceiveAuthenticationChallengeCallback)(WKPageRef page, WKAuthenticationChallengeRef challenge, const void* clientInfo);
66
67typedef void (*WKPageNavigationWebProcessDidCrashCallback)(WKPageRef page, const void* clientInfo);
68
69typedef void (*WKPageNavigationWebProcessDidTerminateCallback)(WKPageRef page, WKProcessTerminationReason reason, const void* clientInfo);
70
71typedef WKDataRef (*WKPageNavigationCopyWebCryptoMasterKeyCallback)(WKPageRef page, const void* clientInfo);
72
73typedef WKStringRef (*WKPageNavigationCopySignedPublicKeyAndChallengeStringCallback)(WKPageRef page, const void* clientInfo);
74
75typedef WKPluginLoadPolicy (*WKPageNavigationDecidePolicyForPluginLoadCallback)(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInfoDictionary, WKStringRef* unavailabilityDescription, const void* clientInfo);
76
77typedef void (*WKPageNavigationDidBeginNavigationGesture)(WKPageRef page, const void* clientInfo);
78
79typedef void (*WKPageNavigationWillEndNavigationGesture)(WKPageRef page, WKBackForwardListItemRef backForwardListItem, const void* clientInfo);
80
81typedef void (*WKPageNavigationDidEndNavigationGesture)(WKPageRef page, WKBackForwardListItemRef backForwardListItem, const void* clientInfo);
82
83typedef void (*WKPageNavigationDidRemoveNavigationGestureSnapshot)(WKPageRef page, const void* clientInfo);
84
85typedef void (*WKPageNavigationContentRuleListNotificationCallback)(WKPageRef, WKURLRef, WKArrayRef, WKArrayRef, const void* clientInfo);
86
87typedef struct WKPageNavigationClientBase {
88 int version;
89 const void* clientInfo;
90} WKPageNavigationClientBase;
91
92typedef struct WKPageNavigationClientV0 {
93 WKPageNavigationClientBase base;
94
95 // Version 0.
96 WKPageNavigationDecidePolicyForNavigationActionCallback decidePolicyForNavigationAction;
97 WKPageNavigationDecidePolicyForNavigationResponseCallback decidePolicyForNavigationResponse;
98 WKPageNavigationDecidePolicyForPluginLoadCallback decidePolicyForPluginLoad;
99 WKPageNavigationDidStartProvisionalNavigationCallback didStartProvisionalNavigation;
100 WKPageNavigationDidReceiveServerRedirectForProvisionalNavigationCallback didReceiveServerRedirectForProvisionalNavigation;
101 WKPageNavigationDidFailProvisionalNavigationCallback didFailProvisionalNavigation;
102 WKPageNavigationDidCommitNavigationCallback didCommitNavigation;
103 WKPageNavigationDidFinishNavigationCallback didFinishNavigation;
104 WKPageNavigationDidFailNavigationCallback didFailNavigation;
105 WKPageNavigationDidFailProvisionalLoadInSubframeCallback didFailProvisionalLoadInSubframe;
106 WKPageNavigationDidFinishDocumentLoadCallback didFinishDocumentLoad;
107 WKPageNavigationDidSameDocumentNavigationCallback didSameDocumentNavigation;
108 WKPageNavigationRenderingProgressDidChangeCallback renderingProgressDidChange;
109 WKPageNavigationCanAuthenticateAgainstProtectionSpaceCallback canAuthenticateAgainstProtectionSpace;
110 WKPageNavigationDidReceiveAuthenticationChallengeCallback didReceiveAuthenticationChallenge;
111 WKPageNavigationWebProcessDidCrashCallback webProcessDidCrash;
112 WKPageNavigationCopyWebCryptoMasterKeyCallback copyWebCryptoMasterKey;
113 WKPageNavigationDidBeginNavigationGesture didBeginNavigationGesture;
114 WKPageNavigationWillEndNavigationGesture willEndNavigationGesture;
115 WKPageNavigationDidEndNavigationGesture didEndNavigationGesture;
116 WKPageNavigationDidRemoveNavigationGestureSnapshot didRemoveNavigationGestureSnapshot;
117} WKPageNavigationClientV0;
118
119typedef struct WKPageNavigationClientV1 {
120 WKPageNavigationClientBase base;
121
122 // Version 0.
123 WKPageNavigationDecidePolicyForNavigationActionCallback decidePolicyForNavigationAction;
124 WKPageNavigationDecidePolicyForNavigationResponseCallback decidePolicyForNavigationResponse;
125 WKPageNavigationDecidePolicyForPluginLoadCallback decidePolicyForPluginLoad;
126 WKPageNavigationDidStartProvisionalNavigationCallback didStartProvisionalNavigation;
127 WKPageNavigationDidReceiveServerRedirectForProvisionalNavigationCallback didReceiveServerRedirectForProvisionalNavigation;
128 WKPageNavigationDidFailProvisionalNavigationCallback didFailProvisionalNavigation;
129 WKPageNavigationDidCommitNavigationCallback didCommitNavigation;
130 WKPageNavigationDidFinishNavigationCallback didFinishNavigation;
131 WKPageNavigationDidFailNavigationCallback didFailNavigation;
132 WKPageNavigationDidFailProvisionalLoadInSubframeCallback didFailProvisionalLoadInSubframe;
133 WKPageNavigationDidFinishDocumentLoadCallback didFinishDocumentLoad;
134 WKPageNavigationDidSameDocumentNavigationCallback didSameDocumentNavigation;
135 WKPageNavigationRenderingProgressDidChangeCallback renderingProgressDidChange;
136 WKPageNavigationCanAuthenticateAgainstProtectionSpaceCallback canAuthenticateAgainstProtectionSpace;
137 WKPageNavigationDidReceiveAuthenticationChallengeCallback didReceiveAuthenticationChallenge;
138 WKPageNavigationWebProcessDidCrashCallback webProcessDidCrash;
139 WKPageNavigationCopyWebCryptoMasterKeyCallback copyWebCryptoMasterKey;
140 WKPageNavigationDidBeginNavigationGesture didBeginNavigationGesture;
141 WKPageNavigationWillEndNavigationGesture willEndNavigationGesture;
142 WKPageNavigationDidEndNavigationGesture didEndNavigationGesture;
143 WKPageNavigationDidRemoveNavigationGestureSnapshot didRemoveNavigationGestureSnapshot;
144
145 // Version 1.
146 WKPageNavigationWebProcessDidTerminateCallback webProcessDidTerminate;
147} WKPageNavigationClientV1;
148
149typedef struct WKPageNavigationClientV2 {
150 WKPageNavigationClientBase base;
151
152 // Version 0.
153 WKPageNavigationDecidePolicyForNavigationActionCallback decidePolicyForNavigationAction;
154 WKPageNavigationDecidePolicyForNavigationResponseCallback decidePolicyForNavigationResponse;
155 WKPageNavigationDecidePolicyForPluginLoadCallback decidePolicyForPluginLoad;
156 WKPageNavigationDidStartProvisionalNavigationCallback didStartProvisionalNavigation;
157 WKPageNavigationDidReceiveServerRedirectForProvisionalNavigationCallback didReceiveServerRedirectForProvisionalNavigation;
158 WKPageNavigationDidFailProvisionalNavigationCallback didFailProvisionalNavigation;
159 WKPageNavigationDidCommitNavigationCallback didCommitNavigation;
160 WKPageNavigationDidFinishNavigationCallback didFinishNavigation;
161 WKPageNavigationDidFailNavigationCallback didFailNavigation;
162 WKPageNavigationDidFailProvisionalLoadInSubframeCallback didFailProvisionalLoadInSubframe;
163 WKPageNavigationDidFinishDocumentLoadCallback didFinishDocumentLoad;
164 WKPageNavigationDidSameDocumentNavigationCallback didSameDocumentNavigation;
165 WKPageNavigationRenderingProgressDidChangeCallback renderingProgressDidChange;
166 WKPageNavigationCanAuthenticateAgainstProtectionSpaceCallback canAuthenticateAgainstProtectionSpace;
167 WKPageNavigationDidReceiveAuthenticationChallengeCallback didReceiveAuthenticationChallenge;
168 WKPageNavigationWebProcessDidCrashCallback webProcessDidCrash;
169 WKPageNavigationCopyWebCryptoMasterKeyCallback copyWebCryptoMasterKey;
170 WKPageNavigationDidBeginNavigationGesture didBeginNavigationGesture;
171 WKPageNavigationWillEndNavigationGesture willEndNavigationGesture;
172 WKPageNavigationDidEndNavigationGesture didEndNavigationGesture;
173 WKPageNavigationDidRemoveNavigationGestureSnapshot didRemoveNavigationGestureSnapshot;
174
175 // Version 1.
176 WKPageNavigationWebProcessDidTerminateCallback webProcessDidTerminate;
177
178 // Version 2.
179 WKPageNavigationContentRuleListNotificationCallback contentRuleListNotification;
180} WKPageNavigationClientV2;
181
182typedef struct WKPageNavigationClientV3 {
183 WKPageNavigationClientBase base;
184
185 // Version 0.
186 WKPageNavigationDecidePolicyForNavigationActionCallback decidePolicyForNavigationAction;
187 WKPageNavigationDecidePolicyForNavigationResponseCallback decidePolicyForNavigationResponse;
188 WKPageNavigationDecidePolicyForPluginLoadCallback decidePolicyForPluginLoad;
189 WKPageNavigationDidStartProvisionalNavigationCallback didStartProvisionalNavigation;
190 WKPageNavigationDidReceiveServerRedirectForProvisionalNavigationCallback didReceiveServerRedirectForProvisionalNavigation;
191 WKPageNavigationDidFailProvisionalNavigationCallback didFailProvisionalNavigation;
192 WKPageNavigationDidCommitNavigationCallback didCommitNavigation;
193 WKPageNavigationDidFinishNavigationCallback didFinishNavigation;
194 WKPageNavigationDidFailNavigationCallback didFailNavigation;
195 WKPageNavigationDidFailProvisionalLoadInSubframeCallback didFailProvisionalLoadInSubframe;
196 WKPageNavigationDidFinishDocumentLoadCallback didFinishDocumentLoad;
197 WKPageNavigationDidSameDocumentNavigationCallback didSameDocumentNavigation;
198 WKPageNavigationRenderingProgressDidChangeCallback renderingProgressDidChange;
199 WKPageNavigationCanAuthenticateAgainstProtectionSpaceCallback canAuthenticateAgainstProtectionSpace;
200 WKPageNavigationDidReceiveAuthenticationChallengeCallback didReceiveAuthenticationChallenge;
201 WKPageNavigationWebProcessDidCrashCallback webProcessDidCrash;
202 WKPageNavigationCopyWebCryptoMasterKeyCallback copyWebCryptoMasterKey;
203 WKPageNavigationDidBeginNavigationGesture didBeginNavigationGesture;
204 WKPageNavigationWillEndNavigationGesture willEndNavigationGesture;
205 WKPageNavigationDidEndNavigationGesture didEndNavigationGesture;
206 WKPageNavigationDidRemoveNavigationGestureSnapshot didRemoveNavigationGestureSnapshot;
207
208 // Version 1.
209 WKPageNavigationWebProcessDidTerminateCallback webProcessDidTerminate;
210
211 // Version 2.
212 WKPageNavigationContentRuleListNotificationCallback contentRuleListNotification;
213
214 // Version 3.
215 WKPageNavigationCopySignedPublicKeyAndChallengeStringCallback copySignedPublicKeyAndChallengeString;
216} WKPageNavigationClientV3;
217
218#ifdef __cplusplus
219}
220#endif
221
222#endif // WKPageNavigationClient_h
223