1/*
2 * Copyright 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#import "config.h"
27#import "WebCoreSystemInterface.h"
28#import <Foundation/Foundation.h>
29
30void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *);
31void (*wkCALayerEnumerateRectsBeingDrawnWithBlock)(CALayer *, CGContextRef context, void (^block)(CGRect rect));
32BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef);
33void (*wkCGContextResetClip)(CGContextRef);
34#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
35bool (*wkCGContextDrawsWithCorrectShadowOffsets)(CGContextRef);
36#endif
37CGPatternRef (*wkCGPatternCreateWithImageAndTransform)(CGImageRef, CGAffineTransform, int);
38CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef);
39NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*);
40CFArrayRef (*wkCopyNSURLResponseCertificateChain)(NSURLResponse*);
41CFStringEncoding (*wkGetWebDefaultCFStringEncoding)(void);
42NSString* (*wkCreateURLPasteboardFlavorTypeName)(void);
43NSString* (*wkCreateURLNPasteboardFlavorTypeName)(void);
44void (*wkDrawBezeledTextFieldCell)(NSRect, BOOL enabled);
45void (*wkDrawTextFieldCellFocusRing)(NSTextFieldCell*, NSRect);
46void (*wkDrawCapsLockIndicator)(CGContextRef, CGRect);
47void (*wkDrawBezeledTextArea)(NSRect, BOOL enabled);
48void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int);
49bool (*wkDrawFocusRingAtTime)(CGContextRef, NSTimeInterval);
50bool (*wkDrawCellFocusRingWithFrameAtTime)(NSCell*, NSRect, NSView*, NSTimeInterval);
51NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange);
52NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar);
53BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance);
54void (*wkDrawMediaSliderTrack)(CGContextRef context, CGRect rect, float timeLoaded, float currentTime,
55    float duration, unsigned state);
56BOOL (*wkHitTestMediaUIPart)(int part, CGRect bounds, CGPoint point);
57void (*wkDrawMediaUIPart)(int part, CGContextRef context, CGRect rect, unsigned state);
58void (*wkMeasureMediaUIPart)(int part, CGRect *bounds, CGSize *naturalSize);
59NSView *(*wkCreateMediaUIBackgroundView)(void);
60NSControl *(*wkCreateMediaUIControl)(int);
61void (*wkWindowSetAlpha)(NSWindow *, float);
62void (*wkWindowSetScaledFrame)(NSWindow *, NSRect, NSRect);
63NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
64CFStringRef (*wkSignedPublicKeyAndChallengeString)(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
65NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
66NSString* (*wkGetMIMETypeForExtension)(NSString*);
67NSTimeInterval (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response);
68NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
69BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
70void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
71UInt8 (*wkGetNSEventKeyChar)(NSEvent *);
72void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize, bool hideArrows);
73void (*wkPopupMenuWithSize)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize);
74unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
75int (*wkQTMovieDataRate)(QTMovie*);
76void (*wkQTMovieDisableComponent)(uint32_t[5]);
77float (*wkQTMovieMaxTimeLoaded)(QTMovie*);
78NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void);
79float (*wkQTMovieMaxTimeSeekable)(QTMovie*);
80int (*wkQTMovieGetType)(QTMovie*);
81BOOL (*wkQTMovieHasClosedCaptions)(QTMovie*);
82NSURL *(*wkQTMovieResolvedURL)(QTMovie*);
83void (*wkQTMovieSetShowClosedCaptions)(QTMovie*, BOOL);
84void (*wkQTMovieSelectPreferredAlternates)(QTMovie*);
85void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL);
86NSArray *(*wkQTGetSitesInMediaDownloadCache)();
87void (*wkQTClearMediaDownloadCacheForSite)(NSString *site);
88void (*wkQTClearMediaDownloadCache)();
89
90void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*, BOOL);
91void (*wkSetDragImage)(NSImage*, NSPoint offset);
92void (*wkSetBaseCTM)(CGContextRef, CGAffineTransform);
93void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint point);
94CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef);
95bool (*wkCGContextIsPDFContext)(CGContextRef);
96void (*wkSetUpFontCache)();
97void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream);
98void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream);
99void (*wkSignalCFReadStreamError)(CFReadStreamRef stream, CFStreamError *error);
100CFReadStreamRef (*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 *),
108    void *context);
109void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL);
110void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL);
111unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount);
112int (*wkGetHTTPRequestPriority)(CFURLRequestRef);
113void (*wkSetHTTPRequestMaximumPriority)(int priority);
114void (*wkSetHTTPRequestPriority)(CFURLRequestRef, int priority);
115void (*wkSetHTTPRequestMinimumFastLanePriority)(int priority);
116void (*wkHTTPRequestEnablePipelining)(CFURLRequestRef);
117void (*wkSetCONNECTProxyForStream)(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
118void (*wkSetCONNECTProxyAuthorizationForStream)(CFReadStreamRef, CFStringRef proxyAuthorizationString);
119CFHTTPMessageRef (*wkCopyCONNECTProxyResponse)(CFReadStreamRef, CFURLRef responseURL, CFStringRef proxyHost, CFNumberRef proxyPort);
120
121#if USE(CFNETWORK)
122CFHTTPCookieStorageRef (*wkGetDefaultHTTPCookieStorage)();
123WKCFURLCredentialRef (*wkCopyCredentialFromCFPersistentStorage)(CFURLProtectionSpaceRef protectionSpace);
124void (*wkSetCFURLRequestShouldContentSniff)(CFMutableURLRequestRef, bool);
125void (*wkSetRequestStorageSession)(CFURLStorageSessionRef, CFMutableURLRequestRef);
126#endif
127
128void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t);
129bool (*wkGetVerticalGlyphsForCharacters)(CTFontRef, const UniChar[], CGGlyph[], size_t);
130
131void* wkGetHyphenationLocationBeforeIndex;
132
133CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
134#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
135bool (*wkCTFontTransformGlyphs)(CTFontRef font, CGGlyph glyphs[], CGSize advances[], CFIndex count, wkCTFontTransformOptions options);
136#endif
137
138CGSize (*wkCTRunGetInitialAdvance)(CTRunRef);
139
140CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
141
142CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace);
143CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context);
144
145int (*wkRecommendedScrollerStyle)(void);
146
147bool (*wkExecutableWasLinkedOnOrBeforeSnowLeopard)(void);
148
149CFStringRef (*wkCopyDefaultSearchProviderDisplayName)(void);
150void (*wkSetCrashReportApplicationSpecificInformation)(CFStringRef);
151
152NSCursor *(*wkCursor)(const char*);
153
154NSArray *(*wkSpeechSynthesisGetVoiceIdentifiers)(void);
155NSString *(*wkSpeechSynthesisGetDefaultVoiceIdentifierForLocale)(NSLocale *);
156
157void (*wkUnregisterUniqueIdForElement)(id element);
158void (*wkAccessibilityHandleFocusChanged)(void);
159CFTypeID (*wkGetAXTextMarkerTypeID)(void);
160CFTypeID (*wkGetAXTextMarkerRangeTypeID)(void);
161CFTypeRef (*wkCreateAXTextMarkerRange)(CFTypeRef start, CFTypeRef end);
162CFTypeRef (*wkCopyAXTextMarkerRangeStart)(CFTypeRef range);
163CFTypeRef (*wkCopyAXTextMarkerRangeEnd)(CFTypeRef range);
164CFTypeRef (*wkCreateAXTextMarker)(const void *bytes, size_t len);
165BOOL (*wkGetBytesFromAXTextMarker)(CFTypeRef textMarker, void *bytes, size_t length);
166AXUIElementRef (*wkCreateAXUIElementRef)(id element);
167
168CFURLStorageSessionRef (*wkCreatePrivateStorageSession)(CFStringRef);
169NSURLRequest* (*wkCopyRequestWithStorageSession)(CFURLStorageSessionRef, NSURLRequest*);
170CFHTTPCookieStorageRef (*wkCopyHTTPCookieStorage)(CFURLStorageSessionRef);
171unsigned (*wkGetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef);
172void (*wkSetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef, unsigned);
173NSArray *(*wkHTTPCookies)(CFHTTPCookieStorageRef);
174NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL *, NSURL *);
175void (*wkSetHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *);
176void (*wkDeleteAllHTTPCookies)(CFHTTPCookieStorageRef);
177void (*wkDeleteHTTPCookie)(CFHTTPCookieStorageRef, NSHTTPCookie *);
178
179CFStringRef (*wkGetCFURLResponseMIMEType)(CFURLResponseRef);
180CFURLRef (*wkGetCFURLResponseURL)(CFURLResponseRef);
181CFHTTPMessageRef (*wkGetCFURLResponseHTTPResponse)(CFURLResponseRef);
182CFStringRef (*wkCopyCFURLResponseSuggestedFilename)(CFURLResponseRef);
183void (*wkSetCFURLResponseMIMEType)(CFURLResponseRef, CFStringRef mimeType);
184void (*wkSetMetadataURL)(NSString *urlString, NSString *referrer, NSString *path);
185
186void(*wkDestroyRenderingResources)(void);
187
188dispatch_source_t (*wkCreateVMPressureDispatchOnMainQueue)(void);
189
190#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
191dispatch_source_t (*wkCreateMemoryStatusPressureCriticalDispatchOnMainQueue)(void);
192#endif
193
194#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
195bool (*wkExecutableWasLinkedOnOrBeforeLion)(void);
196#endif
197
198void (*wkCGPathAddRoundedRect)(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight);
199
200void (*wkCFURLRequestAllowAllPostCaching)(CFURLRequestRef);
201
202#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
203CGFloat (*wkNSElasticDeltaForTimeDelta)(CGFloat initialPosition, CGFloat initialVelocity, CGFloat elapsedTime);
204CGFloat (*wkNSElasticDeltaForReboundDelta)(CGFloat delta);
205CGFloat (*wkNSReboundDeltaForElasticDelta)(CGFloat delta);
206#endif
207
208#if ENABLE(PUBLIC_SUFFIX_LIST)
209bool (*wkIsPublicSuffix)(NSString *host);
210#endif
211
212#if ENABLE(CACHE_PARTITIONING)
213CFStringRef (*wkCachePartitionKey)(void);
214#endif
215
216int (*wkExernalDeviceTypeForPlayer)(AVPlayer *);
217NSString *(*wkExernalDeviceDisplayNameForPlayer)(AVPlayer *);
218
219bool (*wkQueryDecoderAvailability)(void);
220