[Win] WTF: Add alias for process id to use in place of direct uses of pid_t
[WebKit-https.git] / Source / WebKit / UIProcess / API / C / WKPagePrivate.h
1 /*
2  * Copyright (C) 2010 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 WKPagePrivate_h
27 #define WKPagePrivate_h
28
29 #include <WebKit/WKBase.h>
30 #include <WebKit/WKPage.h>
31
32 #if defined(WIN32) || defined(_WIN32)
33 typedef int WKProcessID;
34 #else
35 #include <unistd.h>
36 typedef pid_t WKProcessID;
37 #endif
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 typedef void (*WKPageRenderTreeExternalRepresentationFunction)(WKStringRef, WKErrorRef, void*);
44 WK_EXPORT void WKPageRenderTreeExternalRepresentation(WKPageRef page, void *context, WKPageRenderTreeExternalRepresentationFunction function);
45
46 enum {
47     kWKDebugFlashViewUpdates = 1 << 0,
48     kWKDebugFlashBackingStoreUpdates = 1 << 1
49 };
50 typedef unsigned WKPageDebugPaintFlags;
51
52 WK_EXPORT WKStringRef WKPageCopyStandardUserAgentWithApplicationName(WKStringRef);
53
54 enum {
55     kWKPaginationModeUnpaginated,
56     kWKPaginationModeLeftToRight,
57     kWKPaginationModeRightToLeft,
58     kWKPaginationModeTopToBottom,
59     kWKPaginationModeBottomToTop,
60 };
61 typedef uint32_t WKPaginationMode;
62
63 WK_EXPORT void WKPageSetPaginationMode(WKPageRef page, WKPaginationMode paginationMode);
64 WK_EXPORT WKPaginationMode WKPageGetPaginationMode(WKPageRef page);
65 WK_EXPORT void WKPageSetPaginationBehavesLikeColumns(WKPageRef page, bool behavesLikeColumns);
66 WK_EXPORT bool WKPageGetPaginationBehavesLikeColumns(WKPageRef page);
67 WK_EXPORT void WKPageSetPageLength(WKPageRef page, double pageLength);
68 WK_EXPORT double WKPageGetPageLength(WKPageRef page);
69 WK_EXPORT void WKPageSetGapBetweenPages(WKPageRef page, double gap);
70 WK_EXPORT double WKPageGetGapBetweenPages(WKPageRef page);
71 WK_EXPORT void WKPageSetPaginationLineGridEnabled(WKPageRef page, bool lineGridEnabled);
72 WK_EXPORT bool WKPageGetPaginationLineGridEnabled(WKPageRef page);
73
74 WK_EXPORT unsigned WKPageGetPageCount(WKPageRef page);
75
76 struct WKPrintInfo {
77     float pageSetupScaleFactor;
78     float availablePaperWidth;
79     float availablePaperHeight;
80 };
81 typedef struct WKPrintInfo WKPrintInfo;
82
83 typedef void (*WKPageComputePagesForPrintingFunction)(WKRect* pageRects, uint32_t pageCount, double resultPageScaleFactor, WKErrorRef error, void* functionContext);
84 WK_EXPORT void WKPageComputePagesForPrinting(WKPageRef page, WKFrameRef frame, WKPrintInfo, WKPageComputePagesForPrintingFunction, void* context);
85
86 typedef void (*WKPageDrawToPDFFunction)(WKDataRef data, WKErrorRef error, void* functionContext);
87 WK_EXPORT void WKPageBeginPrinting(WKPageRef page, WKFrameRef frame, WKPrintInfo printInfo);
88 WK_EXPORT void WKPageDrawPagesToPDF(WKPageRef page, WKFrameRef frame, WKPrintInfo printInfo, uint32_t first, uint32_t count, WKPageDrawToPDFFunction callback, void* context);
89 WK_EXPORT void WKPageEndPrinting(WKPageRef page);
90
91 WK_EXPORT bool WKPageGetIsControlledByAutomation(WKPageRef page);
92 WK_EXPORT void WKPageSetControlledByAutomation(WKPageRef page, bool controlled);
93
94 WK_EXPORT bool WKPageGetAllowsRemoteInspection(WKPageRef page);
95 WK_EXPORT void WKPageSetAllowsRemoteInspection(WKPageRef page, bool allow);
96
97 WK_EXPORT void WKPageSetMediaVolume(WKPageRef page, float volume);
98 WK_EXPORT void WKPageSetMayStartMediaWhenInWindow(WKPageRef page, bool mayStartMedia);
99
100 typedef void (*WKPageGetBytecodeProfileFunction)(WKStringRef, WKErrorRef, void*);
101 WK_EXPORT void WKPageGetBytecodeProfile(WKPageRef page, void* context, WKPageGetBytecodeProfileFunction function);
102
103 typedef void (*WKPageGetSamplingProfilerOutputFunction)(WKStringRef, WKErrorRef, void*);
104 WK_EXPORT void WKPageGetSamplingProfilerOutput(WKPageRef page, void* context, WKPageGetSamplingProfilerOutputFunction function);
105
106 typedef void (*WKPageIsWebProcessResponsiveFunction)(bool isWebProcessResponsive, void* context);
107 WK_EXPORT void WKPageIsWebProcessResponsive(WKPageRef page, void* context, WKPageIsWebProcessResponsiveFunction function);
108     
109 WK_EXPORT WKArrayRef WKPageCopyRelatedPages(WKPageRef page);
110
111 WK_EXPORT WKFrameRef WKPageLookUpFrameFromHandle(WKPageRef page, WKFrameHandleRef handle);
112
113 enum {
114     kWKScrollPinningBehaviorDoNotPin,
115     kWKScrollPinningBehaviorPinToTop,
116     kWKScrollPinningBehaviorPinToBottom
117 };
118 typedef uint32_t WKScrollPinningBehavior;
119
120 WK_EXPORT WKScrollPinningBehavior WKPageGetScrollPinningBehavior(WKPageRef page);
121 WK_EXPORT void WKPageSetScrollPinningBehavior(WKPageRef page, WKScrollPinningBehavior pinning);
122
123 WK_EXPORT bool WKPageGetAddsVisitedLinks(WKPageRef page);
124 WK_EXPORT void WKPageSetAddsVisitedLinks(WKPageRef page, bool visitedLinks);
125
126 WK_EXPORT bool WKPageIsPlayingAudio(WKPageRef page);
127
128 enum {
129     kWKMediaNoneMuted = 0,
130     kWKMediaAudioMuted = 1 << 0,
131     kWKMediaCaptureDevicesMuted = 1 << 1,
132 };
133 typedef uint32_t WKMediaMutedState;
134 WK_EXPORT void WKPageSetMuted(WKPageRef page, WKMediaMutedState muted);
135
136 WK_EXPORT void WKPageClearUserMediaState(WKPageRef page);
137 WK_EXPORT void WKPageSetMediaCaptureEnabled(WKPageRef page, bool enabled);
138 WK_EXPORT bool WKPageGetMediaCaptureEnabled(WKPageRef page);
139
140 WK_EXPORT void WKPageDidAllowPointerLock(WKPageRef page);
141 WK_EXPORT void WKPageDidDenyPointerLock(WKPageRef page);
142
143 enum {
144     kWKMediaIsNotPlaying = 0,
145     kWKMediaIsPlayingAudio = 1 << 0,
146     kWKMediaIsPlayingVideo = 1 << 1,
147     kWKMediaHasActiveAudioCaptureDevice = 1 << 2,
148     kWKMediaHasActiveVideoCaptureDevice = 1 << 3,
149     kWKMediaHasMutedAudioCaptureDevice = 1 << 4,
150     kWKMediaHasMutedVideoCaptureDevice = 1 << 5,
151 };
152 typedef uint32_t WKMediaState;
153
154
155 WK_EXPORT WKMediaState WKPageGetMediaState(WKPageRef page);
156
157 enum {
158     kWKMediaEventTypePlayPause,
159     kWKMediaEventTypeTrackNext,
160     kWKMediaEventTypeTrackPrevious
161 };
162 typedef uint32_t WKMediaEventType;
163
164 WK_EXPORT bool WKPageHasMediaSessionWithActiveMediaElements(WKPageRef page);
165 WK_EXPORT void WKPageHandleMediaEvent(WKPageRef page, WKMediaEventType event);
166
167 WK_EXPORT void WKPageLoadURLWithShouldOpenExternalURLsPolicy(WKPageRef page, WKURLRef url, bool shouldOpenExternalURLs);
168
169 typedef void (*WKPagePostPresentationUpdateFunction)(WKErrorRef, void*);
170 WK_EXPORT void WKPageCallAfterNextPresentationUpdate(WKPageRef page, void* context, WKPagePostPresentationUpdateFunction function);
171
172 WK_EXPORT bool WKPageGetResourceCachingDisabled(WKPageRef page);
173 WK_EXPORT void WKPageSetResourceCachingDisabled(WKPageRef page, bool disabled);
174
175 WK_EXPORT void WKPageRestoreFromSessionStateWithoutNavigation(WKPageRef page, WKTypeRef sessionState);
176
177 WK_EXPORT void WKPageSetIgnoresViewportScaleLimits(WKPageRef page, bool ignoresViewportScaleLimits);
178
179 WK_EXPORT WKProcessID WKPageGetProcessIdentifier(WKPageRef page);
180
181 #ifdef __cplusplus
182 }
183 #endif
184
185 #endif /* WKPagePrivate_h */