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