6cf90d8237041bfa5b9ea53c0d4b0fac26b0513e
[WebKit-https.git] / WebKitLibraries / win / include / WebKitSystemInterface / WebKitSystemInterface.h
1 /*
2  * Copyright (C) 2007, 2008, 2009 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 COMPUTER, 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 COMPUTER, 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 wchar_t UChar;
48 typedef struct _CFURLResponse* CFURLResponseRef;
49 typedef struct OpaqueCFHTTPCookieStorage*  CFHTTPCookieStorageRef;
50 typedef struct __CFDictionary* CFMutableDictionaryRef;
51 typedef struct _CFURLRequest* CFMutableURLRequestRef;
52 typedef const struct _CFURLRequest* CFURLRequestRef;
53 typedef struct __CFHTTPMessage* CFHTTPMessageRef;
54 typedef const struct __CFNumber* CFNumberRef;
55 typedef struct __CFReadStream* CFReadStreamRef;
56 typedef const struct __CFURL* CFURLRef;
57 typedef struct _CFURLProtectionSpace* CFURLProtectionSpaceRef;
58 typedef struct tagLOGFONTW LOGFONTW;
59 typedef LOGFONTW LOGFONT;
60 typedef struct _CACFLayer *CACFLayerRef;
61 typedef struct __CVBuffer *CVBufferRef;
62 typedef CVBufferRef CVImageBufferRef;
63 typedef CVImageBufferRef CVPixelBufferRef;
64 typedef struct _CAImageQueue *CAImageQueueRef;
65 typedef unsigned long CFTypeID;
66 typedef struct _CFURLCredential* WKCFURLCredentialRef;
67 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
68 typedef const struct _CFURLCache* CFURLCacheRef;
69
70 void wkSetFontSmoothingLevel(int type);
71 int wkGetFontSmoothingLevel();
72 void wkSetFontSmoothingContrast(CGFloat);
73 CGFloat wkGetFontSmoothingContrast();
74 void wkSystemFontSmoothingChanged();
75 uint32_t wkSetFontSmoothingStyle(CGContextRef cg, bool fontAllowsSmoothing);
76 void wkRestoreFontSmoothingStyle(CGContextRef cg, uint32_t oldStyle);
77 void wkSetCGContextFontRenderingStyle(CGContextRef, bool isSystemFont, bool isPrinterFont, bool usePlatformNativeGlyphs);
78 void wkGetGlyphAdvances(CGFontRef, const CGAffineTransform&, bool isSystemFont, bool isPrinterFont, CGGlyph, CGSize& advance);
79 void wkGetGlyphs(CGFontRef, const UChar[], CGGlyph[], size_t count);
80 void wkSetUpFontCache(size_t s);
81
82 void wkSetPatternBaseCTM(CGContextRef, CGAffineTransform);
83 void wkSetPatternPhaseInUserSpace(CGContextRef, CGPoint phasePoint);
84 CGAffineTransform wkGetUserToBaseCTM(CGContextRef);
85
86 void wkDrawFocusRing(CGContextRef, CGColorRef, float radius);
87
88 CFDictionaryRef wkGetSSLCertificateInfo(CFURLResponseRef);
89 CFDataRef wkGetSSLPeerCertificateData(CFDictionaryRef);
90 void* wkGetSSLPeerCertificateDataBytePtr(CFDictionaryRef);
91 void wkSetSSLPeerCertificateData(CFMutableDictionaryRef, CFDataRef);
92 void* wkGetSSLCertificateChainContext(CFDictionaryRef);
93 CFHTTPCookieStorageRef wkGetDefaultHTTPCookieStorage();
94 CFHTTPCookieStorageRef wkCreateInMemoryHTTPCookieStorage();
95 void wkSetCFURLRequestShouldContentSniff(CFMutableURLRequestRef, bool);
96 CFStringRef wkCopyFoundationCacheDirectory(CFURLStorageSessionRef);
97 void wkSetClientCertificateInSSLProperties(CFMutableDictionaryRef, CFDataRef);
98
99 CFArrayRef wkCFURLRequestCopyHTTPRequestBodyParts(CFURLRequestRef);
100 void wkCFURLRequestSetHTTPRequestBodyParts(CFMutableURLRequestRef, CFArrayRef bodyParts);
101
102 CFURLStorageSessionRef wkCreatePrivateStorageSession(CFStringRef identifier);
103 void wkSetRequestStorageSession(CFURLStorageSessionRef, CFMutableURLRequestRef);
104 CFURLCacheRef wkCopyURLCache(CFURLStorageSessionRef);
105 CFHTTPCookieStorageRef wkCopyHTTPCookieStorage(CFURLStorageSessionRef);
106 CFDataRef wkCopySerializedDefaultStorageSession();
107 CFURLStorageSessionRef wkDeserializeStorageSession(CFDataRef);
108
109 CFArrayRef wkCFURLCacheCopyAllHostNamesInPersistentStore();
110 void wkCFURLCacheDeleteHostNamesInPersistentStore(CFArrayRef hostNames);
111
112 unsigned wkInitializeMaximumHTTPConnectionCountPerHost(unsigned preferredConnectionCount);
113 int wkGetHTTPPipeliningPriority(CFURLRequestRef);
114 void wkSetHTTPPipeliningMaximumPriority(int maximumPriority);
115 void wkSetHTTPPipeliningPriority(CFURLRequestRef, int priority);
116
117 void wkSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
118 void wkSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString);
119 CFHTTPMessageRef wkCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL);
120
121 WKCFURLCredentialRef wkCopyCredentialFromCFPersistentStorage(CFURLProtectionSpaceRef protectionSpace);
122
123 CFStringRef wkCFNetworkErrorGetLocalizedDescription(CFIndex errorCode);
124
125
126 enum wkCAImageQueueFlags {
127     kWKCAImageQueueAsync = 1U << 0,
128     kWKCAImageQueueFill = 1U << 1,
129     kWKCAImageQueueProtected = 1U << 2,
130     kWKCAImageQueueUseCleanAperture = 1U << 3,
131     kWKCAImageQueueUseAspectRatio = 1U << 4,
132     kWKCAImageQueueLowQualityColor = 1U << 5,
133 };
134
135 enum wkWKCAImageQueueImageType {
136     kWKCAImageQueueNil = 1,
137     kWKCAImageQueueSurface,
138     kWKCAImageQueueBuffer,
139     kWKCAImageQueueIOSurface,
140 };
141
142 enum wkWKCAImageQueueImageFlags {
143     kWKCAImageQueueOpaque = 1U << 0,
144     kWKCAImageQueueFlush = 1U << 1,
145     kWKCAImageQueueWillFlush = 1U << 2,
146     kWKCAImageQueueFlipped = 1U << 3,
147     kWKCAImageQueueWaitGPU = 1U << 4,
148 };
149
150 typedef void (*wkCAImageQueueReleaseCallback)(unsigned int type, uint64_t id, void *info);
151 CAImageQueueRef wkCAImageQueueCreate(uint32_t width, uint32_t height, uint32_t capacity);
152 void wkCAImageQueueInvalidate(CAImageQueueRef iq);
153 size_t wkCAImageQueueCollect(CAImageQueueRef iq);
154 bool wkCAImageQueueInsertImage(CAImageQueueRef iq, CFTimeInterval t, unsigned int type, uint64_t id, uint32_t flags, wkCAImageQueueReleaseCallback release, void *info);
155 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);
156 void wkCAImageQueueSetFlags(CAImageQueueRef iq, uint32_t mask, uint32_t flags);
157 uint32_t wkCAImageQueueGetFlags(CAImageQueueRef iq);
158 CFTypeID wkCAImageQueueGetTypeID(void);
159
160 WKCACFContext* wkCACFContextCreate();
161 void wkCACFContextDestroy(WKCACFContext*);
162
163 void wkCACFContextSetLayer(WKCACFContext*, CACFLayerRef);
164 void wkCACFContextFlush(WKCACFContext*);
165
166 CFTimeInterval wkCACFContextGetLastCommitTime(WKCACFContext*);
167 CFTimeInterval wkCACFContextGetNextUpdateTime(WKCACFContext*);
168
169 void* wkCACFContextGetUserData(WKCACFContext*);
170 void wkCACFContextSetUserData(WKCACFContext*, void*);
171
172 void* wkCACFLayerGetContextUserData(CACFLayerRef);
173
174 void wkCACFContextSetD3DDevice(WKCACFContext*, IDirect3DDevice9*);
175 void wkCACFContextReleaseD3DResources(WKCACFContext*);
176
177 bool wkCACFContextBeginUpdate(WKCACFContext*, void* buffer, size_t bufferSize, CFTimeInterval time, const CGRect& bounds, const CGRect dirtyRects[], size_t dirtyRectCount);
178 void wkCACFContextRenderUpdate(WKCACFContext*);
179 void wkCACFContextFinishUpdate(WKCACFContext*);
180 void wkCACFContextAddUpdateRect(WKCACFContext*, const CGRect&);
181
182 WKCACFUpdateRectEnumerator* wkCACFContextCopyUpdateRectEnumerator(WKCACFContext*);
183 const CGRect* wkCACFUpdateRectEnumeratorNextRect(WKCACFUpdateRectEnumerator*);
184 void wkCACFUpdateRectEnumeratorRelease(WKCACFUpdateRectEnumerator*);
185
186 CFDictionaryRef wkCFURLRequestCreateSerializableRepresentation(CFURLRequestRef cfRequest, CFTypeRef tokenNull);
187 CFURLRequestRef wkCFURLRequestCreateFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
188 CFDictionaryRef wkCFURLResponseCreateSerializableRepresentation(CFURLResponseRef cfResponse, CFTypeRef tokenNull);
189 CFURLResponseRef wkCFURLResponseCreateFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
190
191 typedef void (*wkQuickTimeMIMETypeCallBack)(const char* mimeType);
192 void wkGetQuickTimeMIMETypeList(wkQuickTimeMIMETypeCallBack);
193
194 typedef enum {
195     WKMediaUIPartFullscreenButton   = 0,
196     WKMediaUIPartMuteButton,
197     WKMediaUIPartPlayButton,
198     WKMediaUIPartSeekBackButton,
199     WKMediaUIPartSeekForwardButton,
200     WKMediaUIPartTimelineSlider,
201     WKMediaUIPartTimelineSliderThumb,
202     WKMediaUIPartRewindButton,
203     WKMediaUIPartSeekToRealtimeButton,
204     WKMediaUIPartShowClosedCaptionsButton,
205     WKMediaUIPartHideClosedCaptionsButton,
206     WKMediaUIPartUnMuteButton,
207     WKMediaUIPartPauseButton,
208     WKMediaUIPartBackground,
209     WKMediaUIPartCurrentTimeDisplay,
210     WKMediaUIPartTimeRemainingDisplay,
211     WKMediaUIPartStatusDisplay,
212     WKMediaUIPartControlsPanel,
213     WKMediaUIPartVolumeSliderContainer,
214     WKMediaUIPartVolumeSlider,
215     WKMediaUIPartVolumeSliderThumb
216 } WKMediaUIPart;
217
218 typedef enum {
219     WKMediaControllerThemeClassic   = 1,
220     WKMediaControllerThemeQuickTime = 2
221 } WKMediaControllerThemeStyle;
222
223 typedef enum {
224     WKMediaControllerFlagDisabled = 1 << 0,
225     WKMediaControllerFlagPressed = 1 << 1,
226     WKMediaControllerFlagDrawEndCaps = 1 << 3,
227     WKMediaControllerFlagFocused = 1 << 4
228 } WKMediaControllerThemeState;
229
230 #ifdef __cplusplus
231 extern "C" {
232 #endif
233
234 bool WKMediaControllerThemeAvailable(int themeStyle);
235 bool WKHitTestMediaUIPart(int part, int themeStyle, CGRect bounds, CGPoint point);
236 void WKMeasureMediaUIPart(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
237 void WKDrawMediaUIPart(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
238 void WKDrawMediaSliderTrack(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration, unsigned state);
239
240 #ifdef __cplusplus
241 }
242 #endif
243
244 #endif // WebKitSystemInterface_h