| 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 (*)(WKStringRef, WKErrorRef, void*); |
| 44 | WK_EXPORT void (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 | , |
| 56 | , |
| 57 | , |
| 58 | , |
| 59 | , |
| 60 | }; |
| 61 | typedef uint32_t ; |
| 62 | |
| 63 | WK_EXPORT void (WKPageRef page, WKPaginationMode ); |
| 64 | WK_EXPORT WKPaginationMode (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 (WKPageRef page, bool lineGridEnabled); |
| 72 | WK_EXPORT bool (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* , 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 | WK_EXPORT WKArrayRef WKPageCopyRelatedPages(WKPageRef page); |
| 107 | |
| 108 | WK_EXPORT WKFrameRef WKPageLookUpFrameFromHandle(WKPageRef page, WKFrameHandleRef handle); |
| 109 | |
| 110 | enum { |
| 111 | kWKScrollPinningBehaviorDoNotPin, |
| 112 | kWKScrollPinningBehaviorPinToTop, |
| 113 | kWKScrollPinningBehaviorPinToBottom |
| 114 | }; |
| 115 | typedef uint32_t WKScrollPinningBehavior; |
| 116 | |
| 117 | WK_EXPORT WKScrollPinningBehavior WKPageGetScrollPinningBehavior(WKPageRef page); |
| 118 | WK_EXPORT void WKPageSetScrollPinningBehavior(WKPageRef page, WKScrollPinningBehavior pinning); |
| 119 | |
| 120 | WK_EXPORT bool WKPageGetAddsVisitedLinks(WKPageRef page); |
| 121 | WK_EXPORT void WKPageSetAddsVisitedLinks(WKPageRef page, bool visitedLinks); |
| 122 | |
| 123 | WK_EXPORT bool WKPageIsPlayingAudio(WKPageRef page); |
| 124 | |
| 125 | enum { |
| 126 | kWKMediaNoneMuted = 0, |
| 127 | kWKMediaAudioMuted = 1 << 0, |
| 128 | kWKMediaCaptureDevicesMuted = 1 << 1, |
| 129 | kWKMediaScreenCaptureMuted = 1 << 2, |
| 130 | }; |
| 131 | typedef uint32_t WKMediaMutedState; |
| 132 | WK_EXPORT void WKPageSetMuted(WKPageRef page, WKMediaMutedState muted); |
| 133 | |
| 134 | WK_EXPORT void WKPageClearUserMediaState(WKPageRef page); |
| 135 | WK_EXPORT void WKPageSetMediaCaptureEnabled(WKPageRef page, bool enabled); |
| 136 | WK_EXPORT bool WKPageGetMediaCaptureEnabled(WKPageRef page); |
| 137 | |
| 138 | WK_EXPORT void WKPageDidAllowPointerLock(WKPageRef page); |
| 139 | WK_EXPORT void WKPageDidDenyPointerLock(WKPageRef page); |
| 140 | |
| 141 | enum { |
| 142 | kWKMediaIsNotPlaying = 0, |
| 143 | kWKMediaIsPlayingAudio = 1 << 0, |
| 144 | kWKMediaIsPlayingVideo = 1 << 1, |
| 145 | kWKMediaHasActiveAudioCaptureDevice = 1 << 2, |
| 146 | kWKMediaHasActiveVideoCaptureDevice = 1 << 3, |
| 147 | kWKMediaHasMutedAudioCaptureDevice = 1 << 4, |
| 148 | kWKMediaHasMutedVideoCaptureDevice = 1 << 5, |
| 149 | kWKMediaHasActiveDisplayCaptureDevice = 1 << 6, |
| 150 | kWKMediaHasMutedDisplayCaptureDevice = 1 << 7, |
| 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 (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 __BLOCKS__ |
| 182 | typedef void (^WKPageGetApplicationManifestBlock)(void); |
| 183 | WK_EXPORT void WKPageGetApplicationManifest_b(WKPageRef page, WKPageGetApplicationManifestBlock block); |
| 184 | #endif |
| 185 | |
| 186 | typedef void (*WKPageDumpAdClickAttributionFunction)(WKStringRef adClickAttributionRepresentation, void* functionContext); |
| 187 | WK_EXPORT void WKPageDumpAdClickAttribution(WKPageRef, WKPageDumpAdClickAttributionFunction, void* callbackContext); |
| 188 | typedef void (*WKPageClearAdClickAttributionFunction)(void* functionContext); |
| 189 | WK_EXPORT void WKPageClearAdClickAttribution(WKPageRef, WKPageClearAdClickAttributionFunction, void* callbackContext); |
| 190 | typedef void (*WKPageSetAdClickAttributionOverrideTimerForTestingFunction)(void* functionContext); |
| 191 | WK_EXPORT void WKPageSetAdClickAttributionOverrideTimerForTesting(WKPageRef page, bool value, WKPageSetAdClickAttributionOverrideTimerForTestingFunction callback, void* callbackContext); |
| 192 | typedef void (*WKPageSetAdClickAttributionConversionURLForTestingFunction)(void* functionContext); |
| 193 | WK_EXPORT void WKPageSetAdClickAttributionConversionURLForTesting(WKPageRef page, WKURLRef urlString, WKPageSetAdClickAttributionConversionURLForTestingFunction callback, void* callbackContext); |
| 194 | typedef void (*WKPageMarkAdClickAttributionsAsExpiredForTestingFunction)(void* functionContext); |
| 195 | WK_EXPORT void WKPageMarkAdClickAttributionsAsExpiredForTesting(WKPageRef page, WKPageMarkAdClickAttributionsAsExpiredForTestingFunction callback, void* callbackContext); |
| 196 | |
| 197 | #ifdef __cplusplus |
| 198 | } |
| 199 | #endif |
| 200 | |
| 201 | #endif /* WKPagePrivate_h */ |
| 202 | |