2 WebKitSystemInterface.h
3 Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
8 #import <Cocoa/Cocoa.h>
9 #import <Carbon/Carbon.h>
19 WKCertificateParseResultSucceeded = 0,
20 WKCertificateParseResultFailed = 1,
21 WKCertificateParseResultPKCS7 = 2,
22 } WKCertificateParseResult;
24 CFStringRef WKCopyCFLocalizationPreferredName(CFStringRef localization);
25 CFStringRef WKSignedPublicKeyAndChallengeString(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
26 WKCertificateParseResult WKAddCertificatesToKeychainFromData(const void *bytes, unsigned length);
28 NSString *WKGetPreferredExtensionForMIMEType(NSString *type);
29 NSArray *WKGetExtensionsForMIMEType(NSString *type);
30 NSString *WKGetMIMETypeForExtension(NSString *extension);
32 NSDate *WKGetNSURLResponseLastModifiedDate(NSURLResponse *response);
33 NSTimeInterval WKGetNSURLResponseFreshnessLifetime(NSURLResponse *response);
34 NSString *WKCopyNSURLResponseStatusLine(NSURLResponse *response);
36 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
37 CFArrayRef WKCopyNSURLResponseCertificateChain(NSURLResponse *response);
40 CFStringEncoding WKGetWebDefaultCFStringEncoding(void);
42 void WKSetMetadataURL(NSString *URLString, NSString *referrer, NSString *path);
43 void WKSetNSURLConnectionDefersCallbacks(NSURLConnection *connection, BOOL defers);
45 void WKShowKeyAndMain(void);
47 OSStatus WKSyncWindowWithCGAfterMove(WindowRef);
48 unsigned WKCarbonWindowMask(void);
49 void *WKGetNativeWindowFromWindowRef(WindowRef);
50 OSType WKCarbonWindowPropertyCreator(void);
51 OSType WKCarbonWindowPropertyTag(void);
54 typedef id WKNSURLConnectionDelegateProxyPtr;
56 WKNSURLConnectionDelegateProxyPtr WKCreateNSURLConnectionDelegateProxy(void);
58 void WKDisableCGDeferredUpdates(void);
60 Class WKNSURLProtocolClassForRequest(NSURLRequest *request);
61 void WKSetNSURLRequestShouldContentSniff(NSMutableURLRequest *request, BOOL shouldContentSniff);
63 void WKSetCookieStoragePrivateBrowsingEnabled(BOOL enabled);
65 unsigned WKGetNSAutoreleasePoolCount(void);
67 void WKAdvanceDefaultButtonPulseAnimation(NSButtonCell *button);
69 NSString *WKMouseMovedNotification(void);
70 NSString *WKWindowWillOrderOnScreenNotification(void);
71 void WKSetNSWindowShouldPostEventNotifications(NSWindow *window, BOOL post);
73 CFTypeID WKGetAXTextMarkerTypeID(void);
74 CFTypeID WKGetAXTextMarkerRangeTypeID(void);
75 CFTypeRef WKCreateAXTextMarker(const void *bytes, size_t len);
76 BOOL WKGetBytesFromAXTextMarker(CFTypeRef textMarker, void *bytes, size_t length);
77 CFTypeRef WKCreateAXTextMarkerRange(CFTypeRef start, CFTypeRef end);
78 CFTypeRef WKCopyAXTextMarkerRangeStart(CFTypeRef range);
79 CFTypeRef WKCopyAXTextMarkerRangeEnd(CFTypeRef range);
80 void WKAccessibilityHandleFocusChanged(void);
81 AXUIElementRef WKCreateAXUIElementRef(id element);
82 void WKUnregisterUniqueIdForElement(id element);
84 void WKSetUpFontCache(void);
86 void WKSignalCFReadStreamEnd(CFReadStreamRef stream);
87 void WKSignalCFReadStreamHasBytes(CFReadStreamRef stream);
88 void WKSignalCFReadStreamError(CFReadStreamRef stream, CFStreamError *error);
90 CFReadStreamRef WKCreateCustomCFReadStream(void *(*formCreate)(CFReadStreamRef, void *),
91 void (*formFinalize)(CFReadStreamRef, void *),
92 Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *),
93 CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *),
94 Boolean (*formCanRead)(CFReadStreamRef, void *),
95 void (*formClose)(CFReadStreamRef, void *),
96 void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
97 void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
100 void WKDrawCapsLockIndicator(CGContextRef, CGRect);
102 void WKDrawFocusRing(CGContextRef context, CGColorRef color, int radius);
103 // The CG context's current path is the focus ring's path.
104 // A color of 0 means "use system focus ring color".
105 // A radius of 0 means "use default focus ring radius".
107 void WKSetDragImage(NSImage *image, NSPoint offset);
109 void WKDrawBezeledTextFieldCell(NSRect, BOOL enabled);
110 void WKDrawTextFieldCellFocusRing(NSTextFieldCell*, NSRect);
111 void WKDrawBezeledTextArea(NSRect, BOOL enabled);
112 void WKPopupMenu(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
114 void WKSendUserChangeNotifications(void);
116 BOOL WKConvertNSEventToCarbonEvent(EventRecord *carbonEvent, NSEvent *cocoaEvent);
117 void WKSendKeyEventToTSM(NSEvent *theEvent);
118 void WKCallDrawingNotification(CGrafPtr port, Rect *bounds);
121 BOOL WKGetGlyphTransformedAdvances(CGFontRef, NSFont*, CGAffineTransform *m, ATSGlyphRef *glyph, CGSize *advance);
122 NSFont *WKGetFontInLanguageForRange(NSFont *font, NSString *string, NSRange range);
123 NSFont *WKGetFontInLanguageForCharacter(NSFont *font, UniChar ch);
124 void WKSetCGFontRenderingMode(CGContextRef cgContext, NSFont *font);
125 BOOL WKCGContextGetShouldSmoothFonts(CGContextRef cgContext);
127 #ifdef BUILDING_ON_TIGER
128 // CGFontGetAscent, CGFontGetDescent, CGFontGetLeading and CGFontGetUnitsPerEm were not available until Leopard
129 void WKGetFontMetrics(CGFontRef font, int *ascent, int *descent, int *lineGap, unsigned *unitsPerEm);
130 // CTFontCopyGraphicsFont was not available until Leopard
131 CGFontRef WKGetCGFontFromNSFont(NSFont *font);
132 // CTFontGetPlatformFont was not available until Leopard
133 ATSUFontID WKGetNSFontATSUFontId(NSFont *font);
134 // CGFontCopyFullName was not available until Leopard
135 CFStringRef WKCopyFullFontName(CGFontRef font);
138 void WKSetPatternBaseCTM(CGContextRef, CGAffineTransform);
139 void WKSetPatternPhaseInUserSpace(CGContextRef, CGPoint);
140 CGAffineTransform WKGetUserToBaseCTM(CGContextRef);
142 #ifndef BUILDING_ON_TIGER
143 void WKGetGlyphsForCharacters(CGFontRef, const UniChar[], CGGlyph[], size_t);
145 typedef void *WKGlyphVectorRef;
146 OSStatus WKConvertCharToGlyphs(void *styleGroup, const UniChar* characters, unsigned numCharacters, WKGlyphVectorRef glyphs);
147 OSStatus WKGetATSStyleGroup(ATSUStyle fontStyle, void **styleGroup);
148 void WKReleaseStyleGroup(void *group);
149 OSStatus WKInitializeGlyphVector(int count, WKGlyphVectorRef glyphs);
150 void WKClearGlyphVector(WKGlyphVectorRef glyphs);
152 int WKGetGlyphVectorNumGlyphs(WKGlyphVectorRef glyphVector);
153 ATSLayoutRecord *WKGetGlyphVectorFirstRecord(WKGlyphVectorRef glyphVector);
154 size_t WKGetGlyphVectorRecordSize(WKGlyphVectorRef glyphVector);
157 CTLineRef WKCreateCTLineWithUniCharProvider(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
158 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
159 CTTypesetterRef WKCreateCTTypesetterWithUniCharProviderAndOptions(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
161 CGContextRef WKIOSurfaceContextCreate(IOSurfaceRef, unsigned width, unsigned height, CGColorSpaceRef);
162 CGImageRef WKIOSurfaceContextCreateImage(CGContextRef context);
166 NSEvent *WKCreateNSEventWithCarbonEvent(EventRef eventRef);
167 NSEvent *WKCreateNSEventWithCarbonMouseMoveEvent(EventRef inEvent, NSWindow *window);
168 NSEvent *WKCreateNSEventWithCarbonClickEvent(EventRef inEvent, WindowRef windowRef);
171 CGContextRef WKNSWindowOverrideCGContext(NSWindow *, CGContextRef);
172 void WKNSWindowRestoreCGContext(NSWindow *, CGContextRef);
174 void WKNSWindowMakeBottomCornersSquare(NSWindow *);
176 // These constants match the ones used by ThemeScrollbarArrowStyle (some of the values are private, so we can't just
177 // use that enum directly).
179 WKThemeScrollBarArrowsSingle = 0,
180 WKThemeScrollBarArrowsLowerRight = 1,
181 WKThemeScrollBarArrowsDouble = 2,
182 WKThemeScrollBarArrowsUpperLeft = 3,
183 } WKThemeScrollBarArrowStyle;
185 OSStatus WKThemeDrawTrack(const HIThemeTrackDrawInfo* inDrawInfo, CGContextRef inContext, int inArrowStyle);
187 #ifdef BUILDING_ON_TIGER
188 // WKSupportsMultipartXMixedReplace is not required on Leopard as multipart/x-mixed-replace is always handled by NSURLRequest
189 BOOL WKSupportsMultipartXMixedReplace(NSMutableURLRequest *request);
192 BOOL WKCGContextIsBitmapContext(CGContextRef context);
194 void WKGetWheelEventDeltas(NSEvent *, float *deltaX, float *deltaY, BOOL *continuous);
196 BOOL WKAppVersionCheckLessThan(NSString *, int, double);
201 WKMovieTypeStoredStream,
202 WKMovieTypeLiveStream
205 int WKQTMovieGetType(QTMovie* movie);
207 BOOL WKQTMovieHasClosedCaptions(QTMovie* movie);
208 void WKQTMovieSetShowClosedCaptions(QTMovie* movie, BOOL showClosedCaptions);
209 void WKQTMovieSelectPreferredAlternates(QTMovie* movie);
210 void WKQTMovieSelectPreferredAlternateTrackForMediaType(QTMovie* movie, NSString* mediaType);
212 unsigned WKQTIncludeOnlyModernMediaFileTypes(void);
213 int WKQTMovieDataRate(QTMovie* movie);
214 float WKQTMovieMaxTimeLoaded(QTMovie* movie);
215 float WKQTMovieMaxTimeSeekable(QTMovie* movie);
216 NSString *WKQTMovieMaxTimeLoadedChangeNotification(void);
217 void WKQTMovieViewSetDrawSynchronously(QTMovieView* view, BOOL sync);
218 void WKQTMovieDisableComponent(uint32_t[5]);
220 CFStringRef WKCopyFoundationCacheDirectory(void);
222 void WKSetVisibleApplicationName(CFStringRef);
225 WKMediaUIPartFullscreenButton = 0,
226 WKMediaUIPartMuteButton,
227 WKMediaUIPartPlayButton,
228 WKMediaUIPartSeekBackButton,
229 WKMediaUIPartSeekForwardButton,
230 WKMediaUIPartTimelineSlider,
231 WKMediaUIPartTimelineSliderThumb,
232 WKMediaUIPartRewindButton,
233 WKMediaUIPartSeekToRealtimeButton,
234 WKMediaUIPartShowClosedCaptionsButton,
235 WKMediaUIPartHideClosedCaptionsButton,
236 WKMediaUIPartUnMuteButton,
237 WKMediaUIPartPauseButton,
238 WKMediaUIPartBackground,
239 WKMediaUIPartCurrentTimeDisplay,
240 WKMediaUIPartTimeRemainingDisplay,
241 WKMediaUIPartStatusDisplay,
242 WKMediaUIPartControlsPanel,
243 WKMediaUIPartVolumeSliderContainer,
244 WKMediaUIPartVolumeSlider,
245 WKMediaUIPartVolumeSliderThumb
249 WKMediaControllerThemeClassic = 1,
250 WKMediaControllerThemeQuickTime = 2
251 } WKMediaControllerThemeStyle;
254 WKMediaControllerFlagDisabled = 1 << 0,
255 WKMediaControllerFlagPressed = 1 << 1,
256 WKMediaControllerFlagDrawEndCaps = 1 << 3,
257 WKMediaControllerFlagFocused = 1 << 4
258 } WKMediaControllerThemeState;
260 BOOL WKMediaControllerThemeAvailable(int themeStyle);
261 BOOL WKHitTestMediaUIPart(int part, int themeStyle, CGRect bounds, CGPoint point);
262 void WKMeasureMediaUIPart(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
263 void WKDrawMediaUIPart(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
264 void WKDrawMediaSliderTrack(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration, unsigned state);
265 NSView *WKCreateMediaUIBackgroundView(void);
268 WKMediaUIControlTimeline,
269 WKMediaUIControlSlider,
270 WKMediaUIControlPlayPauseButton,
271 WKMediaUIControlExitFullscreenButton,
272 WKMediaUIControlRewindButton,
273 WKMediaUIControlFastForwardButton,
274 WKMediaUIControlVolumeUpButton,
275 WKMediaUIControlVolumeDownButton
276 } WKMediaUIControlType;
278 NSControl *WKCreateMediaUIControl(int controlType);
280 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
281 mach_port_t WKInitializeRenderServer(void);
285 CALayer *WKMakeRenderLayer(uint32_t contextID);
287 typedef struct __WKSoftwareCARendererRef *WKSoftwareCARendererRef;
289 WKSoftwareCARendererRef WKSoftwareCARendererCreate(uint32_t contextID);
290 void WKSoftwareCARendererDestroy(WKSoftwareCARendererRef);
291 void WKSoftwareCARendererRender(WKSoftwareCARendererRef, CGContextRef, CGRect);
293 typedef struct __WKCARemoteLayerClientRef *WKCARemoteLayerClientRef;
295 WKCARemoteLayerClientRef WKCARemoteLayerClientMakeWithServerPort(mach_port_t port);
296 void WKCARemoteLayerClientInvalidate(WKCARemoteLayerClientRef);
297 uint32_t WKCARemoteLayerClientGetClientId(WKCARemoteLayerClientRef);
298 void WKCARemoteLayerClientSetLayer(WKCARemoteLayerClientRef, CALayer *);
299 CALayer *WKCARemoteLayerClientGetLayer(WKCARemoteLayerClientRef);
301 typedef struct __WKWindowBounceAnimationContext *WKWindowBounceAnimationContextRef;
303 WKWindowBounceAnimationContextRef WKWindowBounceAnimationContextCreate(NSWindow *window);
304 void WKWindowBounceAnimationContextDestroy(WKWindowBounceAnimationContextRef context);
305 void WKWindowBounceAnimationSetAnimationProgress(WKWindowBounceAnimationContextRef context, double animationProgress);
307 #if defined(__x86_64__)
309 CFRunLoopSourceRef WKCreateMIGServerSource(mig_subsystem_t subsystem, mach_port_t serverPort);
310 #endif // defined(__x86_64__)
312 NSUInteger WKGetInputPanelWindowStyle(void);
313 UInt8 WKGetNSEventKeyChar(NSEvent *);
314 #endif // !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
316 @class CAPropertyAnimation;
317 void WKSetCAAnimationValueFunction(CAPropertyAnimation*, NSString* function);
319 unsigned WKInitializeMaximumHTTPConnectionCountPerHost(unsigned preferredConnectionCount);
321 void WKSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
322 void WKSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString);
323 CFHTTPMessageRef WKCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL);
325 BOOL WKIsLatchingWheelEvent(NSEvent *);
327 #ifndef BUILDING_ON_TIGER
328 void WKWindowSetAlpha(NSWindow *window, float alphaValue);
329 void WKWindowSetScaledFrame(NSWindow *window, NSRect scaleFrame, NSRect nonScaledFrame);
332 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
333 void WKSyncSurfaceToView(NSView *view);
335 void WKEnableSettingCursorWhenInBackground(void);
337 CFDictionaryRef WKNSURLRequestCreateSerializableRepresentation(NSURLRequest *request, CFTypeRef tokenNull);
338 NSURLRequest *WKNSURLRequestFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
340 CFDictionaryRef WKNSURLResponseCreateSerializableRepresentation(NSURLResponse *response, CFTypeRef tokenNull);
341 NSURLResponse *WKNSURLResponseFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
344 ScriptCode WKGetScriptCodeFromCurrentKeyboardInputSource(void);
349 #if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
350 CFIndex WKGetHyphenationLocationBeforeIndex(CFStringRef string, CFIndex index);
353 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
355 WKSandboxExtensionTypeReadOnly,
356 WKSandboxExtensionTypeWriteOnly,
357 WKSandboxExtensionTypeReadWrite,
358 } WKSandboxExtensionType;
359 typedef struct __WKSandboxExtension *WKSandboxExtensionRef;
361 WKSandboxExtensionRef WKSandboxExtensionCreate(const char* path, WKSandboxExtensionType type);
362 void WKSandboxExtensionDestroy(WKSandboxExtensionRef sandboxExtension);
364 bool WKSandboxExtensionConsume(WKSandboxExtensionRef sandboxExtension);
365 bool WKSandboxExtensionInvalidate(WKSandboxExtensionRef sandboxExtension);
367 const char* WKSandboxExtensionGetSerializedFormat(WKSandboxExtensionRef sandboxExtension, size_t* length);
368 WKSandboxExtensionRef WKSandboxExtensionCreateFromSerializedFormat(const char* serializationFormat, size_t length);