Many modern media control tests leak documents in testing
[WebKit-https.git] / Source / WebKit / WebProcess / InjectedBundle / API / c / WKBundlePage.h
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/WKFindOptions.h>
40 #include <WebKit/WKImage.h>
41
42 #ifndef __cplusplus
43 #include <stdbool.h>
44 #endif
45
46 #include <stdint.h>
47
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51
52 WK_EXPORT void WKBundlePageWillEnterFullScreen(WKBundlePageRef page);
53 WK_EXPORT void WKBundlePageDidEnterFullScreen(WKBundlePageRef page);
54 WK_EXPORT void WKBundlePageWillExitFullScreen(WKBundlePageRef page);
55 WK_EXPORT void WKBundlePageDidExitFullScreen(WKBundlePageRef page);
56
57 WK_EXPORT WKTypeID WKBundlePageGetTypeID();
58
59 WK_EXPORT void WKBundlePageSetContextMenuClient(WKBundlePageRef page, WKBundlePageContextMenuClientBase* client);
60 WK_EXPORT void WKBundlePageSetEditorClient(WKBundlePageRef page, WKBundlePageEditorClientBase* client);
61 WK_EXPORT void WKBundlePageSetFormClient(WKBundlePageRef page, WKBundlePageFormClientBase* client);
62 WK_EXPORT void WKBundlePageSetPageLoaderClient(WKBundlePageRef page, WKBundlePageLoaderClientBase* client);
63 WK_EXPORT void WKBundlePageSetResourceLoadClient(WKBundlePageRef page, WKBundlePageResourceLoadClientBase* client);
64 WK_EXPORT void WKBundlePageSetPolicyClient(WKBundlePageRef page, WKBundlePagePolicyClientBase* client);
65 WK_EXPORT void WKBundlePageSetUIClient(WKBundlePageRef page, WKBundlePageUIClientBase* client);
66 WK_EXPORT void WKBundlePageSetFullScreenClient(WKBundlePageRef page, WKBundlePageFullScreenClientBase* client);
67
68 WK_EXPORT WKBundlePageGroupRef WKBundlePageGetPageGroup(WKBundlePageRef page);
69 WK_EXPORT WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef page);
70 WK_EXPORT WKFrameHandleRef WKBundleFrameCreateFrameHandle(WKBundleFrameRef);
71
72 WK_EXPORT WKBundleBackForwardListRef WKBundlePageGetBackForwardList(WKBundlePageRef page);
73
74 WK_EXPORT void WKBundlePageInstallPageOverlay(WKBundlePageRef page, WKBundlePageOverlayRef pageOverlay);
75 WK_EXPORT void WKBundlePageUninstallPageOverlay(WKBundlePageRef page, WKBundlePageOverlayRef pageOverlay);
76
77 WK_EXPORT void WKBundlePageInstallPageOverlayWithAnimation(WKBundlePageRef page, WKBundlePageOverlayRef pageOverlay);
78 WK_EXPORT void WKBundlePageUninstallPageOverlayWithAnimation(WKBundlePageRef page, WKBundlePageOverlayRef pageOverlay);
79
80 WK_EXPORT void WKBundlePageSetTopOverhangImage(WKBundlePageRef page, WKImageRef image);
81 WK_EXPORT void WKBundlePageSetBottomOverhangImage(WKBundlePageRef page, WKImageRef image);
82
83 #if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE
84 WK_EXPORT void WKBundlePageSetHeaderBanner(WKBundlePageRef page, WKBundlePageBannerRef banner);
85 WK_EXPORT void WKBundlePageSetFooterBanner(WKBundlePageRef page, WKBundlePageBannerRef banner);
86 #endif // !TARGET_OS_IPHONE
87
88 WK_EXPORT bool WKBundlePageHasLocalDataForURL(WKBundlePageRef page, WKURLRef url);
89 WK_EXPORT bool WKBundlePageCanHandleRequest(WKURLRequestRef request);
90
91 WK_EXPORT bool WKBundlePageFindString(WKBundlePageRef page, WKStringRef target, WKFindOptions findOptions);
92
93 WK_EXPORT WKImageRef WKBundlePageCreateSnapshotWithOptions(WKBundlePageRef page, WKRect rect, WKSnapshotOptions options);
94
95 // We should deprecate these functions in favor of just using WKBundlePageCreateSnapshotWithOptions.
96 WK_EXPORT WKImageRef WKBundlePageCreateSnapshotInViewCoordinates(WKBundlePageRef page, WKRect rect, WKImageOptions options);
97 WK_EXPORT WKImageRef WKBundlePageCreateSnapshotInDocumentCoordinates(WKBundlePageRef page, WKRect rect, WKImageOptions options);
98
99 // We should keep this function since it allows passing a scale factor, but we should re-name it to
100 // WKBundlePageCreateScaledSnapshotWithOptions.
101 WK_EXPORT WKImageRef WKBundlePageCreateScaledSnapshotInDocumentCoordinates(WKBundlePageRef page, WKRect rect, double scaleFactor, WKImageOptions options);
102
103 WK_EXPORT double WKBundlePageGetBackingScaleFactor(WKBundlePageRef page);
104
105 WK_EXPORT void WKBundlePageListenForLayoutMilestones(WKBundlePageRef page, WKLayoutMilestones milestones);
106
107 WK_EXPORT WKBundleInspectorRef WKBundlePageGetInspector(WKBundlePageRef page);
108
109 WK_EXPORT bool WKBundlePageIsUsingEphemeralSession(WKBundlePageRef page);
110
111 WK_EXPORT bool WKBundlePageIsControlledByAutomation(WKBundlePageRef page);
112
113 WK_EXPORT void WKBundlePageStartMonitoringScrollOperations(WKBundlePageRef page);
114
115 WK_EXPORT WKStringRef WKBundlePageCopyGroupIdentifier(WKBundlePageRef page);
116
117 typedef void (*WKBundlePageTestNotificationCallback)(void* context);
118 WK_EXPORT void WKBundlePageRegisterScrollOperationCompletionCallback(WKBundlePageRef, WKBundlePageTestNotificationCallback, void* context);
119
120 // Call the given callback after both a postTask() on the page's document's ScriptExecutionContext, and a zero-delay timer.
121 WK_EXPORT void WKBundlePageCallAfterTasksAndTimers(WKBundlePageRef, WKBundlePageTestNotificationCallback, void* context);
122
123 WK_EXPORT void WKBundlePagePostMessage(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody);
124
125 // Switches a connection into a fully synchronous mode, so all messages become synchronous until we get a response.
126 WK_EXPORT void WKBundlePagePostSynchronousMessageForTesting(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData);
127
128 #ifdef __cplusplus
129 }
130 #endif
131
132 #endif /* WKBundlePage_h */