a8417035089fb07831433b2d39944cbea6a286ab
[WebKit-https.git] / Source / WebCore / platform / mac / WebCoreSystemInterface.mm
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
30 void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *);
31 void (*wkCALayerEnumerateRectsBeingDrawnWithBlock)(CALayer *, CGContextRef context, void (^block)(CGRect rect));
32 BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef);
33 void (*wkCGContextResetClip)(CGContextRef);
34 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
35 bool (*wkCGContextDrawsWithCorrectShadowOffsets)(CGContextRef);
36 #endif
37 CGPatternRef (*wkCGPatternCreateWithImageAndTransform)(CGImageRef, CGAffineTransform, int);
38 CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef);
39 NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*);
40 CFArrayRef (*wkCopyNSURLResponseCertificateChain)(NSURLResponse*);
41 NSString* (*wkCreateURLPasteboardFlavorTypeName)(void);
42 NSString* (*wkCreateURLNPasteboardFlavorTypeName)(void);
43 void (*wkDrawBezeledTextFieldCell)(NSRect, BOOL enabled);
44 void (*wkDrawTextFieldCellFocusRing)(NSTextFieldCell*, NSRect);
45 void (*wkDrawCapsLockIndicator)(CGContextRef, CGRect);
46 void (*wkDrawBezeledTextArea)(NSRect, BOOL enabled);
47 void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int);
48 bool (*wkDrawFocusRingAtTime)(CGContextRef, NSTimeInterval);
49 bool (*wkDrawCellFocusRingWithFrameAtTime)(NSCell*, NSRect, NSView*, NSTimeInterval);
50 NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange);
51 NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar);
52 BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance);
53 void (*wkDrawMediaSliderTrack)(CGContextRef context, CGRect rect, float timeLoaded, float currentTime,
54     float duration, unsigned state);
55 BOOL (*wkHitTestMediaUIPart)(int part, CGRect bounds, CGPoint point);
56 void (*wkDrawMediaUIPart)(int part, CGContextRef context, CGRect rect, unsigned state);
57 void (*wkMeasureMediaUIPart)(int part, CGRect *bounds, CGSize *naturalSize);
58 NSView *(*wkCreateMediaUIBackgroundView)(void);
59 NSControl *(*wkCreateMediaUIControl)(int);
60 void (*wkWindowSetAlpha)(NSWindow *, float);
61 void (*wkWindowSetScaledFrame)(NSWindow *, NSRect, NSRect);
62 NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
63 CFStringRef (*wkSignedPublicKeyAndChallengeString)(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
64 NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
65 NSString* (*wkGetMIMETypeForExtension)(NSString*);
66 NSTimeInterval (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response);
67 NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
68 BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
69 void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
70 UInt8 (*wkGetNSEventKeyChar)(NSEvent *);
71 void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
72 void (*wkPopupMenuWithSize)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize);
73 unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
74 int (*wkQTMovieDataRate)(QTMovie*);
75 void (*wkQTMovieDisableComponent)(uint32_t[5]);
76 float (*wkQTMovieMaxTimeLoaded)(QTMovie*);
77 NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void);
78 float (*wkQTMovieMaxTimeSeekable)(QTMovie*);
79 int (*wkQTMovieGetType)(QTMovie*);
80 BOOL (*wkQTMovieHasClosedCaptions)(QTMovie*);
81 NSURL *(*wkQTMovieResolvedURL)(QTMovie*);
82 void (*wkQTMovieSetShowClosedCaptions)(QTMovie*, BOOL);
83 void (*wkQTMovieSelectPreferredAlternates)(QTMovie*);
84 void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL);
85 NSArray *(*wkQTGetSitesInMediaDownloadCache)();
86 void (*wkQTClearMediaDownloadCacheForSite)(NSString *site);
87 void (*wkQTClearMediaDownloadCache)();
88
89 void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*, BOOL);
90 void (*wkSetDragImage)(NSImage*, NSPoint offset);
91 void (*wkSetBaseCTM)(CGContextRef, CGAffineTransform);
92 void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint point);
93 CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef);
94 bool (*wkCGContextIsPDFContext)(CGContextRef);
95 void (*wkSetUpFontCache)();
96 void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream);
97 void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream);
98 void (*wkSignalCFReadStreamError)(CFReadStreamRef stream, CFStreamError *error);
99 CFReadStreamRef (*wkCreateCustomCFReadStream)(void *(*formCreate)(CFReadStreamRef, void *), 
100     void (*formFinalize)(CFReadStreamRef, void *), 
101     Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *), 
102     CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *), 
103     Boolean (*formCanRead)(CFReadStreamRef, void *), 
104     void (*formClose)(CFReadStreamRef, void *), 
105     void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *), 
106     void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
107     void *context);
108 void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL);
109 void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL);
110 unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount);
111 int (*wkGetHTTPRequestPriority)(CFURLRequestRef);
112 void (*wkSetHTTPRequestMaximumPriority)(int priority);
113 void (*wkSetHTTPRequestPriority)(CFURLRequestRef, int priority);
114 void (*wkSetHTTPRequestMinimumFastLanePriority)(int priority);
115 void (*wkHTTPRequestEnablePipelining)(CFURLRequestRef);
116 void (*wkSetCONNECTProxyForStream)(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
117 void (*wkSetCONNECTProxyAuthorizationForStream)(CFReadStreamRef, CFStringRef proxyAuthorizationString);
118 CFHTTPMessageRef (*wkCopyCONNECTProxyResponse)(CFReadStreamRef, CFURLRef responseURL, CFStringRef proxyHost, CFNumberRef proxyPort);
119
120 #if USE(CFNETWORK)
121 CFHTTPCookieStorageRef (*wkGetDefaultHTTPCookieStorage)();
122 WKCFURLCredentialRef (*wkCopyCredentialFromCFPersistentStorage)(CFURLProtectionSpaceRef protectionSpace);
123 void (*wkSetCFURLRequestShouldContentSniff)(CFMutableURLRequestRef, bool);
124 void (*wkSetRequestStorageSession)(CFURLStorageSessionRef, CFMutableURLRequestRef);
125 #endif
126
127 void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t);
128 bool (*wkGetVerticalGlyphsForCharacters)(CTFontRef, const UniChar[], CGGlyph[], size_t);
129
130 void* wkGetHyphenationLocationBeforeIndex;
131
132 CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
133 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
134 bool (*wkCTFontTransformGlyphs)(CTFontRef font, CGGlyph glyphs[], CGSize advances[], CFIndex count, wkCTFontTransformOptions options);
135 #endif
136
137 CGSize (*wkCTRunGetInitialAdvance)(CTRunRef);
138
139 CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
140
141 CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace);
142 CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context);
143
144 int (*wkRecommendedScrollerStyle)(void);
145
146 bool (*wkExecutableWasLinkedOnOrBeforeSnowLeopard)(void);
147
148 CFStringRef (*wkCopyDefaultSearchProviderDisplayName)(void);
149 void (*wkSetCrashReportApplicationSpecificInformation)(CFStringRef);
150
151 NSURL *(*wkAVAssetResolvedURL)(AVAsset*);
152
153 NSCursor *(*wkCursor)(const char*);
154
155 NSArray *(*wkSpeechSynthesisGetVoiceIdentifiers)(void);
156 NSString *(*wkSpeechSynthesisGetDefaultVoiceIdentifierForLocale)(NSLocale *);
157
158 void (*wkUnregisterUniqueIdForElement)(id element);
159 void (*wkAccessibilityHandleFocusChanged)(void);
160 CFTypeID (*wkGetAXTextMarkerTypeID)(void);
161 CFTypeID (*wkGetAXTextMarkerRangeTypeID)(void);
162 CFTypeRef (*wkCreateAXTextMarkerRange)(CFTypeRef start, CFTypeRef end);
163 CFTypeRef (*wkCopyAXTextMarkerRangeStart)(CFTypeRef range);
164 CFTypeRef (*wkCopyAXTextMarkerRangeEnd)(CFTypeRef range);
165 CFTypeRef (*wkCreateAXTextMarker)(const void *bytes, size_t len);
166 BOOL (*wkGetBytesFromAXTextMarker)(CFTypeRef textMarker, void *bytes, size_t length);
167 AXUIElementRef (*wkCreateAXUIElementRef)(id element);
168
169 CFURLStorageSessionRef (*wkCreatePrivateStorageSession)(CFStringRef);
170 NSURLRequest* (*wkCopyRequestWithStorageSession)(CFURLStorageSessionRef, NSURLRequest*);
171 CFHTTPCookieStorageRef (*wkCopyHTTPCookieStorage)(CFURLStorageSessionRef);
172 unsigned (*wkGetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef);
173 void (*wkSetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef, unsigned);
174 NSArray *(*wkHTTPCookies)(CFHTTPCookieStorageRef);
175 NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL *, NSURL *);
176 void (*wkSetHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *);
177 void (*wkDeleteAllHTTPCookies)(CFHTTPCookieStorageRef);
178 void (*wkDeleteHTTPCookie)(CFHTTPCookieStorageRef, NSHTTPCookie *);
179
180 CFStringRef (*wkGetCFURLResponseMIMEType)(CFURLResponseRef);
181 CFURLRef (*wkGetCFURLResponseURL)(CFURLResponseRef);
182 CFHTTPMessageRef (*wkGetCFURLResponseHTTPResponse)(CFURLResponseRef);
183 CFStringRef (*wkCopyCFURLResponseSuggestedFilename)(CFURLResponseRef);
184 void (*wkSetCFURLResponseMIMEType)(CFURLResponseRef, CFStringRef mimeType);
185 void (*wkSetMetadataURL)(NSString *urlString, NSString *referrer, NSString *path);
186
187 void(*wkDestroyRenderingResources)(void);
188
189 dispatch_source_t (*wkCreateVMPressureDispatchOnMainQueue)(void);
190
191 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
192 dispatch_source_t (*wkCreateMemoryStatusPressureCriticalDispatchOnMainQueue)(void);
193 #endif
194
195 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
196 bool (*wkExecutableWasLinkedOnOrBeforeLion)(void);
197 #endif
198
199 void (*wkCGPathAddRoundedRect)(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight);
200
201 void (*wkCFURLRequestAllowAllPostCaching)(CFURLRequestRef);
202
203 #if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
204 CGFloat (*wkNSElasticDeltaForTimeDelta)(CGFloat initialPosition, CGFloat initialVelocity, CGFloat elapsedTime);
205 CGFloat (*wkNSElasticDeltaForReboundDelta)(CGFloat delta);
206 CGFloat (*wkNSReboundDeltaForElasticDelta)(CGFloat delta);
207 #endif
208
209 #if ENABLE(PUBLIC_SUFFIX_LIST)
210 bool (*wkIsPublicSuffix)(NSString *host);
211 #endif
212
213 #if ENABLE(CACHE_PARTITIONING)
214 CFStringRef (*wkCachePartitionKey)(void);
215 #endif
216
217 int (*wkExernalDeviceTypeForPlayer)(AVPlayer *);
218 NSString *(*wkExernalDeviceDisplayNameForPlayer)(AVPlayer *);
219
220 bool (*wkQueryDecoderAvailability)(void);