b204281febcfb6c8ad8d1accbfbb6c9edc958000
[WebKit.git] / WebKitLibraries / win / include / WebKitSystemInterface / WebKitSystemInterface.h
1 /*
2  * Copyright (C) 2007, 2008, 2009, 2013 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. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24  */
25
26 #ifndef WebKitSystemInterface_h
27 #define WebKitSystemInterface_h
28
29 struct CGAffineTransform;
30 struct CGPoint;
31 struct CGRect;
32 struct CGSize;
33 struct IDirect3DDevice9;
34 struct WKCACFContext;
35 struct WKCACFUpdateRectEnumerator;
36
37 typedef struct _CACFLayer* CACFLayerRef;
38 typedef const struct __CFArray* CFArrayRef;
39 typedef const struct __CFData* CFDataRef;
40 typedef const struct __CFString* CFStringRef;
41 typedef double CFTimeInterval;
42 typedef struct CGColor* CGColorRef;
43 typedef struct CGContext* CGContextRef;
44 typedef unsigned short CGFontIndex;
45 typedef struct CGFont* CGFontRef;
46 typedef CGFontIndex CGGlyph;
47 typedef struct CGImage* CGImageRef;
48 typedef struct CGPattern* CGPatternRef;
49 typedef wchar_t UChar;
50 typedef struct _CFURLResponse* CFURLResponseRef;
51 typedef struct OpaqueCFHTTPCookieStorage*  CFHTTPCookieStorageRef;
52 typedef struct __CFDictionary* CFMutableDictionaryRef;
53 typedef struct _CFURLRequest* CFMutableURLRequestRef;
54 typedef const struct _CFURLRequest* CFURLRequestRef;
55 typedef struct __CFHTTPMessage* CFHTTPMessageRef;
56 typedef const struct __CFNumber* CFNumberRef;
57 typedef struct __CFReadStream* CFReadStreamRef;
58 typedef const struct __CFURL* CFURLRef;
59 typedef struct _CFURLProtectionSpace* CFURLProtectionSpaceRef;
60 typedef struct tagLOGFONTW LOGFONTW;
61 typedef LOGFONTW LOGFONT;
62 typedef struct _CACFLayer *CACFLayerRef;
63 typedef struct __CVBuffer *CVBufferRef;
64 typedef CVBufferRef CVImageBufferRef;
65 typedef CVImageBufferRef CVPixelBufferRef;
66 typedef struct _CAImageQueue *CAImageQueueRef;
67 typedef unsigned long CFTypeID;
68 typedef struct _CFURLCredential* WKCFURLCredentialRef;
69 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
70 typedef const struct _CFURLCache* CFURLCacheRef;
71
72 void wkSetFontSmoothingLevel(int type);
73 int wkGetFontSmoothingLevel();
74 void wkSetFontSmoothingContrast(CGFloat);
75 CGFloat wkGetFontSmoothingContrast();
76 void wkSystemFontSmoothingChanged();
77 uint32_t wkSetFontSmoothingStyle(CGContextRef cg, bool fontAllowsSmoothing);
78 void wkRestoreFontSmoothingStyle(CGContextRef cg, uint32_t oldStyle);
79 void wkSetCGContextFontRenderingStyle(CGContextRef, bool isSystemFont, bool isPrinterFont, bool usePlatformNativeGlyphs);
80 void wkGetGlyphAdvances(CGFontRef, const CGAffineTransform&, bool isSystemFont, bool isPrinterFont, CGGlyph, CGSize& advance);
81 void wkGetGlyphs(CGFontRef, const UChar[], CGGlyph[], size_t count);
82 void wkSetUpFontCache(size_t s);
83
84 void wkSetBaseCTM(CGContextRef, CGAffineTransform);
85 void wkSetPatternPhaseInUserSpace(CGContextRef, CGPoint phasePoint);
86 CGAffineTransform wkGetUserToBaseCTM(CGContextRef);
87 bool wkCGContextIsPDFContext(CGContextRef);
88
89 void wkDrawFocusRing(CGContextRef, CGColorRef, float radius);
90
91 CFDictionaryRef wkGetSSLCertificateInfo(CFURLResponseRef);
92 CFDataRef wkGetSSLPeerCertificateData(CFDictionaryRef);
93 void* wkGetSSLPeerCertificateDataBytePtr(CFDictionaryRef);
94 void wkSetSSLPeerCertificateData(CFMutableDictionaryRef, CFDataRef);
95 void* wkGetSSLCertificateChainContext(CFDictionaryRef);
96 CFHTTPCookieStorageRef wkGetDefaultHTTPCookieStorage();
97 CFHTTPCookieStorageRef wkCreateInMemoryHTTPCookieStorage();
98 void wkSetCFURLRequestShouldContentSniff(CFMutableURLRequestRef, bool);
99 CFStringRef wkCopyFoundationCacheDirectory(CFURLStorageSessionRef);
100 void wkSetClientCertificateInSSLProperties(CFMutableDictionaryRef, CFDataRef);
101
102 CFArrayRef wkCFURLRequestCopyHTTPRequestBodyParts(CFURLRequestRef);
103 void wkCFURLRequestSetHTTPRequestBodyParts(CFMutableURLRequestRef, CFArrayRef bodyParts);
104
105 CFURLStorageSessionRef wkCreatePrivateStorageSession(CFStringRef identifier, CFURLStorageSessionRef defaultStorageSession);
106 void wkSetRequestStorageSession(CFURLStorageSessionRef, CFMutableURLRequestRef);
107 CFURLCacheRef wkCopyURLCache(CFURLStorageSessionRef);
108 CFHTTPCookieStorageRef wkCopyHTTPCookieStorage(CFURLStorageSessionRef);
109 CFDataRef wkCopySerializedDefaultStorageSession();
110 CFURLStorageSessionRef wkDeserializeStorageSession(CFDataRef);
111
112 CFArrayRef wkCFURLCacheCopyAllHostNamesInPersistentStore();
113 void wkCFURLCacheDeleteHostNamesInPersistentStore(CFArrayRef hostNames);
114
115 unsigned wkInitializeMaximumHTTPConnectionCountPerHost(unsigned preferredConnectionCount);
116 int wkGetHTTPRequestPriority(CFURLRequestRef);
117 void wkSetHTTPRequestMaximumPriority(int maximumPriority);
118 void wkSetHTTPRequestPriority(CFURLRequestRef, int priority);
119 void wkHTTPRequestEnablePipelining(CFURLRequestRef);
120
121 void wkSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
122 void wkSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString);
123 CFHTTPMessageRef wkCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL, CFStringRef proxyHost, CFNumberRef proxyPort);
124
125 WKCFURLCredentialRef wkCopyCredentialFromCFPersistentStorage(CFURLProtectionSpaceRef protectionSpace);
126
127 CFStringRef wkCFNetworkErrorGetLocalizedDescription(CFIndex errorCode);
128
129
130 enum wkCAImageQueueFlags {
131     kWKCAImageQueueAsync = 1U << 0,
132     kWKCAImageQueueFill = 1U << 1,
133     kWKCAImageQueueProtected = 1U << 2,
134     kWKCAImageQueueUseCleanAperture = 1U << 3,
135     kWKCAImageQueueUseAspectRatio = 1U << 4,
136     kWKCAImageQueueLowQualityColor = 1U << 5,
137 };
138
139 enum wkWKCAImageQueueImageType {
140     kWKCAImageQueueNil = 1,
141     kWKCAImageQueueSurface,
142     kWKCAImageQueueBuffer,
143     kWKCAImageQueueIOSurface,
144 };
145
146 enum wkWKCAImageQueueImageFlags {
147     kWKCAImageQueueOpaque = 1U << 0,
148     kWKCAImageQueueFlush = 1U << 1,
149     kWKCAImageQueueWillFlush = 1U << 2,
150     kWKCAImageQueueFlipped = 1U << 3,
151     kWKCAImageQueueWaitGPU = 1U << 4,
152 };
153
154 typedef void (*wkCAImageQueueReleaseCallback)(unsigned int type, uint64_t id, void *info);
155 CAImageQueueRef wkCAImageQueueCreate(uint32_t width, uint32_t height, uint32_t capacity);
156 void wkCAImageQueueInvalidate(CAImageQueueRef iq);
157 size_t wkCAImageQueueCollect(CAImageQueueRef iq);
158 bool wkCAImageQueueInsertImage(CAImageQueueRef iq, CFTimeInterval t, unsigned int type, uint64_t id, uint32_t flags, wkCAImageQueueReleaseCallback release, void *info);
159 uint64_t wkCAImageQueueRegisterPixelBuffer(CAImageQueueRef iq, void *data, size_t data_size, size_t rowbytes, size_t width, size_t height, OSType pixel_format, CFDictionaryRef attachments, uint32_t flags);
160 void wkCAImageQueueSetFlags(CAImageQueueRef iq, uint32_t mask, uint32_t flags);
161 uint32_t wkCAImageQueueGetFlags(CAImageQueueRef iq);
162 CFTypeID wkCAImageQueueGetTypeID(void);
163
164 WKCACFContext* wkCACFContextCreate();
165 void wkCACFContextDestroy(WKCACFContext*);
166
167 void wkCACFContextSetLayer(WKCACFContext*, CACFLayerRef);
168 void wkCACFContextFlush(WKCACFContext*);
169
170 CFTimeInterval wkCACFContextGetLastCommitTime(WKCACFContext*);
171 CFTimeInterval wkCACFContextGetNextUpdateTime(WKCACFContext*);
172
173 void* wkCACFContextGetUserData(WKCACFContext*);
174 void wkCACFContextSetUserData(WKCACFContext*, void*);
175
176 void* wkCACFLayerGetContextUserData(CACFLayerRef);
177
178 void wkCACFContextSetD3DDevice(WKCACFContext*, IDirect3DDevice9*);
179 void wkCACFContextReleaseD3DResources(WKCACFContext*);
180
181 bool wkCACFContextBeginUpdate(WKCACFContext*, void* buffer, size_t bufferSize, CFTimeInterval time, const CGRect& bounds, const CGRect dirtyRects[], size_t dirtyRectCount);
182 void wkCACFContextRenderUpdate(WKCACFContext*);
183 void wkCACFContextFinishUpdate(WKCACFContext*);
184 void wkCACFContextAddUpdateRect(WKCACFContext*, const CGRect&);
185
186 WKCACFUpdateRectEnumerator* wkCACFContextCopyUpdateRectEnumerator(WKCACFContext*);
187 const CGRect* wkCACFUpdateRectEnumeratorNextRect(WKCACFUpdateRectEnumerator*);
188 void wkCACFUpdateRectEnumeratorRelease(WKCACFUpdateRectEnumerator*);
189
190 typedef enum {
191     wkPatternTilingNoDistortion,
192     wkPatternTilingConstantSpacingMinimalDistortion,
193     wkPatternTilingConstantSpacing
194 } wkPatternTiling;
195
196 CGPatternRef wkCGPatternCreateWithImageAndTransform(CGImageRef image, CGAffineTransform transform, int tiling);
197
198 bool wkCGContextDrawsWithCorrectShadowOffsets(CGContextRef);
199
200 CFDictionaryRef wkCFURLRequestCreateSerializableRepresentation(CFURLRequestRef cfRequest, CFTypeRef tokenNull);
201 CFURLRequestRef wkCFURLRequestCreateFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
202 CFDictionaryRef wkCFURLResponseCreateSerializableRepresentation(CFURLResponseRef cfResponse, CFTypeRef tokenNull);
203 CFURLResponseRef wkCFURLResponseCreateFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
204
205 typedef void (*wkQuickTimeMIMETypeCallBack)(const char* mimeType);
206 void wkGetQuickTimeMIMETypeList(wkQuickTimeMIMETypeCallBack);
207
208 typedef enum {
209     WKMediaUIPartFullscreenButton   = 0,
210     WKMediaUIPartMuteButton,
211     WKMediaUIPartPlayButton,
212     WKMediaUIPartSeekBackButton,
213     WKMediaUIPartSeekForwardButton,
214     WKMediaUIPartTimelineSlider,
215     WKMediaUIPartTimelineSliderThumb,
216     WKMediaUIPartRewindButton,
217     WKMediaUIPartSeekToRealtimeButton,
218     WKMediaUIPartShowClosedCaptionsButton,
219     WKMediaUIPartHideClosedCaptionsButton,
220     WKMediaUIPartUnMuteButton,
221     WKMediaUIPartPauseButton,
222     WKMediaUIPartBackground,
223     WKMediaUIPartCurrentTimeDisplay,
224     WKMediaUIPartTimeRemainingDisplay,
225     WKMediaUIPartStatusDisplay,
226     WKMediaUIPartControlsPanel,
227     WKMediaUIPartVolumeSliderContainer,
228     WKMediaUIPartVolumeSlider,
229     WKMediaUIPartVolumeSliderThumb,
230     WKMediaUIPartFullScreenVolumeSlider,
231     WKMediaUIPartFullScreenVolumeSliderThumb,
232     WKMediaUIPartVolumeSliderMuteButton,
233     WKMediaUIPartTextTrackDisplayContainer,
234     WKMediaUIPartTextTrackDisplay,
235     WKMediaUIPartExitFullscreenButton,
236 } WKMediaUIPart;
237
238 typedef enum {
239     WKMediaControllerFlagDisabled = 1 << 0,
240     WKMediaControllerFlagPressed = 1 << 1,
241     WKMediaControllerFlagDrawEndCaps = 1 << 3,
242     WKMediaControllerFlagFocused = 1 << 4
243 } WKMediaControllerThemeState;
244
245 #ifdef __cplusplus
246 extern "C" {
247 #endif
248
249 bool WKHitTestMediaUIPart(int part, CGRect bounds, CGPoint point);
250 void WKMeasureMediaUIPart(int part, CGRect *bounds, CGSize *naturalSize);
251 void WKDrawMediaUIPart(int part, CGContextRef context, CGRect rect, unsigned state);
252 void WKDrawMediaSliderTrack(CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration, unsigned state);
253
254 #ifdef __cplusplus
255 }
256 #endif
257
258 #endif // WebKitSystemInterface_h