2 * Copyright (C) 2010 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
26 #ifndef WKPagePrivate_h
27 #define WKPagePrivate_h
29 #include <WebKit/WKBase.h>
30 #include <WebKit/WKPage.h>
36 typedef void (*WKPageRenderTreeExternalRepresentationFunction)(WKStringRef, WKErrorRef, void*);
37 WK_EXPORT void WKPageRenderTreeExternalRepresentation(WKPageRef page, void *context, WKPageRenderTreeExternalRepresentationFunction function);
40 kWKDebugFlashViewUpdates = 1 << 0,
41 kWKDebugFlashBackingStoreUpdates = 1 << 1
43 typedef unsigned WKPageDebugPaintFlags;
45 WK_EXPORT void WKPageSetDebugPaintFlags(WKPageDebugPaintFlags flags);
46 WK_EXPORT WKPageDebugPaintFlags WKPageGetDebugPaintFlags(void);
48 WK_EXPORT WKStringRef WKPageCopyStandardUserAgentWithApplicationName(WKStringRef);
51 kWKPaginationModeUnpaginated,
52 kWKPaginationModeLeftToRight,
53 kWKPaginationModeRightToLeft,
54 kWKPaginationModeTopToBottom,
55 kWKPaginationModeBottomToTop,
57 typedef uint32_t WKPaginationMode;
59 WK_EXPORT void WKPageSetPaginationMode(WKPageRef page, WKPaginationMode paginationMode);
60 WK_EXPORT WKPaginationMode WKPageGetPaginationMode(WKPageRef page);
61 WK_EXPORT void WKPageSetPaginationBehavesLikeColumns(WKPageRef page, bool behavesLikeColumns);
62 WK_EXPORT bool WKPageGetPaginationBehavesLikeColumns(WKPageRef page);
63 WK_EXPORT void WKPageSetPageLength(WKPageRef page, double pageLength);
64 WK_EXPORT double WKPageGetPageLength(WKPageRef page);
65 WK_EXPORT void WKPageSetGapBetweenPages(WKPageRef page, double gap);
66 WK_EXPORT double WKPageGetGapBetweenPages(WKPageRef page);
67 WK_EXPORT void WKPageSetPaginationLineGridEnabled(WKPageRef page, bool lineGridEnabled);
68 WK_EXPORT bool WKPageGetPaginationLineGridEnabled(WKPageRef page);
70 WK_EXPORT unsigned WKPageGetPageCount(WKPageRef page);
73 float pageSetupScaleFactor;
74 float availablePaperWidth;
75 float availablePaperHeight;
77 typedef struct WKPrintInfo WKPrintInfo;
79 typedef void (*WKPageComputePagesForPrintingFunction)(WKRect* pageRects, uint32_t pageCount, double resultPageScaleFactor, WKErrorRef error, void* functionContext);
80 WK_EXPORT void WKPageComputePagesForPrinting(WKPageRef page, WKFrameRef frame, WKPrintInfo, WKPageComputePagesForPrintingFunction, void* context);
82 typedef void (*WKPageDrawToPDFFunction)(WKDataRef data, WKErrorRef error, void* functionContext);
83 WK_EXPORT void WKPageBeginPrinting(WKPageRef page, WKFrameRef frame, WKPrintInfo printInfo);
84 WK_EXPORT void WKPageDrawPagesToPDF(WKPageRef page, WKFrameRef frame, WKPrintInfo printInfo, uint32_t first, uint32_t count, WKPageDrawToPDFFunction callback, void* context);
85 WK_EXPORT void WKPageEndPrinting(WKPageRef page);
87 WK_EXPORT bool WKPageGetIsControlledByAutomation(WKPageRef page);
88 WK_EXPORT void WKPageSetControlledByAutomation(WKPageRef page, bool controlled);
90 WK_EXPORT bool WKPageGetAllowsRemoteInspection(WKPageRef page);
91 WK_EXPORT void WKPageSetAllowsRemoteInspection(WKPageRef page, bool allow);
93 WK_EXPORT void WKPageSetMediaVolume(WKPageRef page, float volume);
94 WK_EXPORT void WKPageSetMayStartMediaWhenInWindow(WKPageRef page, bool mayStartMedia);
96 typedef void (*WKPageGetBytecodeProfileFunction)(WKStringRef, WKErrorRef, void*);
97 WK_EXPORT void WKPageGetBytecodeProfile(WKPageRef page, void* context, WKPageGetBytecodeProfileFunction function);
99 typedef void (*WKPageGetSamplingProfilerOutputFunction)(WKStringRef, WKErrorRef, void*);
100 WK_EXPORT void WKPageGetSamplingProfilerOutput(WKPageRef page, void* context, WKPageGetSamplingProfilerOutputFunction function);
102 typedef void (*WKPageIsWebProcessResponsiveFunction)(bool isWebProcessResponsive, void* context);
103 WK_EXPORT void WKPageIsWebProcessResponsive(WKPageRef page, void* context, WKPageIsWebProcessResponsiveFunction function);
105 WK_EXPORT WKArrayRef WKPageCopyRelatedPages(WKPageRef page);
107 WK_EXPORT WKFrameRef WKPageLookUpFrameFromHandle(WKPageRef page, WKFrameHandleRef handle);
110 kWKScrollPinningBehaviorDoNotPin,
111 kWKScrollPinningBehaviorPinToTop,
112 kWKScrollPinningBehaviorPinToBottom
114 typedef uint32_t WKScrollPinningBehavior;
116 WK_EXPORT WKScrollPinningBehavior WKPageGetScrollPinningBehavior(WKPageRef page);
117 WK_EXPORT void WKPageSetScrollPinningBehavior(WKPageRef page, WKScrollPinningBehavior pinning);
119 WK_EXPORT bool WKPageGetAddsVisitedLinks(WKPageRef page);
120 WK_EXPORT void WKPageSetAddsVisitedLinks(WKPageRef page, bool visitedLinks);
122 WK_EXPORT bool WKPageIsPlayingAudio(WKPageRef page);
125 kWKMediaNoneMuted = 0,
126 kWKMediaAudioMuted = 1 << 0,
127 kWKMediaCaptureDevicesMuted = 1 << 1,
129 typedef uint32_t WKMediaMutedState;
130 WK_EXPORT void WKPageSetMuted(WKPageRef page, WKMediaMutedState muted);
133 kWKMediaIsNotPlaying = 0,
134 kWKMediaIsPlayingAudio = 1 << 0,
135 kWKMediaIsPlayingVideo = 1 << 1,
136 kWKMediaHasActiveCaptureDevice = 1 << 2,
137 kWKMediaHasCaptureDevice = 1 << 3,
139 typedef uint32_t WKMediaState;
142 WK_EXPORT WKMediaState WKPageGetMediaState(WKPageRef page);
145 kWKMediaEventTypePlayPause,
146 kWKMediaEventTypeTrackNext,
147 kWKMediaEventTypeTrackPrevious
149 typedef uint32_t WKMediaEventType;
151 WK_EXPORT bool WKPageHasMediaSessionWithActiveMediaElements(WKPageRef page);
152 WK_EXPORT void WKPageHandleMediaEvent(WKPageRef page, WKMediaEventType event);
154 WK_EXPORT void WKPageLoadURLWithShouldOpenExternalURLsPolicy(WKPageRef page, WKURLRef url, bool shouldOpenExternalURLs);
156 typedef void (*WKPagePostPresentationUpdateFunction)(WKErrorRef, void*);
157 WK_EXPORT void WKPageCallAfterNextPresentationUpdate(WKPageRef page, void* context, WKPagePostPresentationUpdateFunction function);
159 WK_EXPORT bool WKPageGetResourceCachingDisabled(WKPageRef page);
160 WK_EXPORT void WKPageSetResourceCachingDisabled(WKPageRef page, bool disabled);
162 WK_EXPORT void WKPageRestoreFromSessionStateWithoutNavigation(WKPageRef page, WKTypeRef sessionState);
164 WK_EXPORT void WKPageSetIgnoresViewportScaleLimits(WKPageRef page, bool ignoresViewportScaleLimits);
166 WK_EXPORT pid_t WKPageGetProcessIdentifier(WKPageRef page);
172 #endif /* WKPagePrivate_h */