https://bugs.webkit.org/show_bug.cgi?id=129722
[WebKit-https.git] / WebKitLibraries / WebKitSystemInterface.h
1 /*      
2     WebKitSystemInterface.h
3     Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
4
5     Public header file.
6 */
7
8 #import <Foundation/Foundation.h>
9 #import <dispatch/dispatch.h>
10
11 #if !TARGET_OS_IPHONE
12 #import <AppKit/AppKit.h>
13 #import <Carbon/Carbon.h>
14 #else
15 #import <CoreImage/CoreImage.h>
16 #import <CoreText/CoreText.h>
17 #if !TARGET_IPHONE_SIMULATOR
18 #import <IOSurface/IOSurface.h>
19 #endif
20 #import <WebKitSystemInterfaceIOS.h>
21 #endif
22
23 @class AVAsset;
24 @class AVPlayer;
25 @class QTMovie;
26 @class QTMovieView;
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 typedef struct _CFURLResponse* CFURLResponseRef;
33 typedef const struct _CFURLRequest* CFURLRequestRef;
34 typedef struct _CFURLRequest* CFMutableURLRequestRef;
35
36 typedef struct _CFURLCredential* WKCFURLCredentialRef;
37 typedef struct _CFURLProtectionSpace* CFURLProtectionSpaceRef;
38
39 typedef enum {
40     WKCertificateParseResultSucceeded  = 0,
41     WKCertificateParseResultFailed     = 1,
42     WKCertificateParseResultPKCS7      = 2,
43 } WKCertificateParseResult;
44
45 CFStringRef WKCopyCFLocalizationPreferredName(CFStringRef localization);
46 void WKSetDefaultLocalization(CFStringRef localization);
47
48 CFStringRef WKSignedPublicKeyAndChallengeString(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
49 WKCertificateParseResult WKAddCertificatesToKeychainFromData(const void *bytes, unsigned length);
50
51 NSString *WKGetPreferredExtensionForMIMEType(NSString *type);
52 NSArray *WKGetExtensionsForMIMEType(NSString *type);
53 NSString *WKGetMIMETypeForExtension(NSString *extension);
54
55 NSDate *WKGetNSURLResponseLastModifiedDate(NSURLResponse *response);
56 NSString *WKCopyNSURLResponseStatusLine(NSURLResponse *response);
57
58 CFArrayRef WKCopyNSURLResponseCertificateChain(NSURLResponse *response);
59
60 CFStringEncoding WKGetWebDefaultCFStringEncoding(void);
61
62 void WKSetMetadataURL(NSString *URLString, NSString *referrer, NSString *path);
63 void WKSetNSURLConnectionDefersCallbacks(NSURLConnection *connection, BOOL defers);
64
65 #if !TARGET_OS_IPHONE
66 void WKShowKeyAndMain(void);
67 #ifndef __LP64__
68 OSStatus WKSyncWindowWithCGAfterMove(WindowRef);
69 unsigned WKCarbonWindowMask(void);
70 void *WKGetNativeWindowFromWindowRef(WindowRef);
71 OSType WKCarbonWindowPropertyCreator(void);
72 OSType WKCarbonWindowPropertyTag(void);
73 #endif
74
75 void WKDisableCGDeferredUpdates(void);
76 #endif
77
78 Class WKNSURLProtocolClassForRequest(NSURLRequest *request);
79 void WKSetNSURLRequestShouldContentSniff(NSMutableURLRequest *request, BOOL shouldContentSniff);
80
81 #if !TARGET_OS_IPHONE
82 #ifndef __LP64__
83 unsigned WKGetNSAutoreleasePoolCount(void);
84 #endif
85
86 void WKAdvanceDefaultButtonPulseAnimation(NSButtonCell *button);
87
88 NSString *WKMouseMovedNotification(void);
89 NSString *WKWindowWillOrderOnScreenNotification(void);
90 NSString *WKWindowWillOrderOffScreenNotification(void);
91 void WKSetNSWindowShouldPostEventNotifications(NSWindow *window, BOOL post);
92
93 CFTypeID WKGetAXTextMarkerTypeID(void);
94 CFTypeID WKGetAXTextMarkerRangeTypeID(void);
95 CFTypeRef WKCreateAXTextMarker(const void *bytes, size_t len);
96 BOOL WKGetBytesFromAXTextMarker(CFTypeRef textMarker, void *bytes, size_t length);
97 CFTypeRef WKCreateAXTextMarkerRange(CFTypeRef start, CFTypeRef end);
98 CFTypeRef WKCopyAXTextMarkerRangeStart(CFTypeRef range);
99 CFTypeRef WKCopyAXTextMarkerRangeEnd(CFTypeRef range);
100 void WKAccessibilityHandleFocusChanged(void);
101 AXUIElementRef WKCreateAXUIElementRef(id element);
102 void WKUnregisterUniqueIdForElement(id element);
103     
104 NSArray *WKSpeechSynthesisGetVoiceIdentifiers(void);
105 NSString *WKSpeechSynthesisGetDefaultVoiceIdentifierForLocale(NSLocale*);
106 #endif
107     
108 BOOL WKShouldBlockPlugin(NSString *bundleIdentifier, NSString *bundleVersionString);
109 BOOL WKIsPluginUpdateAvailable(NSString *bundleIdentifier);
110
111 BOOL WKShouldBlockWebGL();
112 BOOL WKShouldSuggestBlockingWebGL();
113
114 // Remote Accessibility API.
115 #if !TARGET_OS_IPHONE
116 void WKAXRegisterRemoteApp(void);
117 void WKAXInitializeElementWithPresenterPid(id, pid_t);
118 NSData *WKAXRemoteTokenForElement(id);
119 id WKAXRemoteElementForToken(NSData *);
120 void WKAXSetWindowForRemoteElement(id remoteWindow, id remoteElement);
121 void WKAXRegisterRemoteProcess(bool registerProcess, pid_t);
122 pid_t WKAXRemoteProcessIdentifier(id remoteElement);
123 #endif
124
125 void WKSetUpFontCache(void);
126
127 void WKSignalCFReadStreamEnd(CFReadStreamRef stream);
128 void WKSignalCFReadStreamHasBytes(CFReadStreamRef stream);
129 void WKSignalCFReadStreamError(CFReadStreamRef stream, CFStreamError *error);
130
131 CFReadStreamRef WKCreateCustomCFReadStream(void *(*formCreate)(CFReadStreamRef, void *), 
132     void (*formFinalize)(CFReadStreamRef, void *), 
133     Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *), 
134     CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *), 
135     Boolean (*formCanRead)(CFReadStreamRef, void *), 
136     void (*formClose)(CFReadStreamRef, void *), 
137     void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *), 
138     void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
139     void *context);
140
141 #if !TARGET_OS_IPHONE
142 void WKDrawCapsLockIndicator(CGContextRef, CGRect);
143
144 void WKDrawFocusRing(CGContextRef context, CGColorRef color, int radius);
145     // The CG context's current path is the focus ring's path.
146     // A color of 0 means "use system focus ring color".
147     // A radius of 0 means "use default focus ring radius".
148
149 void WKSetDragImage(NSImage *image, NSPoint offset);
150
151 void WKDrawBezeledTextFieldCell(NSRect, BOOL enabled);
152 void WKDrawTextFieldCellFocusRing(NSTextFieldCell*, NSRect);
153 void WKDrawBezeledTextArea(NSRect, BOOL enabled);
154 void WKPopupMenu(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
155 void WKPopupContextMenu(NSMenu *menu, NSPoint screenLocation);
156 void WKSendUserChangeNotifications(void);
157 #ifndef __LP64__
158 BOOL WKConvertNSEventToCarbonEvent(EventRecord *carbonEvent, NSEvent *cocoaEvent);
159 void WKSendKeyEventToTSM(NSEvent *theEvent);
160 void WKCallDrawingNotification(CGrafPtr port, Rect *bounds);
161 #endif
162
163 BOOL WKGetGlyphTransformedAdvances(CGFontRef, NSFont*, CGAffineTransform *m, ATSGlyphRef *glyph, CGSize *advance);
164 NSFont *WKGetFontInLanguageForRange(NSFont *font, NSString *string, NSRange range);
165 NSFont *WKGetFontInLanguageForCharacter(NSFont *font, UniChar ch);
166 void WKSetCGFontRenderingMode(CGContextRef cgContext, NSFont *font, BOOL shouldSubpixelQuantize);
167 #endif
168
169 BOOL WKCGContextGetShouldSmoothFonts(CGContextRef cgContext);
170
171
172 void WKSetBaseCTM(CGContextRef, CGAffineTransform);
173 void WKSetPatternPhaseInUserSpace(CGContextRef, CGPoint);
174 CGAffineTransform WKGetUserToBaseCTM(CGContextRef);
175
176 void WKGetGlyphsForCharacters(CGFontRef, const UniChar[], CGGlyph[], size_t);
177 bool WKGetVerticalGlyphsForCharacters(CTFontRef, const UniChar[], CGGlyph[], size_t);
178
179 CTLineRef WKCreateCTLineWithUniCharProvider(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
180
181 #if TARGET_OS_IPHONE || MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
182 enum {
183     WKCTFontTransformApplyShaping = (1 << 0),
184     WKCTFontTransformApplyPositioning = (1 << 1)
185 };
186
187 typedef int WKCTFontTransformOptions;
188
189 bool WKCTFontTransformGlyphs(CTFontRef font, CGGlyph glyphs[], CGSize advances[], CFIndex count, WKCTFontTransformOptions options);
190 #endif // TARGET_OS_IPHONE || MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
191
192 CTTypesetterRef WKCreateCTTypesetterWithUniCharProviderAndOptions(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
193
194 CGSize WKCTRunGetInitialAdvance(CTRunRef);
195
196 #if (TARGET_OS_IPHONE && TARGET_OS_EMBEDDED) || MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
197 CGContextRef WKIOSurfaceContextCreate(IOSurfaceRef, unsigned width, unsigned height, CGColorSpaceRef);
198 CGImageRef WKIOSurfaceContextCreateImage(CGContextRef context);
199 #endif
200
201 typedef enum {
202     WKPatternTilingNoDistortion,
203     WKPatternTilingConstantSpacingMinimalDistortion,
204     WKPatternTilingConstantSpacing
205 } WKPatternTiling;
206
207 CGPatternRef WKCGPatternCreateWithImageAndTransform(CGImageRef image, CGAffineTransform transform, int tiling);
208 void WKCGContextResetClip(CGContextRef);
209
210 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
211 bool WKCGContextDrawsWithCorrectShadowOffsets(CGContextRef);
212 #endif
213
214 #if !TARGET_OS_IPHONE
215 #ifndef __LP64__
216 NSEvent *WKCreateNSEventWithCarbonEvent(EventRef eventRef);
217 NSEvent *WKCreateNSEventWithCarbonMouseMoveEvent(EventRef inEvent, NSWindow *window);
218 NSEvent *WKCreateNSEventWithCarbonClickEvent(EventRef inEvent, WindowRef windowRef);
219 #endif
220
221 CGContextRef WKNSWindowOverrideCGContext(NSWindow *, CGContextRef);
222 void WKNSWindowRestoreCGContext(NSWindow *, CGContextRef);
223
224 void WKNSWindowMakeBottomCornersSquare(NSWindow *);
225
226 // These constants match the ones used by ThemeScrollbarArrowStyle (some of the values are private, so we can't just
227 // use that enum directly).
228 typedef enum {
229     WKThemeScrollBarArrowsSingle     = 0,
230     WKThemeScrollBarArrowsLowerRight = 1,
231     WKThemeScrollBarArrowsDouble     = 2,
232     WKThemeScrollBarArrowsUpperLeft  = 3,
233 } WKThemeScrollBarArrowStyle;
234
235 OSStatus WKThemeDrawTrack(const HIThemeTrackDrawInfo* inDrawInfo, CGContextRef inContext, int inArrowStyle);
236 #endif
237
238
239 BOOL WKCGContextIsBitmapContext(CGContextRef context);
240 bool WKCGContextIsPDFContext(CGContextRef context);
241
242 #if !TARGET_OS_IPHONE
243 void WKGetWheelEventDeltas(NSEvent *, float *deltaX, float *deltaY, BOOL *continuous);
244
245 BOOL WKAppVersionCheckLessThan(NSString *, int, double);
246
247 typedef enum {
248     WKMovieTypeUnknown,
249     WKMovieTypeDownload,
250     WKMovieTypeStoredStream,
251     WKMovieTypeLiveStream
252 } WKMovieType;
253
254 int WKQTMovieGetType(QTMovie* movie);
255
256 BOOL WKQTMovieHasClosedCaptions(QTMovie* movie);
257 void WKQTMovieSetShowClosedCaptions(QTMovie* movie, BOOL showClosedCaptions);
258 void WKQTMovieSelectPreferredAlternates(QTMovie* movie);
259 void WKQTMovieSelectPreferredAlternateTrackForMediaType(QTMovie* movie, NSString* mediaType);
260
261 unsigned WKQTIncludeOnlyModernMediaFileTypes(void);
262 int WKQTMovieDataRate(QTMovie* movie);
263 float WKQTMovieMaxTimeLoaded(QTMovie* movie);
264 float WKQTMovieMaxTimeSeekable(QTMovie* movie);
265 NSString *WKQTMovieMaxTimeLoadedChangeNotification(void);
266 void WKQTMovieViewSetDrawSynchronously(QTMovieView* view, BOOL sync);
267 void WKQTMovieDisableComponent(uint32_t[5]);
268 NSURL *WKQTMovieResolvedURL(QTMovie* movie);
269 #endif
270
271 CFStringRef WKCopyFoundationCacheDirectory(void);
272
273 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
274 CFURLStorageSessionRef WKCreatePrivateStorageSession(CFStringRef);
275 NSURLRequest *WKCopyRequestWithStorageSession(CFURLStorageSessionRef, NSURLRequest *);
276 NSCachedURLResponse *WKCachedResponseForRequest(CFURLStorageSessionRef, NSURLRequest *);
277 void WKSetRequestStorageSession(CFURLStorageSessionRef, CFMutableURLRequestRef);
278
279 typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
280 CFHTTPCookieStorageRef WKCopyHTTPCookieStorage(CFURLStorageSessionRef);
281 unsigned WKGetHTTPCookieAcceptPolicy(CFHTTPCookieStorageRef);
282 void WKSetHTTPCookieAcceptPolicy(CFHTTPCookieStorageRef, unsigned policy);
283 NSArray *WKHTTPCookies(CFHTTPCookieStorageRef);
284 NSArray *WKHTTPCookiesForURL(CFHTTPCookieStorageRef, NSURL *, NSURL *);
285 void WKSetHTTPCookiesForURL(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *);
286 void WKDeleteAllHTTPCookies(CFHTTPCookieStorageRef);
287 void WKDeleteHTTPCookie(CFHTTPCookieStorageRef, NSHTTPCookie *);
288
289 CFHTTPCookieStorageRef WKGetDefaultHTTPCookieStorage(void);
290 WKCFURLCredentialRef WKCopyCredentialFromCFPersistentStorage(CFURLProtectionSpaceRef);
291 void WKSetCFURLRequestShouldContentSniff(CFMutableURLRequestRef, bool flag);
292 CFArrayRef WKCFURLRequestCopyHTTPRequestBodyParts(CFURLRequestRef);
293 void WKCFURLRequestSetHTTPRequestBodyParts(CFMutableURLRequestRef, CFArrayRef bodyParts);
294
295 #if !TARGET_OS_IPHONE
296 void WKSetVisibleApplicationName(CFStringRef);
297 void WKSetApplicationInformationItem(CFStringRef key, CFTypeRef value);
298 #endif
299
300 CFURLRef WKCopyBundleURLForExecutableURL(CFURLRef);
301
302 #if !TARGET_OS_IPHONE
303 typedef enum {
304     WKMediaUIPartFullscreenButton   = 0,
305     WKMediaUIPartMuteButton,
306     WKMediaUIPartPlayButton,
307     WKMediaUIPartSeekBackButton,
308     WKMediaUIPartSeekForwardButton,
309     WKMediaUIPartTimelineSlider,
310     WKMediaUIPartTimelineSliderThumb,
311     WKMediaUIPartRewindButton,
312     WKMediaUIPartSeekToRealtimeButton,
313     WKMediaUIPartShowClosedCaptionsButton,
314     WKMediaUIPartHideClosedCaptionsButton,
315     WKMediaUIPartUnMuteButton,
316     WKMediaUIPartPauseButton,
317     WKMediaUIPartBackground,
318     WKMediaUIPartCurrentTimeDisplay,
319     WKMediaUIPartTimeRemainingDisplay,
320     WKMediaUIPartStatusDisplay,
321     WKMediaUIPartControlsPanel,
322     WKMediaUIPartVolumeSliderContainer,
323     WKMediaUIPartVolumeSlider,
324     WKMediaUIPartVolumeSliderThumb,
325     WKMediaUIPartFullScreenVolumeSlider,
326     WKMediaUIPartFullScreenVolumeSliderThumb,
327     WKMediaUIPartVolumeSliderMuteButton,
328     WKMediaUIPartTextTrackDisplayContainer,
329     WKMediaUIPartTextTrackDisplay,
330     WKMediaUIPartExitFullscreenButton,
331 } WKMediaUIPart;
332
333 typedef enum {
334     WKMediaControllerFlagDisabled = 1 << 0,
335     WKMediaControllerFlagPressed = 1 << 1,
336     WKMediaControllerFlagDrawEndCaps = 1 << 3,
337     WKMediaControllerFlagFocused = 1 << 4
338 } WKMediaControllerThemeState;
339
340 BOOL WKHitTestMediaUIPart(int part, CGRect bounds, CGPoint point);
341 void WKMeasureMediaUIPart(int part, CGRect *bounds, CGSize *naturalSize);
342 void WKDrawMediaUIPart(int part, CGContextRef context, CGRect rect, unsigned state);
343 void WKDrawMediaSliderTrack(CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration, unsigned state);
344 NSView *WKCreateMediaUIBackgroundView(void);
345
346 typedef enum {
347     WKMediaUIControlTimeline,
348     WKMediaUIControlSlider,
349     WKMediaUIControlPlayPauseButton,
350     WKMediaUIControlExitFullscreenButton,
351     WKMediaUIControlRewindButton,
352     WKMediaUIControlFastForwardButton,
353     WKMediaUIControlVolumeUpButton,
354     WKMediaUIControlVolumeDownButton
355 } WKMediaUIControlType;
356     
357 NSControl *WKCreateMediaUIControl(int controlType);
358
359 NSArray *WKQTGetSitesInMediaDownloadCache();
360 void WKQTClearMediaDownloadCacheForSite(NSString *site);
361 void WKQTClearMediaDownloadCache();
362     
363 mach_port_t WKInitializeRenderServer(void);
364 #endif
365
366 @class CALayer;
367
368 CALayer *WKMakeRenderLayer(uint32_t contextID);
369     
370 #if !TARGET_OS_IPHONE
371 typedef struct __WKSoftwareCARendererRef *WKSoftwareCARendererRef;
372
373 WKSoftwareCARendererRef WKSoftwareCARendererCreate(uint32_t contextID);
374 void WKSoftwareCARendererDestroy(WKSoftwareCARendererRef);
375 void WKSoftwareCARendererRender(WKSoftwareCARendererRef, CGContextRef, CGRect);
376 #endif
377
378 typedef struct __WKCAContextRef *WKCAContextRef;
379
380 WKCAContextRef WKCAContextMakeRemoteWithServerPort(mach_port_t port);
381 #if !TARGET_OS_IPHONE
382 WKCAContextRef WKCAContextMakeRemoteForWindowServer(void);
383 #endif
384 void WKCAContextInvalidate(WKCAContextRef);
385 uint32_t WKCAContextGetContextId(WKCAContextRef);
386 void WKCAContextSetLayer(WKCAContextRef, CALayer *);
387 CALayer *WKCAContextGetLayer(WKCAContextRef);
388 void WKCAContextSetColorSpace(WKCAContextRef, CGColorSpaceRef);
389 CGColorSpaceRef WKCAContextGetColorSpace(WKCAContextRef);
390 void WKDestroyRenderingResources(void);
391
392 void WKCALayerEnumerateRectsBeingDrawnWithBlock(CALayer *layer, CGContextRef context, void (^block)(CGRect rect));
393
394 @class CARenderer;
395
396 void WKCARendererAddChangeNotificationObserver(CARenderer *, void (*callback)(void*), void* context);
397 void WKCARendererRemoveChangeNotificationObserver(CARenderer *, void (*callback)(void*), void* context);
398
399 #if !TARGET_OS_IPHONE
400 typedef struct __WKWindowBounceAnimationContext *WKWindowBounceAnimationContextRef;
401
402 WKWindowBounceAnimationContextRef WKWindowBounceAnimationContextCreate(NSWindow *window);
403 void WKWindowBounceAnimationContextDestroy(WKWindowBounceAnimationContextRef context);
404 void WKWindowBounceAnimationSetAnimationProgress(WKWindowBounceAnimationContextRef context, double animationProgress);
405
406 void WKWindowSetClipRect(NSWindow*, NSRect);
407
408 #if defined(__x86_64__)
409 #import <mach/mig.h>
410 CFRunLoopSourceRef WKCreateMIGServerSource(mig_subsystem_t subsystem, mach_port_t serverPort);
411 #endif
412
413 NSUInteger WKGetInputPanelWindowStyle(void);
414 UInt8 WKGetNSEventKeyChar(NSEvent *);
415 #endif
416
417 @class CAPropertyAnimation;
418 void WKSetCAAnimationValueFunction(CAPropertyAnimation*, NSString* function);
419
420 unsigned WKInitializeMaximumHTTPConnectionCountPerHost(unsigned preferredConnectionCount);
421 int WKGetHTTPRequestPriority(CFURLRequestRef);
422 void WKSetHTTPRequestMaximumPriority(int maximumPriority);
423 void WKSetHTTPRequestPriority(CFURLRequestRef, int priority);
424 void WKSetHTTPRequestMinimumFastLanePriority(int priority);
425 void WKHTTPRequestEnablePipelining(CFURLRequestRef);
426
427 void WKSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
428 void WKSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString);
429 CFHTTPMessageRef WKCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL, CFStringRef proxyHost, CFNumberRef proxyPort);
430
431 #if !TARGET_OS_IPHONE
432 void WKWindowSetAlpha(NSWindow *window, float alphaValue);
433 void WKWindowSetScaledFrame(NSWindow *window, NSRect scaleFrame, NSRect nonScaledFrame);
434
435 void WKSyncSurfaceToView(NSView *view);
436
437 void WKEnableSettingCursorWhenInBackground(void);
438 #endif
439
440 CFDictionaryRef WKNSURLRequestCreateSerializableRepresentation(NSURLRequest *request, CFTypeRef tokenNull);
441 NSURLRequest *WKNSURLRequestFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
442
443 CFDictionaryRef WKNSURLResponseCreateSerializableRepresentation(NSURLResponse *response, CFTypeRef tokenNull);
444 NSURLResponse *WKNSURLResponseFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
445
446 #if !TARGET_OS_IPHONE && !defined(__LP64__)
447 ScriptCode WKGetScriptCodeFromCurrentKeyboardInputSource(void);
448 #endif
449
450 CFArrayRef WKCFURLCacheCopyAllHostNamesInPersistentStore(void);
451 void WKCFURLCacheDeleteHostNamesInPersistentStore(CFArrayRef hostArray);    
452
453 CFStringRef WKGetCFURLResponseMIMEType(CFURLResponseRef);
454 CFURLRef WKGetCFURLResponseURL(CFURLResponseRef);
455 CFHTTPMessageRef WKGetCFURLResponseHTTPResponse(CFURLResponseRef);
456 CFStringRef WKCopyCFURLResponseSuggestedFilename(CFURLResponseRef);
457 void WKSetCFURLResponseMIMEType(CFURLResponseRef, CFStringRef mimeType);
458
459 CIFormat WKCIGetRGBA8Format(void);
460
461 #if !TARGET_OS_IPHONE
462 typedef enum {
463     WKSandboxExtensionTypeReadOnly,
464     WKSandboxExtensionTypeReadWrite,
465 } WKSandboxExtensionType;
466 typedef struct __WKSandboxExtension *WKSandboxExtensionRef;
467
468 WKSandboxExtensionRef WKSandboxExtensionCreate(const char* path, WKSandboxExtensionType type);
469 void WKSandboxExtensionDestroy(WKSandboxExtensionRef sandboxExtension);
470
471 bool WKSandboxExtensionConsume(WKSandboxExtensionRef sandboxExtension);
472 bool WKSandboxExtensionInvalidate(WKSandboxExtensionRef sandboxExtension);
473
474 const char* WKSandboxExtensionGetSerializedFormat(WKSandboxExtensionRef sandboxExtension, size_t* length);
475 WKSandboxExtensionRef WKSandboxExtensionCreateFromSerializedFormat(const char* serializationFormat, size_t length);
476
477 OSStatus WKEnableSandboxStyleFileQuarantine(void);
478
479 int WKRecommendedScrollerStyle(void);
480
481 bool WKExecutableWasLinkedOnOrBeforeSnowLeopard(void);
482
483 NSRange WKExtractWordDefinitionTokenRangeFromContextualString(NSString *contextString, NSRange range, NSDictionary **options);
484 void WKShowWordDefinitionWindow(NSAttributedString *term, NSPoint screenPoint, NSDictionary *options);
485 void WKHideWordDefinitionWindow(void);
486 #endif
487
488 #if !TARGET_OS_IPHONE
489 CFStringRef WKCopyDefaultSearchProviderDisplayName(void);
490 #endif
491
492 void WKSetCrashReportApplicationSpecificInformation(CFStringRef);
493
494 NSURL* WKAVAssetResolvedURL(AVAsset*);
495
496 #if !TARGET_OS_IPHONE
497 NSCursor *WKCursor(const char *name);
498 #endif
499
500 dispatch_source_t WKCreateVMPressureDispatchOnMainQueue(void);
501 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
502 dispatch_source_t WKCreateMemoryStatusPressureCriticalDispatchOnMainQueue(void);
503 #endif
504     
505 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
506 bool WKExecutableWasLinkedOnOrBeforeLion(void);
507 #endif
508
509 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
510 bool WKExecutableWasLinkedOnOrBeforeMountainLion(void);
511 #endif
512
513 void WKCGPathAddRoundedRect(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight);
514
515 void WKCFURLRequestAllowAllPostCaching(CFURLRequestRef);
516
517 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
518 CGFloat WKNSElasticDeltaForTimeDelta(CGFloat initialPosition, CGFloat initialVelocity, CGFloat elapsedTime);
519 CGFloat WKNSElasticDeltaForReboundDelta(CGFloat delta);
520 CGFloat WKNSReboundDeltaForElasticDelta(CGFloat delta);
521 #endif
522
523 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
524 typedef enum {
525     WKOcclusionNotificationTypeApplicationBecameVisible,
526     WKOcclusionNotificationTypeApplicationBecameOccluded,
527     WKOcclusionNotificationTypeApplicationWindowModificationsStarted,
528     WKOcclusionNotificationTypeApplicationWindowModificationsStopped,
529     WKOcclusionNotificationTypeWindowBecameVisible,
530     WKOcclusionNotificationTypeWindowBecameOccluded,
531 } WKOcclusionNotificationType;
532
533 typedef uint32_t WKWindowID;
534
535 typedef void (*WKOcclusionNotificationHandler)(uint32_t, void* data, uint32_t dataLength, void*, uint32_t);
536
537 bool WKRegisterOcclusionNotificationHandler(WKOcclusionNotificationType, WKOcclusionNotificationHandler);
538 bool WKUnregisterOcclusionNotificationHandler(WKOcclusionNotificationType, WKOcclusionNotificationHandler);
539 bool WKEnableWindowOcclusionNotifications(NSInteger windowID, bool *outCurrentOcclusionState);
540 #endif
541
542 void WKCFNetworkSetOverrideSystemProxySettings(CFDictionaryRef);
543
544 #if TARGET_OS_IPHONE || MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
545 bool WKIsPublicSuffix(NSString *domain);
546
547 CFArrayRef WKCFURLCacheCopyAllHostNamesInPersistentStoreForPartition(CFStringRef partition);
548 typedef void (^CFURLCacheCopyAllPartitionNamesResultsNotification)(CFArrayRef partitionNames);
549
550 void WKCFURLCacheDeleteHostNamesInPersistentStoreForPartition(CFArrayRef hostArray, CFStringRef partition);
551 CFStringRef WKCachePartitionKey(void);
552 void WKCFURLCacheCopyAllPartitionNames(CFURLCacheCopyAllPartitionNamesResultsNotification resultsBlock);
553 #endif
554
555 typedef enum {
556     WKExternalPlaybackTypeNone,
557     WKExternalPlaybackTypeAirPlay,
558     WKExternalPlaybackTypeTVOut,
559 } WKExternalPlaybackType;
560
561 int WKExernalDeviceTypeForPlayer(AVPlayer *);
562 NSString *WKExernalDeviceDisplayNameForPlayer(AVPlayer *);
563
564 #ifdef __cplusplus
565 }
566 #endif