Home | History | Annotate | Download | only in C
      1 /*
      2  * Copyright (C) 2010, 2011 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 WKPage_h
     27 #define WKPage_h
     28 
     29 #include <WebKit2/WKBase.h>
     30 #include <WebKit2/WKEvent.h>
     31 #include <WebKit2/WKFindOptions.h>
     32 #include <WebKit2/WKGeometry.h>
     33 #include <WebKit2/WKNativeEvent.h>
     34 #include <WebKit2/WKPageLoadTypes.h>
     35 
     36 #ifndef __cplusplus
     37 #include <stdbool.h>
     38 #endif
     39 
     40 #ifdef __cplusplus
     41 extern "C" {
     42 #endif
     43 
     44 enum {
     45     kWKFocusDirectionBackward = 0,
     46     kWKFocusDirectionForward = 1
     47 };
     48 typedef uint32_t WKFocusDirection;
     49 
     50 typedef void (*WKPageCallback)(WKPageRef page, const void* clientInfo);
     51 
     52 // FrameLoad Client
     53 typedef void (*WKPageDidStartProvisionalLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
     54 typedef void (*WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
     55 typedef void (*WKPageDidFailProvisionalLoadWithErrorForFrameCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo);
     56 typedef void (*WKPageDidCommitLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
     57 typedef void (*WKPageDidFinishDocumentLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
     58 typedef void (*WKPageDidFinishLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
     59 typedef void (*WKPageDidFailLoadWithErrorForFrameCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo);
     60 typedef void (*WKPageDidSameDocumentNavigationForFrameCallback)(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void *clientInfo);
     61 typedef void (*WKPageDidReceiveTitleForFrameCallback)(WKPageRef page, WKStringRef title, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
     62 typedef void (*WKPageDidFirstLayoutForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
     63 typedef void (*WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
     64 typedef void (*WKPageDidRemoveFrameFromHierarchyCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
     65 typedef void (*WKPageDidDisplayInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
     66 typedef void (*WKPageDidRunInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
     67 typedef bool (*WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback)(WKPageRef page, WKFrameRef frame, WKProtectionSpaceRef protectionSpace, const void *clientInfo);
     68 typedef void (*WKPageDidReceiveAuthenticationChallengeInFrameCallback)(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo);
     69 typedef void (*WKPageDidChangeBackForwardListCallback)(WKPageRef page, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void *clientInfo);
     70 typedef bool (*WKPageShouldGoToBackForwardListItemCallback)(WKPageRef page, WKBackForwardListItemRef item, const void *clientInfo);
     71 
     72 struct WKPageLoaderClient {
     73     int                                                                 version;
     74     const void *                                                        clientInfo;
     75     WKPageDidStartProvisionalLoadForFrameCallback                       didStartProvisionalLoadForFrame;
     76     WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback    didReceiveServerRedirectForProvisionalLoadForFrame;
     77     WKPageDidFailProvisionalLoadWithErrorForFrameCallback               didFailProvisionalLoadWithErrorForFrame;
     78     WKPageDidCommitLoadForFrameCallback                                 didCommitLoadForFrame;
     79     WKPageDidFinishDocumentLoadForFrameCallback                         didFinishDocumentLoadForFrame;
     80     WKPageDidFinishLoadForFrameCallback                                 didFinishLoadForFrame;
     81     WKPageDidFailLoadWithErrorForFrameCallback                          didFailLoadWithErrorForFrame;
     82     WKPageDidSameDocumentNavigationForFrameCallback                     didSameDocumentNavigationForFrame;
     83     WKPageDidReceiveTitleForFrameCallback                               didReceiveTitleForFrame;
     84     WKPageDidFirstLayoutForFrameCallback                                didFirstLayoutForFrame;
     85     WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback                didFirstVisuallyNonEmptyLayoutForFrame;
     86     WKPageDidRemoveFrameFromHierarchyCallback                           didRemoveFrameFromHierarchy;
     87     WKPageDidDisplayInsecureContentForFrameCallback                     didDisplayInsecureContentForFrame;
     88     WKPageDidRunInsecureContentForFrameCallback                         didRunInsecureContentForFrame;
     89     WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback          canAuthenticateAgainstProtectionSpaceInFrame;
     90     WKPageDidReceiveAuthenticationChallengeInFrameCallback              didReceiveAuthenticationChallengeInFrame;
     91 
     92     // FIXME: Move to progress client.
     93     WKPageCallback                                                      didStartProgress;
     94     WKPageCallback                                                      didChangeProgress;
     95     WKPageCallback                                                      didFinishProgress;
     96 
     97     // FIXME: These three functions should not be part of this client.
     98     WKPageCallback                                                      processDidBecomeUnresponsive;
     99     WKPageCallback                                                      processDidBecomeResponsive;
    100     WKPageCallback                                                      processDidCrash;
    101 
    102     WKPageDidChangeBackForwardListCallback                              didChangeBackForwardList;
    103     WKPageShouldGoToBackForwardListItemCallback                         shouldGoToBackForwardListItem;
    104 };
    105 typedef struct WKPageLoaderClient WKPageLoaderClient;
    106 
    107 // Policy Client.
    108 typedef void (*WKPageDecidePolicyForNavigationActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
    109 typedef void (*WKPageDecidePolicyForNewWindowActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
    110 typedef void (*WKPageDecidePolicyForResponseCallback)(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
    111 typedef void (*WKPageUnableToImplementPolicyCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void* clientInfo);
    112 
    113 struct WKPagePolicyClient {
    114     int                                                                 version;
    115     const void *                                                        clientInfo;
    116     WKPageDecidePolicyForNavigationActionCallback                       decidePolicyForNavigationAction;
    117     WKPageDecidePolicyForNewWindowActionCallback                        decidePolicyForNewWindowAction;
    118     WKPageDecidePolicyForResponseCallback                               decidePolicyForResponse;
    119     WKPageUnableToImplementPolicyCallback                               unableToImplementPolicy;
    120 };
    121 typedef struct WKPagePolicyClient WKPagePolicyClient;
    122 
    123 // Form Client.
    124 typedef void (*WKPageWillSubmitFormCallback)(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef userData, WKFormSubmissionListenerRef listener, const void* clientInfo);
    125 
    126 struct WKPageFormClient {
    127     int                                                                 version;
    128     const void *                                                        clientInfo;
    129     WKPageWillSubmitFormCallback                                        willSubmitForm;
    130 };
    131 typedef struct WKPageFormClient WKPageFormClient;
    132 
    133 // Resource Load Client.
    134 typedef void (*WKPageDidInitiateLoadForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKURLRequestRef request, bool pageIsProvisionallyLoading, const void* clientInfo);
    135 typedef void (*WKPageDidSendRequestForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKURLRequestRef request, WKURLResponseRef redirectResponse, const void* clientInfo);
    136 typedef void (*WKPageDidReceiveResponseForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKURLResponseRef response, const void* clientInfo);
    137 typedef void (*WKPageDidReceiveContentLengthForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, uint64_t contentLength, const void* clientInfo);
    138 typedef void (*WKPageDidFinishLoadForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, const void* clientInfo);
    139 typedef void (*WKPageDidFailLoadForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKErrorRef error, const void* clientInfo);
    140 
    141 struct WKPageResourceLoadClient {
    142     int                                                                 version;
    143     const void *                                                        clientInfo;
    144     WKPageDidInitiateLoadForResourceCallback                            didInitiateLoadForResource;
    145     WKPageDidSendRequestForResourceCallback                             didSendRequestForResource;
    146     WKPageDidReceiveResponseForResourceCallback                         didReceiveResponseForResource;
    147     WKPageDidReceiveContentLengthForResourceCallback                    didReceiveContentLengthForResource;
    148     WKPageDidFinishLoadForResourceCallback                              didFinishLoadForResource;
    149     WKPageDidFailLoadForResourceCallback                                didFailLoadForResource;
    150 };
    151 typedef struct WKPageResourceLoadClient WKPageResourceLoadClient;
    152 
    153 // UI Client
    154 typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo);
    155 typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void *clientInfo);
    156 typedef bool (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo);
    157 typedef WKStringRef (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void *clientInfo);
    158 typedef void (*WKPageTakeFocusCallback)(WKPageRef page, WKFocusDirection direction, const void *clientInfo);
    159 typedef void (*WKPageFocusCallback)(WKPageRef page, const void *clientInfo);
    160 typedef void (*WKPageUnfocusCallback)(WKPageRef page, const void *clientInfo);
    161 typedef void (*WKPageSetStatusTextCallback)(WKPageRef page, WKStringRef text, const void *clientInfo);
    162 typedef void (*WKPageMouseDidMoveOverElementCallback)(WKPageRef page, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo);
    163 typedef void (*WKPageMissingPluginButtonClickedCallback)(WKPageRef page, WKStringRef mimeType, WKStringRef url, WKStringRef pluginsPageURL, const void* clientInfo);
    164 typedef void (*WKPageDidNotHandleKeyEventCallback)(WKPageRef page, WKNativeEventPtr event, const void *clientInfo);
    165 typedef bool (*WKPageGetToolbarsAreVisibleCallback)(WKPageRef page, const void *clientInfo);
    166 typedef void (*WKPageSetToolbarsAreVisibleCallback)(WKPageRef page, bool toolbarsVisible, const void *clientInfo);
    167 typedef bool (*WKPageGetMenuBarIsVisibleCallback)(WKPageRef page, const void *clientInfo);
    168 typedef void (*WKPageSetMenuBarIsVisibleCallback)(WKPageRef page, bool menuBarVisible, const void *clientInfo);
    169 typedef bool (*WKPageGetStatusBarIsVisibleCallback)(WKPageRef page, const void *clientInfo);
    170 typedef void (*WKPageSetStatusBarIsVisibleCallback)(WKPageRef page, bool statusBarVisible, const void *clientInfo);
    171 typedef bool (*WKPageGetIsResizableCallback)(WKPageRef page, const void *clientInfo);
    172 typedef void (*WKPageSetIsResizableCallback)(WKPageRef page, bool resizable, const void *clientInfo);
    173 typedef WKRect (*WKPageGetWindowFrameCallback)(WKPageRef page, const void *clientInfo);
    174 typedef void (*WKPageSetWindowFrameCallback)(WKPageRef page, WKRect frame, const void *clientInfo);
    175 typedef bool (*WKPageRunBeforeUnloadConfirmPanelCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo);
    176 typedef unsigned long long (*WKPageExceededDatabaseQuotaCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentUsage, unsigned long long expectedUsage, const void *clientInfo);
    177 typedef void (*WKPageRunOpenPanelCallback)(WKPageRef page, WKFrameRef frame, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener, const void *clientInfo);
    178 typedef void (*WKPageDecidePolicyForGeolocationPermissionRequestCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKGeolocationPermissionRequestRef permissionRequest, const void* clientInfo);
    179 typedef float (*WKPageHeaderHeightCallback)(WKPageRef page, WKFrameRef frame, const void* clientInfo);
    180 typedef float (*WKPageFooterHeightCallback)(WKPageRef page, WKFrameRef frame, const void* clientInfo);
    181 typedef void (*WKPageDrawHeaderCallback)(WKPageRef page, WKFrameRef frame, WKRect rect, const void* clientInfo);
    182 typedef void (*WKPageDrawFooterCallback)(WKPageRef page, WKFrameRef frame, WKRect rect, const void* clientInfo);
    183 typedef void (*WKPagePrintFrameCallback)(WKPageRef page, WKFrameRef frame, const void* clientInfo);
    184 typedef void (*WKPageDidCompleteRubberBandForMainFrameCallback)(WKPageRef page, WKSize initialOverhang, const void* clientInfo);
    185 typedef void (*WKPageSaveDataToFileInDownloadsFolderCallback)(WKPageRef page, WKStringRef suggestedFilename, WKStringRef mimeType, WKURLRef originatingURL, WKDataRef data, const void* clientInfo);
    186 
    187 struct WKPageUIClient {
    188     int                                                                 version;
    189     const void *                                                        clientInfo;
    190     WKPageCreateNewPageCallback                                         createNewPage;
    191     WKPageCallback                                                      showPage;
    192     WKPageCallback                                                      close;
    193     WKPageTakeFocusCallback                                             takeFocus;
    194     WKPageFocusCallback                                                 focus;
    195     WKPageUnfocusCallback                                               unfocus;
    196     WKPageRunJavaScriptAlertCallback                                    runJavaScriptAlert;
    197     WKPageRunJavaScriptConfirmCallback                                  runJavaScriptConfirm;
    198     WKPageRunJavaScriptPromptCallback                                   runJavaScriptPrompt;
    199     WKPageSetStatusTextCallback                                         setStatusText;
    200     WKPageMouseDidMoveOverElementCallback                               mouseDidMoveOverElement;
    201     WKPageMissingPluginButtonClickedCallback                            missingPluginButtonClicked;
    202     WKPageDidNotHandleKeyEventCallback                                  didNotHandleKeyEvent;
    203     WKPageGetToolbarsAreVisibleCallback                                 toolbarsAreVisible;
    204     WKPageSetToolbarsAreVisibleCallback                                 setToolbarsAreVisible;
    205     WKPageGetMenuBarIsVisibleCallback                                   menuBarIsVisible;
    206     WKPageSetMenuBarIsVisibleCallback                                   setMenuBarIsVisible;
    207     WKPageGetStatusBarIsVisibleCallback                                 statusBarIsVisible;
    208     WKPageSetStatusBarIsVisibleCallback                                 setStatusBarIsVisible;
    209     WKPageGetIsResizableCallback                                        isResizable;
    210     WKPageSetIsResizableCallback                                        setIsResizable;
    211     WKPageGetWindowFrameCallback                                        getWindowFrame;
    212     WKPageSetWindowFrameCallback                                        setWindowFrame;
    213     WKPageRunBeforeUnloadConfirmPanelCallback                           runBeforeUnloadConfirmPanel;
    214     WKPageCallback                                                      didDraw;
    215     WKPageCallback                                                      pageDidScroll;
    216     WKPageExceededDatabaseQuotaCallback                                 exceededDatabaseQuota;
    217     WKPageRunOpenPanelCallback                                          runOpenPanel;
    218     WKPageDecidePolicyForGeolocationPermissionRequestCallback           decidePolicyForGeolocationPermissionRequest;
    219     WKPageHeaderHeightCallback                                          headerHeight;
    220     WKPageFooterHeightCallback                                          footerHeight;
    221     WKPageDrawHeaderCallback                                            drawHeader;
    222     WKPageDrawFooterCallback                                            drawFooter;
    223     WKPagePrintFrameCallback                                            printFrame;
    224     WKPageCallback                                                      runModal;
    225     WKPageDidCompleteRubberBandForMainFrameCallback                     didCompleteRubberBandForMainFrame;
    226     WKPageSaveDataToFileInDownloadsFolderCallback                       saveDataToFileInDownloadsFolder;
    227 };
    228 typedef struct WKPageUIClient WKPageUIClient;
    229 
    230 // Find client.
    231 typedef void (*WKPageDidFindStringCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo);
    232 typedef void (*WKPageDidFailToFindStringCallback)(WKPageRef page, WKStringRef string, const void* clientInfo);
    233 typedef void (*WKPageDidCountStringMatchesCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo);
    234 
    235 struct WKPageFindClient {
    236     int                                                                 version;
    237     const void *                                                        clientInfo;
    238     WKPageDidFindStringCallback                                         didFindString;
    239     WKPageDidFailToFindStringCallback                                   didFailToFindString;
    240     WKPageDidCountStringMatchesCallback                                 didCountStringMatches;
    241 };
    242 typedef struct WKPageFindClient WKPageFindClient;
    243 
    244 enum {
    245     kWKMoreThanMaximumMatchCount = -1
    246 };
    247 
    248 // ContextMenu client
    249 typedef void (*WKPageGetContextMenuFromProposedContextMenuCallback)(WKPageRef page, WKArrayRef proposedMenu, WKArrayRef* newMenu, WKTypeRef userData, const void* clientInfo);
    250 typedef void (*WKPageCustomContextMenuItemSelectedCallback)(WKPageRef page, WKContextMenuItemRef contextMenuItem, const void* clientInfo);
    251 
    252 struct WKPageContextMenuClient {
    253     int                                                                 version;
    254     const void *                                                        clientInfo;
    255     WKPageGetContextMenuFromProposedContextMenuCallback                 getContextMenuFromProposedMenu;
    256     WKPageCustomContextMenuItemSelectedCallback                         customContextMenuItemSelected;
    257 };
    258 typedef struct WKPageContextMenuClient WKPageContextMenuClient;
    259 
    260 WK_EXPORT WKTypeID WKPageGetTypeID();
    261 
    262 WK_EXPORT WKContextRef WKPageGetContext(WKPageRef page);
    263 WK_EXPORT WKPageGroupRef WKPageGetPageGroup(WKPageRef page);
    264 
    265 WK_EXPORT void WKPageLoadURL(WKPageRef page, WKURLRef url);
    266 WK_EXPORT void WKPageLoadURLRequest(WKPageRef page, WKURLRequestRef urlRequest);
    267 WK_EXPORT void WKPageLoadHTMLString(WKPageRef page, WKStringRef htmlString, WKURLRef baseURL);
    268 WK_EXPORT void WKPageLoadAlternateHTMLString(WKPageRef page, WKStringRef htmlString, WKURLRef baseURL, WKURLRef unreachableURL);
    269 WK_EXPORT void WKPageLoadPlainTextString(WKPageRef page, WKStringRef plainTextString);
    270 
    271 WK_EXPORT void WKPageStopLoading(WKPageRef page);
    272 WK_EXPORT void WKPageReload(WKPageRef page);
    273 WK_EXPORT void WKPageReloadFromOrigin(WKPageRef page);
    274 
    275 WK_EXPORT bool WKPageTryClose(WKPageRef page);
    276 WK_EXPORT void WKPageClose(WKPageRef page);
    277 WK_EXPORT bool WKPageIsClosed(WKPageRef page);
    278 
    279 WK_EXPORT void WKPageGoForward(WKPageRef page);
    280 WK_EXPORT bool WKPageCanGoForward(WKPageRef page);
    281 WK_EXPORT void WKPageGoBack(WKPageRef page);
    282 WK_EXPORT bool WKPageCanGoBack(WKPageRef page);
    283 WK_EXPORT void WKPageGoToBackForwardListItem(WKPageRef page, WKBackForwardListItemRef item);
    284 WK_EXPORT WKBackForwardListRef WKPageGetBackForwardList(WKPageRef page);
    285 
    286 WK_EXPORT WKStringRef WKPageCopyTitle(WKPageRef page);
    287 
    288 WK_EXPORT WKURLRef WKPageCopyPendingAPIRequestURL(WKPageRef page);
    289 
    290 WK_EXPORT WKFrameRef WKPageGetMainFrame(WKPageRef page);
    291 WK_EXPORT WKFrameRef WKPageGetFocusedFrame(WKPageRef page); // The focused frame may be inactive.
    292 WK_EXPORT WKFrameRef WKPageGetFrameSetLargestFrame(WKPageRef page);
    293 WK_EXPORT double WKPageGetEstimatedProgress(WKPageRef page);
    294 
    295 WK_EXPORT void WKPageSetMemoryCacheClientCallsEnabled(WKPageRef page, bool memoryCacheClientCallsEnabled);
    296 
    297 #if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR
    298 WK_EXPORT WKInspectorRef WKPageGetInspector(WKPageRef page);
    299 #endif
    300 
    301 WK_EXPORT WKStringRef WKPageCopyUserAgent(WKPageRef page);
    302 
    303 WK_EXPORT WKStringRef WKPageCopyApplicationNameForUserAgent(WKPageRef page);
    304 WK_EXPORT void WKPageSetApplicationNameForUserAgent(WKPageRef page, WKStringRef applicationName);
    305 
    306 WK_EXPORT WKStringRef WKPageCopyCustomUserAgent(WKPageRef page);
    307 WK_EXPORT void WKPageSetCustomUserAgent(WKPageRef page, WKStringRef userAgent);
    308 
    309 WK_EXPORT bool WKPageSupportsTextEncoding(WKPageRef page);
    310 WK_EXPORT WKStringRef WKPageCopyCustomTextEncodingName(WKPageRef page);
    311 WK_EXPORT void WKPageSetCustomTextEncodingName(WKPageRef page, WKStringRef encodingName);
    312 
    313 WK_EXPORT void WKPageTerminate(WKPageRef page);
    314 
    315 WK_EXPORT WKStringRef WKPageGetSessionHistoryURLValueType(void);
    316 
    317 typedef bool (*WKPageSessionStateFilterCallback)(WKPageRef page, WKStringRef valueType, WKTypeRef value, void* context);
    318 WK_EXPORT WKDataRef WKPageCopySessionState(WKPageRef page, void* context, WKPageSessionStateFilterCallback urlAllowedCallback);
    319 WK_EXPORT void WKPageRestoreFromSessionState(WKPageRef page, WKDataRef sessionStateData);
    320 
    321 WK_EXPORT bool WKPageSupportsTextZoom(WKPageRef page);
    322 WK_EXPORT double WKPageGetTextZoomFactor(WKPageRef page);
    323 WK_EXPORT void WKPageSetTextZoomFactor(WKPageRef page, double zoomFactor);
    324 WK_EXPORT double WKPageGetPageZoomFactor(WKPageRef page);
    325 WK_EXPORT void WKPageSetPageZoomFactor(WKPageRef page, double zoomFactor);
    326 WK_EXPORT void WKPageSetPageAndTextZoomFactors(WKPageRef page, double pageZoomFactor, double textZoomFactor);
    327 
    328 WK_EXPORT void WKPageSetScaleFactor(WKPageRef page, double scale, WKPoint origin);
    329 WK_EXPORT double WKPageGetScaleFactor(WKPageRef page);
    330 
    331 WK_EXPORT void WKPageSetUseFixedLayout(WKPageRef page, bool fixed);
    332 WK_EXPORT void WKPageSetFixedLayoutSize(WKPageRef page, WKSize size);
    333 WK_EXPORT bool WKPageUseFixedLayout(WKPageRef page);
    334 WK_EXPORT WKSize WKPageFixedLayoutSize(WKPageRef page);
    335 
    336 WK_EXPORT bool WKPageHasHorizontalScrollbar(WKPageRef page);
    337 WK_EXPORT bool WKPageHasVerticalScrollbar(WKPageRef page);
    338 
    339 WK_EXPORT bool WKPageIsPinnedToLeftSide(WKPageRef page);
    340 WK_EXPORT bool WKPageIsPinnedToRightSide(WKPageRef page);
    341 
    342 WK_EXPORT bool WKPageCanDelete(WKPageRef page);
    343 WK_EXPORT bool WKPageHasSelectedRange(WKPageRef page);
    344 WK_EXPORT bool WKPageIsContentEditable(WKPageRef page);
    345 
    346 WK_EXPORT void WKPageFindString(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount);
    347 WK_EXPORT void WKPageHideFindUI(WKPageRef page);
    348 WK_EXPORT void WKPageCountStringMatches(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount);
    349 
    350 WK_EXPORT void WKPageSetPageContextMenuClient(WKPageRef page, const WKPageContextMenuClient* client);
    351 WK_EXPORT void WKPageSetPageFindClient(WKPageRef page, const WKPageFindClient* client);
    352 WK_EXPORT void WKPageSetPageFormClient(WKPageRef page, const WKPageFormClient* client);
    353 WK_EXPORT void WKPageSetPageLoaderClient(WKPageRef page, const WKPageLoaderClient* client);
    354 WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, const WKPagePolicyClient* client);
    355 WK_EXPORT void WKPageSetPageResourceLoadClient(WKPageRef page, const WKPageResourceLoadClient* client);
    356 WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, const WKPageUIClient* client);
    357 
    358 typedef void (*WKPageRunJavaScriptFunction)(WKSerializedScriptValueRef, WKErrorRef, void*);
    359 WK_EXPORT void WKPageRunJavaScriptInMainFrame(WKPageRef page, WKStringRef script, void* context, WKPageRunJavaScriptFunction function);
    360 #ifdef __BLOCKS__
    361 typedef void (^WKPageRunJavaScriptBlock)(WKSerializedScriptValueRef, WKErrorRef);
    362 WK_EXPORT void WKPageRunJavaScriptInMainFrame_b(WKPageRef page, WKStringRef script, WKPageRunJavaScriptBlock block);
    363 #endif
    364 
    365 typedef void (*WKPageGetSourceForFrameFunction)(WKStringRef, WKErrorRef, void*);
    366 WK_EXPORT void WKPageGetSourceForFrame(WKPageRef page, WKFrameRef frame, void* context, WKPageGetSourceForFrameFunction function);
    367 #ifdef __BLOCKS__
    368 typedef void (^WKPageGetSourceForFrameBlock)(WKStringRef, WKErrorRef);
    369 WK_EXPORT void WKPageGetSourceForFrame_b(WKPageRef page, WKFrameRef frame, WKPageGetSourceForFrameBlock block);
    370 #endif
    371 
    372 typedef void (*WKPageGetContentsAsStringFunction)(WKStringRef, WKErrorRef, void*);
    373 WK_EXPORT void WKPageGetContentsAsString(WKPageRef page, void* context, WKPageGetContentsAsStringFunction function);
    374 #ifdef __BLOCKS__
    375 typedef void (^WKPageGetContentsAsStringBlock)(WKStringRef, WKErrorRef);
    376 WK_EXPORT void WKPageGetContentsAsString_b(WKPageRef page, WKPageGetContentsAsStringBlock block);
    377 #endif
    378 
    379 typedef void (*WKPageForceRepaintFunction)(WKErrorRef, void*);
    380 WK_EXPORT void WKPageForceRepaint(WKPageRef page, void* context, WKPageForceRepaintFunction function);
    381 
    382 /*
    383     Some of the more common command name strings include the following, although any WebCore EditorCommand string is supported:
    384 
    385     "Cut"
    386     "Copy"
    387     "Paste"
    388     "SelectAll"
    389     "Undo"
    390     "Redo"
    391 */
    392 
    393 // state represents the state of the command in a menu (on is 1, off is 0, and mixed is -1), typically used to add a checkmark next to the menu item.
    394 typedef void (*WKPageValidateCommandCallback)(WKStringRef command, bool isEnabled, int32_t state, WKErrorRef, void* context);
    395 WK_EXPORT void WKPageValidateCommand(WKPageRef page, WKStringRef command, void* context, WKPageValidateCommandCallback callback);
    396 WK_EXPORT void WKPageExecuteCommand(WKPageRef page, WKStringRef command);
    397 
    398 #ifdef __cplusplus
    399 }
    400 #endif
    401 
    402 #endif /* WKPage_h */
    403