2 WebKitSystemInterface.h
3 Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
8 #import <Cocoa/Cocoa.h>
9 #import <Carbon/Carbon.h>
19 typedef struct _CFURLResponse* CFURLResponseRef;
20 typedef const struct _CFURLRequest* CFURLRequestRef;
21 typedef struct _CFURLRequest* CFMutableURLRequestRef;
23 typedef struct _CFURLCredential* WKCFURLCredentialRef;
24 typedef struct _CFURLProtectionSpace* CFURLProtectionSpaceRef;
27 WKCertificateParseResultSucceeded = 0,
28 WKCertificateParseResultFailed = 1,
29 WKCertificateParseResultPKCS7 = 2,
30 } WKCertificateParseResult;
32 CFStringRef WKCopyCFLocalizationPreferredName(CFStringRef localization);
33 void WKSetDefaultLocalization(CFStringRef localization);
35 CFStringRef WKSignedPublicKeyAndChallengeString(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
36 WKCertificateParseResult WKAddCertificatesToKeychainFromData(const void *bytes, unsigned length);
38 NSString *WKGetPreferredExtensionForMIMEType(NSString *type);
39 NSArray *WKGetExtensionsForMIMEType(NSString *type);
40 NSString *WKGetMIMETypeForExtension(NSString *extension);
42 NSDate *WKGetNSURLResponseLastModifiedDate(NSURLResponse *response);
43 NSTimeInterval WKGetNSURLResponseFreshnessLifetime(NSURLResponse *response);
44 NSString *WKCopyNSURLResponseStatusLine(NSURLResponse *response);
46 #ifndef BUILDING_ON_LEOPARD
47 CFArrayRef WKCopyNSURLResponseCertificateChain(NSURLResponse *response);
50 CFStringEncoding WKGetWebDefaultCFStringEncoding(void);
52 void WKSetMetadataURL(NSString *URLString, NSString *referrer, NSString *path);
53 void WKSetNSURLConnectionDefersCallbacks(NSURLConnection *connection, BOOL defers);
55 void WKShowKeyAndMain(void);
57 OSStatus WKSyncWindowWithCGAfterMove(WindowRef);
58 unsigned WKCarbonWindowMask(void);
59 void *WKGetNativeWindowFromWindowRef(WindowRef);
60 OSType WKCarbonWindowPropertyCreator(void);
61 OSType WKCarbonWindowPropertyTag(void);
64 typedef id WKNSURLConnectionDelegateProxyPtr;
66 WKNSURLConnectionDelegateProxyPtr WKCreateNSURLConnectionDelegateProxy(void);
68 void WKDisableCGDeferredUpdates(void);
70 Class WKNSURLProtocolClassForRequest(NSURLRequest *request);
71 void WKSetNSURLRequestShouldContentSniff(NSMutableURLRequest *request, BOOL shouldContentSniff);
73 void WKSetCookieStoragePrivateBrowsingEnabled(BOOL enabled);
75 unsigned WKGetNSAutoreleasePoolCount(void);
77 void WKAdvanceDefaultButtonPulseAnimation(NSButtonCell *button);
79 NSString *WKMouseMovedNotification(void);
80 NSString *WKWindowWillOrderOnScreenNotification(void);
81 NSString *WKWindowWillOrderOffScreenNotification(void);
82 void WKSetNSWindowShouldPostEventNotifications(NSWindow *window, BOOL post);
84 CFTypeID WKGetAXTextMarkerTypeID(void);
85 CFTypeID WKGetAXTextMarkerRangeTypeID(void);
86 CFTypeRef WKCreateAXTextMarker(const void *bytes, size_t len);
87 BOOL WKGetBytesFromAXTextMarker(CFTypeRef textMarker, void *bytes, size_t length);
88 CFTypeRef WKCreateAXTextMarkerRange(CFTypeRef start, CFTypeRef end);
89 CFTypeRef WKCopyAXTextMarkerRangeStart(CFTypeRef range);
90 CFTypeRef WKCopyAXTextMarkerRangeEnd(CFTypeRef range);
91 void WKAccessibilityHandleFocusChanged(void);
92 AXUIElementRef WKCreateAXUIElementRef(id element);
93 void WKUnregisterUniqueIdForElement(id element);
96 #if !defined(BUILDING_ON_LEOPARD)
97 // Remote Accessibility API.
98 void WKAXRegisterRemoteApp(void);
99 void WKAXInitializeElementWithPresenterPid(id, pid_t);
100 NSData *WKAXRemoteTokenForElement(id);
101 id WKAXRemoteElementForToken(NSData *);
102 void WKAXSetWindowForRemoteElement(id remoteWindow, id remoteElement);
103 void WKAXRegisterRemoteProcess(bool registerProcess, pid_t);
104 pid_t WKAXRemoteProcessIdentifier(id remoteElement);
107 void WKSetUpFontCache(void);
109 void WKSignalCFReadStreamEnd(CFReadStreamRef stream);
110 void WKSignalCFReadStreamHasBytes(CFReadStreamRef stream);
111 void WKSignalCFReadStreamError(CFReadStreamRef stream, CFStreamError *error);
113 CFReadStreamRef WKCreateCustomCFReadStream(void *(*formCreate)(CFReadStreamRef, void *),
114 void (*formFinalize)(CFReadStreamRef, void *),
115 Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *),
116 CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *),
117 Boolean (*formCanRead)(CFReadStreamRef, void *),
118 void (*formClose)(CFReadStreamRef, void *),
119 void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
120 void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
123 void WKDrawCapsLockIndicator(CGContextRef, CGRect);
125 void WKDrawFocusRing(CGContextRef context, CGColorRef color, int radius);
126 // The CG context's current path is the focus ring's path.
127 // A color of 0 means "use system focus ring color".
128 // A radius of 0 means "use default focus ring radius".
130 void WKSetDragImage(NSImage *image, NSPoint offset);
132 void WKDrawBezeledTextFieldCell(NSRect, BOOL enabled);
133 void WKDrawTextFieldCellFocusRing(NSTextFieldCell*, NSRect);
134 void WKDrawBezeledTextArea(NSRect, BOOL enabled);
135 void WKPopupMenu(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
136 void WKPopupContextMenu(NSMenu *menu, NSPoint screenLocation);
137 void WKSendUserChangeNotifications(void);
139 BOOL WKConvertNSEventToCarbonEvent(EventRecord *carbonEvent, NSEvent *cocoaEvent);
140 void WKSendKeyEventToTSM(NSEvent *theEvent);
141 void WKCallDrawingNotification(CGrafPtr port, Rect *bounds);
144 BOOL WKGetGlyphTransformedAdvances(CGFontRef, NSFont*, CGAffineTransform *m, ATSGlyphRef *glyph, CGSize *advance);
145 NSFont *WKGetFontInLanguageForRange(NSFont *font, NSString *string, NSRange range);
146 NSFont *WKGetFontInLanguageForCharacter(NSFont *font, UniChar ch);
147 void WKSetCGFontRenderingMode(CGContextRef cgContext, NSFont *font);
148 BOOL WKCGContextGetShouldSmoothFonts(CGContextRef cgContext);
151 void WKSetPatternBaseCTM(CGContextRef, CGAffineTransform);
152 void WKSetPatternPhaseInUserSpace(CGContextRef, CGPoint);
153 CGAffineTransform WKGetUserToBaseCTM(CGContextRef);
155 void WKGetGlyphsForCharacters(CGFontRef, const UniChar[], CGGlyph[], size_t);
156 bool WKGetVerticalGlyphsForCharacters(CTFontRef, const UniChar[], CGGlyph[], size_t);
158 CTLineRef WKCreateCTLineWithUniCharProvider(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
159 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
160 CTTypesetterRef WKCreateCTTypesetterWithUniCharProviderAndOptions(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
162 CGContextRef WKIOSurfaceContextCreate(IOSurfaceRef, unsigned width, unsigned height, CGColorSpaceRef);
163 CGImageRef WKIOSurfaceContextCreateImage(CGContextRef context);
167 NSEvent *WKCreateNSEventWithCarbonEvent(EventRef eventRef);
168 NSEvent *WKCreateNSEventWithCarbonMouseMoveEvent(EventRef inEvent, NSWindow *window);
169 NSEvent *WKCreateNSEventWithCarbonClickEvent(EventRef inEvent, WindowRef windowRef);
172 CGContextRef WKNSWindowOverrideCGContext(NSWindow *, CGContextRef);
173 void WKNSWindowRestoreCGContext(NSWindow *, CGContextRef);
175 void WKNSWindowMakeBottomCornersSquare(NSWindow *);
177 // These constants match the ones used by ThemeScrollbarArrowStyle (some of the values are private, so we can't just
178 // use that enum directly).
180 WKThemeScrollBarArrowsSingle = 0,
181 WKThemeScrollBarArrowsLowerRight = 1,
182 WKThemeScrollBarArrowsDouble = 2,
183 WKThemeScrollBarArrowsUpperLeft = 3,
184 } WKThemeScrollBarArrowStyle;
186 OSStatus WKThemeDrawTrack(const HIThemeTrackDrawInfo* inDrawInfo, CGContextRef inContext, int inArrowStyle);
189 BOOL WKCGContextIsBitmapContext(CGContextRef context);
191 void WKGetWheelEventDeltas(NSEvent *, float *deltaX, float *deltaY, BOOL *continuous);
193 BOOL WKAppVersionCheckLessThan(NSString *, int, double);
198 WKMovieTypeStoredStream,
199 WKMovieTypeLiveStream
202 int WKQTMovieGetType(QTMovie* movie);
204 BOOL WKQTMovieHasClosedCaptions(QTMovie* movie);
205 void WKQTMovieSetShowClosedCaptions(QTMovie* movie, BOOL showClosedCaptions);
206 void WKQTMovieSelectPreferredAlternates(QTMovie* movie);
207 void WKQTMovieSelectPreferredAlternateTrackForMediaType(QTMovie* movie, NSString* mediaType);
209 unsigned WKQTIncludeOnlyModernMediaFileTypes(void);
210 int WKQTMovieDataRate(QTMovie* movie);
211 float WKQTMovieMaxTimeLoaded(QTMovie* movie);
212 float WKQTMovieMaxTimeSeekable(QTMovie* movie);
213 NSString *WKQTMovieMaxTimeLoadedChangeNotification(void);
214 void WKQTMovieViewSetDrawSynchronously(QTMovieView* view, BOOL sync);
215 void WKQTMovieDisableComponent(uint32_t[5]);
216 NSURL *WKQTMovieResolvedURL(QTMovie* movie);
218 CFStringRef WKCopyFoundationCacheDirectory(void);
220 #if defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LEOPARD)
221 typedef struct __CFURLStorageSession* CFURLStorageSessionRef;
223 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
225 CFURLStorageSessionRef WKCreatePrivateStorageSession(CFStringRef);
226 NSURLRequest *WKCopyRequestWithStorageSession(CFURLStorageSessionRef, NSURLRequest*);
227 NSCachedURLResponse *WKCachedResponseForRequest(CFURLStorageSessionRef, NSURLRequest*);
228 void WKSetRequestStorageSession(CFURLStorageSessionRef, CFMutableURLRequestRef);
230 typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
231 CFHTTPCookieStorageRef WKCopyHTTPCookieStorage(CFURLStorageSessionRef);
232 unsigned WKGetHTTPCookieAcceptPolicy(CFHTTPCookieStorageRef);
233 void WKSetHTTPCookieAcceptPolicy(CFHTTPCookieStorageRef, unsigned policy);
234 NSArray *WKHTTPCookiesForURL(CFHTTPCookieStorageRef, NSURL *);
235 void WKSetHTTPCookiesForURL(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *);
236 void WKDeleteHTTPCookie(CFHTTPCookieStorageRef, NSHTTPCookie *);
238 CFHTTPCookieStorageRef WKGetDefaultHTTPCookieStorage(void);
239 WKCFURLCredentialRef WKCopyCredentialFromCFPersistentStorage(CFURLProtectionSpaceRef);
240 void WKSetCFURLRequestShouldContentSniff(CFMutableURLRequestRef, bool flag);
241 CFArrayRef WKCFURLRequestCopyHTTPRequestBodyParts(CFURLRequestRef);
242 void WKCFURLRequestSetHTTPRequestBodyParts(CFMutableURLRequestRef, CFArrayRef bodyParts);
244 void WKSetVisibleApplicationName(CFStringRef);
247 WKMediaUIPartFullscreenButton = 0,
248 WKMediaUIPartMuteButton,
249 WKMediaUIPartPlayButton,
250 WKMediaUIPartSeekBackButton,
251 WKMediaUIPartSeekForwardButton,
252 WKMediaUIPartTimelineSlider,
253 WKMediaUIPartTimelineSliderThumb,
254 WKMediaUIPartRewindButton,
255 WKMediaUIPartSeekToRealtimeButton,
256 WKMediaUIPartShowClosedCaptionsButton,
257 WKMediaUIPartHideClosedCaptionsButton,
258 WKMediaUIPartUnMuteButton,
259 WKMediaUIPartPauseButton,
260 WKMediaUIPartBackground,
261 WKMediaUIPartCurrentTimeDisplay,
262 WKMediaUIPartTimeRemainingDisplay,
263 WKMediaUIPartStatusDisplay,
264 WKMediaUIPartControlsPanel,
265 WKMediaUIPartVolumeSliderContainer,
266 WKMediaUIPartVolumeSlider,
267 WKMediaUIPartVolumeSliderThumb
271 WKMediaControllerThemeClassic = 1,
272 WKMediaControllerThemeQuickTime = 2
273 } WKMediaControllerThemeStyle;
276 WKMediaControllerFlagDisabled = 1 << 0,
277 WKMediaControllerFlagPressed = 1 << 1,
278 WKMediaControllerFlagDrawEndCaps = 1 << 3,
279 WKMediaControllerFlagFocused = 1 << 4
280 } WKMediaControllerThemeState;
282 BOOL WKMediaControllerThemeAvailable(int themeStyle);
283 BOOL WKHitTestMediaUIPart(int part, int themeStyle, CGRect bounds, CGPoint point);
284 void WKMeasureMediaUIPart(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
285 void WKDrawMediaUIPart(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
286 void WKDrawMediaSliderTrack(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration, unsigned state);
287 NSView *WKCreateMediaUIBackgroundView(void);
290 WKMediaUIControlTimeline,
291 WKMediaUIControlSlider,
292 WKMediaUIControlPlayPauseButton,
293 WKMediaUIControlExitFullscreenButton,
294 WKMediaUIControlRewindButton,
295 WKMediaUIControlFastForwardButton,
296 WKMediaUIControlVolumeUpButton,
297 WKMediaUIControlVolumeDownButton
298 } WKMediaUIControlType;
300 NSControl *WKCreateMediaUIControl(int controlType);
302 NSArray *WKQTGetSitesInMediaDownloadCache();
303 void WKQTClearMediaDownloadCacheForSite(NSString *site);
304 void WKQTClearMediaDownloadCache();
306 #ifndef BUILDING_ON_LEOPARD
307 mach_port_t WKInitializeRenderServer(void);
311 CALayer *WKMakeRenderLayer(uint32_t contextID);
313 typedef struct __WKSoftwareCARendererRef *WKSoftwareCARendererRef;
315 WKSoftwareCARendererRef WKSoftwareCARendererCreate(uint32_t contextID);
316 void WKSoftwareCARendererDestroy(WKSoftwareCARendererRef);
317 void WKSoftwareCARendererRender(WKSoftwareCARendererRef, CGContextRef, CGRect);
319 typedef struct __WKCARemoteLayerClientRef *WKCARemoteLayerClientRef;
321 WKCARemoteLayerClientRef WKCARemoteLayerClientMakeWithServerPort(mach_port_t port);
322 void WKCARemoteLayerClientInvalidate(WKCARemoteLayerClientRef);
323 uint32_t WKCARemoteLayerClientGetClientId(WKCARemoteLayerClientRef);
324 void WKCARemoteLayerClientSetLayer(WKCARemoteLayerClientRef, CALayer *);
325 CALayer *WKCARemoteLayerClientGetLayer(WKCARemoteLayerClientRef);
329 void WKCARendererAddChangeNotificationObserver(CARenderer *, void (*callback)(void*), void* context);
330 void WKCARendererRemoveChangeNotificationObserver(CARenderer *, void (*callback)(void*), void* context);
332 typedef struct __WKWindowBounceAnimationContext *WKWindowBounceAnimationContextRef;
334 WKWindowBounceAnimationContextRef WKWindowBounceAnimationContextCreate(NSWindow *window);
335 void WKWindowBounceAnimationContextDestroy(WKWindowBounceAnimationContextRef context);
336 void WKWindowBounceAnimationSetAnimationProgress(WKWindowBounceAnimationContextRef context, double animationProgress);
338 #if defined(__x86_64__)
340 CFRunLoopSourceRef WKCreateMIGServerSource(mig_subsystem_t subsystem, mach_port_t serverPort);
341 #endif // defined(__x86_64__)
343 NSUInteger WKGetInputPanelWindowStyle(void);
344 UInt8 WKGetNSEventKeyChar(NSEvent *);
345 #endif // !defined(BUILDING_ON_LEOPARD)
347 @class CAPropertyAnimation;
348 void WKSetCAAnimationValueFunction(CAPropertyAnimation*, NSString* function);
350 unsigned WKInitializeMaximumHTTPConnectionCountPerHost(unsigned preferredConnectionCount);
351 int WKGetHTTPPipeliningPriority(CFURLRequestRef);
352 void WKSetHTTPPipeliningMaximumPriority(int maximumPriority);
353 void WKSetHTTPPipeliningPriority(CFURLRequestRef, int priority);
354 void WKSetHTTPPipeliningMinimumFastLanePriority(int priority);
356 void WKSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
357 void WKSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString);
358 CFHTTPMessageRef WKCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL);
360 #if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
362 WKEventPhaseNone = 0,
363 WKEventPhaseBegan = 1,
364 WKEventPhaseChanged = 2,
365 WKEventPhaseEnded = 3,
368 int WKGetNSEventMomentumPhase(NSEvent *);
371 void WKWindowSetAlpha(NSWindow *window, float alphaValue);
372 void WKWindowSetScaledFrame(NSWindow *window, NSRect scaleFrame, NSRect nonScaledFrame);
374 #ifndef BUILDING_ON_LEOPARD
375 void WKSyncSurfaceToView(NSView *view);
377 void WKEnableSettingCursorWhenInBackground(void);
379 CFDictionaryRef WKNSURLRequestCreateSerializableRepresentation(NSURLRequest *request, CFTypeRef tokenNull);
380 NSURLRequest *WKNSURLRequestFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
382 CFDictionaryRef WKNSURLResponseCreateSerializableRepresentation(NSURLResponse *response, CFTypeRef tokenNull);
383 NSURLResponse *WKNSURLResponseFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
386 ScriptCode WKGetScriptCodeFromCurrentKeyboardInputSource(void);
391 #if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
392 CFIndex WKGetHyphenationLocationBeforeIndex(CFStringRef string, CFIndex index);
395 CFArrayRef WKCFURLCacheCopyAllHostNamesInPersistentStore(void);
396 void WKCFURLCacheDeleteHostNamesInPersistentStore(CFArrayRef hostArray);
398 CFStringRef WKGetCFURLResponseMIMEType(CFURLResponseRef);
399 CFURLRef WKGetCFURLResponseURL(CFURLResponseRef);
400 CFHTTPMessageRef WKGetCFURLResponseHTTPResponse(CFURLResponseRef);
401 CFStringRef WKCopyCFURLResponseSuggestedFilename(CFURLResponseRef);
402 void WKSetCFURLResponseMIMEType(CFURLResponseRef, CFStringRef mimeType);
404 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
407 WKSandboxExtensionTypeReadOnly,
408 WKSandboxExtensionTypeWriteOnly,
409 WKSandboxExtensionTypeReadWrite,
410 } WKSandboxExtensionType;
411 typedef struct __WKSandboxExtension *WKSandboxExtensionRef;
413 WKSandboxExtensionRef WKSandboxExtensionCreate(const char* path, WKSandboxExtensionType type);
414 void WKSandboxExtensionDestroy(WKSandboxExtensionRef sandboxExtension);
416 bool WKSandboxExtensionConsume(WKSandboxExtensionRef sandboxExtension);
417 bool WKSandboxExtensionInvalidate(WKSandboxExtensionRef sandboxExtension);
419 const char* WKSandboxExtensionGetSerializedFormat(WKSandboxExtensionRef sandboxExtension, size_t* length);
420 WKSandboxExtensionRef WKSandboxExtensionCreateFromSerializedFormat(const char* serializationFormat, size_t length);
422 int WKRecommendedScrollerStyle(void);
424 bool WKExecutableWasLinkedOnOrBeforeSnowLeopard(void);
426 NSRange WKExtractWordDefinitionTokenRangeFromContextualString(NSString *contextString, NSRange range, NSDictionary **options);
427 void WKShowWordDefinitionWindow(NSAttributedString *term, NSPoint screenPoint, NSDictionary *options);
428 void WKHideWordDefinitionWindow(void);
430 CFStringRef WKCopyDefaultSearchProviderDisplayName(void);
432 NSURL* WKAVAssetResolvedURL(AVAsset*);
434 NSCursor *WKCursor(const char *name);