[MediaStream] Add "has capture device" bit to media state flags
[WebKit-https.git] / Source / WebKit2 / 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 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 typedef void (*WKPageRenderTreeExternalRepresentationFunction)(WKStringRef, WKErrorRef, void*);
37 WK_EXPORT void WKPageRenderTreeExternalRepresentation(WKPageRef page, void *context, WKPageRenderTreeExternalRepresentationFunction function);
38
39 enum {
40     kWKDebugFlashViewUpdates = 1 << 0,
41     kWKDebugFlashBackingStoreUpdates = 1 << 1
42 };
43 typedef unsigned WKPageDebugPaintFlags;
44
45 WK_EXPORT void WKPageSetDebugPaintFlags(WKPageDebugPaintFlags flags);
46 WK_EXPORT WKPageDebugPaintFlags WKPageGetDebugPaintFlags(void);
47
48 WK_EXPORT WKStringRef WKPageCopyStandardUserAgentWithApplicationName(WKStringRef);
49
50 enum {
51     kWKPaginationModeUnpaginated,
52     kWKPaginationModeLeftToRight,
53     kWKPaginationModeRightToLeft,
54     kWKPaginationModeTopToBottom,
55     kWKPaginationModeBottomToTop,
56 };
57 typedef uint32_t WKPaginationMode;
58
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);
69
70 WK_EXPORT unsigned WKPageGetPageCount(WKPageRef page);
71
72 struct WKPrintInfo {
73     float pageSetupScaleFactor;
74     float availablePaperWidth;
75     float availablePaperHeight;
76 };
77 typedef struct WKPrintInfo WKPrintInfo;
78
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);
81
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);
86
87 WK_EXPORT bool WKPageGetIsControlledByAutomation(WKPageRef page);
88 WK_EXPORT void WKPageSetControlledByAutomation(WKPageRef page, bool controlled);
89
90 WK_EXPORT bool WKPageGetAllowsRemoteInspection(WKPageRef page);
91 WK_EXPORT void WKPageSetAllowsRemoteInspection(WKPageRef page, bool allow);
92
93 WK_EXPORT void WKPageSetMediaVolume(WKPageRef page, float volume);
94 WK_EXPORT void WKPageSetMayStartMediaWhenInWindow(WKPageRef page, bool mayStartMedia);
95
96 typedef void (*WKPageGetBytecodeProfileFunction)(WKStringRef, WKErrorRef, void*);
97 WK_EXPORT void WKPageGetBytecodeProfile(WKPageRef page, void* context, WKPageGetBytecodeProfileFunction function);
98
99 typedef void (*WKPageGetSamplingProfilerOutputFunction)(WKStringRef, WKErrorRef, void*);
100 WK_EXPORT void WKPageGetSamplingProfilerOutput(WKPageRef page, void* context, WKPageGetSamplingProfilerOutputFunction function);
101
102 typedef void (*WKPageIsWebProcessResponsiveFunction)(bool isWebProcessResponsive, void* context);
103 WK_EXPORT void WKPageIsWebProcessResponsive(WKPageRef page, void* context, WKPageIsWebProcessResponsiveFunction function);
104     
105 WK_EXPORT WKArrayRef WKPageCopyRelatedPages(WKPageRef page);
106
107 WK_EXPORT WKFrameRef WKPageLookUpFrameFromHandle(WKPageRef page, WKFrameHandleRef handle);
108
109 enum {
110     kWKScrollPinningBehaviorDoNotPin,
111     kWKScrollPinningBehaviorPinToTop,
112     kWKScrollPinningBehaviorPinToBottom
113 };
114 typedef uint32_t WKScrollPinningBehavior;
115
116 WK_EXPORT WKScrollPinningBehavior WKPageGetScrollPinningBehavior(WKPageRef page);
117 WK_EXPORT void WKPageSetScrollPinningBehavior(WKPageRef page, WKScrollPinningBehavior pinning);
118
119 WK_EXPORT bool WKPageGetAddsVisitedLinks(WKPageRef page);
120 WK_EXPORT void WKPageSetAddsVisitedLinks(WKPageRef page, bool visitedLinks);
121
122 WK_EXPORT bool WKPageIsPlayingAudio(WKPageRef page);
123
124 enum {
125     kWKMediaNoneMuted = 0,
126     kWKMediaAudioMuted = 1 << 0,
127     kWKMediaCaptureDevicesMuted = 1 << 1,
128 };
129 typedef uint32_t WKMediaMutedState;
130 WK_EXPORT void WKPageSetMuted(WKPageRef page, WKMediaMutedState muted);
131
132 enum {
133     kWKMediaIsNotPlaying = 0,
134     kWKMediaIsPlayingAudio = 1 << 0,
135     kWKMediaIsPlayingVideo = 1 << 1,
136     kWKMediaHasActiveCaptureDevice = 1 << 2,
137     kWKMediaHasCaptureDevice = 1 << 3,
138 };
139 typedef uint32_t WKMediaState;
140
141
142 WK_EXPORT WKMediaState WKPageGetMediaState(WKPageRef page);
143
144 enum {
145     kWKMediaEventTypePlayPause,
146     kWKMediaEventTypeTrackNext,
147     kWKMediaEventTypeTrackPrevious
148 };
149 typedef uint32_t WKMediaEventType;
150
151 WK_EXPORT bool WKPageHasMediaSessionWithActiveMediaElements(WKPageRef page);
152 WK_EXPORT void WKPageHandleMediaEvent(WKPageRef page, WKMediaEventType event);
153
154 WK_EXPORT void WKPageLoadURLWithShouldOpenExternalURLsPolicy(WKPageRef page, WKURLRef url, bool shouldOpenExternalURLs);
155
156 typedef void (*WKPagePostPresentationUpdateFunction)(WKErrorRef, void*);
157 WK_EXPORT void WKPageCallAfterNextPresentationUpdate(WKPageRef page, void* context, WKPagePostPresentationUpdateFunction function);
158
159 WK_EXPORT bool WKPageGetResourceCachingDisabled(WKPageRef page);
160 WK_EXPORT void WKPageSetResourceCachingDisabled(WKPageRef page, bool disabled);
161
162 WK_EXPORT void WKPageRestoreFromSessionStateWithoutNavigation(WKPageRef page, WKTypeRef sessionState);
163
164 WK_EXPORT void WKPageSetIgnoresViewportScaleLimits(WKPageRef page, bool ignoresViewportScaleLimits);
165
166 WK_EXPORT pid_t WKPageGetProcessIdentifier(WKPageRef page);
167
168 #ifdef __cplusplus
169 }
170 #endif
171
172 #endif /* WKPagePrivate_h */