1/*
2 * Copyright (C) 2013 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 WKPageLoaderClient_h
27#define WKPageLoaderClient_h
28
29#include <WebKit/WKBase.h>
30#include <WebKit/WKErrorRef.h>
31#include <WebKit/WKPageLoadTypes.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37enum {
38    kWKPluginLoadPolicyLoadNormally = 0,
39    kWKPluginLoadPolicyBlocked,
40    kWKPluginLoadPolicyInactive,
41    kWKPluginLoadPolicyLoadUnsandboxed,
42};
43typedef uint32_t WKPluginLoadPolicy;
44
45enum {
46    kWKWebGLLoadPolicyBlocked = 0,
47    kWKWebGLLoadPolicyLoadNormally,
48    kWKWebGLLoadPolicyPending
49};
50typedef uint32_t WKWebGLLoadPolicy;
51
52typedef void (*WKPageLoaderClientCallback)(WKPageRef page, const void* clientInfo);
53typedef void (*WKPageDidStartProvisionalLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
54typedef void (*WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
55typedef void (*WKPageDidFailProvisionalLoadWithErrorForFrameCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo);
56typedef void (*WKPageDidCommitLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
57typedef void (*WKPageDidFinishDocumentLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
58typedef void (*WKPageDidFinishLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
59typedef void (*WKPageDidFailLoadWithErrorForFrameCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo);
60typedef void (*WKPageDidSameDocumentNavigationForFrameCallback)(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void *clientInfo);
61typedef void (*WKPageDidReceiveTitleForFrameCallback)(WKPageRef page, WKStringRef title, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
62typedef void (*WKPageDidFirstLayoutForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
63typedef void (*WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
64typedef void (*WKPageDidRemoveFrameFromHierarchyCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
65typedef void (*WKPageDidDisplayInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
66typedef void (*WKPageDidRunInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
67typedef void (*WKPageDidDetectXSSForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
68typedef bool (*WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback)(WKPageRef page, WKFrameRef frame, WKProtectionSpaceRef protectionSpace, const void *clientInfo);
69typedef void (*WKPageDidReceiveAuthenticationChallengeInFrameCallback)(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo);
70typedef void (*WKPageDidChangeBackForwardListCallback)(WKPageRef page, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void *clientInfo);
71typedef bool (*WKPageShouldGoToBackForwardListItemCallback)(WKPageRef page, WKBackForwardListItemRef item, const void *clientInfo);
72typedef bool (*WKPageShouldKeepCurrentBackForwardListItemInListCallback)(WKPageRef page, WKBackForwardListItemRef item, const void *clientInfo);
73typedef void (*WKPageWillGoToBackForwardListItemCallback)(WKPageRef page, WKBackForwardListItemRef item, WKTypeRef userData, const void *clientInfo);
74typedef void (*WKPageDidLayoutCallback)(WKPageRef page, WKLayoutMilestones milestones, WKTypeRef userData, const void *clientInfo);
75typedef WKPluginLoadPolicy (*WKPagePluginLoadPolicyCallback)(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInfoDictionary, WKStringRef* unavailabilityDescription, const void* clientInfo);
76typedef void (*WKPagePluginDidFailCallback)(WKPageRef page, uint32_t errorCode, WKDictionaryRef pluginInfoDictionary, const void* clientInfo);
77typedef WKWebGLLoadPolicy (*WKPageWebGLLoadPolicyCallback)(WKPageRef page, WKStringRef url, const void* clientInfo);
78
79// Deprecated
80typedef void (*WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef mimeType, const void* clientInfo);
81typedef void (*WKPagePluginDidFailCallback_deprecatedForUseWithV1)(WKPageRef page, uint32_t errorCode, WKStringRef mimeType, WKStringRef pluginIdentifier, WKStringRef pluginVersion, const void* clientInfo);
82typedef WKPluginLoadPolicy (*WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2)(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInfoDictionary, const void* clientInfo);
83
84typedef struct WKPageLoaderClientBase {
85    int                                                                 version;
86    const void *                                                        clientInfo;
87} WKPageLoaderClientBase;
88
89typedef struct WKPageLoaderClientV0 {
90    WKPageLoaderClientBase                                              base;
91
92    // Version 0.
93    WKPageDidStartProvisionalLoadForFrameCallback                       didStartProvisionalLoadForFrame;
94    WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback    didReceiveServerRedirectForProvisionalLoadForFrame;
95    WKPageDidFailProvisionalLoadWithErrorForFrameCallback               didFailProvisionalLoadWithErrorForFrame;
96    WKPageDidCommitLoadForFrameCallback                                 didCommitLoadForFrame;
97    WKPageDidFinishDocumentLoadForFrameCallback                         didFinishDocumentLoadForFrame;
98    WKPageDidFinishLoadForFrameCallback                                 didFinishLoadForFrame;
99    WKPageDidFailLoadWithErrorForFrameCallback                          didFailLoadWithErrorForFrame;
100    WKPageDidSameDocumentNavigationForFrameCallback                     didSameDocumentNavigationForFrame;
101    WKPageDidReceiveTitleForFrameCallback                               didReceiveTitleForFrame;
102    WKPageDidFirstLayoutForFrameCallback                                didFirstLayoutForFrame;
103    WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback                didFirstVisuallyNonEmptyLayoutForFrame;
104    WKPageDidRemoveFrameFromHierarchyCallback                           didRemoveFrameFromHierarchy;
105    WKPageDidDisplayInsecureContentForFrameCallback                     didDisplayInsecureContentForFrame;
106    WKPageDidRunInsecureContentForFrameCallback                         didRunInsecureContentForFrame;
107    WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback          canAuthenticateAgainstProtectionSpaceInFrame;
108    WKPageDidReceiveAuthenticationChallengeInFrameCallback              didReceiveAuthenticationChallengeInFrame;
109
110    // FIXME: Move to progress client.
111    WKPageLoaderClientCallback                                          didStartProgress;
112    WKPageLoaderClientCallback                                          didChangeProgress;
113    WKPageLoaderClientCallback                                          didFinishProgress;
114
115    // FIXME: These three functions should not be part of this client.
116    WKPageLoaderClientCallback                                          processDidBecomeUnresponsive;
117    WKPageLoaderClientCallback                                          processDidBecomeResponsive;
118    WKPageLoaderClientCallback                                          processDidCrash;
119    WKPageDidChangeBackForwardListCallback                              didChangeBackForwardList;
120    WKPageShouldGoToBackForwardListItemCallback                         shouldGoToBackForwardListItem;
121    WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0      didFailToInitializePlugin_deprecatedForUseWithV0;
122} WKPageLoaderClientV0;
123
124typedef struct WKPageLoaderClientV1 {
125    WKPageLoaderClientBase                                              base;
126
127    // Version -.
128    WKPageDidStartProvisionalLoadForFrameCallback                       didStartProvisionalLoadForFrame;
129    WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback    didReceiveServerRedirectForProvisionalLoadForFrame;
130    WKPageDidFailProvisionalLoadWithErrorForFrameCallback               didFailProvisionalLoadWithErrorForFrame;
131    WKPageDidCommitLoadForFrameCallback                                 didCommitLoadForFrame;
132    WKPageDidFinishDocumentLoadForFrameCallback                         didFinishDocumentLoadForFrame;
133    WKPageDidFinishLoadForFrameCallback                                 didFinishLoadForFrame;
134    WKPageDidFailLoadWithErrorForFrameCallback                          didFailLoadWithErrorForFrame;
135    WKPageDidSameDocumentNavigationForFrameCallback                     didSameDocumentNavigationForFrame;
136    WKPageDidReceiveTitleForFrameCallback                               didReceiveTitleForFrame;
137    WKPageDidFirstLayoutForFrameCallback                                didFirstLayoutForFrame;
138    WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback                didFirstVisuallyNonEmptyLayoutForFrame;
139    WKPageDidRemoveFrameFromHierarchyCallback                           didRemoveFrameFromHierarchy;
140    WKPageDidDisplayInsecureContentForFrameCallback                     didDisplayInsecureContentForFrame;
141    WKPageDidRunInsecureContentForFrameCallback                         didRunInsecureContentForFrame;
142    WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback          canAuthenticateAgainstProtectionSpaceInFrame;
143    WKPageDidReceiveAuthenticationChallengeInFrameCallback              didReceiveAuthenticationChallengeInFrame;
144
145    // FIXME: Move to progress client.
146    WKPageLoaderClientCallback                                          didStartProgress;
147    WKPageLoaderClientCallback                                          didChangeProgress;
148    WKPageLoaderClientCallback                                          didFinishProgress;
149
150    // FIXME: These three functions should not be part of this client.
151    WKPageLoaderClientCallback                                          processDidBecomeUnresponsive;
152    WKPageLoaderClientCallback                                          processDidBecomeResponsive;
153    WKPageLoaderClientCallback                                          processDidCrash;
154    WKPageDidChangeBackForwardListCallback                              didChangeBackForwardList;
155    WKPageShouldGoToBackForwardListItemCallback                         shouldGoToBackForwardListItem;
156    WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0      didFailToInitializePlugin_deprecatedForUseWithV0;
157
158    // Version 1.
159    WKPageDidDetectXSSForFrameCallback                                  didDetectXSSForFrame;
160
161    void*                                                               didNewFirstVisuallyNonEmptyLayout_unavailable;
162
163    WKPageWillGoToBackForwardListItemCallback                           willGoToBackForwardListItem;
164
165    WKPageLoaderClientCallback                                          interactionOccurredWhileProcessUnresponsive;
166    WKPagePluginDidFailCallback_deprecatedForUseWithV1                  pluginDidFail_deprecatedForUseWithV1;
167} WKPageLoaderClientV1;
168
169typedef struct WKPageLoaderClientV2 {
170    WKPageLoaderClientBase                                              base;
171
172    // Version 0.
173    WKPageDidStartProvisionalLoadForFrameCallback                       didStartProvisionalLoadForFrame;
174    WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback    didReceiveServerRedirectForProvisionalLoadForFrame;
175    WKPageDidFailProvisionalLoadWithErrorForFrameCallback               didFailProvisionalLoadWithErrorForFrame;
176    WKPageDidCommitLoadForFrameCallback                                 didCommitLoadForFrame;
177    WKPageDidFinishDocumentLoadForFrameCallback                         didFinishDocumentLoadForFrame;
178    WKPageDidFinishLoadForFrameCallback                                 didFinishLoadForFrame;
179    WKPageDidFailLoadWithErrorForFrameCallback                          didFailLoadWithErrorForFrame;
180    WKPageDidSameDocumentNavigationForFrameCallback                     didSameDocumentNavigationForFrame;
181    WKPageDidReceiveTitleForFrameCallback                               didReceiveTitleForFrame;
182    WKPageDidFirstLayoutForFrameCallback                                didFirstLayoutForFrame;
183    WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback                didFirstVisuallyNonEmptyLayoutForFrame;
184    WKPageDidRemoveFrameFromHierarchyCallback                           didRemoveFrameFromHierarchy;
185    WKPageDidDisplayInsecureContentForFrameCallback                     didDisplayInsecureContentForFrame;
186    WKPageDidRunInsecureContentForFrameCallback                         didRunInsecureContentForFrame;
187    WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback          canAuthenticateAgainstProtectionSpaceInFrame;
188    WKPageDidReceiveAuthenticationChallengeInFrameCallback              didReceiveAuthenticationChallengeInFrame;
189
190    // FIXME: Move to progress client.
191    WKPageLoaderClientCallback                                          didStartProgress;
192    WKPageLoaderClientCallback                                          didChangeProgress;
193    WKPageLoaderClientCallback                                          didFinishProgress;
194
195    // FIXME: These three functions should not be part of this client.
196    WKPageLoaderClientCallback                                          processDidBecomeUnresponsive;
197    WKPageLoaderClientCallback                                          processDidBecomeResponsive;
198    WKPageLoaderClientCallback                                          processDidCrash;
199    WKPageDidChangeBackForwardListCallback                              didChangeBackForwardList;
200    WKPageShouldGoToBackForwardListItemCallback                         shouldGoToBackForwardListItem;
201    WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0      didFailToInitializePlugin_deprecatedForUseWithV0;
202
203    // Version 1.
204    WKPageDidDetectXSSForFrameCallback                                  didDetectXSSForFrame;
205
206    void*                                                               didNewFirstVisuallyNonEmptyLayout_unavailable;
207
208    WKPageWillGoToBackForwardListItemCallback                           willGoToBackForwardListItem;
209
210    WKPageLoaderClientCallback                                          interactionOccurredWhileProcessUnresponsive;
211    WKPagePluginDidFailCallback_deprecatedForUseWithV1                  pluginDidFail_deprecatedForUseWithV1;
212
213    // Version 2.
214    void                                                                (*didReceiveIntentForFrame_unavailable)(void);
215    void                                                                (*registerIntentServiceForFrame_unavailable)(void);
216
217    WKPageDidLayoutCallback                                             didLayout;
218    WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2               pluginLoadPolicy_deprecatedForUseWithV2;
219    WKPagePluginDidFailCallback                                         pluginDidFail;
220} WKPageLoaderClientV2;
221
222typedef struct WKPageLoaderClientV3 {
223    WKPageLoaderClientBase                                              base;
224
225    // Version 0.
226    WKPageDidStartProvisionalLoadForFrameCallback                       didStartProvisionalLoadForFrame;
227    WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback    didReceiveServerRedirectForProvisionalLoadForFrame;
228    WKPageDidFailProvisionalLoadWithErrorForFrameCallback               didFailProvisionalLoadWithErrorForFrame;
229    WKPageDidCommitLoadForFrameCallback                                 didCommitLoadForFrame;
230    WKPageDidFinishDocumentLoadForFrameCallback                         didFinishDocumentLoadForFrame;
231    WKPageDidFinishLoadForFrameCallback                                 didFinishLoadForFrame;
232    WKPageDidFailLoadWithErrorForFrameCallback                          didFailLoadWithErrorForFrame;
233    WKPageDidSameDocumentNavigationForFrameCallback                     didSameDocumentNavigationForFrame;
234    WKPageDidReceiveTitleForFrameCallback                               didReceiveTitleForFrame;
235    WKPageDidFirstLayoutForFrameCallback                                didFirstLayoutForFrame;
236    WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback                didFirstVisuallyNonEmptyLayoutForFrame;
237    WKPageDidRemoveFrameFromHierarchyCallback                           didRemoveFrameFromHierarchy;
238    WKPageDidDisplayInsecureContentForFrameCallback                     didDisplayInsecureContentForFrame;
239    WKPageDidRunInsecureContentForFrameCallback                         didRunInsecureContentForFrame;
240    WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback          canAuthenticateAgainstProtectionSpaceInFrame;
241    WKPageDidReceiveAuthenticationChallengeInFrameCallback              didReceiveAuthenticationChallengeInFrame;
242
243    // FIXME: Move to progress client.
244    WKPageLoaderClientCallback                                          didStartProgress;
245    WKPageLoaderClientCallback                                          didChangeProgress;
246    WKPageLoaderClientCallback                                          didFinishProgress;
247
248    // FIXME: These three functions should not be part of this client.
249    WKPageLoaderClientCallback                                          processDidBecomeUnresponsive;
250    WKPageLoaderClientCallback                                          processDidBecomeResponsive;
251    WKPageLoaderClientCallback                                          processDidCrash;
252    WKPageDidChangeBackForwardListCallback                              didChangeBackForwardList;
253    WKPageShouldGoToBackForwardListItemCallback                         shouldGoToBackForwardListItem;
254    WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0      didFailToInitializePlugin_deprecatedForUseWithV0;
255
256    // Version 1.
257    WKPageDidDetectXSSForFrameCallback                                  didDetectXSSForFrame;
258
259    void*                                                               didNewFirstVisuallyNonEmptyLayout_unavailable;
260
261    WKPageWillGoToBackForwardListItemCallback                           willGoToBackForwardListItem;
262
263    WKPageLoaderClientCallback                                          interactionOccurredWhileProcessUnresponsive;
264    WKPagePluginDidFailCallback_deprecatedForUseWithV1                  pluginDidFail_deprecatedForUseWithV1;
265
266    // Version 2.
267    void                                                                (*didReceiveIntentForFrame_unavailable)(void);
268    void                                                                (*registerIntentServiceForFrame_unavailable)(void);
269
270    WKPageDidLayoutCallback                                             didLayout;
271    WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2               pluginLoadPolicy_deprecatedForUseWithV2;
272    WKPagePluginDidFailCallback                                         pluginDidFail;
273
274    // Version 3.
275    WKPagePluginLoadPolicyCallback                                      pluginLoadPolicy;
276} WKPageLoaderClientV3;
277
278typedef struct WKPageLoaderClientV4 {
279    WKPageLoaderClientBase                                              base;
280
281    // Version 0.
282    WKPageDidStartProvisionalLoadForFrameCallback                       didStartProvisionalLoadForFrame;
283    WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback    didReceiveServerRedirectForProvisionalLoadForFrame;
284    WKPageDidFailProvisionalLoadWithErrorForFrameCallback               didFailProvisionalLoadWithErrorForFrame;
285    WKPageDidCommitLoadForFrameCallback                                 didCommitLoadForFrame;
286    WKPageDidFinishDocumentLoadForFrameCallback                         didFinishDocumentLoadForFrame;
287    WKPageDidFinishLoadForFrameCallback                                 didFinishLoadForFrame;
288    WKPageDidFailLoadWithErrorForFrameCallback                          didFailLoadWithErrorForFrame;
289    WKPageDidSameDocumentNavigationForFrameCallback                     didSameDocumentNavigationForFrame;
290    WKPageDidReceiveTitleForFrameCallback                               didReceiveTitleForFrame;
291    WKPageDidFirstLayoutForFrameCallback                                didFirstLayoutForFrame;
292    WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback                didFirstVisuallyNonEmptyLayoutForFrame;
293    WKPageDidRemoveFrameFromHierarchyCallback                           didRemoveFrameFromHierarchy;
294    WKPageDidDisplayInsecureContentForFrameCallback                     didDisplayInsecureContentForFrame;
295    WKPageDidRunInsecureContentForFrameCallback                         didRunInsecureContentForFrame;
296    WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback          canAuthenticateAgainstProtectionSpaceInFrame;
297    WKPageDidReceiveAuthenticationChallengeInFrameCallback              didReceiveAuthenticationChallengeInFrame;
298
299    // FIXME: Move to progress client.
300    WKPageLoaderClientCallback                                          didStartProgress;
301    WKPageLoaderClientCallback                                          didChangeProgress;
302    WKPageLoaderClientCallback                                          didFinishProgress;
303
304    // FIXME: These three functions should not be part of this client.
305    WKPageLoaderClientCallback                                          processDidBecomeUnresponsive;
306    WKPageLoaderClientCallback                                          processDidBecomeResponsive;
307    WKPageLoaderClientCallback                                          processDidCrash;
308    WKPageDidChangeBackForwardListCallback                              didChangeBackForwardList;
309    WKPageShouldGoToBackForwardListItemCallback                         shouldGoToBackForwardListItem;
310    WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0      didFailToInitializePlugin_deprecatedForUseWithV0;
311
312    // Version 1.
313    WKPageDidDetectXSSForFrameCallback                                  didDetectXSSForFrame;
314
315    void*                                                               didNewFirstVisuallyNonEmptyLayout_unavailable;
316
317    WKPageWillGoToBackForwardListItemCallback                           willGoToBackForwardListItem;
318
319    WKPageLoaderClientCallback                                          interactionOccurredWhileProcessUnresponsive;
320    WKPagePluginDidFailCallback_deprecatedForUseWithV1                  pluginDidFail_deprecatedForUseWithV1;
321
322    // Version 2.
323    void                                                                (*didReceiveIntentForFrame_unavailable)(void);
324    void                                                                (*registerIntentServiceForFrame_unavailable)(void);
325
326    WKPageDidLayoutCallback                                             didLayout;
327    WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2               pluginLoadPolicy_deprecatedForUseWithV2;
328    WKPagePluginDidFailCallback                                         pluginDidFail;
329
330    // Version 3.
331    WKPagePluginLoadPolicyCallback                                      pluginLoadPolicy;
332
333    // Version 4
334    WKPageWebGLLoadPolicyCallback                                       webGLLoadPolicy;
335    WKPageWebGLLoadPolicyCallback                                       resolveWebGLLoadPolicy;
336} WKPageLoaderClientV4;
337
338typedef struct WKPageLoaderClientV5 {
339    WKPageLoaderClientBase                                              base;
340
341    // Version 0.
342    WKPageDidStartProvisionalLoadForFrameCallback                       didStartProvisionalLoadForFrame;
343    WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback    didReceiveServerRedirectForProvisionalLoadForFrame;
344    WKPageDidFailProvisionalLoadWithErrorForFrameCallback               didFailProvisionalLoadWithErrorForFrame;
345    WKPageDidCommitLoadForFrameCallback                                 didCommitLoadForFrame;
346    WKPageDidFinishDocumentLoadForFrameCallback                         didFinishDocumentLoadForFrame;
347    WKPageDidFinishLoadForFrameCallback                                 didFinishLoadForFrame;
348    WKPageDidFailLoadWithErrorForFrameCallback                          didFailLoadWithErrorForFrame;
349    WKPageDidSameDocumentNavigationForFrameCallback                     didSameDocumentNavigationForFrame;
350    WKPageDidReceiveTitleForFrameCallback                               didReceiveTitleForFrame;
351    WKPageDidFirstLayoutForFrameCallback                                didFirstLayoutForFrame;
352    WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback                didFirstVisuallyNonEmptyLayoutForFrame;
353    WKPageDidRemoveFrameFromHierarchyCallback                           didRemoveFrameFromHierarchy;
354    WKPageDidDisplayInsecureContentForFrameCallback                     didDisplayInsecureContentForFrame;
355    WKPageDidRunInsecureContentForFrameCallback                         didRunInsecureContentForFrame;
356    WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback          canAuthenticateAgainstProtectionSpaceInFrame;
357    WKPageDidReceiveAuthenticationChallengeInFrameCallback              didReceiveAuthenticationChallengeInFrame;
358
359    // FIXME: Move to progress client.
360    WKPageLoaderClientCallback                                          didStartProgress;
361    WKPageLoaderClientCallback                                          didChangeProgress;
362    WKPageLoaderClientCallback                                          didFinishProgress;
363
364    // FIXME: These three functions should not be part of this client.
365    WKPageLoaderClientCallback                                          processDidBecomeUnresponsive;
366    WKPageLoaderClientCallback                                          processDidBecomeResponsive;
367    WKPageLoaderClientCallback                                          processDidCrash;
368    WKPageDidChangeBackForwardListCallback                              didChangeBackForwardList;
369    WKPageShouldGoToBackForwardListItemCallback                         shouldGoToBackForwardListItem;
370    WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0      didFailToInitializePlugin_deprecatedForUseWithV0;
371
372    // Version 1.
373    WKPageDidDetectXSSForFrameCallback                                  didDetectXSSForFrame;
374
375    void*                                                               didNewFirstVisuallyNonEmptyLayout_unavailable;
376
377    WKPageWillGoToBackForwardListItemCallback                           willGoToBackForwardListItem;
378
379    WKPageLoaderClientCallback                                          interactionOccurredWhileProcessUnresponsive;
380    WKPagePluginDidFailCallback_deprecatedForUseWithV1                  pluginDidFail_deprecatedForUseWithV1;
381
382    // Version 2.
383    void                                                                (*didReceiveIntentForFrame_unavailable)(void);
384    void                                                                (*registerIntentServiceForFrame_unavailable)(void);
385
386    WKPageDidLayoutCallback                                             didLayout;
387    WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2               pluginLoadPolicy_deprecatedForUseWithV2;
388    WKPagePluginDidFailCallback                                         pluginDidFail;
389
390    // Version 3.
391    WKPagePluginLoadPolicyCallback                                      pluginLoadPolicy;
392
393    // Version 4.
394    WKPageWebGLLoadPolicyCallback                                       webGLLoadPolicy;
395    WKPageWebGLLoadPolicyCallback                                       resolveWebGLLoadPolicy;
396
397    // Version 5.
398    WKPageShouldKeepCurrentBackForwardListItemInListCallback            shouldKeepCurrentBackForwardListItemInList;
399} WKPageLoaderClientV5;
400
401// FIXME: These should be deprecated.
402enum { kWKPageLoaderClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 3 };
403typedef struct WKPageLoaderClient {
404    int                                                                 version;
405    const void *                                                        clientInfo;
406
407    // Version 0.
408    WKPageDidStartProvisionalLoadForFrameCallback                       didStartProvisionalLoadForFrame;
409    WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback    didReceiveServerRedirectForProvisionalLoadForFrame;
410    WKPageDidFailProvisionalLoadWithErrorForFrameCallback               didFailProvisionalLoadWithErrorForFrame;
411    WKPageDidCommitLoadForFrameCallback                                 didCommitLoadForFrame;
412    WKPageDidFinishDocumentLoadForFrameCallback                         didFinishDocumentLoadForFrame;
413    WKPageDidFinishLoadForFrameCallback                                 didFinishLoadForFrame;
414    WKPageDidFailLoadWithErrorForFrameCallback                          didFailLoadWithErrorForFrame;
415    WKPageDidSameDocumentNavigationForFrameCallback                     didSameDocumentNavigationForFrame;
416    WKPageDidReceiveTitleForFrameCallback                               didReceiveTitleForFrame;
417    WKPageDidFirstLayoutForFrameCallback                                didFirstLayoutForFrame;
418    WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback                didFirstVisuallyNonEmptyLayoutForFrame;
419    WKPageDidRemoveFrameFromHierarchyCallback                           didRemoveFrameFromHierarchy;
420    WKPageDidDisplayInsecureContentForFrameCallback                     didDisplayInsecureContentForFrame;
421    WKPageDidRunInsecureContentForFrameCallback                         didRunInsecureContentForFrame;
422    WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback          canAuthenticateAgainstProtectionSpaceInFrame;
423    WKPageDidReceiveAuthenticationChallengeInFrameCallback              didReceiveAuthenticationChallengeInFrame;
424
425    // FIXME: Move to progress client.
426    WKPageLoaderClientCallback                                          didStartProgress;
427    WKPageLoaderClientCallback                                          didChangeProgress;
428    WKPageLoaderClientCallback                                          didFinishProgress;
429
430    // FIXME: These three functions should not be part of this client.
431    WKPageLoaderClientCallback                                          processDidBecomeUnresponsive;
432    WKPageLoaderClientCallback                                          processDidBecomeResponsive;
433    WKPageLoaderClientCallback                                          processDidCrash;
434    WKPageDidChangeBackForwardListCallback                              didChangeBackForwardList;
435    WKPageShouldGoToBackForwardListItemCallback                         shouldGoToBackForwardListItem;
436    WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0      didFailToInitializePlugin_deprecatedForUseWithV0;
437
438    // Version 1.
439    WKPageDidDetectXSSForFrameCallback                                  didDetectXSSForFrame;
440
441    void*                                                               didNewFirstVisuallyNonEmptyLayout_unavailable;
442
443    WKPageWillGoToBackForwardListItemCallback                           willGoToBackForwardListItem;
444
445    WKPageLoaderClientCallback                                          interactionOccurredWhileProcessUnresponsive;
446    WKPagePluginDidFailCallback_deprecatedForUseWithV1                  pluginDidFail_deprecatedForUseWithV1;
447
448    // Version 2.
449    void                                                                (*didReceiveIntentForFrame_unavailable)(void);
450    void                                                                (*registerIntentServiceForFrame_unavailable)(void);
451
452    WKPageDidLayoutCallback                                             didLayout;
453    WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2               pluginLoadPolicy_deprecatedForUseWithV2;
454    WKPagePluginDidFailCallback                                         pluginDidFail;
455
456    // Version 3.
457    WKPagePluginLoadPolicyCallback                                      pluginLoadPolicy;
458} WKPageLoaderClient;
459
460#ifdef __cplusplus
461}
462#endif
463
464#endif // WKPageLoaderClient_h
465