1faf5a9c87985ecc3872ec8a00c09be5881b7fd1
[WebKit-https.git] / Source / WebCore / platform / mac / WebCoreSystemInterface.mm
1 /*
2  * Copyright 2006, 2007, 2008, 2009, 2010 Apple Computer, 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 COMPUTER, 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 COMPUTER, 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 radius);
48 NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange);
49 NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar);
50 BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance);
51 void (*wkDrawMediaSliderTrack)(CGContextRef context, CGRect rect, float timeLoaded, float currentTime,
52     float duration, unsigned state);
53 BOOL (*wkHitTestMediaUIPart)(int part, CGRect bounds, CGPoint point);
54 void (*wkDrawMediaUIPart)(int part, CGContextRef context, CGRect rect, unsigned state);
55 void (*wkMeasureMediaUIPart)(int part, CGRect *bounds, CGSize *naturalSize);
56 NSView *(*wkCreateMediaUIBackgroundView)(void);
57 NSControl *(*wkCreateMediaUIControl)(int);
58 void (*wkWindowSetAlpha)(NSWindow *, float);
59 void (*wkWindowSetScaledFrame)(NSWindow *, NSRect, NSRect);
60 NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
61 CFStringRef (*wkSignedPublicKeyAndChallengeString)(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
62 NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
63 NSString* (*wkGetMIMETypeForExtension)(NSString*);
64 NSTimeInterval (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response);
65 NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
66 BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
67 void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
68 UInt8 (*wkGetNSEventKeyChar)(NSEvent *);
69 void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
70 unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
71 int (*wkQTMovieDataRate)(QTMovie*);
72 void (*wkQTMovieDisableComponent)(uint32_t[5]);
73 float (*wkQTMovieMaxTimeLoaded)(QTMovie*);
74 NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void);
75 float (*wkQTMovieMaxTimeSeekable)(QTMovie*);
76 int (*wkQTMovieGetType)(QTMovie*);
77 BOOL (*wkQTMovieHasClosedCaptions)(QTMovie*);
78 NSURL *(*wkQTMovieResolvedURL)(QTMovie*);
79 void (*wkQTMovieSetShowClosedCaptions)(QTMovie*, BOOL);
80 void (*wkQTMovieSelectPreferredAlternates)(QTMovie*);
81 void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL);
82 NSArray *(*wkQTGetSitesInMediaDownloadCache)();
83 void (*wkQTClearMediaDownloadCacheForSite)(NSString *site);
84 void (*wkQTClearMediaDownloadCache)();
85
86 #if PLATFORM(MAC)
87 void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*, BOOL);
88 #else
89 void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*);
90 #endif
91 void (*wkSetDragImage)(NSImage*, NSPoint offset);
92 void (*wkSetBaseCTM)(CGContextRef, CGAffineTransform);
93 void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint point);
94 CGAffineTransform (*wkGetUserToBaseCTM)(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 (*wkGetHTTPPipeliningPriority)(CFURLRequestRef);
112 void (*wkSetHTTPPipeliningMaximumPriority)(int priority);
113 void (*wkSetHTTPPipeliningPriority)(CFURLRequestRef, int priority);
114 void (*wkSetHTTPPipeliningMinimumFastLanePriority)(int priority);
115 void (*wkSetCONNECTProxyForStream)(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
116 void (*wkSetCONNECTProxyAuthorizationForStream)(CFReadStreamRef, CFStringRef proxyAuthorizationString);
117 CFHTTPMessageRef (*wkCopyCONNECTProxyResponse)(CFReadStreamRef, CFURLRef responseURL, CFStringRef proxyHost, CFNumberRef proxyPort);
118
119 #if USE(CFNETWORK)
120 CFHTTPCookieStorageRef (*wkGetDefaultHTTPCookieStorage)();
121 WKCFURLCredentialRef (*wkCopyCredentialFromCFPersistentStorage)(CFURLProtectionSpaceRef protectionSpace);
122 void (*wkSetCFURLRequestShouldContentSniff)(CFMutableURLRequestRef, bool);
123 CFArrayRef (*wkCFURLRequestCopyHTTPRequestBodyParts)(CFURLRequestRef);
124 void (*wkCFURLRequestSetHTTPRequestBodyParts)(CFMutableURLRequestRef, CFArrayRef bodyParts);
125 void (*wkSetRequestStorageSession)(CFURLStorageSessionRef, CFMutableURLRequestRef);
126 #endif
127
128 void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t);
129 bool (*wkGetVerticalGlyphsForCharacters)(CTFontRef, const UniChar[], CGGlyph[], size_t);
130
131 void* wkGetHyphenationLocationBeforeIndex;
132
133 CTLineRef (*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
135 bool (*wkCTFontTransformGlyphs)(CTFontRef font, CGGlyph glyphs[], CGSize advances[], CFIndex count, wkCTFontTransformOptions options);
136 #endif
137
138 CGSize (*wkCTRunGetInitialAdvance)(CTRunRef);
139
140 CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
141
142 CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace);
143 CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context);
144
145 int (*wkRecommendedScrollerStyle)(void);
146
147 bool (*wkExecutableWasLinkedOnOrBeforeSnowLeopard)(void);
148
149 CFStringRef (*wkCopyDefaultSearchProviderDisplayName)(void);
150 void (*wkSetCrashReportApplicationSpecificInformation)(CFStringRef);
151
152 NSURL *(*wkAVAssetResolvedURL)(AVAsset*);
153
154 NSCursor *(*wkCursor)(const char*);
155
156 #if PLATFORM(MAC)
157 NSArray *(*wkSpeechSynthesisGetVoiceIdentifiers)(void);
158 NSString *(*wkSpeechSynthesisGetDefaultVoiceIdentifierForLocale)(NSLocale *);
159 #endif
160
161 void (*wkUnregisterUniqueIdForElement)(id element);
162 void (*wkAccessibilityHandleFocusChanged)(void);
163 CFTypeID (*wkGetAXTextMarkerTypeID)(void);
164 CFTypeID (*wkGetAXTextMarkerRangeTypeID)(void);
165 CFTypeRef (*wkCreateAXTextMarkerRange)(CFTypeRef start, CFTypeRef end);
166 CFTypeRef (*wkCopyAXTextMarkerRangeStart)(CFTypeRef range);
167 CFTypeRef (*wkCopyAXTextMarkerRangeEnd)(CFTypeRef range);
168 CFTypeRef (*wkCreateAXTextMarker)(const void *bytes, size_t len);
169 BOOL (*wkGetBytesFromAXTextMarker)(CFTypeRef textMarker, void *bytes, size_t length);
170 AXUIElementRef (*wkCreateAXUIElementRef)(id element);
171
172 CFURLStorageSessionRef (*wkCreatePrivateStorageSession)(CFStringRef);
173 NSURLRequest* (*wkCopyRequestWithStorageSession)(CFURLStorageSessionRef, NSURLRequest*);
174 CFHTTPCookieStorageRef (*wkCopyHTTPCookieStorage)(CFURLStorageSessionRef);
175 unsigned (*wkGetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef);
176 void (*wkSetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef, unsigned);
177 NSArray *(*wkHTTPCookies)(CFHTTPCookieStorageRef);
178 NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL *);
179 void (*wkSetHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *);
180 void (*wkDeleteAllHTTPCookies)(CFHTTPCookieStorageRef);
181 void (*wkDeleteHTTPCookie)(CFHTTPCookieStorageRef, NSHTTPCookie *);
182
183 CFStringRef (*wkGetCFURLResponseMIMEType)(CFURLResponseRef);
184 CFURLRef (*wkGetCFURLResponseURL)(CFURLResponseRef);
185 CFHTTPMessageRef (*wkGetCFURLResponseHTTPResponse)(CFURLResponseRef);
186 CFStringRef (*wkCopyCFURLResponseSuggestedFilename)(CFURLResponseRef);
187 void (*wkSetCFURLResponseMIMEType)(CFURLResponseRef, CFStringRef mimeType);
188 void (*wkSetMetadataURL)(NSString *urlString, NSString *referrer, NSString *path);
189
190 void(*wkDestroyRenderingResources)(void);
191
192 dispatch_source_t (*wkCreateVMPressureDispatchOnMainQueue)(void);
193
194 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
195 dispatch_source_t (*wkCreateMemoryStatusPressureCriticalDispatchOnMainQueue)(void);
196 #endif
197
198 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
199 bool (*wkExecutableWasLinkedOnOrBeforeLion)(void);
200 #endif
201
202 void (*wkCGPathAddRoundedRect)(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight);
203
204 void (*wkCFURLRequestAllowAllPostCaching)(CFURLRequestRef);
205
206 #if USE(CONTENT_FILTERING)
207 BOOL (*wkFilterIsManagedSession)(void);
208 WebFilterEvaluator *(*wkFilterCreateInstance)(NSURLResponse *);
209 BOOL (*wkFilterWasBlocked)(WebFilterEvaluator *);
210 BOOL (*wkFilterIsBuffering)(WebFilterEvaluator *);
211 NSData *(*wkFilterAddData)(WebFilterEvaluator *, NSData *);
212 NSData *(*wkFilterDataComplete)(WebFilterEvaluator *);
213 #endif
214
215 #if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
216 CGFloat (*wkNSElasticDeltaForTimeDelta)(CGFloat initialPosition, CGFloat initialVelocity, CGFloat elapsedTime);
217 CGFloat (*wkNSElasticDeltaForReboundDelta)(CGFloat delta);
218 CGFloat (*wkNSReboundDeltaForElasticDelta)(CGFloat delta);
219 #endif
220
221 #if ENABLE(PUBLIC_SUFFIX_LIST)
222 bool (*wkIsPublicSuffix)(NSString *host);
223 #endif
224
225 #if ENABLE(CACHE_PARTITIONING)
226 CFStringRef (*wkCachePartitionKey)(void);
227 #endif