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 #include <CFNetwork/CFURLCredentialPriv.h>
31 struct CGAffineTransform;
35 struct IDirect3DDevice9;
37 struct WKCACFUpdateRectEnumerator;
39 typedef struct _CACFLayer* CACFLayerRef;
40 typedef const struct __CFData* CFDataRef;
41 typedef const struct __CFString* CFStringRef;
42 typedef double CFTimeInterval;
43 typedef struct CGColor* CGColorRef;
44 typedef struct CGContext* CGContextRef;
45 typedef unsigned short CGFontIndex;
46 typedef struct CGFont* CGFontRef;
47 typedef CGFontIndex CGGlyph;
48 typedef wchar_t UChar;
49 typedef struct _CFURLResponse* CFURLResponseRef;
50 typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
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;
67 void wkSetFontSmoothingLevel(int type);
68 int wkGetFontSmoothingLevel();
69 void wkSetFontSmoothingContrast(CGFloat);
70 CGFloat wkGetFontSmoothingContrast();
71 void wkSystemFontSmoothingChanged();
72 uint32_t wkSetFontSmoothingStyle(CGContextRef cg, bool fontAllowsSmoothing);
73 void wkRestoreFontSmoothingStyle(CGContextRef cg, uint32_t oldStyle);
74 void wkSetCGContextFontRenderingStyle(CGContextRef, bool isSystemFont, bool isPrinterFont, bool usePlatformNativeGlyphs);
75 void wkGetGlyphAdvances(CGFontRef, const CGAffineTransform&, bool isSystemFont, bool isPrinterFont, CGGlyph, CGSize& advance);
76 void wkGetGlyphs(CGFontRef, const UChar[], CGGlyph[], size_t count);
77 void wkSetUpFontCache(size_t s);
79 void wkSetPatternBaseCTM(CGContextRef, CGAffineTransform);
80 void wkSetPatternPhaseInUserSpace(CGContextRef, CGPoint phasePoint);
81 CGAffineTransform wkGetUserToBaseCTM(CGContextRef);
83 void wkDrawFocusRing(CGContextRef, CGColorRef, float radius);
85 CFDictionaryRef wkGetSSLCertificateInfo(CFURLResponseRef);
86 void* wkGetSSLPeerCertificateData(CFDictionaryRef);
87 void* wkGetSSLCertificateChainContext(CFDictionaryRef);
88 CFHTTPCookieStorageRef wkGetDefaultHTTPCookieStorage();
89 void wkSetCFURLRequestShouldContentSniff(CFMutableURLRequestRef, bool);
90 CFStringRef wkCopyFoundationCacheDirectory();
91 void wkSetClientCertificateInSSLProperties(CFMutableDictionaryRef, CFDataRef);
93 CFArrayRef wkCFURLRequestCopyHTTPRequestBodyParts(CFURLRequestRef);
94 void wkCFURLRequestSetHTTPRequestBodyParts(CFMutableURLRequestRef, CFArrayRef bodyParts);
96 unsigned wkInitializeMaximumHTTPConnectionCountPerHost(unsigned preferredConnectionCount);
98 void wkSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
99 void wkSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString);
100 CFHTTPMessageRef wkCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL);
102 CFURLCredentialRef wkCopyCredentialFromCFPersistentStorage(CFURLProtectionSpaceRef protectionSpace);
104 CFStringRef wkCFNetworkErrorGetLocalizedDescription(CFIndex errorCode);
107 enum wkCAImageQueueFlags {
108 kWKCAImageQueueAsync = 1U << 0,
109 kWKCAImageQueueFill = 1U << 1,
110 kWKCAImageQueueProtected = 1U << 2,
111 kWKCAImageQueueUseCleanAperture = 1U << 3,
112 kWKCAImageQueueUseAspectRatio = 1U << 4,
113 kWKCAImageQueueLowQualityColor = 1U << 5,
116 enum wkWKCAImageQueueImageType {
117 kWKCAImageQueueNil = 1,
118 kWKCAImageQueueSurface,
119 kWKCAImageQueueBuffer,
120 kWKCAImageQueueIOSurface,
123 enum wkWKCAImageQueueImageFlags {
124 kWKCAImageQueueOpaque = 1U << 0,
125 kWKCAImageQueueFlush = 1U << 1,
126 kWKCAImageQueueWillFlush = 1U << 2,
127 kWKCAImageQueueFlipped = 1U << 3,
128 kWKCAImageQueueWaitGPU = 1U << 4,
131 typedef void (*wkCAImageQueueReleaseCallback)(unsigned int type, uint64_t id, void *info);
132 CAImageQueueRef wkCAImageQueueCreate(uint32_t width, uint32_t height, uint32_t capacity);
133 void wkCAImageQueueInvalidate(CAImageQueueRef iq);
134 size_t wkCAImageQueueCollect(CAImageQueueRef iq);
135 bool wkCAImageQueueInsertImage(CAImageQueueRef iq, CFTimeInterval t, unsigned int type, uint64_t id, uint32_t flags, wkCAImageQueueReleaseCallback release, void *info);
136 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);
137 void wkCAImageQueueSetFlags(CAImageQueueRef iq, uint32_t mask, uint32_t flags);
138 uint32_t wkCAImageQueueGetFlags(CAImageQueueRef iq);
139 CFTypeID wkCAImageQueueGetTypeID(void);
141 WKCACFContext* wkCACFContextCreate();
142 void wkCACFContextDestroy(WKCACFContext*);
144 void wkCACFContextSetLayer(WKCACFContext*, CACFLayerRef);
145 void wkCACFContextFlush(WKCACFContext*);
147 void wkCACFContextInitializeD3DDevice(WKCACFContext*, IDirect3DDevice9*);
148 void wkCACFContextReleaseD3DResources(WKCACFContext*);
150 bool wkCACFContextBeginUpdate(WKCACFContext*, void* buffer, size_t bufferSize, CFTimeInterval time, const CGRect& bounds, const CGRect dirtyRects[], size_t dirtyRectCount);
151 void wkCACFContextRenderUpdate(WKCACFContext*);
152 void wkCACFContextFinishUpdate(WKCACFContext*);
153 void wkCACFContextAddUpdateRect(WKCACFContext*, const CGRect&);
155 WKCACFUpdateRectEnumerator* wkCACFContextCopyUpdateRectEnumerator(WKCACFContext*);
156 const CGRect* wkCACFUpdateRectEnumeratorNextRect(WKCACFUpdateRectEnumerator*);
157 void wkCACFUpdateRectEnumeratorRelease(WKCACFUpdateRectEnumerator*);
160 WKMediaUIPartFullscreenButton = 0,
161 WKMediaUIPartMuteButton,
162 WKMediaUIPartPlayButton,
163 WKMediaUIPartSeekBackButton,
164 WKMediaUIPartSeekForwardButton,
165 WKMediaUIPartTimelineSlider,
166 WKMediaUIPartTimelineSliderThumb,
167 WKMediaUIPartRewindButton,
168 WKMediaUIPartSeekToRealtimeButton,
169 WKMediaUIPartShowClosedCaptionsButton,
170 WKMediaUIPartHideClosedCaptionsButton,
171 WKMediaUIPartUnMuteButton,
172 WKMediaUIPartPauseButton,
173 WKMediaUIPartBackground,
174 WKMediaUIPartCurrentTimeDisplay,
175 WKMediaUIPartTimeRemainingDisplay,
176 WKMediaUIPartStatusDisplay,
177 WKMediaUIPartControlsPanel,
178 WKMediaUIPartVolumeSliderContainer,
179 WKMediaUIPartVolumeSlider,
180 WKMediaUIPartVolumeSliderThumb
184 WKMediaControllerThemeClassic = 1,
185 WKMediaControllerThemeQuickTime = 2
186 } WKMediaControllerThemeStyle;
189 WKMediaControllerFlagDisabled = 1 << 0,
190 WKMediaControllerFlagPressed = 1 << 1,
191 WKMediaControllerFlagDrawEndCaps = 1 << 3,
192 WKMediaControllerFlagFocused = 1 << 4
193 } WKMediaControllerThemeState;
199 bool WKMediaControllerThemeAvailable(int themeStyle);
200 bool WKHitTestMediaUIPart(int part, int themeStyle, CGRect bounds, CGPoint point);
201 void WKMeasureMediaUIPart(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
202 void WKDrawMediaUIPart(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
203 void WKDrawMediaSliderTrack(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration, unsigned state);
209 #endif // WebKitSystemInterface_h