1/*
2 * Copyright (C) 2013-2018 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#pragma once
27
28#include <WebKit/WKBase.h>
29#include <WebKit/WKEvent.h>
30
31enum {
32 WKBundlePageUIElementVisibilityUnknown,
33 WKBundlePageUIElementVisible,
34 WKBundlePageUIElementHidden
35};
36typedef uint32_t WKBundlePageUIElementVisibility;
37
38
39typedef void (*WKBundlePageWillAddMessageToConsoleCallback)(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void *clientInfo);
40typedef void (*WKBundlePageWillSetStatusbarTextCallback)(WKBundlePageRef page, WKStringRef statusbarText, const void *clientInfo);
41typedef void (*WKBundlePageWillRunJavaScriptAlertCallback)(WKBundlePageRef page, WKStringRef alertText, WKBundleFrameRef frame, const void *clientInfo);
42typedef void (*WKBundlePageWillRunJavaScriptConfirmCallback)(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void *clientInfo);
43typedef void (*WKBundlePageWillRunJavaScriptPromptCallback)(WKBundlePageRef page, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void *clientInfo);
44typedef void (*WKBundlePageMouseDidMoveOverElementCallback)(WKBundlePageRef page, WKBundleHitTestResultRef hitTestResult, WKEventModifiers modifiers, WKTypeRef* userData, const void *clientInfo);
45typedef void (*WKBundlePageDidScrollCallback)(WKBundlePageRef page, const void *clientInfo);
46typedef WKStringRef (*WKBundlePageGenerateFileForUploadCallback)(WKBundlePageRef page, WKStringRef originalFilePath, const void* clientInfo);
47typedef WKBundlePageUIElementVisibility (*WKBundlePageStatusBarIsVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
48typedef WKBundlePageUIElementVisibility (*WKBundlePageMenuBarIsVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
49typedef WKBundlePageUIElementVisibility (*WKBundlePageToolbarsAreVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
50typedef void (*WKBundlePageReachedAppCacheOriginQuotaCallback)(WKBundlePageRef page, WKSecurityOriginRef origin, int64_t totalBytesNeeded, const void *clientInfo);
51typedef uint64_t (*WKBundlePageExceededDatabaseQuotaCallback)(WKBundlePageRef page, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes, const void *clientInfo);
52typedef WKStringRef (*WKBundlePagePlugInCreateStartLabelTitleCallback)(WKStringRef mimeType, const void *clientInfo);
53typedef WKStringRef (*WKBundlePagePlugInCreateStartLabelSubtitleCallback)(WKStringRef mimeType, const void *clientInfo);
54typedef WKStringRef (*WKBundlePagePlugInCreateExtraStyleSheetCallback)(const void *clientInfo);
55typedef WKStringRef (*WKBundlePagePlugInCreateExtraScriptCallback)(const void *clientInfo);
56typedef void (*WKBundlePageDidClickAutoFillButtonCallback)(WKBundlePageRef page, WKBundleNodeHandleRef inputElement, WKTypeRef* userData, const void *clientInfo);
57typedef void (*WKBundlePageDidResignInputElementStrongPasswordAppearance)(WKBundlePageRef page, WKBundleNodeHandleRef inputElement, WKTypeRef* userData, const void *clientInfo);
58
59typedef struct WKBundlePageUIClientBase {
60 int version;
61 const void * clientInfo;
62} WKBundlePageUIClientBase;
63
64typedef struct WKBundlePageUIClientV0 {
65 WKBundlePageUIClientBase base;
66
67 // Version 0.
68 WKBundlePageWillAddMessageToConsoleCallback willAddMessageToConsole;
69 WKBundlePageWillSetStatusbarTextCallback willSetStatusbarText;
70 WKBundlePageWillRunJavaScriptAlertCallback willRunJavaScriptAlert;
71 WKBundlePageWillRunJavaScriptConfirmCallback willRunJavaScriptConfirm;
72 WKBundlePageWillRunJavaScriptPromptCallback willRunJavaScriptPrompt;
73 WKBundlePageMouseDidMoveOverElementCallback mouseDidMoveOverElement;
74 WKBundlePageDidScrollCallback pageDidScroll;
75 void* unused1;
76 WKBundlePageGenerateFileForUploadCallback shouldGenerateFileForUpload;
77 WKBundlePageGenerateFileForUploadCallback generateFileForUpload;
78 void* unused2;
79 WKBundlePageStatusBarIsVisibleCallback statusBarIsVisible;
80 WKBundlePageMenuBarIsVisibleCallback menuBarIsVisible;
81 WKBundlePageToolbarsAreVisibleCallback toolbarsAreVisible;
82} WKBundlePageUIClientV0;
83
84typedef struct WKBundlePageUIClientV1 {
85 WKBundlePageUIClientBase base;
86
87 // Version 0.
88 WKBundlePageWillAddMessageToConsoleCallback willAddMessageToConsole;
89 WKBundlePageWillSetStatusbarTextCallback willSetStatusbarText;
90 WKBundlePageWillRunJavaScriptAlertCallback willRunJavaScriptAlert;
91 WKBundlePageWillRunJavaScriptConfirmCallback willRunJavaScriptConfirm;
92 WKBundlePageWillRunJavaScriptPromptCallback willRunJavaScriptPrompt;
93 WKBundlePageMouseDidMoveOverElementCallback mouseDidMoveOverElement;
94 WKBundlePageDidScrollCallback pageDidScroll;
95 void* unused1;
96 WKBundlePageGenerateFileForUploadCallback shouldGenerateFileForUpload;
97 WKBundlePageGenerateFileForUploadCallback generateFileForUpload;
98 void* unused2;
99 WKBundlePageStatusBarIsVisibleCallback statusBarIsVisible;
100 WKBundlePageMenuBarIsVisibleCallback menuBarIsVisible;
101 WKBundlePageToolbarsAreVisibleCallback toolbarsAreVisible;
102
103 // Version 1.
104 WKBundlePageReachedAppCacheOriginQuotaCallback didReachApplicationCacheOriginQuota;
105} WKBundlePageUIClientV1;
106
107typedef struct WKBundlePageUIClientV2 {
108 WKBundlePageUIClientBase base;
109
110 // Version 0.
111 WKBundlePageWillAddMessageToConsoleCallback willAddMessageToConsole;
112 WKBundlePageWillSetStatusbarTextCallback willSetStatusbarText;
113 WKBundlePageWillRunJavaScriptAlertCallback willRunJavaScriptAlert;
114 WKBundlePageWillRunJavaScriptConfirmCallback willRunJavaScriptConfirm;
115 WKBundlePageWillRunJavaScriptPromptCallback willRunJavaScriptPrompt;
116 WKBundlePageMouseDidMoveOverElementCallback mouseDidMoveOverElement;
117 WKBundlePageDidScrollCallback pageDidScroll;
118 void* unused1;
119 WKBundlePageGenerateFileForUploadCallback shouldGenerateFileForUpload;
120 WKBundlePageGenerateFileForUploadCallback generateFileForUpload;
121 void* unused2;
122 WKBundlePageStatusBarIsVisibleCallback statusBarIsVisible;
123 WKBundlePageMenuBarIsVisibleCallback menuBarIsVisible;
124 WKBundlePageToolbarsAreVisibleCallback toolbarsAreVisible;
125
126 // Version 1.
127 WKBundlePageReachedAppCacheOriginQuotaCallback didReachApplicationCacheOriginQuota;
128
129 // Version 2.
130 WKBundlePageExceededDatabaseQuotaCallback didExceedDatabaseQuota;
131 WKBundlePagePlugInCreateStartLabelTitleCallback createPlugInStartLabelTitle;
132 WKBundlePagePlugInCreateStartLabelSubtitleCallback createPlugInStartLabelSubtitle;
133 WKBundlePagePlugInCreateExtraStyleSheetCallback createPlugInExtraStyleSheet;
134 WKBundlePagePlugInCreateExtraScriptCallback createPlugInExtraScript;
135} WKBundlePageUIClientV2;
136
137typedef struct WKBundlePageUIClientV3 {
138 WKBundlePageUIClientBase base;
139
140 // Version 0.
141 WKBundlePageWillAddMessageToConsoleCallback willAddMessageToConsole;
142 WKBundlePageWillSetStatusbarTextCallback willSetStatusbarText;
143 WKBundlePageWillRunJavaScriptAlertCallback willRunJavaScriptAlert;
144 WKBundlePageWillRunJavaScriptConfirmCallback willRunJavaScriptConfirm;
145 WKBundlePageWillRunJavaScriptPromptCallback willRunJavaScriptPrompt;
146 WKBundlePageMouseDidMoveOverElementCallback mouseDidMoveOverElement;
147 WKBundlePageDidScrollCallback pageDidScroll;
148 void* unused1;
149 WKBundlePageGenerateFileForUploadCallback shouldGenerateFileForUpload;
150 WKBundlePageGenerateFileForUploadCallback generateFileForUpload;
151 void* unused2;
152 WKBundlePageStatusBarIsVisibleCallback statusBarIsVisible;
153 WKBundlePageMenuBarIsVisibleCallback menuBarIsVisible;
154 WKBundlePageToolbarsAreVisibleCallback toolbarsAreVisible;
155
156 // Version 1.
157 WKBundlePageReachedAppCacheOriginQuotaCallback didReachApplicationCacheOriginQuota;
158
159 // Version 2.
160 WKBundlePageExceededDatabaseQuotaCallback didExceedDatabaseQuota;
161 WKBundlePagePlugInCreateStartLabelTitleCallback createPlugInStartLabelTitle;
162 WKBundlePagePlugInCreateStartLabelSubtitleCallback createPlugInStartLabelSubtitle;
163 WKBundlePagePlugInCreateExtraStyleSheetCallback createPlugInExtraStyleSheet;
164 WKBundlePagePlugInCreateExtraScriptCallback createPlugInExtraScript;
165
166 // Version 3.
167 void* unused3;
168 void* unused4;
169 void* unused5;
170
171 WKBundlePageDidClickAutoFillButtonCallback didClickAutoFillButton;
172} WKBundlePageUIClientV3;
173
174typedef struct WKBundlePageUIClientV4 {
175 WKBundlePageUIClientBase base;
176
177 // Version 0.
178 WKBundlePageWillAddMessageToConsoleCallback willAddMessageToConsole;
179 WKBundlePageWillSetStatusbarTextCallback willSetStatusbarText;
180 WKBundlePageWillRunJavaScriptAlertCallback willRunJavaScriptAlert;
181 WKBundlePageWillRunJavaScriptConfirmCallback willRunJavaScriptConfirm;
182 WKBundlePageWillRunJavaScriptPromptCallback willRunJavaScriptPrompt;
183 WKBundlePageMouseDidMoveOverElementCallback mouseDidMoveOverElement;
184 WKBundlePageDidScrollCallback pageDidScroll;
185 void* unused1;
186 WKBundlePageGenerateFileForUploadCallback shouldGenerateFileForUpload;
187 WKBundlePageGenerateFileForUploadCallback generateFileForUpload;
188 void* unused2;
189 WKBundlePageStatusBarIsVisibleCallback statusBarIsVisible;
190 WKBundlePageMenuBarIsVisibleCallback menuBarIsVisible;
191 WKBundlePageToolbarsAreVisibleCallback toolbarsAreVisible;
192
193 // Version 1.
194 WKBundlePageReachedAppCacheOriginQuotaCallback didReachApplicationCacheOriginQuota;
195
196 // Version 2.
197 WKBundlePageExceededDatabaseQuotaCallback didExceedDatabaseQuota;
198 WKBundlePagePlugInCreateStartLabelTitleCallback createPlugInStartLabelTitle;
199 WKBundlePagePlugInCreateStartLabelSubtitleCallback createPlugInStartLabelSubtitle;
200 WKBundlePagePlugInCreateExtraStyleSheetCallback createPlugInExtraStyleSheet;
201 WKBundlePagePlugInCreateExtraScriptCallback createPlugInExtraScript;
202
203 // Version 3.
204 void* unused3;
205 void* unused4;
206 void* unused5;
207
208 WKBundlePageDidClickAutoFillButtonCallback didClickAutoFillButton;
209
210 // Version 4.
211 WKBundlePageDidResignInputElementStrongPasswordAppearance didResignInputElementStrongPasswordAppearance;
212} WKBundlePageUIClientV4;
213