b7779450af2b0b3dc7994e57483295520eff8fe2
[WebKit-https.git] / Source / WebKit2 / WebProcess / InjectedBundle / API / c / WKBundlePageUIClient.h
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 WKBundlePageUIClient_h
27 #define WKBundlePageUIClient_h
28
29 #include <WebKit/WKBase.h>
30 #include <WebKit/WKEvent.h>
31
32 enum {
33     WKBundlePageUIElementVisibilityUnknown,
34     WKBundlePageUIElementVisible,
35     WKBundlePageUIElementHidden
36 };
37 typedef uint32_t WKBundlePageUIElementVisibility;
38
39
40 typedef void (*WKBundlePageWillAddMessageToConsoleCallback)(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void *clientInfo);
41 typedef void (*WKBundlePageWillSetStatusbarTextCallback)(WKBundlePageRef page, WKStringRef statusbarText, const void *clientInfo);
42 typedef void (*WKBundlePageWillRunJavaScriptAlertCallback)(WKBundlePageRef page, WKStringRef alertText, WKBundleFrameRef frame, const void *clientInfo);
43 typedef void (*WKBundlePageWillRunJavaScriptConfirmCallback)(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void *clientInfo);
44 typedef void (*WKBundlePageWillRunJavaScriptPromptCallback)(WKBundlePageRef page, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void *clientInfo);
45 typedef void (*WKBundlePageMouseDidMoveOverElementCallback)(WKBundlePageRef page, WKBundleHitTestResultRef hitTestResult, WKEventModifiers modifiers, WKTypeRef* userData, const void *clientInfo);
46 typedef void (*WKBundlePageDidScrollCallback)(WKBundlePageRef page, const void *clientInfo);
47 typedef WKStringRef (*WKBundlePageGenerateFileForUploadCallback)(WKBundlePageRef page, WKStringRef originalFilePath, const void* clientInfo);
48 typedef WKBundlePageUIElementVisibility (*WKBundlePageStatusBarIsVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
49 typedef WKBundlePageUIElementVisibility (*WKBundlePageMenuBarIsVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
50 typedef WKBundlePageUIElementVisibility (*WKBundlePageToolbarsAreVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
51 typedef void (*WKBundlePageReachedAppCacheOriginQuotaCallback)(WKBundlePageRef page, WKSecurityOriginRef origin, int64_t totalBytesNeeded, const void *clientInfo);
52 typedef 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);
53 typedef WKStringRef (*WKBundlePagePlugInCreateStartLabelTitleCallback)(WKStringRef mimeType, const void *clientInfo);
54 typedef WKStringRef (*WKBundlePagePlugInCreateStartLabelSubtitleCallback)(WKStringRef mimeType, const void *clientInfo);
55 typedef WKStringRef (*WKBundlePagePlugInCreateExtraStyleSheetCallback)(const void *clientInfo);
56 typedef WKStringRef (*WKBundlePagePlugInCreateExtraScriptCallback)(const void *clientInfo);
57 typedef void (*WKBundlePageDidBeginTrackingPotentialLongMousePressCallback)(WKBundlePageRef page, WKPoint mouseDownPosition, WKBundleHitTestResultRef hitTestResult, WKTypeRef* userData, const void *clientInfo);
58 typedef void (*WKBundlePageDidRecognizeLongMousePressCallback)(WKBundlePageRef page, WKTypeRef* userData, const void *clientInfo);
59 typedef void (*WKBundlePageDidCancelTrackingPotentialLongMousePressCallback)(WKBundlePageRef page, WKTypeRef* userData, const void *clientInfo);
60 typedef void (*WKBundlePageDidClickAutoFillButtonCallback)(WKBundlePageRef page, WKBundleNodeHandleRef inputElement, WKTypeRef* userData, const void *clientInfo);
61
62 typedef struct WKBundlePageUIClientBase {
63     int                                                                 version;
64     const void *                                                        clientInfo;
65 } WKBundlePageUIClientBase;
66
67 typedef struct WKBundlePageUIClientV0 {
68     WKBundlePageUIClientBase                                            base;
69
70     // Version 0.
71     WKBundlePageWillAddMessageToConsoleCallback                         willAddMessageToConsole;
72     WKBundlePageWillSetStatusbarTextCallback                            willSetStatusbarText;
73     WKBundlePageWillRunJavaScriptAlertCallback                          willRunJavaScriptAlert;
74     WKBundlePageWillRunJavaScriptConfirmCallback                        willRunJavaScriptConfirm;
75     WKBundlePageWillRunJavaScriptPromptCallback                         willRunJavaScriptPrompt;
76     WKBundlePageMouseDidMoveOverElementCallback                         mouseDidMoveOverElement;
77     WKBundlePageDidScrollCallback                                       pageDidScroll;
78     void*                                                               unused1;
79     WKBundlePageGenerateFileForUploadCallback                           shouldGenerateFileForUpload;
80     WKBundlePageGenerateFileForUploadCallback                           generateFileForUpload;
81     void*                                                               unused2;
82     WKBundlePageStatusBarIsVisibleCallback                              statusBarIsVisible;
83     WKBundlePageMenuBarIsVisibleCallback                                menuBarIsVisible;
84     WKBundlePageToolbarsAreVisibleCallback                              toolbarsAreVisible;
85 } WKBundlePageUIClientV0;
86
87 typedef struct WKBundlePageUIClientV1 {
88     WKBundlePageUIClientBase                                            base;
89
90     // Version 0.
91     WKBundlePageWillAddMessageToConsoleCallback                         willAddMessageToConsole;
92     WKBundlePageWillSetStatusbarTextCallback                            willSetStatusbarText;
93     WKBundlePageWillRunJavaScriptAlertCallback                          willRunJavaScriptAlert;
94     WKBundlePageWillRunJavaScriptConfirmCallback                        willRunJavaScriptConfirm;
95     WKBundlePageWillRunJavaScriptPromptCallback                         willRunJavaScriptPrompt;
96     WKBundlePageMouseDidMoveOverElementCallback                         mouseDidMoveOverElement;
97     WKBundlePageDidScrollCallback                                       pageDidScroll;
98     void*                                                               unused1;
99     WKBundlePageGenerateFileForUploadCallback                           shouldGenerateFileForUpload;
100     WKBundlePageGenerateFileForUploadCallback                           generateFileForUpload;
101     void*                                                               unused2;
102     WKBundlePageStatusBarIsVisibleCallback                              statusBarIsVisible;
103     WKBundlePageMenuBarIsVisibleCallback                                menuBarIsVisible;
104     WKBundlePageToolbarsAreVisibleCallback                              toolbarsAreVisible;
105
106     // Version 1.
107     WKBundlePageReachedAppCacheOriginQuotaCallback                      didReachApplicationCacheOriginQuota;
108 } WKBundlePageUIClientV1;
109
110 typedef struct WKBundlePageUIClientV2 {
111     WKBundlePageUIClientBase                                            base;
112
113     // Version 0.
114     WKBundlePageWillAddMessageToConsoleCallback                         willAddMessageToConsole;
115     WKBundlePageWillSetStatusbarTextCallback                            willSetStatusbarText;
116     WKBundlePageWillRunJavaScriptAlertCallback                          willRunJavaScriptAlert;
117     WKBundlePageWillRunJavaScriptConfirmCallback                        willRunJavaScriptConfirm;
118     WKBundlePageWillRunJavaScriptPromptCallback                         willRunJavaScriptPrompt;
119     WKBundlePageMouseDidMoveOverElementCallback                         mouseDidMoveOverElement;
120     WKBundlePageDidScrollCallback                                       pageDidScroll;
121     void*                                                               unused1;
122     WKBundlePageGenerateFileForUploadCallback                           shouldGenerateFileForUpload;
123     WKBundlePageGenerateFileForUploadCallback                           generateFileForUpload;
124     void*                                                               unused2;
125     WKBundlePageStatusBarIsVisibleCallback                              statusBarIsVisible;
126     WKBundlePageMenuBarIsVisibleCallback                                menuBarIsVisible;
127     WKBundlePageToolbarsAreVisibleCallback                              toolbarsAreVisible;
128
129     // Version 1.
130     WKBundlePageReachedAppCacheOriginQuotaCallback                      didReachApplicationCacheOriginQuota;
131
132     // Version 2.
133     WKBundlePageExceededDatabaseQuotaCallback                           didExceedDatabaseQuota;
134     WKBundlePagePlugInCreateStartLabelTitleCallback                     createPlugInStartLabelTitle;
135     WKBundlePagePlugInCreateStartLabelSubtitleCallback                  createPlugInStartLabelSubtitle;
136     WKBundlePagePlugInCreateExtraStyleSheetCallback                     createPlugInExtraStyleSheet;
137     WKBundlePagePlugInCreateExtraScriptCallback                         createPlugInExtraScript;
138 } WKBundlePageUIClientV2;
139
140 typedef struct WKBundlePageUIClientV3 {
141     WKBundlePageUIClientBase                                            base;
142
143     // Version 0.
144     WKBundlePageWillAddMessageToConsoleCallback                         willAddMessageToConsole;
145     WKBundlePageWillSetStatusbarTextCallback                            willSetStatusbarText;
146     WKBundlePageWillRunJavaScriptAlertCallback                          willRunJavaScriptAlert;
147     WKBundlePageWillRunJavaScriptConfirmCallback                        willRunJavaScriptConfirm;
148     WKBundlePageWillRunJavaScriptPromptCallback                         willRunJavaScriptPrompt;
149     WKBundlePageMouseDidMoveOverElementCallback                         mouseDidMoveOverElement;
150     WKBundlePageDidScrollCallback                                       pageDidScroll;
151     void*                                                               unused1;
152     WKBundlePageGenerateFileForUploadCallback                           shouldGenerateFileForUpload;
153     WKBundlePageGenerateFileForUploadCallback                           generateFileForUpload;
154     void*                                                               unused2;
155     WKBundlePageStatusBarIsVisibleCallback                              statusBarIsVisible;
156     WKBundlePageMenuBarIsVisibleCallback                                menuBarIsVisible;
157     WKBundlePageToolbarsAreVisibleCallback                              toolbarsAreVisible;
158
159     // Version 1.
160     WKBundlePageReachedAppCacheOriginQuotaCallback                      didReachApplicationCacheOriginQuota;
161
162     // Version 2.
163     WKBundlePageExceededDatabaseQuotaCallback                           didExceedDatabaseQuota;
164     WKBundlePagePlugInCreateStartLabelTitleCallback                     createPlugInStartLabelTitle;
165     WKBundlePagePlugInCreateStartLabelSubtitleCallback                  createPlugInStartLabelSubtitle;
166     WKBundlePagePlugInCreateExtraStyleSheetCallback                     createPlugInExtraStyleSheet;
167     WKBundlePagePlugInCreateExtraScriptCallback                         createPlugInExtraScript;
168
169     // Version 3.
170     WKBundlePageDidBeginTrackingPotentialLongMousePressCallback         didBeginTrackingPotentialLongMousePress;
171     WKBundlePageDidRecognizeLongMousePressCallback                      didRecognizeLongMousePress;
172     WKBundlePageDidCancelTrackingPotentialLongMousePressCallback        didCancelTrackingPotentialLongMousePress;
173
174     WKBundlePageDidClickAutoFillButtonCallback                          didClickAutoFillButton;
175 } WKBundlePageUIClientV3;
176
177 #endif // WKBundlePageUIClient_h