[WK2][WKTR] TestRunner needs to implement dumpApplicationCacheDelegateCallbacks
[WebKit-https.git] / Source / WebKit2 / WebProcess / InjectedBundle / API / c / WKBundlePage.h
1 /*
2  * Copyright (C) 2010 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 WKBundlePage_h
27 #define WKBundlePage_h
28
29 #include <JavaScriptCore/JavaScript.h>
30 #include <WebKit2/WKBase.h>
31 #include <WebKit2/WKEvent.h>
32 #include <WebKit2/WKFindOptions.h>
33 #include <WebKit2/WKImage.h>
34 #include <WebKit2/WKPageLoadTypes.h>
35
36 #ifndef __cplusplus
37 #include <stdbool.h>
38 #endif
39
40 #include <stdint.h>
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 enum {
47     kWKInsertActionTyped = 0,
48     kWKInsertActionPasted = 1,
49     kWKInsertActionDropped = 2
50 };
51 typedef uint32_t WKInsertActionType;
52
53 enum {
54     kWKAffinityUpstream,
55     kWKAffinityDownstream
56 };
57 typedef uint32_t WKAffinityType;
58
59 enum {
60     WKInputFieldActionTypeMoveUp,
61     WKInputFieldActionTypeMoveDown,
62     WKInputFieldActionTypeCancel,
63     WKInputFieldActionTypeInsertTab,
64     WKInputFieldActionTypeInsertBacktab,
65     WKInputFieldActionTypeInsertNewline,
66     WKInputFieldActionTypeInsertDelete
67 };
68 typedef uint32_t WKInputFieldActionType;
69
70 enum {
71     WKFullScreenNoKeyboard,
72     WKFullScreenKeyboard,
73 };
74 typedef uint32_t WKFullScreenKeyboardRequestType;
75
76 enum {
77     WKScrollDirectionLeft,
78     WKScrollDirectionRight
79 };
80 typedef uint32_t WKScrollDirection;
81
82 // Loader Client
83 typedef void (*WKBundlePageDidStartProvisionalLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
84 typedef void (*WKBundlePageDidReceiveServerRedirectForProvisionalLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
85 typedef void (*WKBundlePageDidFailProvisionalLoadWithErrorForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKErrorRef error, WKTypeRef* userData, const void *clientInfo);
86 typedef void (*WKBundlePageDidCommitLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
87 typedef void (*WKBundlePageDidDocumentFinishLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
88 typedef void (*WKBundlePageDidFinishLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
89 typedef void (*WKBundlePageDidFinishDocumentLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
90 typedef void (*WKBundlePageDidFinishProgressCallback)(WKBundlePageRef page, const void *clientInfo);
91 typedef void (*WKBundlePageDidFailLoadWithErrorForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKErrorRef error, WKTypeRef* userData, const void *clientInfo);
92 typedef void (*WKBundlePageDidSameDocumentNavigationForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef* userData, const void *clientInfo);
93 typedef void (*WKBundlePageDidReceiveTitleForFrameCallback)(WKBundlePageRef page, WKStringRef title, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
94 typedef void (*WKBundlePageDidRemoveFrameFromHierarchyCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
95 typedef void (*WKBundlePageDidDisplayInsecureContentForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
96 typedef void (*WKBundlePageDidRunInsecureContentForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
97 typedef void (*WKBundlePageDidDetectXSSForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
98 typedef void (*WKBundlePageDidFirstLayoutForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
99 typedef void (*WKBundlePageDidFirstVisuallyNonEmptyLayoutForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
100 typedef void (*WKBundlePageDidNewFirstVisuallyNonEmptyLayoutCallback)(WKBundlePageRef page, WKTypeRef* userData, const void *clientInfo);
101 typedef void (*WKBundlePageDidLayoutForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void* clientInfo);
102 typedef void (*WKBundlePageDidClearWindowObjectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleScriptWorldRef world, const void *clientInfo);
103 typedef void (*WKBundlePageDidCancelClientRedirectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo);
104 typedef void (*WKBundlePageWillPerformClientRedirectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKURLRef url, double delay, double date, const void *clientInfo);
105 typedef void (*WKBundlePageDidHandleOnloadEventsForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo);
106 typedef bool (*WKBundlePageShouldGoToBackForwardListItemCallback)(WKBundlePageRef page, WKBundleBackForwardListItemRef item, WKTypeRef* userData, const void *clientInfo);
107 typedef void (*WKBundlePageGlobalObjectIsAvailableForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef, WKBundleScriptWorldRef, const void* clientInfo);
108 typedef void (*WKBundlePageWillDisconnectDOMWindowExtensionFromGlobalObjectCallback)(WKBundlePageRef page, WKBundleDOMWindowExtensionRef, const void* clientInfo);
109 typedef void (*WKBundlePageDidReconnectDOMWindowExtensionToGlobalObjectCallback)(WKBundlePageRef page, WKBundleDOMWindowExtensionRef, const void* clientInfo);
110 typedef void (*WKBundlePageWillDestroyGlobalObjectForDOMWindowExtensionCallback)(WKBundlePageRef page, WKBundleDOMWindowExtensionRef, const void* clientInfo);
111 typedef bool (*WKBundlePageShouldForceUniversalAccessFromLocalURLCallback)(WKBundlePageRef, WKStringRef url, const void* clientInfo);
112 typedef void (*WKBundlePageDidReceiveIntentForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleIntentRequestRef intentRequest, WKTypeRef* userData, const void* clientInfo);
113 typedef void (*WKBundlePageRegisterIntentServiceForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKIntentServiceInfoRef serviceInfo, WKTypeRef* userData, const void* clientInfo);
114
115 struct WKBundlePageLoaderClient {
116     int                                                                     version;
117     const void *                                                            clientInfo;
118
119     // Version 0.
120     WKBundlePageDidStartProvisionalLoadForFrameCallback                     didStartProvisionalLoadForFrame;
121     WKBundlePageDidReceiveServerRedirectForProvisionalLoadForFrameCallback  didReceiveServerRedirectForProvisionalLoadForFrame;
122     WKBundlePageDidFailProvisionalLoadWithErrorForFrameCallback             didFailProvisionalLoadWithErrorForFrame;
123     WKBundlePageDidCommitLoadForFrameCallback                               didCommitLoadForFrame;
124     WKBundlePageDidFinishDocumentLoadForFrameCallback                       didFinishDocumentLoadForFrame;
125     WKBundlePageDidFinishLoadForFrameCallback                               didFinishLoadForFrame;
126     WKBundlePageDidFailLoadWithErrorForFrameCallback                        didFailLoadWithErrorForFrame;
127     WKBundlePageDidSameDocumentNavigationForFrameCallback                   didSameDocumentNavigationForFrame;
128     WKBundlePageDidReceiveTitleForFrameCallback                             didReceiveTitleForFrame;
129     WKBundlePageDidFirstLayoutForFrameCallback                              didFirstLayoutForFrame;
130     WKBundlePageDidFirstVisuallyNonEmptyLayoutForFrameCallback              didFirstVisuallyNonEmptyLayoutForFrame;
131     WKBundlePageDidRemoveFrameFromHierarchyCallback                         didRemoveFrameFromHierarchy;
132     WKBundlePageDidDisplayInsecureContentForFrameCallback                   didDisplayInsecureContentForFrame;
133     WKBundlePageDidRunInsecureContentForFrameCallback                       didRunInsecureContentForFrame;
134     WKBundlePageDidClearWindowObjectForFrameCallback                        didClearWindowObjectForFrame;
135     WKBundlePageDidCancelClientRedirectForFrameCallback                     didCancelClientRedirectForFrame;
136     WKBundlePageWillPerformClientRedirectForFrameCallback                   willPerformClientRedirectForFrame;
137     WKBundlePageDidHandleOnloadEventsForFrameCallback                       didHandleOnloadEventsForFrame;
138
139     // Version 1.
140     WKBundlePageDidLayoutForFrameCallback                                   didLayoutForFrame;
141     WKBundlePageDidNewFirstVisuallyNonEmptyLayoutCallback                   didNewFirstVisuallyNonEmptyLayout;
142     WKBundlePageDidDetectXSSForFrameCallback                                didDetectXSSForFrame;
143     WKBundlePageShouldGoToBackForwardListItemCallback                       shouldGoToBackForwardListItem;
144     WKBundlePageGlobalObjectIsAvailableForFrameCallback                     globalObjectIsAvailableForFrame;
145     WKBundlePageWillDisconnectDOMWindowExtensionFromGlobalObjectCallback    willDisconnectDOMWindowExtensionFromGlobalObject;
146     WKBundlePageDidReconnectDOMWindowExtensionToGlobalObjectCallback        didReconnectDOMWindowExtensionToGlobalObject;
147     WKBundlePageWillDestroyGlobalObjectForDOMWindowExtensionCallback        willDestroyGlobalObjectForDOMWindowExtension;
148     
149     // Version 2
150     WKBundlePageDidFinishProgressCallback                                   didFinishProgress;
151     WKBundlePageShouldForceUniversalAccessFromLocalURLCallback              shouldForceUniversalAccessFromLocalURL;
152
153     // Version 3
154     WKBundlePageDidReceiveIntentForFrameCallback                            didReceiveIntentForFrame;
155     WKBundlePageRegisterIntentServiceForFrameCallback                       registerIntentServiceForFrame;
156 };
157 typedef struct WKBundlePageLoaderClient WKBundlePageLoaderClient;
158
159 enum { kWKBundlePageLoaderClientCurrentVersion = 3 };
160
161 enum {
162     WKBundlePagePolicyActionPassThrough,
163     WKBundlePagePolicyActionUse
164 };
165 typedef uint32_t WKBundlePagePolicyAction;
166
167 // Policy Client
168 typedef WKBundlePagePolicyAction (*WKBundlePageDecidePolicyForNavigationActionCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNavigationActionRef navigationAction, WKURLRequestRef request, WKTypeRef* userData, const void* clientInfo);
169 typedef WKBundlePagePolicyAction (*WKBundlePageDecidePolicyForNewWindowActionCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNavigationActionRef navigationAction, WKURLRequestRef request, WKStringRef frameName, WKTypeRef* userData, const void* clientInfo);
170 typedef WKBundlePagePolicyAction (*WKBundlePageDecidePolicyForResponseCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKTypeRef* userData, const void* clientInfo);
171 typedef void (*WKBundlePageUnableToImplementPolicyCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKErrorRef error, WKTypeRef* userData, const void* clientInfo);
172
173 struct WKBundlePagePolicyClient {
174     int                                                                 version;
175     const void *                                                        clientInfo;
176     WKBundlePageDecidePolicyForNavigationActionCallback                 decidePolicyForNavigationAction;
177     WKBundlePageDecidePolicyForNewWindowActionCallback                  decidePolicyForNewWindowAction;
178     WKBundlePageDecidePolicyForResponseCallback                         decidePolicyForResponse;
179     WKBundlePageUnableToImplementPolicyCallback                         unableToImplementPolicy;
180 };
181 typedef struct WKBundlePagePolicyClient WKBundlePagePolicyClient;
182
183 enum { kWKBundlePagePolicyClientCurrentVersion = 0 };
184
185 // Resource Load Client
186 typedef void (*WKBundlePageDidInitiateLoadForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, WKURLRequestRef, bool pageIsProvisionallyLoading, const void* clientInfo);
187 typedef WKURLRequestRef (*WKBundlePageWillSendRequestForFrameCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, WKURLRequestRef, WKURLResponseRef redirectResponse, const void *clientInfo);
188 typedef void (*WKBundlePageDidReceiveResponseForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, WKURLResponseRef, const void* clientInfo);
189 typedef void (*WKBundlePageDidReceiveContentLengthForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, uint64_t contentLength, const void* clientInfo);
190 typedef void (*WKBundlePageDidFinishLoadForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, const void* clientInfo);
191 typedef void (*WKBundlePageDidFailLoadForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, WKErrorRef, const void* clientInfo);
192 typedef bool (*WKBundlePageShouldCacheResponseCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, const void* clientInfo);
193 typedef bool (*WKBundlePageShouldUseCredentialStorageCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, const void* clientInfo);
194
195 struct WKBundlePageResourceLoadClient {
196     int                                                                 version;
197     const void *                                                        clientInfo;
198
199     // Version 0.
200     WKBundlePageDidInitiateLoadForResourceCallback                      didInitiateLoadForResource;
201
202     // willSendRequestForFrame is supposed to return a retained reference to the URL request.
203     WKBundlePageWillSendRequestForFrameCallback                         willSendRequestForFrame;
204
205     WKBundlePageDidReceiveResponseForResourceCallback                   didReceiveResponseForResource;
206     WKBundlePageDidReceiveContentLengthForResourceCallback              didReceiveContentLengthForResource;
207     WKBundlePageDidFinishLoadForResourceCallback                        didFinishLoadForResource;
208     WKBundlePageDidFailLoadForResourceCallback                          didFailLoadForResource;
209
210     // Version 1.
211     WKBundlePageShouldCacheResponseCallback                             shouldCacheResponse;
212     WKBundlePageShouldUseCredentialStorageCallback                      shouldUseCredentialStorage;
213 };
214 typedef struct WKBundlePageResourceLoadClient WKBundlePageResourceLoadClient;
215
216 enum { kWKBundlePageResourceLoadClientCurrentVersion = 1 };
217
218 enum {
219     WKBundlePageUIElementVisibilityUnknown,
220     WKBundlePageUIElementVisible,
221     WKBundlePageUIElementHidden
222 };
223 typedef uint32_t WKBundlePageUIElementVisibility;
224     
225 // UI Client
226 typedef void (*WKBundlePageWillAddMessageToConsoleCallback)(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void *clientInfo);
227 typedef void (*WKBundlePageWillSetStatusbarTextCallback)(WKBundlePageRef page, WKStringRef statusbarText, const void *clientInfo);
228 typedef void (*WKBundlePageWillRunJavaScriptAlertCallback)(WKBundlePageRef page, WKStringRef alertText, WKBundleFrameRef frame, const void *clientInfo);
229 typedef void (*WKBundlePageWillRunJavaScriptConfirmCallback)(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void *clientInfo);
230 typedef void (*WKBundlePageWillRunJavaScriptPromptCallback)(WKBundlePageRef page, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void *clientInfo);
231 typedef void (*WKBundlePageMouseDidMoveOverElementCallback)(WKBundlePageRef page, WKBundleHitTestResultRef hitTestResult, WKEventModifiers modifiers, WKTypeRef* userData, const void *clientInfo);
232 typedef void (*WKBundlePageDidScrollCallback)(WKBundlePageRef page, const void *clientInfo);
233 typedef void (*WKBundlePagePaintCustomOverhangAreaCallback)(WKBundlePageRef page, WKGraphicsContextRef graphicsContext, WKRect horizontalOverhang, WKRect verticalOverhang, WKRect dirtyRect, const void* clientInfo);
234 typedef WKStringRef (*WKBundlePageGenerateFileForUploadCallback)(WKBundlePageRef page, WKStringRef originalFilePath, const void* clientInfo);
235 typedef bool (*WKBundlePageShouldRubberBandInDirectionCallback)(WKBundlePageRef page, WKScrollDirection scrollDirection, const void* clientInfo);
236 typedef WKBundlePageUIElementVisibility (*WKBundlePageStatusBarIsVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
237 typedef WKBundlePageUIElementVisibility (*WKBundlePageMenuBarIsVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
238 typedef WKBundlePageUIElementVisibility (*WKBundlePageToolbarsAreVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
239 typedef void (*WKBundlePageReachedAppCacheOriginQuotaCallback)(WKBundlePageRef page, WKSecurityOriginRef origin, int64_t totalBytesNeeded, const void *clientInfo);
240
241 struct WKBundlePageUIClient {
242     int                                                                 version;
243     const void *                                                        clientInfo;
244     WKBundlePageWillAddMessageToConsoleCallback                         willAddMessageToConsole;
245     WKBundlePageWillSetStatusbarTextCallback                            willSetStatusbarText;
246     WKBundlePageWillRunJavaScriptAlertCallback                          willRunJavaScriptAlert;
247     WKBundlePageWillRunJavaScriptConfirmCallback                        willRunJavaScriptConfirm;
248     WKBundlePageWillRunJavaScriptPromptCallback                         willRunJavaScriptPrompt;
249     WKBundlePageMouseDidMoveOverElementCallback                         mouseDidMoveOverElement;
250     WKBundlePageDidScrollCallback                                       pageDidScroll;
251     WKBundlePagePaintCustomOverhangAreaCallback                         paintCustomOverhangArea;
252     WKBundlePageGenerateFileForUploadCallback                           shouldGenerateFileForUpload;
253     WKBundlePageGenerateFileForUploadCallback                           generateFileForUpload;
254     WKBundlePageShouldRubberBandInDirectionCallback                     shouldRubberBandInDirection;
255     WKBundlePageStatusBarIsVisibleCallback                              statusBarIsVisible;
256     WKBundlePageMenuBarIsVisibleCallback                                menuBarIsVisible;
257     WKBundlePageToolbarsAreVisibleCallback                              toolbarsAreVisible;
258
259     // Version 1.
260     WKBundlePageReachedAppCacheOriginQuotaCallback                      didReachApplicationCacheOriginQuota;
261 };
262 typedef struct WKBundlePageUIClient WKBundlePageUIClient;
263
264 enum { kWKBundlePageUIClientCurrentVersion = 1 };
265
266 // Editor client
267 typedef bool (*WKBundlePageShouldBeginEditingCallback)(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo);
268 typedef bool (*WKBundlePageShouldEndEditingCallback)(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo);
269 typedef bool (*WKBundlePageShouldInsertNodeCallback)(WKBundlePageRef page, WKBundleNodeHandleRef node, WKBundleRangeHandleRef rangeToReplace, WKInsertActionType action, const void* clientInfo);
270 typedef bool (*WKBundlePageShouldInsertTextCallback)(WKBundlePageRef page, WKStringRef string, WKBundleRangeHandleRef rangeToReplace, WKInsertActionType action, const void* clientInfo);
271 typedef bool (*WKBundlePageShouldDeleteRangeCallback)(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo);
272 typedef bool (*WKBundlePageShouldChangeSelectedRange)(WKBundlePageRef page, WKBundleRangeHandleRef fromRange, WKBundleRangeHandleRef toRange, WKAffinityType affinity, bool stillSelecting, const void* clientInfo);
273 typedef bool (*WKBundlePageShouldApplyStyle)(WKBundlePageRef page, WKBundleCSSStyleDeclarationRef style, WKBundleRangeHandleRef range, const void* clientInfo);
274 typedef void (*WKBundlePageEditingNotification)(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo);
275
276 struct WKBundlePageEditorClient {
277     int                                                                 version;
278     const void *                                                        clientInfo;
279     WKBundlePageShouldBeginEditingCallback                              shouldBeginEditing;
280     WKBundlePageShouldEndEditingCallback                                shouldEndEditing;
281     WKBundlePageShouldInsertNodeCallback                                shouldInsertNode;
282     WKBundlePageShouldInsertTextCallback                                shouldInsertText;
283     WKBundlePageShouldDeleteRangeCallback                               shouldDeleteRange;
284     WKBundlePageShouldChangeSelectedRange                               shouldChangeSelectedRange;
285     WKBundlePageShouldApplyStyle                                        shouldApplyStyle;
286     WKBundlePageEditingNotification                                     didBeginEditing;
287     WKBundlePageEditingNotification                                     didEndEditing;
288     WKBundlePageEditingNotification                                     didChange;
289     WKBundlePageEditingNotification                                     didChangeSelection;
290 };
291 typedef struct WKBundlePageEditorClient WKBundlePageEditorClient;
292
293 enum { kWKBundlePageEditorClientCurrentVersion = 0 };
294
295 // Form client
296 typedef void (*WKBundlePageTextFieldDidBeginEditingCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo);
297 typedef void (*WKBundlePageTextFieldDidEndEditingCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo);
298 typedef void (*WKBundlePageTextDidChangeInTextFieldCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo);
299 typedef void (*WKBundlePageTextDidChangeInTextAreaCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlTextAreaElementHandle, WKBundleFrameRef frame, const void* clientInfo);
300 typedef bool (*WKBundlePageShouldPerformActionInTextFieldCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKInputFieldActionType actionType, WKBundleFrameRef frame, const void* clientInfo);
301 typedef void (*WKBundlePageWillSubmitFormCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlFormElementHandle, WKBundleFrameRef frame, WKBundleFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef* userData, const void* clientInfo);
302 typedef void (*WKBundlePageWillSendSubmitEventCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlFormElementHandle, WKBundleFrameRef frame, WKBundleFrameRef sourceFrame, WKDictionaryRef values, const void* clientInfo);
303
304 struct WKBundlePageFormClient {
305     int                                                                 version;
306     const void *                                                        clientInfo;
307     
308     // Version 0.
309     WKBundlePageTextFieldDidBeginEditingCallback                        textFieldDidBeginEditing;
310     WKBundlePageTextFieldDidEndEditingCallback                          textFieldDidEndEditing;
311     WKBundlePageTextDidChangeInTextFieldCallback                        textDidChangeInTextField;
312     WKBundlePageTextDidChangeInTextAreaCallback                         textDidChangeInTextArea;
313     WKBundlePageShouldPerformActionInTextFieldCallback                  shouldPerformActionInTextField;
314     WKBundlePageWillSubmitFormCallback                                  willSubmitForm;
315     
316     // Version 1.
317     WKBundlePageWillSendSubmitEventCallback                             willSendSubmitEvent;
318 };
319 typedef struct WKBundlePageFormClient WKBundlePageFormClient;
320
321 enum { kWKBundlePageFormClientCurrentVersion = 1 };
322
323 // ContextMenu client
324 typedef void (*WKBundlePageGetContextMenuFromDefaultContextMenuCallback)(WKBundlePageRef page, WKBundleHitTestResultRef hitTestResult, WKArrayRef defaultMenu, WKArrayRef* newMenu, WKTypeRef* userData, const void* clientInfo);
325
326 struct WKBundlePageContextMenuClient {
327     int                                                                 version;
328     const void *                                                        clientInfo;
329     WKBundlePageGetContextMenuFromDefaultContextMenuCallback            getContextMenuFromDefaultMenu;
330 };
331 typedef struct WKBundlePageContextMenuClient WKBundlePageContextMenuClient;
332
333 enum { kWKBundlePageContextMenuClientCurrentVersion = 0 };
334
335 // Full Screen client
336 typedef bool (*WKBundlePageSupportsFullScreen)(WKBundlePageRef page, WKFullScreenKeyboardRequestType requestType);
337 typedef void (*WKBundlePageEnterFullScreenForElement)(WKBundlePageRef page, WKBundleNodeHandleRef element);
338 typedef void (*WKBundlePageExitFullScreenForElement)(WKBundlePageRef page, WKBundleNodeHandleRef element);
339 typedef void (*WKBundlePageBeganEnterFullScreen)(WKBundlePageRef page, WKRect initialFrame, WKRect finalFrame);
340 typedef void (*WKBundlePageBeganExitFullScreen)(WKBundlePageRef page, WKRect initialFrame, WKRect finalFrame);
341 typedef void (*WKBundlePageCloseFullScreen)(WKBundlePageRef page);
342
343 struct WKBundlePageFullScreenClient {
344     int                                                                 version;
345     const void *                                                        clientInfo;
346
347     // Version 0:
348     WKBundlePageSupportsFullScreen                                      supportsFullScreen;
349     WKBundlePageEnterFullScreenForElement                               enterFullScreenForElement;
350     WKBundlePageExitFullScreenForElement                                exitFullScreenForElement;
351
352     // Version 1:
353     WKBundlePageBeganEnterFullScreen                                    beganEnterFullScreen;
354     WKBundlePageBeganExitFullScreen                                     beganExitFullScreen;
355     WKBundlePageCloseFullScreen                                         closeFullScreen;
356 };
357 typedef struct WKBundlePageFullScreenClient WKBundlePageFullScreenClient;
358
359 enum { kWKBundlePageFullScreenClientCurrentVersion = 1 };
360
361 // MessageTrace client
362 typedef void (*WKBundlePageDiagnosticLoggingCallback)(WKBundlePageRef page, WKStringRef message, WKStringRef description, WKStringRef success, const void* clientInfo);
363
364 struct WKBundlePageDiagnosticLoggingClient {
365     int                                                                 version;
366     const void *                                                        clientInfo;
367     WKBundlePageDiagnosticLoggingCallback                               logDiagnosticMessage;
368 };
369 typedef struct WKBundlePageDiagnosticLoggingClient WKBundlePageDiagnosticLoggingClient;
370
371 enum { kWKBundlePageDiagnosticLoggingClientCurrentVersion = 0 };
372
373 WK_EXPORT void WKBundlePageWillEnterFullScreen(WKBundlePageRef page);
374 WK_EXPORT void WKBundlePageDidEnterFullScreen(WKBundlePageRef page);
375 WK_EXPORT void WKBundlePageWillExitFullScreen(WKBundlePageRef page);
376 WK_EXPORT void WKBundlePageDidExitFullScreen(WKBundlePageRef page);
377
378 WK_EXPORT WKTypeID WKBundlePageGetTypeID();
379
380 WK_EXPORT void WKBundlePageSetContextMenuClient(WKBundlePageRef page, WKBundlePageContextMenuClient* client);
381 WK_EXPORT void WKBundlePageSetEditorClient(WKBundlePageRef page, WKBundlePageEditorClient* client);
382 WK_EXPORT void WKBundlePageSetFormClient(WKBundlePageRef page, WKBundlePageFormClient* client);
383 WK_EXPORT void WKBundlePageSetPageLoaderClient(WKBundlePageRef page, WKBundlePageLoaderClient* client);
384 WK_EXPORT void WKBundlePageSetResourceLoadClient(WKBundlePageRef page, WKBundlePageResourceLoadClient* client);
385 WK_EXPORT void WKBundlePageSetPolicyClient(WKBundlePageRef page, WKBundlePagePolicyClient* client);
386 WK_EXPORT void WKBundlePageSetUIClient(WKBundlePageRef page, WKBundlePageUIClient* client);
387 WK_EXPORT void WKBundlePageSetFullScreenClient(WKBundlePageRef page, WKBundlePageFullScreenClient* client);
388 WK_EXPORT void WKBundlePageSetDiagnosticLoggingClient(WKBundlePageRef page, WKBundlePageDiagnosticLoggingClient* client);
389
390 WK_EXPORT WKBundlePageGroupRef WKBundlePageGetPageGroup(WKBundlePageRef page);
391 WK_EXPORT WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef page);
392
393 WK_EXPORT WKBundleBackForwardListRef WKBundlePageGetBackForwardList(WKBundlePageRef page);
394
395 WK_EXPORT void WKBundlePageSetUnderlayPage(WKBundlePageRef page, WKBundlePageRef pageUnderlay);
396
397 WK_EXPORT void WKBundlePageInstallPageOverlay(WKBundlePageRef page, WKBundlePageOverlayRef pageOverlay);
398 WK_EXPORT void WKBundlePageUninstallPageOverlay(WKBundlePageRef page, WKBundlePageOverlayRef pageOverlay);
399
400 WK_EXPORT bool WKBundlePageHasLocalDataForURL(WKBundlePageRef page, WKURLRef url);
401 WK_EXPORT bool WKBundlePageCanHandleRequest(WKURLRequestRef request);
402
403 WK_EXPORT bool WKBundlePageFindString(WKBundlePageRef page, WKStringRef target, WKFindOptions findOptions);
404
405 WK_EXPORT WKImageRef WKBundlePageCreateSnapshotWithOptions(WKBundlePageRef page, WKRect rect, WKSnapshotOptions options);
406
407 // We should deprecate these functions in favor of just using WKBundlePageCreateSnapshotWithOptions.
408 WK_EXPORT WKImageRef WKBundlePageCreateSnapshotInViewCoordinates(WKBundlePageRef page, WKRect rect, WKImageOptions options);
409 WK_EXPORT WKImageRef WKBundlePageCreateSnapshotInDocumentCoordinates(WKBundlePageRef page, WKRect rect, WKImageOptions options);
410
411 // We should keep this function since it allows passing a scale factor, but we should re-name it to
412 // WKBundlePageCreateScaledSnapshotWithOptions.
413 WK_EXPORT WKImageRef WKBundlePageCreateScaledSnapshotInDocumentCoordinates(WKBundlePageRef page, WKRect rect, double scaleFactor, WKImageOptions options);
414
415 WK_EXPORT double WKBundlePageGetBackingScaleFactor(WKBundlePageRef page);
416
417 WK_EXPORT void WKBundlePageDeliverIntentToFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleIntentRef intent);
418
419 #if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR
420 WK_EXPORT WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef page);
421 #endif
422
423 #ifdef __cplusplus
424 }
425 #endif
426
427 #endif /* WKBundlePage_h */