2 * Copyright (C) 2007, 2008, 2009 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 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.
26 #ifndef WebKitSystemInterface_h
27 #define WebKitSystemInterface_h
29 struct CGAffineTransform;
33 struct IDirect3DDevice9;
35 struct WKCACFUpdateRectEnumerator;
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;
69 void wkSetFontSmoothingLevel(int type);
70 int wkGetFontSmoothingLevel();
71 void wkSetFontSmoothingContrast(CGFloat);
72 CGFloat wkGetFontSmoothingContrast();
73 void wkSystemFontSmoothingChanged();
74 uint32_t wkSetFontSmoothingStyle(CGContextRef cg, bool fontAllowsSmoothing);
75 void wkRestoreFontSmoothingStyle(CGContextRef cg, uint32_t oldStyle);
76 void wkSetCGContextFontRenderingStyle(CGContextRef, bool isSystemFont, bool isPrinterFont, bool usePlatformNativeGlyphs);
77 void wkGetGlyphAdvances(CGFontRef, const CGAffineTransform&, bool isSystemFont, bool isPrinterFont, CGGlyph, CGSize& advance);
78 void wkGetGlyphs(CGFontRef, const UChar[], CGGlyph[], size_t count);
79 void wkSetUpFontCache(size_t s);
81 void wkSetPatternBaseCTM(CGContextRef, CGAffineTransform);
82 void wkSetPatternPhaseInUserSpace(CGContextRef, CGPoint phasePoint);
83 CGAffineTransform wkGetUserToBaseCTM(CGContextRef);
85 void wkDrawFocusRing(CGContextRef, CGColorRef, float radius);
87 CFDictionaryRef wkGetSSLCertificateInfo(CFURLResponseRef);
88 void* wkGetSSLPeerCertificateData(CFDictionaryRef);
89 void* wkGetSSLCertificateChainContext(CFDictionaryRef);
90 CFHTTPCookieStorageRef wkGetDefaultHTTPCookieStorage();
91 CFHTTPCookieStorageRef wkCreatePrivateHTTPCookieStorage();
92 void wkSetCFURLRequestShouldContentSniff(CFMutableURLRequestRef, bool);
93 CFStringRef wkCopyFoundationCacheDirectory();
94 void wkSetClientCertificateInSSLProperties(CFMutableDictionaryRef, CFDataRef);
96 CFArrayRef wkCFURLRequestCopyHTTPRequestBodyParts(CFURLRequestRef);
97 void wkCFURLRequestSetHTTPRequestBodyParts(CFMutableURLRequestRef, CFArrayRef bodyParts);
99 CFURLStorageSessionRef wkCreatePrivateStorageSession(CFStringRef identifier);
100 void wkSetRequestStorageSession(CFURLStorageSessionRef, CFMutableURLRequestRef);
102 CFArrayRef wkCFURLCacheCopyAllHostNamesInPersistentStore();
103 void wkCFURLCacheDeleteHostNamesInPersistentStore(CFArrayRef hostNames);
105 unsigned wkInitializeMaximumHTTPConnectionCountPerHost(unsigned preferredConnectionCount);
107 void wkSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
108 void wkSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString);
109 CFHTTPMessageRef wkCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL);
111 WKCFURLCredentialRef wkCopyCredentialFromCFPersistentStorage(CFURLProtectionSpaceRef protectionSpace);
113 CFStringRef wkCFNetworkErrorGetLocalizedDescription(CFIndex errorCode);
116 enum wkCAImageQueueFlags {
117 kWKCAImageQueueAsync = 1U << 0,
118 kWKCAImageQueueFill = 1U << 1,
119 kWKCAImageQueueProtected = 1U << 2,
120 kWKCAImageQueueUseCleanAperture = 1U << 3,
121 kWKCAImageQueueUseAspectRatio = 1U << 4,
122 kWKCAImageQueueLowQualityColor = 1U << 5,
125 enum wkWKCAImageQueueImageType {
126 kWKCAImageQueueNil = 1,
127 kWKCAImageQueueSurface,
128 kWKCAImageQueueBuffer,
129 kWKCAImageQueueIOSurface,
132 enum wkWKCAImageQueueImageFlags {
133 kWKCAImageQueueOpaque = 1U << 0,
134 kWKCAImageQueueFlush = 1U << 1,
135 kWKCAImageQueueWillFlush = 1U << 2,
136 kWKCAImageQueueFlipped = 1U << 3,
137 kWKCAImageQueueWaitGPU = 1U << 4,
140 typedef void (*wkCAImageQueueReleaseCallback)(unsigned int type, uint64_t id, void *info);
141 CAImageQueueRef wkCAImageQueueCreate(uint32_t width, uint32_t height, uint32_t capacity);
142 void wkCAImageQueueInvalidate(CAImageQueueRef iq);
143 size_t wkCAImageQueueCollect(CAImageQueueRef iq);
144 bool wkCAImageQueueInsertImage(CAImageQueueRef iq, CFTimeInterval t, unsigned int type, uint64_t id, uint32_t flags, wkCAImageQueueReleaseCallback release, void *info);
145 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);
146 void wkCAImageQueueSetFlags(CAImageQueueRef iq, uint32_t mask, uint32_t flags);
147 uint32_t wkCAImageQueueGetFlags(CAImageQueueRef iq);
148 CFTypeID wkCAImageQueueGetTypeID(void);
150 WKCACFContext* wkCACFContextCreate();
151 void wkCACFContextDestroy(WKCACFContext*);
153 void wkCACFContextSetLayer(WKCACFContext*, CACFLayerRef);
154 void wkCACFContextFlush(WKCACFContext*);
156 CFTimeInterval wkCACFContextGetLastCommitTime(WKCACFContext*);
157 CFTimeInterval wkCACFContextGetNextUpdateTime(WKCACFContext*);
159 void* wkCACFContextGetUserData(WKCACFContext*);
160 void wkCACFContextSetUserData(WKCACFContext*, void*);
162 void* wkCACFLayerGetContextUserData(CACFLayerRef);
164 void wkCACFContextSetD3DDevice(WKCACFContext*, IDirect3DDevice9*);
165 void wkCACFContextReleaseD3DResources(WKCACFContext*);
167 bool wkCACFContextBeginUpdate(WKCACFContext*, void* buffer, size_t bufferSize, CFTimeInterval time, const CGRect& bounds, const CGRect dirtyRects[], size_t dirtyRectCount);
168 void wkCACFContextRenderUpdate(WKCACFContext*);
169 void wkCACFContextFinishUpdate(WKCACFContext*);
170 void wkCACFContextAddUpdateRect(WKCACFContext*, const CGRect&);
172 WKCACFUpdateRectEnumerator* wkCACFContextCopyUpdateRectEnumerator(WKCACFContext*);
173 const CGRect* wkCACFUpdateRectEnumeratorNextRect(WKCACFUpdateRectEnumerator*);
174 void wkCACFUpdateRectEnumeratorRelease(WKCACFUpdateRectEnumerator*);
176 CFDictionaryRef wkCFURLRequestCreateSerializableRepresentation(CFURLRequestRef cfRequest, CFTypeRef tokenNull);
177 CFURLRequestRef wkCFURLRequestCreateFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
178 CFDictionaryRef wkCFURLResponseCreateSerializableRepresentation(CFURLResponseRef cfResponse, CFTypeRef tokenNull);
179 CFURLResponseRef wkCFURLResponseCreateFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
181 typedef void (*wkQuickTimeMIMETypeCallBack)(const char* mimeType);
182 void wkGetQuickTimeMIMETypeList(wkQuickTimeMIMETypeCallBack);
185 WKMediaUIPartFullscreenButton = 0,
186 WKMediaUIPartMuteButton,
187 WKMediaUIPartPlayButton,
188 WKMediaUIPartSeekBackButton,
189 WKMediaUIPartSeekForwardButton,
190 WKMediaUIPartTimelineSlider,
191 WKMediaUIPartTimelineSliderThumb,
192 WKMediaUIPartRewindButton,
193 WKMediaUIPartSeekToRealtimeButton,
194 WKMediaUIPartShowClosedCaptionsButton,
195 WKMediaUIPartHideClosedCaptionsButton,
196 WKMediaUIPartUnMuteButton,
197 WKMediaUIPartPauseButton,
198 WKMediaUIPartBackground,
199 WKMediaUIPartCurrentTimeDisplay,
200 WKMediaUIPartTimeRemainingDisplay,
201 WKMediaUIPartStatusDisplay,
202 WKMediaUIPartControlsPanel,
203 WKMediaUIPartVolumeSliderContainer,
204 WKMediaUIPartVolumeSlider,
205 WKMediaUIPartVolumeSliderThumb
209 WKMediaControllerThemeClassic = 1,
210 WKMediaControllerThemeQuickTime = 2
211 } WKMediaControllerThemeStyle;
214 WKMediaControllerFlagDisabled = 1 << 0,
215 WKMediaControllerFlagPressed = 1 << 1,
216 WKMediaControllerFlagDrawEndCaps = 1 << 3,
217 WKMediaControllerFlagFocused = 1 << 4
218 } WKMediaControllerThemeState;
224 bool WKMediaControllerThemeAvailable(int themeStyle);
225 bool WKHitTestMediaUIPart(int part, int themeStyle, CGRect bounds, CGPoint point);
226 void WKMeasureMediaUIPart(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
227 void WKDrawMediaUIPart(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
228 void WKDrawMediaSliderTrack(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration, unsigned state);
234 #endif // WebKitSystemInterface_h