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 WKBundlePageFormClient_h |
27 | #define WKBundlePageFormClient_h |
28 | |
29 | #include <WebKit/WKBase.h> |
30 | #include <WebKit/WKBundlePageEditorClient.h> |
31 | |
32 | typedef void (*WKBundlePageTextFieldDidBeginEditingCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo); |
33 | typedef void (*WKBundlePageTextFieldDidEndEditingCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo); |
34 | typedef void (*WKBundlePageTextDidChangeInTextFieldCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo); |
35 | typedef void (*WKBundlePageTextDidChangeInTextAreaCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlTextAreaElementHandle, WKBundleFrameRef frame, const void* clientInfo); |
36 | typedef bool (*WKBundlePageShouldPerformActionInTextFieldCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKInputFieldActionType actionType, WKBundleFrameRef frame, const void* clientInfo); |
37 | typedef void (*WKBundlePageWillSubmitFormCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlFormElementHandle, WKBundleFrameRef frame, WKBundleFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef* userData, const void* clientInfo); |
38 | typedef void (*WKBundlePageWillSendSubmitEventCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlFormElementHandle, WKBundleFrameRef frame, WKBundleFrameRef sourceFrame, WKDictionaryRef values, const void* clientInfo); |
39 | typedef void (*WKBundlePageDidFocusTextFieldCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo); |
40 | typedef bool (*WKBundlePageShouldNotifyOnFormChangesCallback)(WKBundlePageRef page, const void* clientInfo); |
41 | typedef void (*WKBundlePageDidAssociateFormControlsCallback)(WKBundlePageRef page, WKArrayRef elementHandles, const void* clientInfo); |
42 | typedef void (*WKBundlePageDidAssociateFormControlsForFrameCallback)(WKBundlePageRef page, WKArrayRef elementHandles, WKBundleFrameRef frame, const void* clientInfo); |
43 | |
44 | typedef struct WKBundlePageFormClientBase { |
45 | int version; |
46 | const void * clientInfo; |
47 | } WKBundlePageFormClientBase; |
48 | |
49 | typedef struct WKBundlePageFormClientV0 { |
50 | WKBundlePageFormClientBase base; |
51 | |
52 | // Version 0. |
53 | WKBundlePageTextFieldDidBeginEditingCallback textFieldDidBeginEditing; |
54 | WKBundlePageTextFieldDidEndEditingCallback textFieldDidEndEditing; |
55 | WKBundlePageTextDidChangeInTextFieldCallback textDidChangeInTextField; |
56 | WKBundlePageTextDidChangeInTextAreaCallback textDidChangeInTextArea; |
57 | WKBundlePageShouldPerformActionInTextFieldCallback shouldPerformActionInTextField; |
58 | WKBundlePageWillSubmitFormCallback willSubmitForm; |
59 | } WKBundlePageFormClientV0; |
60 | |
61 | typedef struct WKBundlePageFormClientV1 { |
62 | WKBundlePageFormClientBase base; |
63 | |
64 | // Version 0. |
65 | WKBundlePageTextFieldDidBeginEditingCallback textFieldDidBeginEditing; |
66 | WKBundlePageTextFieldDidEndEditingCallback textFieldDidEndEditing; |
67 | WKBundlePageTextDidChangeInTextFieldCallback textDidChangeInTextField; |
68 | WKBundlePageTextDidChangeInTextAreaCallback textDidChangeInTextArea; |
69 | WKBundlePageShouldPerformActionInTextFieldCallback shouldPerformActionInTextField; |
70 | WKBundlePageWillSubmitFormCallback willSubmitForm; |
71 | |
72 | // Version 1. |
73 | WKBundlePageWillSendSubmitEventCallback willSendSubmitEvent; |
74 | } WKBundlePageFormClientV1; |
75 | |
76 | typedef struct WKBundlePageFormClientV2 { |
77 | WKBundlePageFormClientBase base; |
78 | |
79 | // Version 0. |
80 | WKBundlePageTextFieldDidBeginEditingCallback textFieldDidBeginEditing; |
81 | WKBundlePageTextFieldDidEndEditingCallback textFieldDidEndEditing; |
82 | WKBundlePageTextDidChangeInTextFieldCallback textDidChangeInTextField; |
83 | WKBundlePageTextDidChangeInTextAreaCallback textDidChangeInTextArea; |
84 | WKBundlePageShouldPerformActionInTextFieldCallback shouldPerformActionInTextField; |
85 | WKBundlePageWillSubmitFormCallback willSubmitForm; |
86 | |
87 | // Version 1. |
88 | WKBundlePageWillSendSubmitEventCallback willSendSubmitEvent; |
89 | |
90 | // version 2. |
91 | WKBundlePageDidFocusTextFieldCallback didFocusTextField; |
92 | WKBundlePageShouldNotifyOnFormChangesCallback shouldNotifyOnFormChanges; |
93 | WKBundlePageDidAssociateFormControlsCallback didAssociateFormControls; |
94 | } WKBundlePageFormClientV2; |
95 | |
96 | typedef struct WKBundlePageFormClientV3 { |
97 | WKBundlePageFormClientBase base; |
98 | |
99 | // Version 0. |
100 | WKBundlePageTextFieldDidBeginEditingCallback textFieldDidBeginEditing; |
101 | WKBundlePageTextFieldDidEndEditingCallback textFieldDidEndEditing; |
102 | WKBundlePageTextDidChangeInTextFieldCallback textDidChangeInTextField; |
103 | WKBundlePageTextDidChangeInTextAreaCallback textDidChangeInTextArea; |
104 | WKBundlePageShouldPerformActionInTextFieldCallback shouldPerformActionInTextField; |
105 | WKBundlePageWillSubmitFormCallback willSubmitForm; |
106 | |
107 | // Version 1. |
108 | WKBundlePageWillSendSubmitEventCallback willSendSubmitEvent; |
109 | |
110 | // version 2. |
111 | WKBundlePageDidFocusTextFieldCallback didFocusTextField; |
112 | WKBundlePageShouldNotifyOnFormChangesCallback shouldNotifyOnFormChanges; |
113 | WKBundlePageDidAssociateFormControlsCallback didAssociateFormControls; |
114 | |
115 | // version 3. |
116 | WKBundlePageDidAssociateFormControlsForFrameCallback didAssociateFormControlsForFrame; |
117 | } WKBundlePageFormClientV3; |
118 | |
119 | #endif // WKBundlePageFormClient_h |
120 | |