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);
85 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
86 // Remote Accessibility API.
87 void WKAXRegisterRemoteApp(void);
88 void WKAXInitializeElementWithPresenterPid(id, pid_t);
89 CFDataRef WKAXRemoteTokenForElement(id);
90 id WKAXRemoteElementForToken(CFDataRef);
91 void WKAXInitializeRemoteElementWithWindow(id remoteElement, id window);
94 void WKSetUpFontCache(void);
96 void WKSignalCFReadStreamEnd(CFReadStreamRef stream);
97 void WKSignalCFReadStreamHasBytes(CFReadStreamRef stream);
98 void WKSignalCFReadStreamError(CFReadStreamRef stream, CFStreamError *error);
100 CFReadStreamRef WKCreateCustomCFReadStream(void *(*formCreate)(CFReadStreamRef, void *),
101 void (*formFinalize)(CFReadStreamRef, void *),
102 Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *),
103 CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *),
104 Boolean (*formCanRead)(CFReadStreamRef, void *),
105 void (*formClose)(CFReadStreamRef, void *),
106 void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
107 void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
110 void WKDrawCapsLockIndicator(CGContextRef, CGRect);
112 void WKDrawFocusRing(CGContextRef context, CGColorRef color, int radius);
113 // The CG context's current path is the focus ring's path.
114 // A color of 0 means "use system focus ring color".
115 // A radius of 0 means "use default focus ring radius".
117 void WKSetDragImage(NSImage *image, NSPoint offset);
119 void WKDrawBezeledTextFieldCell(NSRect, BOOL enabled);
120 void WKDrawTextFieldCellFocusRing(NSTextFieldCell*, NSRect);
121 void WKDrawBezeledTextArea(NSRect, BOOL enabled);
122 void WKPopupMenu(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
123 void WKPopupContextMenu(NSMenu *menu, NSPoint screenLocation);
124 void WKSendUserChangeNotifications(void);
126 BOOL WKConvertNSEventToCarbonEvent(EventRecord *carbonEvent, NSEvent *cocoaEvent);
127 void WKSendKeyEventToTSM(NSEvent *theEvent);
128 void WKCallDrawingNotification(CGrafPtr port, Rect *bounds);
131 BOOL WKGetGlyphTransformedAdvances(CGFontRef, NSFont*, CGAffineTransform *m, ATSGlyphRef *glyph, CGSize *advance);
132 NSFont *WKGetFontInLanguageForRange(NSFont *font, NSString *string, NSRange range);
133 NSFont *WKGetFontInLanguageForCharacter(NSFont *font, UniChar ch);
134 void WKSetCGFontRenderingMode(CGContextRef cgContext, NSFont *font);
135 BOOL WKCGContextGetShouldSmoothFonts(CGContextRef cgContext);
137 #ifdef BUILDING_ON_TIGER
138 // CGFontGetAscent, CGFontGetDescent, CGFontGetLeading and CGFontGetUnitsPerEm were not available until Leopard
139 void WKGetFontMetrics(CGFontRef font, int *ascent, int *descent, int *lineGap, unsigned *unitsPerEm);
140 // CTFontCopyGraphicsFont was not available until Leopard
141 CGFontRef WKGetCGFontFromNSFont(NSFont *font);
142 // CTFontGetPlatformFont was not available until Leopard
143 ATSUFontID WKGetNSFontATSUFontId(NSFont *font);
144 // CGFontCopyFullName was not available until Leopard
145 CFStringRef WKCopyFullFontName(CGFontRef font);
148 void WKSetPatternBaseCTM(CGContextRef, CGAffineTransform);
149 void WKSetPatternPhaseInUserSpace(CGContextRef, CGPoint);
150 CGAffineTransform WKGetUserToBaseCTM(CGContextRef);
152 #ifndef BUILDING_ON_TIGER
153 void WKGetGlyphsForCharacters(CGFontRef, const UniChar[], CGGlyph[], size_t);
155 typedef void *WKGlyphVectorRef;
156 OSStatus WKConvertCharToGlyphs(void *styleGroup, const UniChar* characters, unsigned numCharacters, WKGlyphVectorRef glyphs);
157 OSStatus WKGetATSStyleGroup(ATSUStyle fontStyle, void **styleGroup);
158 void WKReleaseStyleGroup(void *group);
159 OSStatus WKInitializeGlyphVector(int count, WKGlyphVectorRef glyphs);
160 void WKClearGlyphVector(WKGlyphVectorRef glyphs);
162 int WKGetGlyphVectorNumGlyphs(WKGlyphVectorRef glyphVector);
163 ATSLayoutRecord *WKGetGlyphVectorFirstRecord(WKGlyphVectorRef glyphVector);
164 size_t WKGetGlyphVectorRecordSize(WKGlyphVectorRef glyphVector);
167 CTLineRef WKCreateCTLineWithUniCharProvider(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
168 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
169 CTTypesetterRef WKCreateCTTypesetterWithUniCharProviderAndOptions(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
171 CGContextRef WKIOSurfaceContextCreate(IOSurfaceRef, unsigned width, unsigned height, CGColorSpaceRef);
172 CGImageRef WKIOSurfaceContextCreateImage(CGContextRef context);
176 NSEvent *WKCreateNSEventWithCarbonEvent(EventRef eventRef);
177 NSEvent *WKCreateNSEventWithCarbonMouseMoveEvent(EventRef inEvent, NSWindow *window);
178 NSEvent *WKCreateNSEventWithCarbonClickEvent(EventRef inEvent, WindowRef windowRef);
181 CGContextRef WKNSWindowOverrideCGContext(NSWindow *, CGContextRef);
182 void WKNSWindowRestoreCGContext(NSWindow *, CGContextRef);
184 void WKNSWindowMakeBottomCornersSquare(NSWindow *);
186 // These constants match the ones used by ThemeScrollbarArrowStyle (some of the values are private, so we can't just
187 // use that enum directly).
189 WKThemeScrollBarArrowsSingle = 0,
190 WKThemeScrollBarArrowsLowerRight = 1,
191 WKThemeScrollBarArrowsDouble = 2,
192 WKThemeScrollBarArrowsUpperLeft = 3,
193 } WKThemeScrollBarArrowStyle;
195 OSStatus WKThemeDrawTrack(const HIThemeTrackDrawInfo* inDrawInfo, CGContextRef inContext, int inArrowStyle);
197 #ifdef BUILDING_ON_TIGER
198 // WKSupportsMultipartXMixedReplace is not required on Leopard as multipart/x-mixed-replace is always handled by NSURLRequest
199 BOOL WKSupportsMultipartXMixedReplace(NSMutableURLRequest *request);
202 BOOL WKCGContextIsBitmapContext(CGContextRef context);
204 void WKGetWheelEventDeltas(NSEvent *, float *deltaX, float *deltaY, BOOL *continuous);
206 BOOL WKAppVersionCheckLessThan(NSString *, int, double);
211 WKMovieTypeStoredStream,
212 WKMovieTypeLiveStream
215 int WKQTMovieGetType(QTMovie* movie);
217 BOOL WKQTMovieHasClosedCaptions(QTMovie* movie);
218 void WKQTMovieSetShowClosedCaptions(QTMovie* movie, BOOL showClosedCaptions);
219 void WKQTMovieSelectPreferredAlternates(QTMovie* movie);
220 void WKQTMovieSelectPreferredAlternateTrackForMediaType(QTMovie* movie, NSString* mediaType);
222 unsigned WKQTIncludeOnlyModernMediaFileTypes(void);
223 int WKQTMovieDataRate(QTMovie* movie);
224 float WKQTMovieMaxTimeLoaded(QTMovie* movie);
225 float WKQTMovieMaxTimeSeekable(QTMovie* movie);
226 NSString *WKQTMovieMaxTimeLoadedChangeNotification(void);
227 void WKQTMovieViewSetDrawSynchronously(QTMovieView* view, BOOL sync);
228 void WKQTMovieDisableComponent(uint32_t[5]);
230 CFStringRef WKCopyFoundationCacheDirectory(void);
232 void WKSetVisibleApplicationName(CFStringRef);
235 WKMediaUIPartFullscreenButton = 0,
236 WKMediaUIPartMuteButton,
237 WKMediaUIPartPlayButton,
238 WKMediaUIPartSeekBackButton,
239 WKMediaUIPartSeekForwardButton,
240 WKMediaUIPartTimelineSlider,
241 WKMediaUIPartTimelineSliderThumb,
242 WKMediaUIPartRewindButton,
243 WKMediaUIPartSeekToRealtimeButton,
244 WKMediaUIPartShowClosedCaptionsButton,
245 WKMediaUIPartHideClosedCaptionsButton,
246 WKMediaUIPartUnMuteButton,
247 WKMediaUIPartPauseButton,
248 WKMediaUIPartBackground,
249 WKMediaUIPartCurrentTimeDisplay,
250 WKMediaUIPartTimeRemainingDisplay,
251 WKMediaUIPartStatusDisplay,
252 WKMediaUIPartControlsPanel,
253 WKMediaUIPartVolumeSliderContainer,
254 WKMediaUIPartVolumeSlider,
255 WKMediaUIPartVolumeSliderThumb
259 WKMediaControllerThemeClassic = 1,
260 WKMediaControllerThemeQuickTime = 2
261 } WKMediaControllerThemeStyle;
264 WKMediaControllerFlagDisabled = 1 << 0,
265 WKMediaControllerFlagPressed = 1 << 1,
266 WKMediaControllerFlagDrawEndCaps = 1 << 3,
267 WKMediaControllerFlagFocused = 1 << 4
268 } WKMediaControllerThemeState;
270 BOOL WKMediaControllerThemeAvailable(int themeStyle);
271 BOOL WKHitTestMediaUIPart(int part, int themeStyle, CGRect bounds, CGPoint point);
272 void WKMeasureMediaUIPart(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
273 void WKDrawMediaUIPart(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
274 void WKDrawMediaSliderTrack(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration, unsigned state);
275 NSView *WKCreateMediaUIBackgroundView(void);
278 WKMediaUIControlTimeline,
279 WKMediaUIControlSlider,
280 WKMediaUIControlPlayPauseButton,
281 WKMediaUIControlExitFullscreenButton,
282 WKMediaUIControlRewindButton,
283 WKMediaUIControlFastForwardButton,
284 WKMediaUIControlVolumeUpButton,
285 WKMediaUIControlVolumeDownButton
286 } WKMediaUIControlType;
288 NSControl *WKCreateMediaUIControl(int controlType);
290 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
291 mach_port_t WKInitializeRenderServer(void);
295 CALayer *WKMakeRenderLayer(uint32_t contextID);
297 typedef struct __WKSoftwareCARendererRef *WKSoftwareCARendererRef;
299 WKSoftwareCARendererRef WKSoftwareCARendererCreate(uint32_t contextID);
300 void WKSoftwareCARendererDestroy(WKSoftwareCARendererRef);
301 void WKSoftwareCARendererRender(WKSoftwareCARendererRef, CGContextRef, CGRect);
303 typedef struct __WKCARemoteLayerClientRef *WKCARemoteLayerClientRef;
305 WKCARemoteLayerClientRef WKCARemoteLayerClientMakeWithServerPort(mach_port_t port);
306 void WKCARemoteLayerClientInvalidate(WKCARemoteLayerClientRef);
307 uint32_t WKCARemoteLayerClientGetClientId(WKCARemoteLayerClientRef);
308 void WKCARemoteLayerClientSetLayer(WKCARemoteLayerClientRef, CALayer *);
309 CALayer *WKCARemoteLayerClientGetLayer(WKCARemoteLayerClientRef);
311 typedef struct __WKWindowBounceAnimationContext *WKWindowBounceAnimationContextRef;
313 WKWindowBounceAnimationContextRef WKWindowBounceAnimationContextCreate(NSWindow *window);
314 void WKWindowBounceAnimationContextDestroy(WKWindowBounceAnimationContextRef context);
315 void WKWindowBounceAnimationSetAnimationProgress(WKWindowBounceAnimationContextRef context, double animationProgress);
317 #if defined(__x86_64__)
319 CFRunLoopSourceRef WKCreateMIGServerSource(mig_subsystem_t subsystem, mach_port_t serverPort);
320 #endif // defined(__x86_64__)
322 NSUInteger WKGetInputPanelWindowStyle(void);
323 UInt8 WKGetNSEventKeyChar(NSEvent *);
324 #endif // !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
326 @class CAPropertyAnimation;
327 void WKSetCAAnimationValueFunction(CAPropertyAnimation*, NSString* function);
329 unsigned WKInitializeMaximumHTTPConnectionCountPerHost(unsigned preferredConnectionCount);
331 void WKSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
332 void WKSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString);
333 CFHTTPMessageRef WKCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL);
335 BOOL WKIsLatchingWheelEvent(NSEvent *);
337 #ifndef BUILDING_ON_TIGER
338 void WKWindowSetAlpha(NSWindow *window, float alphaValue);
339 void WKWindowSetScaledFrame(NSWindow *window, NSRect scaleFrame, NSRect nonScaledFrame);
342 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
343 void WKSyncSurfaceToView(NSView *view);
345 void WKEnableSettingCursorWhenInBackground(void);
347 CFDictionaryRef WKNSURLRequestCreateSerializableRepresentation(NSURLRequest *request, CFTypeRef tokenNull);
348 NSURLRequest *WKNSURLRequestFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
350 CFDictionaryRef WKNSURLResponseCreateSerializableRepresentation(NSURLResponse *response, CFTypeRef tokenNull);
351 NSURLResponse *WKNSURLResponseFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
354 ScriptCode WKGetScriptCodeFromCurrentKeyboardInputSource(void);
359 #if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
360 CFIndex WKGetHyphenationLocationBeforeIndex(CFStringRef string, CFIndex index);
363 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
365 WKSandboxExtensionTypeReadOnly,
366 WKSandboxExtensionTypeWriteOnly,
367 WKSandboxExtensionTypeReadWrite,
368 } WKSandboxExtensionType;
369 typedef struct __WKSandboxExtension *WKSandboxExtensionRef;
371 WKSandboxExtensionRef WKSandboxExtensionCreate(const char* path, WKSandboxExtensionType type);
372 void WKSandboxExtensionDestroy(WKSandboxExtensionRef sandboxExtension);
374 bool WKSandboxExtensionConsume(WKSandboxExtensionRef sandboxExtension);
375 bool WKSandboxExtensionInvalidate(WKSandboxExtensionRef sandboxExtension);
377 const char* WKSandboxExtensionGetSerializedFormat(WKSandboxExtensionRef sandboxExtension, size_t* length);
378 WKSandboxExtensionRef WKSandboxExtensionCreateFromSerializedFormat(const char* serializationFormat, size_t length);