1 | /* |
2 | * Copyright (C) 2010, 2015 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 WKBundlePage_h |
27 | #define WKBundlePage_h |
28 | |
29 | #include <JavaScriptCore/JavaScript.h> |
30 | #include <WebKit/WKBase.h> |
31 | #include <WebKit/WKBundlePageContextMenuClient.h> |
32 | #include <WebKit/WKBundlePageEditorClient.h> |
33 | #include <WebKit/WKBundlePageFormClient.h> |
34 | #include <WebKit/WKBundlePageFullScreenClient.h> |
35 | #include <WebKit/WKBundlePageLoaderClient.h> |
36 | #include <WebKit/WKBundlePagePolicyClient.h> |
37 | #include <WebKit/WKBundlePageResourceLoadClient.h> |
38 | #include <WebKit/WKBundlePageUIClient.h> |
39 | #include <WebKit/WKDeprecated.h> |
40 | #include <WebKit/WKFindOptions.h> |
41 | #include <WebKit/WKImage.h> |
42 | |
43 | #ifndef __cplusplus |
44 | #include <stdbool.h> |
45 | #endif |
46 | |
47 | #include <stdint.h> |
48 | |
49 | #ifdef __cplusplus |
50 | extern "C" { |
51 | #endif |
52 | |
53 | WK_EXPORT void WKBundlePageWillEnterFullScreen(WKBundlePageRef page); |
54 | WK_EXPORT void WKBundlePageDidEnterFullScreen(WKBundlePageRef page); |
55 | WK_EXPORT void WKBundlePageWillExitFullScreen(WKBundlePageRef page); |
56 | WK_EXPORT void WKBundlePageDidExitFullScreen(WKBundlePageRef page); |
57 | |
58 | WK_EXPORT WKTypeID WKBundlePageGetTypeID(); |
59 | |
60 | WK_EXPORT void (WKBundlePageRef page, WKBundlePageContextMenuClientBase* client); |
61 | WK_EXPORT void WKBundlePageSetEditorClient(WKBundlePageRef page, WKBundlePageEditorClientBase* client); |
62 | WK_EXPORT void WKBundlePageSetFormClient(WKBundlePageRef page, WKBundlePageFormClientBase* client); |
63 | WK_EXPORT void WKBundlePageSetPageLoaderClient(WKBundlePageRef page, WKBundlePageLoaderClientBase* client); |
64 | WK_EXPORT void WKBundlePageSetResourceLoadClient(WKBundlePageRef page, WKBundlePageResourceLoadClientBase* client); |
65 | WK_EXPORT void WKBundlePageSetPolicyClient(WKBundlePageRef page, WKBundlePagePolicyClientBase* client); |
66 | WK_EXPORT void WKBundlePageSetUIClient(WKBundlePageRef page, WKBundlePageUIClientBase* client); |
67 | WK_EXPORT void WKBundlePageSetFullScreenClient(WKBundlePageRef page, WKBundlePageFullScreenClientBase* client); |
68 | |
69 | WK_EXPORT WKBundlePageGroupRef WKBundlePageGetPageGroup(WKBundlePageRef page); |
70 | WK_EXPORT WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef page); |
71 | WK_EXPORT WKFrameHandleRef WKBundleFrameCreateFrameHandle(WKBundleFrameRef); |
72 | |
73 | WK_EXPORT WKBundleBackForwardListRef WKBundlePageGetBackForwardList(WKBundlePageRef page) WK_C_API_DEPRECATED; |
74 | WK_EXPORT WKStringRef WKBundlePageDumpHistoryForTesting(WKBundlePageRef page, WKStringRef directory); |
75 | WK_EXPORT void WKBundleClearHistoryForTesting(WKBundlePageRef page); |
76 | |
77 | WK_EXPORT void WKBundlePageInstallPageOverlay(WKBundlePageRef page, WKBundlePageOverlayRef pageOverlay); |
78 | WK_EXPORT void WKBundlePageUninstallPageOverlay(WKBundlePageRef page, WKBundlePageOverlayRef pageOverlay); |
79 | |
80 | WK_EXPORT void WKBundlePageInstallPageOverlayWithAnimation(WKBundlePageRef page, WKBundlePageOverlayRef pageOverlay); |
81 | WK_EXPORT void WKBundlePageUninstallPageOverlayWithAnimation(WKBundlePageRef page, WKBundlePageOverlayRef pageOverlay); |
82 | |
83 | WK_EXPORT void WKBundlePageSetTopOverhangImage(WKBundlePageRef page, WKImageRef image); |
84 | WK_EXPORT void WKBundlePageSetBottomOverhangImage(WKBundlePageRef page, WKImageRef image); |
85 | |
86 | #if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE |
87 | WK_EXPORT void (WKBundlePageRef page, WKBundlePageBannerRef banner); |
88 | WK_EXPORT void (WKBundlePageRef page, WKBundlePageBannerRef banner); |
89 | #endif // !TARGET_OS_IPHONE |
90 | |
91 | WK_EXPORT bool WKBundlePageHasLocalDataForURL(WKBundlePageRef page, WKURLRef url); |
92 | WK_EXPORT bool WKBundlePageCanHandleRequest(WKURLRequestRef request); |
93 | |
94 | WK_EXPORT bool WKBundlePageFindString(WKBundlePageRef page, WKStringRef target, WKFindOptions findOptions); |
95 | WK_EXPORT void WKBundlePageFindStringMatches(WKBundlePageRef page, WKStringRef target, WKFindOptions findOptions); |
96 | WK_EXPORT void (WKBundlePageRef page, WKArrayRef matchIndices, WKStringRef replacementText, bool selectionOnly); |
97 | |
98 | WK_EXPORT WKImageRef WKBundlePageCreateSnapshotWithOptions(WKBundlePageRef page, WKRect rect, WKSnapshotOptions options); |
99 | |
100 | // We should deprecate these functions in favor of just using WKBundlePageCreateSnapshotWithOptions. |
101 | WK_EXPORT WKImageRef WKBundlePageCreateSnapshotInViewCoordinates(WKBundlePageRef page, WKRect rect, WKImageOptions options); |
102 | WK_EXPORT WKImageRef WKBundlePageCreateSnapshotInDocumentCoordinates(WKBundlePageRef page, WKRect rect, WKImageOptions options); |
103 | |
104 | // We should keep this function since it allows passing a scale factor, but we should re-name it to |
105 | // WKBundlePageCreateScaledSnapshotWithOptions. |
106 | WK_EXPORT WKImageRef WKBundlePageCreateScaledSnapshotInDocumentCoordinates(WKBundlePageRef page, WKRect rect, double scaleFactor, WKImageOptions options); |
107 | |
108 | WK_EXPORT double WKBundlePageGetBackingScaleFactor(WKBundlePageRef page); |
109 | |
110 | WK_EXPORT void WKBundlePageListenForLayoutMilestones(WKBundlePageRef page, WKLayoutMilestones milestones); |
111 | |
112 | WK_EXPORT WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef page); |
113 | |
114 | WK_EXPORT bool WKBundlePageIsUsingEphemeralSession(WKBundlePageRef page); |
115 | |
116 | WK_EXPORT bool WKBundlePageIsControlledByAutomation(WKBundlePageRef page); |
117 | |
118 | WK_EXPORT void WKBundlePageStartMonitoringScrollOperations(WKBundlePageRef page); |
119 | |
120 | WK_EXPORT WKStringRef WKBundlePageCopyGroupIdentifier(WKBundlePageRef page); |
121 | |
122 | typedef void (*WKBundlePageTestNotificationCallback)(void* context); |
123 | // Returns true if the callback function will be called, else false. |
124 | WK_EXPORT bool (WKBundlePageRef, WKBundlePageTestNotificationCallback, void* context); |
125 | |
126 | // Call the given callback after both a postTask() on the page's document's ScriptExecutionContext, and a zero-delay timer. |
127 | WK_EXPORT void WKBundlePageCallAfterTasksAndTimers(WKBundlePageRef, WKBundlePageTestNotificationCallback, void* context); |
128 | |
129 | WK_EXPORT void WKBundlePagePostMessage(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody); |
130 | |
131 | // Switches a connection into a fully synchronous mode, so all messages become synchronous until we get a response. |
132 | WK_EXPORT void WKBundlePagePostSynchronousMessageForTesting(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnRetainedData); |
133 | // Same as WKBundlePagePostMessage() but the message cannot become synchronous, even if the connection is in fully synchronous mode. |
134 | WK_EXPORT void WKBundlePagePostMessageIgnoringFullySynchronousMode(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody); |
135 | |
136 | #ifdef __cplusplus |
137 | } |
138 | #endif |
139 | |
140 | #endif /* WKBundlePage_h */ |
141 | |