[Mac] Allow popup menus to override default appearance
[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
47 CFStringRef WKSignedPublicKeyAndChallengeString(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
48 WKCertificateParseResult WKAddCertificatesToKeychainFromData(const void *bytes, unsigned length);
49
50 NSString *WKGetPreferredExtensionForMIMEType(NSString *type);
51 NSArray *WKGetExtensionsForMIMEType(NSString *type);
52 NSString *WKGetMIMETypeForExtension(NSString *extension);
53
54 NSDate *WKGetNSURLResponseLastModifiedDate(NSURLResponse *response);
55 NSString *WKCopyNSURLResponseStatusLine(NSURLResponse *response);
56
57 CFArrayRef WKCopyNSURLResponseCertificateChain(NSURLResponse *response);
58
59 CFStringEncoding WKGetWebDefaultCFStringEncoding(void);
60
61 void WKSetMetadataURL(NSString *URLString, NSString *referrer, NSString *path);
62 void WKSetNSURLConnectionDefersCallbacks(NSURLConnection *connection, BOOL defers);
63
64 #if !TARGET_OS_IPHONE
65 void WKShowKeyAndMain(void);
66 #ifndef __LP64__
67 OSStatus WKSyncWindowWithCGAfterMove(WindowRef);
68 unsigned WKCarbonWindowMask(void);
69 void *WKGetNativeWindowFromWindowRef(WindowRef);
70 OSType WKCarbonWindowPropertyCreator(void);
71 OSType WKCarbonWindowPropertyTag(void);
72 #endif
73
74 void WKDisableCGDeferredUpdates(void);
75 #endif
76
77 void WKSetNSURLRequestShouldContentSniff(NSMutableURLRequest *request, BOOL shouldContentSniff);
78
79 #if !TARGET_OS_IPHONE
80 #ifndef __LP64__
81 unsigned WKGetNSAutoreleasePoolCount(void);
82 #endif
83
84 void WKAdvanceDefaultButtonPulseAnimation(NSButtonCell *button);
85
86 NSString *WKMouseMovedNotification(void);
87 NSString *WKWindowWillOrderOnScreenNotification(void);
88 NSString *WKWindowWillOrderOffScreenNotification(void);
89 void WKSetNSWindowShouldPostEventNotifications(NSWindow *window, BOOL post);
90
91 CFTypeID WKGetAXTextMarkerTypeID(void);
92 CFTypeID WKGetAXTextMarkerRangeTypeID(void);
93 CFTypeRef WKCreateAXTextMarker(const void *bytes, size_t len);
94 BOOL WKGetBytesFromAXTextMarker(CFTypeRef textMarker, void *bytes, size_t length);
95 CFTypeRef WKCreateAXTextMarkerRange(CFTypeRef start, CFTypeRef end);
96 CFTypeRef WKCopyAXTextMarkerRangeStart(CFTypeRef range);
97 CFTypeRef WKCopyAXTextMarkerRangeEnd(CFTypeRef range);
98 void WKAccessibilityHandleFocusChanged(void);
99 AXUIElementRef WKCreateAXUIElementRef(id element);
100 void WKUnregisterUniqueIdForElement(id element);
101     
102 NSArray *WKSpeechSynthesisGetVoiceIdentifiers(void);
103 NSString *WKSpeechSynthesisGetDefaultVoiceIdentifierForLocale(NSLocale*);
104 #endif
105     
106 BOOL WKShouldBlockPlugin(NSString *bundleIdentifier, NSString *bundleVersionString);
107 BOOL WKIsPluginUpdateAvailable(NSString *bundleIdentifier);
108
109 BOOL WKShouldBlockWebGL();
110 BOOL WKShouldSuggestBlockingWebGL();
111
112 // Remote Accessibility API.
113 #if !TARGET_OS_IPHONE
114 void WKAXRegisterRemoteApp(void);
115 void WKAXInitializeElementWithPresenterPid(id, pid_t);
116 NSData *WKAXRemoteTokenForElement(id);
117 id WKAXRemoteElementForToken(NSData *);
118 void WKAXSetWindowForRemoteElement(id remoteWindow, id remoteElement);
119 void WKAXRegisterRemoteProcess(bool registerProcess, pid_t);
120 pid_t WKAXRemoteProcessIdentifier(id remoteElement);
121 #endif
122
123 void WKSetUpFontCache(void);
124
125 void WKSignalCFReadStreamEnd(CFReadStreamRef stream);
126 void WKSignalCFReadStreamHasBytes(CFReadStreamRef stream);
127 void WKSignalCFReadStreamError(CFReadStreamRef stream, CFStreamError *error);
128
129 CFReadStreamRef WKCreateCustomCFReadStream(void *(*formCreate)(CFReadStreamRef, void *), 
130     void (*formFinalize)(CFReadStreamRef, void *), 
131     Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *), 
132     CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *), 
133     Boolean (*formCanRead)(CFReadStreamRef, void *), 
134     void (*formClose)(CFReadStreamRef, void *), 
135     void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *), 
136     void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
137     void *context);
138
139 #if !TARGET_OS_IPHONE
140 void WKDrawCapsLockIndicator(CGContextRef, CGRect);
141
142 // The CG context's current path is the focus ring's path.
143 // Color and radius are ignored. Older versions of WebKit expected to
144 // be able to change the rendering of the system focus ring.
145 void WKDrawFocusRing(CGContextRef context, CGColorRef color, int radius);
146 bool WKDrawFocusRingAtTime(CGContextRef context, NSTimeInterval time);
147 bool WKDrawCellFocusRingWithFrameAtTime(NSCell *cell, NSRect cellFrame, NSView *controlView, NSTimeInterval time);
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
155 void WKPopupMenu(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize, bool hideArrows);
156 void WKPopupMenuWithSize(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize);
157 void WKPopupContextMenu(NSMenu *menu, NSPoint screenLocation);
158 void WKSendUserChangeNotifications(void);
159 #ifndef __LP64__
160 BOOL WKConvertNSEventToCarbonEvent(EventRecord *carbonEvent, NSEvent *cocoaEvent);
161 void WKSendKeyEventToTSM(NSEvent *theEvent);
162 void WKCallDrawingNotification(CGrafPtr port, Rect *bounds);
163 #endif
164
165 BOOL WKGetGlyphTransformedAdvances(CGFontRef, NSFont*, CGAffineTransform *m, ATSGlyphRef *glyph, CGSize *advance);
166 NSFont *WKGetFontInLanguageForRange(NSFont *font, NSString *string, NSRange range);
167 NSFont *WKGetFontInLanguageForCharacter(NSFont *font, UniChar ch);
168 void WKSetCGFontRenderingMode(CGContextRef cgContext, NSFont *font, BOOL shouldSubpixelQuantize);
169 #endif
170
171 BOOL WKCGContextGetShouldSmoothFonts(CGContextRef cgContext);
172
173
174 void WKSetBaseCTM(CGContextRef, CGAffineTransform);
175 void WKSetPatternPhaseInUserSpace(CGContextRef, CGPoint);
176 CGAffineTransform WKGetUserToBaseCTM(CGContextRef);
177
178 void WKGetGlyphsForCharacters(CGFontRef, const UniChar[], CGGlyph[], size_t);
179 bool WKGetVerticalGlyphsForCharacters(CTFontRef, const UniChar[], CGGlyph[], size_t);
180
181 CTLineRef WKCreateCTLineWithUniCharProvider(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
182
183 #if TARGET_OS_IPHONE || MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
184 enum {
185     WKCTFontTransformApplyShaping = (1 << 0),
186     WKCTFontTransformApplyPositioning = (1 << 1)
187 };
188
189 typedef int WKCTFontTransformOptions;
190
191 bool WKCTFontTransformGlyphs(CTFontRef font, CGGlyph glyphs[], CGSize advances[], CFIndex count, WKCTFontTransformOptions options);
192 #endif // TARGET_OS_IPHONE || MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
193
194 CTTypesetterRef WKCreateCTTypesetterWithUniCharProviderAndOptions(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
195
196 CGSize WKCTRunGetInitialAdvance(CTRunRef);
197
198 #if (TARGET_OS_IPHONE && TARGET_OS_EMBEDDED) || MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
199 CGContextRef WKIOSurfaceContextCreate(IOSurfaceRef, unsigned width, unsigned height, CGColorSpaceRef);
200 CGImageRef WKIOSurfaceContextCreateImage(CGContextRef context);
201 #endif
202
203 typedef enum {
204     WKPatternTilingNoDistortion,
205     WKPatternTilingConstantSpacingMinimalDistortion,
206     WKPatternTilingConstantSpacing
207 } WKPatternTiling;
208
209 CGPatternRef WKCGPatternCreateWithImageAndTransform(CGImageRef image, CGAffineTransform transform, int tiling);
210 void WKCGContextResetClip(CGContextRef);
211
212 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
213 bool WKCGContextDrawsWithCorrectShadowOffsets(CGContextRef);
214 #endif
215
216 #if !TARGET_OS_IPHONE
217 #ifndef __LP64__
218 NSEvent *WKCreateNSEventWithCarbonEvent(EventRef eventRef);
219 NSEvent *WKCreateNSEventWithCarbonMouseMoveEvent(EventRef inEvent, NSWindow *window);
220 NSEvent *WKCreateNSEventWithCarbonClickEvent(EventRef inEvent, WindowRef windowRef);
221 #endif
222
223 CGContextRef WKNSWindowOverrideCGContext(NSWindow *, CGContextRef);
224 void WKNSWindowRestoreCGContext(NSWindow *, CGContextRef);
225
226 void WKNSWindowMakeBottomCornersSquare(NSWindow *);
227
228 // These constants match the ones used by ThemeScrollbarArrowStyle (some of the values are private, so we can't just
229 // use that enum directly).
230 typedef enum {
231     WKThemeScrollBarArrowsSingle     = 0,
232     WKThemeScrollBarArrowsLowerRight = 1,
233     WKThemeScrollBarArrowsDouble     = 2,
234     WKThemeScrollBarArrowsUpperLeft  = 3,
235 } WKThemeScrollBarArrowStyle;
236
237 OSStatus WKThemeDrawTrack(const HIThemeTrackDrawInfo* inDrawInfo, CGContextRef inContext, int inArrowStyle);
238 #endif
239
240
241 BOOL WKCGContextIsBitmapContext(CGContextRef context);
242 bool WKCGContextIsPDFContext(CGContextRef context);
243
244 #if !TARGET_OS_IPHONE
245 void WKGetWheelEventDeltas(NSEvent *, float *deltaX, float *deltaY, BOOL *continuous);
246
247 BOOL WKAppVersionCheckLessThan(NSString *, int, double);
248
249 typedef enum {
250     WKMovieTypeUnknown,
251     WKMovieTypeDownload,
252     WKMovieTypeStoredStream,
253     WKMovieTypeLiveStream
254 } WKMovieType;
255
256 int WKQTMovieGetType(QTMovie* movie);
257
258 BOOL WKQTMovieHasClosedCaptions(QTMovie* movie);
259 void WKQTMovieSetShowClosedCaptions(QTMovie* movie, BOOL showClosedCaptions);
260 void WKQTMovieSelectPreferredAlternates(QTMovie* movie);
261 void WKQTMovieSelectPreferredAlternateTrackForMediaType(QTMovie* movie, NSString* mediaType);
262
263 unsigned WKQTIncludeOnlyModernMediaFileTypes(void);
264 int WKQTMovieDataRate(QTMovie* movie);
265 float WKQTMovieMaxTimeLoaded(QTMovie* movie);
266 float WKQTMovieMaxTimeSeekable(QTMovie* movie);
267 NSString *WKQTMovieMaxTimeLoadedChangeNotification(void);
268 void WKQTMovieViewSetDrawSynchronously(QTMovieView* view, BOOL sync);
269 void WKQTMovieDisableComponent(uint32_t[5]);
270 NSURL *WKQTMovieResolvedURL(QTMovie* movie);
271 #endif
272
273 CFStringRef WKCopyFoundationCacheDirectory(void);
274
275 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
276 CFURLStorageSessionRef WKCreatePrivateStorageSession(CFStringRef);
277 NSURLRequest *WKCopyRequestWithStorageSession(CFURLStorageSessionRef, NSURLRequest *);
278 NSCachedURLResponse *WKCachedResponseForRequest(CFURLStorageSessionRef, NSURLRequest *);
279 void WKSetRequestStorageSession(CFURLStorageSessionRef, CFMutableURLRequestRef);
280
281 typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
282 CFHTTPCookieStorageRef WKCopyHTTPCookieStorage(CFURLStorageSessionRef);
283 unsigned WKGetHTTPCookieAcceptPolicy(CFHTTPCookieStorageRef);
284 void WKSetHTTPCookieAcceptPolicy(CFHTTPCookieStorageRef, unsigned policy);
285 NSArray *WKHTTPCookies(CFHTTPCookieStorageRef);
286 NSArray *WKHTTPCookiesForURL(CFHTTPCookieStorageRef, NSURL *, NSURL *);
287 void WKSetHTTPCookiesForURL(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *);
288 void WKDeleteAllHTTPCookies(CFHTTPCookieStorageRef);
289 void WKDeleteHTTPCookie(CFHTTPCookieStorageRef, NSHTTPCookie *);
290
291 CFHTTPCookieStorageRef WKGetDefaultHTTPCookieStorage(void);
292 WKCFURLCredentialRef WKCopyCredentialFromCFPersistentStorage(CFURLProtectionSpaceRef);
293 void WKSetCFURLRequestShouldContentSniff(CFMutableURLRequestRef, bool flag);
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 typedef enum {
460     WKSandboxExtensionTypeReadOnly,
461     WKSandboxExtensionTypeReadWrite,
462 } WKSandboxExtensionType;
463 typedef struct __WKSandboxExtension *WKSandboxExtensionRef;
464
465 WKSandboxExtensionRef WKSandboxExtensionCreate(const char* path, WKSandboxExtensionType type);
466 void WKSandboxExtensionDestroy(WKSandboxExtensionRef sandboxExtension);
467
468 bool WKSandboxExtensionConsume(WKSandboxExtensionRef sandboxExtension);
469 bool WKSandboxExtensionInvalidate(WKSandboxExtensionRef sandboxExtension);
470
471 const char* WKSandboxExtensionGetSerializedFormat(WKSandboxExtensionRef sandboxExtension, size_t* length);
472 WKSandboxExtensionRef WKSandboxExtensionCreateFromSerializedFormat(const char* serializationFormat, size_t length);
473
474 #if !TARGET_OS_IPHONE
475 OSStatus WKEnableSandboxStyleFileQuarantine(void);
476
477 int WKRecommendedScrollerStyle(void);
478
479 bool WKExecutableWasLinkedOnOrBeforeSnowLeopard(void);
480
481 NSRange WKExtractWordDefinitionTokenRangeFromContextualString(NSString *contextString, NSRange range, NSDictionary **options);
482 void WKShowWordDefinitionWindow(NSAttributedString *term, NSPoint screenPoint, NSDictionary *options);
483 void WKHideWordDefinitionWindow(void);
484 #endif
485
486 #if !TARGET_OS_IPHONE
487 CFStringRef WKCopyDefaultSearchProviderDisplayName(void);
488 #endif
489
490 void WKSetCrashReportApplicationSpecificInformation(CFStringRef);
491
492 NSURL* WKAVAssetResolvedURL(AVAsset*);
493
494 #if !TARGET_OS_IPHONE
495 NSCursor *WKCursor(const char *name);
496 #endif
497
498 dispatch_source_t WKCreateVMPressureDispatchOnMainQueue(void);
499 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
500 dispatch_source_t WKCreateMemoryStatusPressureCriticalDispatchOnMainQueue(void);
501 #endif
502     
503 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
504 bool WKExecutableWasLinkedOnOrBeforeLion(void);
505 #endif
506
507 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
508 bool WKExecutableWasLinkedOnOrBeforeMountainLion(void);
509 #endif
510
511 void WKCGPathAddRoundedRect(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight);
512
513 void WKCFURLRequestAllowAllPostCaching(CFURLRequestRef);
514
515 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
516 CGFloat WKNSElasticDeltaForTimeDelta(CGFloat initialPosition, CGFloat initialVelocity, CGFloat elapsedTime);
517 CGFloat WKNSElasticDeltaForReboundDelta(CGFloat delta);
518 CGFloat WKNSReboundDeltaForElasticDelta(CGFloat delta);
519 #endif
520
521 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
522 typedef enum {
523     WKOcclusionNotificationTypeApplicationBecameVisible,
524     WKOcclusionNotificationTypeApplicationBecameOccluded,
525     WKOcclusionNotificationTypeApplicationWindowModificationsStarted,
526     WKOcclusionNotificationTypeApplicationWindowModificationsStopped,
527     WKOcclusionNotificationTypeWindowBecameVisible,
528     WKOcclusionNotificationTypeWindowBecameOccluded,
529 } WKOcclusionNotificationType;
530
531 typedef uint32_t WKWindowID;
532
533 typedef void (*WKOcclusionNotificationHandler)(uint32_t, void* data, uint32_t dataLength, void*, uint32_t);
534
535 bool WKRegisterOcclusionNotificationHandler(WKOcclusionNotificationType, WKOcclusionNotificationHandler);
536 bool WKUnregisterOcclusionNotificationHandler(WKOcclusionNotificationType, WKOcclusionNotificationHandler);
537 bool WKEnableWindowOcclusionNotifications(NSInteger windowID, bool *outCurrentOcclusionState);
538 #endif
539
540 void WKCFNetworkSetOverrideSystemProxySettings(CFDictionaryRef);
541
542 #if TARGET_OS_IPHONE || MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
543 bool WKIsPublicSuffix(NSString *domain);
544
545 CFArrayRef WKCFURLCacheCopyAllHostNamesInPersistentStoreForPartition(CFStringRef partition);
546 typedef void (^CFURLCacheCopyAllPartitionNamesResultsNotification)(CFArrayRef partitionNames);
547
548 void WKCFURLCacheDeleteHostNamesInPersistentStoreForPartition(CFArrayRef hostArray, CFStringRef partition);
549 CFStringRef WKCachePartitionKey(void);
550 void WKCFURLCacheCopyAllPartitionNames(CFURLCacheCopyAllPartitionNamesResultsNotification resultsBlock);
551 #endif
552
553 typedef enum {
554     WKExternalPlaybackTypeNone,
555     WKExternalPlaybackTypeAirPlay,
556     WKExternalPlaybackTypeTVOut,
557 } WKExternalPlaybackType;
558
559 int WKExernalDeviceTypeForPlayer(AVPlayer *);
560 NSString *WKExernalDeviceDisplayNameForPlayer(AVPlayer *);
561
562 bool WKQueryDecoderAvailability(void);
563
564 #ifdef __cplusplus
565 }
566 #endif