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