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 WKPatternTilingNoDistortion,
168 WKPatternTilingConstantSpacingMinimalDistortion,
169 WKPatternTilingConstantSpacing
172 CGPatternRef WKCGPatternCreateWithImageAndTransform(CGImageRef image, CGAffineTransform transform, int tiling);
175 NSEvent *WKCreateNSEventWithCarbonEvent(EventRef eventRef);
176 NSEvent *WKCreateNSEventWithCarbonMouseMoveEvent(EventRef inEvent, NSWindow *window);
177 NSEvent *WKCreateNSEventWithCarbonClickEvent(EventRef inEvent, WindowRef windowRef);
180 CGContextRef WKNSWindowOverrideCGContext(NSWindow *, CGContextRef);
181 void WKNSWindowRestoreCGContext(NSWindow *, CGContextRef);
183 void WKNSWindowMakeBottomCornersSquare(NSWindow *);
185 // These constants match the ones used by ThemeScrollbarArrowStyle (some of the values are private, so we can't just
186 // use that enum directly).
188 WKThemeScrollBarArrowsSingle = 0,
189 WKThemeScrollBarArrowsLowerRight = 1,
190 WKThemeScrollBarArrowsDouble = 2,
191 WKThemeScrollBarArrowsUpperLeft = 3,
192 } WKThemeScrollBarArrowStyle;
194 OSStatus WKThemeDrawTrack(const HIThemeTrackDrawInfo* inDrawInfo, CGContextRef inContext, int inArrowStyle);
197 BOOL WKCGContextIsBitmapContext(CGContextRef context);
199 void WKGetWheelEventDeltas(NSEvent *, float *deltaX, float *deltaY, BOOL *continuous);
201 BOOL WKAppVersionCheckLessThan(NSString *, int, double);
206 WKMovieTypeStoredStream,
207 WKMovieTypeLiveStream
210 int WKQTMovieGetType(QTMovie* movie);
212 BOOL WKQTMovieHasClosedCaptions(QTMovie* movie);
213 void WKQTMovieSetShowClosedCaptions(QTMovie* movie, BOOL showClosedCaptions);
214 void WKQTMovieSelectPreferredAlternates(QTMovie* movie);
215 void WKQTMovieSelectPreferredAlternateTrackForMediaType(QTMovie* movie, NSString* mediaType);
217 unsigned WKQTIncludeOnlyModernMediaFileTypes(void);
218 int WKQTMovieDataRate(QTMovie* movie);
219 float WKQTMovieMaxTimeLoaded(QTMovie* movie);
220 float WKQTMovieMaxTimeSeekable(QTMovie* movie);
221 NSString *WKQTMovieMaxTimeLoadedChangeNotification(void);
222 void WKQTMovieViewSetDrawSynchronously(QTMovieView* view, BOOL sync);
223 void WKQTMovieDisableComponent(uint32_t[5]);
224 NSURL *WKQTMovieResolvedURL(QTMovie* movie);
226 CFStringRef WKCopyFoundationCacheDirectory(void);
228 #if defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LEOPARD)
229 typedef struct __CFURLStorageSession* CFURLStorageSessionRef;
231 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
233 CFURLStorageSessionRef WKCreatePrivateStorageSession(CFStringRef);
234 NSURLRequest *WKCopyRequestWithStorageSession(CFURLStorageSessionRef, NSURLRequest*);
235 NSCachedURLResponse *WKCachedResponseForRequest(CFURLStorageSessionRef, NSURLRequest*);
236 void WKSetRequestStorageSession(CFURLStorageSessionRef, CFMutableURLRequestRef);
238 typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
239 CFHTTPCookieStorageRef WKCopyHTTPCookieStorage(CFURLStorageSessionRef);
240 unsigned WKGetHTTPCookieAcceptPolicy(CFHTTPCookieStorageRef);
241 void WKSetHTTPCookieAcceptPolicy(CFHTTPCookieStorageRef, unsigned policy);
242 NSArray *WKHTTPCookiesForURL(CFHTTPCookieStorageRef, NSURL *);
243 void WKSetHTTPCookiesForURL(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *);
244 void WKDeleteHTTPCookie(CFHTTPCookieStorageRef, NSHTTPCookie *);
246 CFHTTPCookieStorageRef WKGetDefaultHTTPCookieStorage(void);
247 WKCFURLCredentialRef WKCopyCredentialFromCFPersistentStorage(CFURLProtectionSpaceRef);
248 void WKSetCFURLRequestShouldContentSniff(CFMutableURLRequestRef, bool flag);
249 CFArrayRef WKCFURLRequestCopyHTTPRequestBodyParts(CFURLRequestRef);
250 void WKCFURLRequestSetHTTPRequestBodyParts(CFMutableURLRequestRef, CFArrayRef bodyParts);
252 void WKSetVisibleApplicationName(CFStringRef);
255 WKMediaUIPartFullscreenButton = 0,
256 WKMediaUIPartMuteButton,
257 WKMediaUIPartPlayButton,
258 WKMediaUIPartSeekBackButton,
259 WKMediaUIPartSeekForwardButton,
260 WKMediaUIPartTimelineSlider,
261 WKMediaUIPartTimelineSliderThumb,
262 WKMediaUIPartRewindButton,
263 WKMediaUIPartSeekToRealtimeButton,
264 WKMediaUIPartShowClosedCaptionsButton,
265 WKMediaUIPartHideClosedCaptionsButton,
266 WKMediaUIPartUnMuteButton,
267 WKMediaUIPartPauseButton,
268 WKMediaUIPartBackground,
269 WKMediaUIPartCurrentTimeDisplay,
270 WKMediaUIPartTimeRemainingDisplay,
271 WKMediaUIPartStatusDisplay,
272 WKMediaUIPartControlsPanel,
273 WKMediaUIPartVolumeSliderContainer,
274 WKMediaUIPartVolumeSlider,
275 WKMediaUIPartVolumeSliderThumb
279 WKMediaControllerThemeClassic = 1,
280 WKMediaControllerThemeQuickTime = 2
281 } WKMediaControllerThemeStyle;
284 WKMediaControllerFlagDisabled = 1 << 0,
285 WKMediaControllerFlagPressed = 1 << 1,
286 WKMediaControllerFlagDrawEndCaps = 1 << 3,
287 WKMediaControllerFlagFocused = 1 << 4
288 } WKMediaControllerThemeState;
290 BOOL WKMediaControllerThemeAvailable(int themeStyle);
291 BOOL WKHitTestMediaUIPart(int part, int themeStyle, CGRect bounds, CGPoint point);
292 void WKMeasureMediaUIPart(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
293 void WKDrawMediaUIPart(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
294 void WKDrawMediaSliderTrack(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration, unsigned state);
295 NSView *WKCreateMediaUIBackgroundView(void);
298 WKMediaUIControlTimeline,
299 WKMediaUIControlSlider,
300 WKMediaUIControlPlayPauseButton,
301 WKMediaUIControlExitFullscreenButton,
302 WKMediaUIControlRewindButton,
303 WKMediaUIControlFastForwardButton,
304 WKMediaUIControlVolumeUpButton,
305 WKMediaUIControlVolumeDownButton
306 } WKMediaUIControlType;
308 NSControl *WKCreateMediaUIControl(int controlType);
310 NSArray *WKQTGetSitesInMediaDownloadCache();
311 void WKQTClearMediaDownloadCacheForSite(NSString *site);
312 void WKQTClearMediaDownloadCache();
314 #ifndef BUILDING_ON_LEOPARD
315 mach_port_t WKInitializeRenderServer(void);
319 CALayer *WKMakeRenderLayer(uint32_t contextID);
321 typedef struct __WKSoftwareCARendererRef *WKSoftwareCARendererRef;
323 WKSoftwareCARendererRef WKSoftwareCARendererCreate(uint32_t contextID);
324 void WKSoftwareCARendererDestroy(WKSoftwareCARendererRef);
325 void WKSoftwareCARendererRender(WKSoftwareCARendererRef, CGContextRef, CGRect);
327 typedef struct __WKCARemoteLayerClientRef *WKCARemoteLayerClientRef;
329 WKCARemoteLayerClientRef WKCARemoteLayerClientMakeWithServerPort(mach_port_t port);
330 void WKCARemoteLayerClientInvalidate(WKCARemoteLayerClientRef);
331 uint32_t WKCARemoteLayerClientGetClientId(WKCARemoteLayerClientRef);
332 void WKCARemoteLayerClientSetLayer(WKCARemoteLayerClientRef, CALayer *);
333 CALayer *WKCARemoteLayerClientGetLayer(WKCARemoteLayerClientRef);
337 void WKCARendererAddChangeNotificationObserver(CARenderer *, void (*callback)(void*), void* context);
338 void WKCARendererRemoveChangeNotificationObserver(CARenderer *, void (*callback)(void*), void* context);
340 typedef struct __WKWindowBounceAnimationContext *WKWindowBounceAnimationContextRef;
342 WKWindowBounceAnimationContextRef WKWindowBounceAnimationContextCreate(NSWindow *window);
343 void WKWindowBounceAnimationContextDestroy(WKWindowBounceAnimationContextRef context);
344 void WKWindowBounceAnimationSetAnimationProgress(WKWindowBounceAnimationContextRef context, double animationProgress);
346 #if defined(__x86_64__)
348 CFRunLoopSourceRef WKCreateMIGServerSource(mig_subsystem_t subsystem, mach_port_t serverPort);
349 #endif // defined(__x86_64__)
351 NSUInteger WKGetInputPanelWindowStyle(void);
352 UInt8 WKGetNSEventKeyChar(NSEvent *);
353 #endif // !defined(BUILDING_ON_LEOPARD)
355 @class CAPropertyAnimation;
356 void WKSetCAAnimationValueFunction(CAPropertyAnimation*, NSString* function);
358 unsigned WKInitializeMaximumHTTPConnectionCountPerHost(unsigned preferredConnectionCount);
359 int WKGetHTTPPipeliningPriority(CFURLRequestRef);
360 void WKSetHTTPPipeliningMaximumPriority(int maximumPriority);
361 void WKSetHTTPPipeliningPriority(CFURLRequestRef, int priority);
362 void WKSetHTTPPipeliningMinimumFastLanePriority(int priority);
364 void WKSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
365 void WKSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString);
366 CFHTTPMessageRef WKCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL);
368 #if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
370 WKEventPhaseNone = 0,
371 WKEventPhaseBegan = 1,
372 WKEventPhaseChanged = 2,
373 WKEventPhaseEnded = 3,
376 int WKGetNSEventMomentumPhase(NSEvent *);
379 void WKWindowSetAlpha(NSWindow *window, float alphaValue);
380 void WKWindowSetScaledFrame(NSWindow *window, NSRect scaleFrame, NSRect nonScaledFrame);
382 #ifndef BUILDING_ON_LEOPARD
383 void WKSyncSurfaceToView(NSView *view);
385 void WKEnableSettingCursorWhenInBackground(void);
387 CFDictionaryRef WKNSURLRequestCreateSerializableRepresentation(NSURLRequest *request, CFTypeRef tokenNull);
388 NSURLRequest *WKNSURLRequestFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
390 CFDictionaryRef WKNSURLResponseCreateSerializableRepresentation(NSURLResponse *response, CFTypeRef tokenNull);
391 NSURLResponse *WKNSURLResponseFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
394 ScriptCode WKGetScriptCodeFromCurrentKeyboardInputSource(void);
399 #if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
400 CFIndex WKGetHyphenationLocationBeforeIndex(CFStringRef string, CFIndex index);
403 CFArrayRef WKCFURLCacheCopyAllHostNamesInPersistentStore(void);
404 void WKCFURLCacheDeleteHostNamesInPersistentStore(CFArrayRef hostArray);
406 CFStringRef WKGetCFURLResponseMIMEType(CFURLResponseRef);
407 CFURLRef WKGetCFURLResponseURL(CFURLResponseRef);
408 CFHTTPMessageRef WKGetCFURLResponseHTTPResponse(CFURLResponseRef);
409 CFStringRef WKCopyCFURLResponseSuggestedFilename(CFURLResponseRef);
410 void WKSetCFURLResponseMIMEType(CFURLResponseRef, CFStringRef mimeType);
412 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
415 WKSandboxExtensionTypeReadOnly,
416 WKSandboxExtensionTypeWriteOnly,
417 WKSandboxExtensionTypeReadWrite,
418 } WKSandboxExtensionType;
419 typedef struct __WKSandboxExtension *WKSandboxExtensionRef;
421 WKSandboxExtensionRef WKSandboxExtensionCreate(const char* path, WKSandboxExtensionType type);
422 void WKSandboxExtensionDestroy(WKSandboxExtensionRef sandboxExtension);
424 bool WKSandboxExtensionConsume(WKSandboxExtensionRef sandboxExtension);
425 bool WKSandboxExtensionInvalidate(WKSandboxExtensionRef sandboxExtension);
427 const char* WKSandboxExtensionGetSerializedFormat(WKSandboxExtensionRef sandboxExtension, size_t* length);
428 WKSandboxExtensionRef WKSandboxExtensionCreateFromSerializedFormat(const char* serializationFormat, size_t length);
430 int WKRecommendedScrollerStyle(void);
432 bool WKExecutableWasLinkedOnOrBeforeSnowLeopard(void);
434 NSRange WKExtractWordDefinitionTokenRangeFromContextualString(NSString *contextString, NSRange range, NSDictionary **options);
435 void WKShowWordDefinitionWindow(NSAttributedString *term, NSPoint screenPoint, NSDictionary *options);
436 void WKHideWordDefinitionWindow(void);
438 CFStringRef WKCopyDefaultSearchProviderDisplayName(void);
440 NSURL* WKAVAssetResolvedURL(AVAsset*);
442 NSCursor *WKCursor(const char *name);