Unreviewed, rolling out r109255.
[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 !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
32 void (*wkCALayerEnumerateRectsBeingDrawnWithBlock)(CALayer *, CGContextRef context, void (^block)(CGRect rect));
33 #endif
34 BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef);
35 void (*wkCGContextResetClip)(CGContextRef);
36 CGPatternRef (*wkCGPatternCreateWithImageAndTransform)(CGImageRef, CGAffineTransform, int);
37 CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef);
38 NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*);
39 NSString* (*wkCreateURLPasteboardFlavorTypeName)(void);
40 NSString* (*wkCreateURLNPasteboardFlavorTypeName)(void);
41 void (*wkDrawBezeledTextFieldCell)(NSRect, BOOL enabled);
42 void (*wkDrawTextFieldCellFocusRing)(NSTextFieldCell*, NSRect);
43 void (*wkDrawCapsLockIndicator)(CGContextRef, CGRect);
44 void (*wkDrawBezeledTextArea)(NSRect, BOOL enabled);
45 void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius);
46 NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange);
47 NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar);
48 BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance);
49 void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, 
50     float duration, unsigned state);
51 BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point);
52 void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
53 void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
54 NSView *(*wkCreateMediaUIBackgroundView)(void);
55 NSControl *(*wkCreateMediaUIControl)(int);
56 void (*wkWindowSetAlpha)(NSWindow *, float);
57 void (*wkWindowSetScaledFrame)(NSWindow *, NSRect, NSRect);
58 BOOL (*wkMediaControllerThemeAvailable)(int themeStyle);
59 NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
60 CFStringRef (*wkSignedPublicKeyAndChallengeString)(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
61 NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
62 NSString* (*wkGetMIMETypeForExtension)(NSString*);
63 NSTimeInterval (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response);
64 NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
65 BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
66 void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
67 UInt8 (*wkGetNSEventKeyChar)(NSEvent *);
68 void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
69 unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
70 int (*wkQTMovieDataRate)(QTMovie*);
71 void (*wkQTMovieDisableComponent)(uint32_t[5]);
72 float (*wkQTMovieMaxTimeLoaded)(QTMovie*);
73 NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void);
74 float (*wkQTMovieMaxTimeSeekable)(QTMovie*);
75 int (*wkQTMovieGetType)(QTMovie*);
76 BOOL (*wkQTMovieHasClosedCaptions)(QTMovie*);
77 NSURL *(*wkQTMovieResolvedURL)(QTMovie*);
78 void (*wkQTMovieSetShowClosedCaptions)(QTMovie*, BOOL);
79 void (*wkQTMovieSelectPreferredAlternates)(QTMovie*);
80 void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL);
81 NSArray *(*wkQTGetSitesInMediaDownloadCache)();
82 void (*wkQTClearMediaDownloadCacheForSite)(NSString *site);
83 void (*wkQTClearMediaDownloadCache)();
84
85 void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*);
86 void (*wkSetCookieStoragePrivateBrowsingEnabled)(BOOL);
87 void (*wkSetDragImage)(NSImage*, NSPoint offset);
88 void (*wkSetBaseCTM)(CGContextRef, CGAffineTransform);
89 void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint point);
90 CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef);
91 void (*wkSetUpFontCache)();
92 void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream);
93 void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream);
94 void (*wkSignalCFReadStreamError)(CFReadStreamRef stream, CFStreamError *error);
95 CFReadStreamRef (*wkCreateCustomCFReadStream)(void *(*formCreate)(CFReadStreamRef, void *), 
96     void (*formFinalize)(CFReadStreamRef, void *), 
97     Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *), 
98     CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *), 
99     Boolean (*formCanRead)(CFReadStreamRef, void *), 
100     void (*formClose)(CFReadStreamRef, void *), 
101     void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *), 
102     void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
103     void *context);
104 void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL);
105 void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL);
106 id (*wkCreateNSURLConnectionDelegateProxy)(void);
107 unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount);
108 int (*wkGetHTTPPipeliningPriority)(CFURLRequestRef);
109 void (*wkSetHTTPPipeliningMaximumPriority)(int priority);
110 void (*wkSetHTTPPipeliningPriority)(CFURLRequestRef, int priority);
111 void (*wkSetHTTPPipeliningMinimumFastLanePriority)(int priority);
112 void (*wkSetCONNECTProxyForStream)(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
113 void (*wkSetCONNECTProxyAuthorizationForStream)(CFReadStreamRef, CFStringRef proxyAuthorizationString);
114 CFHTTPMessageRef (*wkCopyCONNECTProxyResponse)(CFReadStreamRef, CFURLRef responseURL);
115
116 #if USE(CFNETWORK)
117 CFHTTPCookieStorageRef (*wkGetDefaultHTTPCookieStorage)();
118 WKCFURLCredentialRef (*wkCopyCredentialFromCFPersistentStorage)(CFURLProtectionSpaceRef protectionSpace);
119 void (*wkSetCFURLRequestShouldContentSniff)(CFMutableURLRequestRef, bool);
120 CFArrayRef (*wkCFURLRequestCopyHTTPRequestBodyParts)(CFURLRequestRef);
121 void (*wkCFURLRequestSetHTTPRequestBodyParts)(CFMutableURLRequestRef, CFArrayRef bodyParts);
122 void (*wkSetRequestStorageSession)(CFURLStorageSessionRef, CFMutableURLRequestRef);
123 #endif
124
125 void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t);
126 bool (*wkGetVerticalGlyphsForCharacters)(CTFontRef, const UniChar[], CGGlyph[], size_t);
127
128 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
129 void* wkGetHyphenationLocationBeforeIndex;
130 #else
131 CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index);
132 int (*wkGetNSEventMomentumPhase)(NSEvent *);
133 #endif
134
135 CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
136 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
137 CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
138
139 CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace);
140 CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context);
141
142 int (*wkRecommendedScrollerStyle)(void);
143
144 bool (*wkExecutableWasLinkedOnOrBeforeSnowLeopard)(void);
145
146 CFStringRef (*wkCopyDefaultSearchProviderDisplayName)(void);
147
148 NSURL *(*wkAVAssetResolvedURL)(AVAsset*);
149
150 NSCursor *(*wkCursor)(const char*);
151
152 #endif
153
154 void (*wkUnregisterUniqueIdForElement)(id element);
155 void (*wkAccessibilityHandleFocusChanged)(void);
156 CFTypeID (*wkGetAXTextMarkerTypeID)(void);
157 CFTypeID (*wkGetAXTextMarkerRangeTypeID)(void);
158 CFTypeRef (*wkCreateAXTextMarkerRange)(CFTypeRef start, CFTypeRef end);
159 CFTypeRef (*wkCopyAXTextMarkerRangeStart)(CFTypeRef range);
160 CFTypeRef (*wkCopyAXTextMarkerRangeEnd)(CFTypeRef range);
161 CFTypeRef (*wkCreateAXTextMarker)(const void *bytes, size_t len);
162 BOOL (*wkGetBytesFromAXTextMarker)(CFTypeRef textMarker, void *bytes, size_t length);
163 AXUIElementRef (*wkCreateAXUIElementRef)(id element);
164
165 CFURLStorageSessionRef (*wkCreatePrivateStorageSession)(CFStringRef);
166 NSURLRequest* (*wkCopyRequestWithStorageSession)(CFURLStorageSessionRef, NSURLRequest*);
167 CFHTTPCookieStorageRef (*wkCopyHTTPCookieStorage)(CFURLStorageSessionRef);
168 unsigned (*wkGetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef);
169 void (*wkSetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef, unsigned);
170 NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL *);
171 void (*wkSetHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *);
172 void (*wkDeleteHTTPCookie)(CFHTTPCookieStorageRef, NSHTTPCookie *);
173
174 CFStringRef (*wkGetCFURLResponseMIMEType)(CFURLResponseRef);
175 CFURLRef (*wkGetCFURLResponseURL)(CFURLResponseRef);
176 CFHTTPMessageRef (*wkGetCFURLResponseHTTPResponse)(CFURLResponseRef);
177 CFStringRef (*wkCopyCFURLResponseSuggestedFilename)(CFURLResponseRef);
178 void (*wkSetCFURLResponseMIMEType)(CFURLResponseRef, CFStringRef mimeType);
179
180 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
181 dispatch_source_t (*wkCreateVMPressureDispatchOnMainQueue)(void);
182 #endif
183
184 #if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
185 NSString *(*wkGetMacOSXVersionString)(void);
186 bool (*wkExecutableWasLinkedOnOrBeforeLion)(void);
187 #endif