Set minimum priority for fast lane connections
[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 BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef);
32 CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef);
33 NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*);
34 NSString* (*wkCreateURLPasteboardFlavorTypeName)(void);
35 NSString* (*wkCreateURLNPasteboardFlavorTypeName)(void);
36 void (*wkDrawBezeledTextFieldCell)(NSRect, BOOL enabled);
37 void (*wkDrawTextFieldCellFocusRing)(NSTextFieldCell*, NSRect);
38 void (*wkDrawCapsLockIndicator)(CGContextRef, CGRect);
39 void (*wkDrawBezeledTextArea)(NSRect, BOOL enabled);
40 void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius);
41 NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange);
42 NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar);
43 BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance);
44 void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, 
45     float duration, unsigned state);
46 BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point);
47 void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
48 void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
49 BOOL (*wkMediaControllerThemeAvailable)(int themeStyle);
50 NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
51 CFStringRef (*wkSignedPublicKeyAndChallengeString)(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
52 NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
53 NSString* (*wkGetMIMETypeForExtension)(NSString*);
54 NSTimeInterval (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response);
55 NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
56 BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
57 void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
58 void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
59 unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
60 int (*wkQTMovieDataRate)(QTMovie*);
61 void (*wkQTMovieDisableComponent)(uint32_t[5]);
62 float (*wkQTMovieMaxTimeLoaded)(QTMovie*);
63 NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void);
64 float (*wkQTMovieMaxTimeSeekable)(QTMovie*);
65 int (*wkQTMovieGetType)(QTMovie*);
66 BOOL (*wkQTMovieHasClosedCaptions)(QTMovie*);
67 void (*wkQTMovieSetShowClosedCaptions)(QTMovie*, BOOL);
68 void (*wkQTMovieSelectPreferredAlternates)(QTMovie*);
69 void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL);
70 void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*);
71 void (*wkSetCookieStoragePrivateBrowsingEnabled)(BOOL);
72 void (*wkSetDragImage)(NSImage*, NSPoint offset);
73 void (*wkSetPatternBaseCTM)(CGContextRef, CGAffineTransform);
74 void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint point);
75 CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef);
76 void (*wkSetUpFontCache)();
77 void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream);
78 void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream);
79 void (*wkSignalCFReadStreamError)(CFReadStreamRef stream, CFStreamError *error);
80 CFReadStreamRef (*wkCreateCustomCFReadStream)(void *(*formCreate)(CFReadStreamRef, void *), 
81     void (*formFinalize)(CFReadStreamRef, void *), 
82     Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *), 
83     CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *), 
84     Boolean (*formCanRead)(CFReadStreamRef, void *), 
85     void (*formClose)(CFReadStreamRef, void *), 
86     void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *), 
87     void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
88     void *context);
89 void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL);
90 void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL);
91 id (*wkCreateNSURLConnectionDelegateProxy)(void);
92 unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount);
93 int (*wkGetHTTPPipeliningPriority)(NSURLRequest *);
94 void (*wkSetHTTPPipeliningMaximumPriority)(int priority);
95 void (*wkSetHTTPPipeliningPriority)(NSMutableURLRequest *, int priority);
96 void (*wkSetHTTPPipeliningMinimumFastLanePriority)(int priority);
97 void (*wkSetCONNECTProxyForStream)(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
98 void (*wkSetCONNECTProxyAuthorizationForStream)(CFReadStreamRef, CFStringRef proxyAuthorizationString);
99 CFHTTPMessageRef (*wkCopyCONNECTProxyResponse)(CFReadStreamRef, CFURLRef responseURL);
100
101 #ifndef BUILDING_ON_TIGER
102 void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t);
103 #else
104 void (*wkClearGlyphVector)(void* glyphs);
105 OSStatus (*wkConvertCharToGlyphs)(void* styleGroup, const UniChar*, unsigned numCharacters, void* glyphs);
106 CFStringRef (*wkCopyFullFontName)(CGFontRef font);
107 OSStatus (*wkGetATSStyleGroup)(ATSUStyle, void** styleGroup);
108 CGFontRef (*wkGetCGFontFromNSFont)(NSFont*);
109 void (*wkGetFontMetrics)(CGFontRef, int* ascent, int* descent, int* lineGap, unsigned* unitsPerEm);
110 ATSLayoutRecord* (*wkGetGlyphVectorFirstRecord)(void* glyphVector);
111 void* wkGetGlyphsForCharacters;
112 int (*wkGetGlyphVectorNumGlyphs)(void* glyphVector);
113 size_t (*wkGetGlyphVectorRecordSize)(void* glyphVector);
114 OSStatus (*wkInitializeGlyphVector)(int count, void* glyphs);
115 void (*wkReleaseStyleGroup)(void* group);
116 ATSUFontID (*wkGetNSFontATSUFontId)(NSFont*);
117 BOOL (*wkSupportsMultipartXMixedReplace)(NSMutableURLRequest *);
118 #endif
119
120 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
121 void* wkGetHyphenationLocationBeforeIndex;
122 #else
123 CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index);
124 int (*wkGetNSEventMomentumPhase)(NSEvent *);
125 #endif
126
127 CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
128 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
129 CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
130
131 CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace);
132 CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context);
133
134 WKScrollbarPainterRef (*wkMakeScrollbarPainter)(int controlSize, bool isHorizontal);
135 WKScrollbarPainterRef (*wkMakeScrollbarReplacementPainter)(WKScrollbarPainterRef oldPainter, int newStyle, int controlSize, bool isHorizontal);
136 void (*wkScrollbarPainterSetDelegate)(WKScrollbarPainterRef, id scrollbarPainterDelegate);
137 void (*wkScrollbarPainterPaint)(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect);
138 void (*wkScrollbarPainterForceFlashScrollers)(WKScrollbarPainterControllerRef);
139 int (*wkScrollbarThickness)(int controlSize);
140 int (*wkScrollbarMinimumThumbLength)(WKScrollbarPainterRef);
141 int (*wkScrollbarMinimumTotalLengthNeededForThumb)(WKScrollbarPainterRef);
142 CGFloat (*wkScrollbarPainterKnobAlpha)(WKScrollbarPainterRef);
143 void (*wkSetScrollbarPainterKnobAlpha)(WKScrollbarPainterRef, CGFloat);
144 CGFloat (*wkScrollbarPainterTrackAlpha)(WKScrollbarPainterRef);
145 void (*wkSetScrollbarPainterTrackAlpha)(WKScrollbarPainterRef, CGFloat);
146 bool (*wkScrollbarPainterIsHorizontal)(WKScrollbarPainterRef);
147 void (*wkScrollbarPainterSetOverlayState)(WKScrollbarPainterRef, int overlayScrollerState);
148
149 WKScrollbarPainterControllerRef (*wkMakeScrollbarPainterController)(id painterControllerDelegate);
150 void (*wkSetPainterForPainterController)(WKScrollbarPainterControllerRef, WKScrollbarPainterRef, bool isHorizontal);
151 WKScrollbarPainterRef (*wkVerticalScrollbarPainterForController)(WKScrollbarPainterControllerRef);
152 WKScrollbarPainterRef (*wkHorizontalScrollbarPainterForController)(WKScrollbarPainterControllerRef);
153 void (*wkSetScrollbarPainterControllerStyle)(WKScrollbarPainterControllerRef, int newStyle);
154 void (*wkContentAreaScrolled)(WKScrollbarPainterControllerRef);
155 void (*wkContentAreaWillPaint)(WKScrollbarPainterControllerRef);
156 void (*wkMouseEnteredContentArea)(WKScrollbarPainterControllerRef);
157 void (*wkMouseExitedContentArea)(WKScrollbarPainterControllerRef);
158 void (*wkMouseMovedInContentArea)(WKScrollbarPainterControllerRef);
159 void (*wkWillStartLiveResize)(WKScrollbarPainterControllerRef);
160 void (*wkContentAreaResized)(WKScrollbarPainterControllerRef);
161 void (*wkWillEndLiveResize)(WKScrollbarPainterControllerRef);
162 void (*wkContentAreaDidShow)(WKScrollbarPainterControllerRef);
163 void (*wkContentAreaDidHide)(WKScrollbarPainterControllerRef);
164 void (*wkDidBeginScrollGesture)(WKScrollbarPainterControllerRef);
165 void (*wkDidEndScrollGesture)(WKScrollbarPainterControllerRef);
166
167 bool (*wkScrollbarPainterUsesOverlayScrollers)(void);
168 #endif
169
170 void (*wkUnregisterUniqueIdForElement)(id element);
171 void (*wkAccessibilityHandleFocusChanged)(void);
172 CFTypeID (*wkGetAXTextMarkerTypeID)(void);
173 CFTypeID (*wkGetAXTextMarkerRangeTypeID)(void);
174 CFTypeRef (*wkCreateAXTextMarkerRange)(CFTypeRef start, CFTypeRef end);
175 CFTypeRef (*wkCopyAXTextMarkerRangeStart)(CFTypeRef range);
176 CFTypeRef (*wkCopyAXTextMarkerRangeEnd)(CFTypeRef range);
177 CFTypeRef (*wkCreateAXTextMarker)(const void *bytes, size_t len);
178 BOOL (*wkGetBytesFromAXTextMarker)(CFTypeRef textMarker, void *bytes, size_t length);
179 AXUIElementRef (*wkCreateAXUIElementRef)(id element);
180
181 CFURLStorageSessionRef (*wkCreatePrivateStorageSession)(CFStringRef);
182 NSURLRequest* (*wkCopyRequestWithStorageSession)(CFURLStorageSessionRef, NSURLRequest*);
183 CFHTTPCookieStorageRef (*wkCopyHTTPCookieStorage)(CFURLStorageSessionRef);
184 unsigned (*wkGetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef);
185 NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL *);
186 void (*wkSetHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *);
187 void (*wkDeleteHTTPCookie)(CFHTTPCookieStorageRef, NSHTTPCookie *);
188
189 CFStringRef (*wkGetCFURLResponseMIMEType)(CFURLResponseRef);
190 CFURLRef (*wkGetCFURLResponseURL)(CFURLResponseRef);
191 CFHTTPMessageRef (*wkGetCFURLResponseHTTPResponse)(CFURLResponseRef);
192 CFStringRef (*wkCopyCFURLResponseSuggestedFilename)(CFURLResponseRef);
193 void (*wkSetCFURLResponseMIMEType)(CFURLResponseRef, CFStringRef mimeType);