Speculative build fix.
[WebKit-https.git] / WebKitLibraries / WebKitSystemInterface.h
1 /*      
2     WebKitSystemInterface.h
3     Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
4
5     Public header file.
6 */
7
8 #import <Cocoa/Cocoa.h>
9 #import <Carbon/Carbon.h>
10
11 @class QTMovie;
12 @class QTMovieView;
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 typedef enum {
19     WKCertificateParseResultSucceeded  = 0,
20     WKCertificateParseResultFailed     = 1,
21     WKCertificateParseResultPKCS7      = 2,
22 } WKCertificateParseResult;
23
24 CFStringRef WKCopyCFLocalizationPreferredName(CFStringRef localization);
25 CFStringRef WKSignedPublicKeyAndChallengeString(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
26 WKCertificateParseResult WKAddCertificatesToKeychainFromData(const void *bytes, unsigned length);
27
28 NSString *WKGetPreferredExtensionForMIMEType(NSString *type);
29 NSArray *WKGetExtensionsForMIMEType(NSString *type);
30 NSString *WKGetMIMETypeForExtension(NSString *extension);
31
32 NSDate *WKGetNSURLResponseLastModifiedDate(NSURLResponse *response);
33 NSTimeInterval WKGetNSURLResponseFreshnessLifetime(NSURLResponse *response);
34 NSString *WKCopyNSURLResponseStatusLine(NSURLResponse *response);
35
36 CFStringEncoding WKGetWebDefaultCFStringEncoding(void);
37
38 void WKSetMetadataURL(NSString *URLString, NSString *referrer, NSString *path);
39 void WKSetNSURLConnectionDefersCallbacks(NSURLConnection *connection, BOOL defers);
40
41 void WKShowKeyAndMain(void);
42 #ifndef __LP64__
43 OSStatus WKSyncWindowWithCGAfterMove(WindowRef);
44 unsigned WKCarbonWindowMask(void);
45 void *WKGetNativeWindowFromWindowRef(WindowRef);
46 OSType WKCarbonWindowPropertyCreator(void);
47 OSType WKCarbonWindowPropertyTag(void);
48 #endif
49
50 typedef id WKNSURLConnectionDelegateProxyPtr;
51
52 WKNSURLConnectionDelegateProxyPtr WKCreateNSURLConnectionDelegateProxy(void);
53
54 void WKDisableCGDeferredUpdates(void);
55
56 Class WKNSURLProtocolClassForRequest(NSURLRequest *request);
57 void WKSetNSURLRequestShouldContentSniff(NSMutableURLRequest *request, BOOL shouldContentSniff);
58
59 unsigned WKGetNSAutoreleasePoolCount(void);
60
61 void WKAdvanceDefaultButtonPulseAnimation(NSButtonCell *button);
62
63 NSString *WKMouseMovedNotification(void);
64 NSString *WKWindowWillOrderOnScreenNotification(void);
65 void WKSetNSWindowShouldPostEventNotifications(NSWindow *window, BOOL post);
66
67 CFTypeID WKGetAXTextMarkerTypeID(void);
68 CFTypeID WKGetAXTextMarkerRangeTypeID(void);
69 CFTypeRef WKCreateAXTextMarker(const void *bytes, size_t len);
70 BOOL WKGetBytesFromAXTextMarker(CFTypeRef textMarker, void *bytes, size_t length);
71 CFTypeRef WKCreateAXTextMarkerRange(CFTypeRef start, CFTypeRef end);
72 CFTypeRef WKCopyAXTextMarkerRangeStart(CFTypeRef range);
73 CFTypeRef WKCopyAXTextMarkerRangeEnd(CFTypeRef range);
74 void WKAccessibilityHandleFocusChanged(void);
75 AXUIElementRef WKCreateAXUIElementRef(id element);
76 void WKUnregisterUniqueIdForElement(id element);
77
78 void WKSetUpFontCache(void);
79
80 void WKSignalCFReadStreamEnd(CFReadStreamRef stream);
81 void WKSignalCFReadStreamHasBytes(CFReadStreamRef stream);
82 void WKSignalCFReadStreamError(CFReadStreamRef stream, CFStreamError *error);
83
84 CFReadStreamRef WKCreateCustomCFReadStream(void *(*formCreate)(CFReadStreamRef, void *), 
85     void (*formFinalize)(CFReadStreamRef, void *), 
86     Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *), 
87     CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *), 
88     Boolean (*formCanRead)(CFReadStreamRef, void *), 
89     void (*formClose)(CFReadStreamRef, void *), 
90     void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *), 
91     void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
92     void *context);
93
94 void WKDrawCapsLockIndicator(CGContextRef, CGRect);
95
96 void WKDrawFocusRing(CGContextRef context, CGColorRef color, int radius);
97     // The CG context's current path is the focus ring's path.
98     // A color of 0 means "use system focus ring color".
99     // A radius of 0 means "use default focus ring radius".
100
101 void WKSetDragImage(NSImage *image, NSPoint offset);
102
103 void WKDrawBezeledTextFieldCell(NSRect, BOOL enabled);
104 void WKDrawTextFieldCellFocusRing(NSTextFieldCell*, NSRect);
105 void WKDrawBezeledTextArea(NSRect, BOOL enabled);
106 void WKPopupMenu(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
107
108 void WKSendUserChangeNotifications(void);
109 #ifndef __LP64__
110 BOOL WKConvertNSEventToCarbonEvent(EventRecord *carbonEvent, NSEvent *cocoaEvent);
111 void WKSendKeyEventToTSM(NSEvent *theEvent);
112 void WKCallDrawingNotification(CGrafPtr port, Rect *bounds);
113 #endif
114
115 BOOL WKGetGlyphTransformedAdvances(CGFontRef, NSFont*, CGAffineTransform *m, ATSGlyphRef *glyph, CGSize *advance);
116 NSFont *WKGetFontInLanguageForRange(NSFont *font, NSString *string, NSRange range);
117 NSFont *WKGetFontInLanguageForCharacter(NSFont *font, UniChar ch);
118 void WKSetCGFontRenderingMode(CGContextRef cgContext, NSFont *font);
119 BOOL WKCGContextGetShouldSmoothFonts(CGContextRef cgContext);
120
121 #ifdef BUILDING_ON_TIGER
122 // CGFontGetAscent, CGFontGetDescent, CGFontGetLeading and CGFontGetUnitsPerEm were not available until Leopard
123 void WKGetFontMetrics(CGFontRef font, int *ascent, int *descent, int *lineGap, unsigned *unitsPerEm);
124 // CTFontCopyGraphicsFont was not available until Leopard
125 CGFontRef WKGetCGFontFromNSFont(NSFont *font);
126 // CTFontGetPlatformFont was not available until Leopard
127 ATSUFontID WKGetNSFontATSUFontId(NSFont *font);
128 // CGFontCopyFullName was not available until Leopard
129 CFStringRef WKCopyFullFontName(CGFontRef font);
130 #endif
131
132 void WKSetPatternBaseCTM(CGContextRef, CGAffineTransform);
133 void WKSetPatternPhaseInUserSpace(CGContextRef, CGPoint);
134 CGAffineTransform WKGetUserToBaseCTM(CGContextRef);
135
136 #ifndef BUILDING_ON_TIGER
137 void WKGetGlyphsForCharacters(CGFontRef, const UniChar[], CGGlyph[], size_t);
138 #else
139 typedef void *WKGlyphVectorRef;
140 OSStatus WKConvertCharToGlyphs(void *styleGroup, const UniChar *characters, unsigned numCharacters, WKGlyphVectorRef glyphs);
141 OSStatus WKGetATSStyleGroup(ATSUStyle fontStyle, void **styleGroup);
142 void WKReleaseStyleGroup(void *group);
143 OSStatus WKInitializeGlyphVector(int count, WKGlyphVectorRef glyphs);
144 void WKClearGlyphVector(WKGlyphVectorRef glyphs);
145
146 int WKGetGlyphVectorNumGlyphs(WKGlyphVectorRef glyphVector);
147 ATSLayoutRecord *WKGetGlyphVectorFirstRecord(WKGlyphVectorRef glyphVector);
148 size_t WKGetGlyphVectorRecordSize(WKGlyphVectorRef glyphVector);
149 #endif
150
151 #ifndef __LP64__
152 NSEvent *WKCreateNSEventWithCarbonEvent(EventRef eventRef);
153 NSEvent *WKCreateNSEventWithCarbonMouseMoveEvent(EventRef inEvent, NSWindow *window);
154 NSEvent *WKCreateNSEventWithCarbonClickEvent(EventRef inEvent, WindowRef windowRef);
155 #endif
156
157 CGContextRef WKNSWindowOverrideCGContext(NSWindow *, CGContextRef);
158 void WKNSWindowRestoreCGContext(NSWindow *, CGContextRef);
159
160 void WKNSWindowMakeBottomCornersSquare(NSWindow *);
161
162 // These constants match the ones used by ThemeScrollbarArrowStyle (some of the values are private, so we can't just
163 // use that enum directly).
164 typedef enum {
165     WKThemeScrollBarArrowsSingle     = 0,
166     WKThemeScrollBarArrowsLowerRight = 1,
167     WKThemeScrollBarArrowsDouble     = 2,
168     WKThemeScrollBarArrowsUpperLeft  = 3,
169 } WKThemeScrollBarArrowStyle;
170
171 OSStatus WKThemeDrawTrack(const HIThemeTrackDrawInfo* inDrawInfo, CGContextRef inContext, int inArrowStyle);
172
173 #ifdef BUILDING_ON_TIGER
174 // WKSupportsMultipartXMixedReplace is not required on Leopard as multipart/x-mixed-replace is always handled by NSURLRequest
175 BOOL WKSupportsMultipartXMixedReplace(NSMutableURLRequest *request);
176 #endif
177
178 BOOL WKCGContextIsBitmapContext(CGContextRef context);
179
180 void WKGetWheelEventDeltas(NSEvent *, float *deltaX, float *deltaY, BOOL *continuous);
181
182 BOOL WKAppVersionCheckLessThan(NSString *, int, double);
183
184 typedef enum {
185     WKMovieTypeUnknown,
186     WKMovieTypeDownload,
187     WKMovieTypeStoredStream,
188     WKMovieTypeLiveStream
189 } WKMovieType;
190
191 int WKQTMovieGetType(QTMovie* movie);
192
193 BOOL WKQTMovieHasClosedCaptions(QTMovie* movie);
194 void WKQTMovieSetShowClosedCaptions(QTMovie* movie, BOOL showClosedCaptions);
195 void WKQTMovieSelectPreferredAlternates(QTMovie* movie);
196 void WKQTMovieSelectPreferredAlternateTrackForMediaType(QTMovie* movie, NSString* mediaType);
197
198 unsigned WKQTIncludeOnlyModernMediaFileTypes(void);
199 int WKQTMovieDataRate(QTMovie* movie);
200 float WKQTMovieMaxTimeLoaded(QTMovie* movie);
201 float WKQTMovieMaxTimeSeekable(QTMovie* movie);
202 NSString *WKQTMovieMaxTimeLoadedChangeNotification(void);
203 void WKQTMovieViewSetDrawSynchronously(QTMovieView* view, BOOL sync);
204
205 CFStringRef WKCopyFoundationCacheDirectory(void);
206
207 typedef enum {
208     WKMediaUIPartFullscreenButton   = 0,
209     WKMediaUIPartMuteButton,
210     WKMediaUIPartPlayButton,
211     WKMediaUIPartSeekBackButton,
212     WKMediaUIPartSeekForwardButton,
213     WKMediaUIPartSlider,
214     WKMediaUIPartSliderThumb,
215     WKMediaUIPartRewindButton,
216     WKMediaUIPartSeekToRealtimeButton,
217     WKMediaUIPartShowClosedCaptionsButton,
218     WKMediaUIPartHideClosedCaptionsButton,
219     WKMediaUIPartUnMuteButton,
220     WKMediaUIPartPauseButton,
221     WKMediaUIPartBackground,
222     WKMediaUIPartCurrentTimeDisplay,
223     WKMediaUIPartTimeRemainingDisplay
224 } WKMediaUIPart;
225
226 typedef enum {
227     WKMediaControllerThemeClassic   = 1,
228     WKMediaControllerThemeQuickTime = 2
229 } WKMediaControllerThemeStyle;
230
231 typedef enum {
232     WKMediaControllerFlagDisabled = 1 << 0,
233     WKMediaControllerFlagPressed = 1 << 1,
234     WKMediaControllerFlagDrawEndCaps = 1 << 3,
235     WKMediaControllerFlagFocused = 1 << 4
236 } WKMediaControllerThemeState;
237
238 BOOL WKMediaControllerThemeAvailable(int themeStyle);
239 BOOL WKHitTestMediaUIPart(int part, int themeStyle, CGRect bounds, CGPoint point);
240 void WKMeasureMediaUIPart(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
241 void WKDrawMediaUIPart(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
242 void WKDrawMediaSliderTrack(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration, unsigned state);
243 NSView *WKCreateMediaUIBackgroundView(void);
244
245 typedef enum {
246     WKMediaUIControlTimeline,
247     WKMediaUIControlSlider,
248     WKMediaUIControlPlayPauseButton,
249     WKMediaUIControlExitFullscreenButton,
250     WKMediaUIControlRewindButton,
251     WKMediaUIControlFastForwardButton,
252     WKMediaUIControlVolumeUpButton,
253     WKMediaUIControlVolumeDownButton
254
255 } WKMediaUIControlType;
256     
257 NSControl *WKCreateMediaUIControl(int controlType);
258
259 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && defined(__x86_64__)
260 mach_port_t WKInitializeRenderServer(void);
261     
262 @class CALayer;
263
264 CALayer *WKMakeRenderLayer(uint32_t contextID);
265     
266 typedef struct __WKSoftwareCARendererRef *WKSoftwareCARendererRef;
267
268 WKSoftwareCARendererRef WKSoftwareCARendererCreate(uint32_t contextID);
269 void WKSoftwareCARendererDestroy(WKSoftwareCARendererRef);
270 void WKSoftwareCARendererRender(WKSoftwareCARendererRef, CGContextRef, CGRect);
271
272 #import <mach/mig.h>
273
274 CFRunLoopSourceRef WKCreateMIGServerSource(mig_subsystem_t subsystem, mach_port_t serverPort);
275
276 NSUInteger WKGetInputPanelWindowStyle(void);
277  
278 UInt8 WKGetNSEventKeyChar(NSEvent *);
279     
280 #endif
281
282 @class CAPropertyAnimation;
283 void WKSetCAAnimationValueFunction(CAPropertyAnimation*, NSString* function);
284
285 unsigned WKInitializeMaximumHTTPConnectionCountPerHost(unsigned preferredConnectionCount);
286
287 void WKSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
288 void WKSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString);
289 CFHTTPMessageRef WKCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL);
290
291 BOOL WKIsLatchingWheelEvent(NSEvent *);
292
293 #ifndef BUILDING_ON_TIGER
294 void WKWindowSetAlpha(NSWindow *window, float alphaValue);
295 void WKWindowSetScaledFrame(NSWindow *window, NSRect scaleFrame, NSRect nonScaledFrame);
296 #endif
297
298 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
299 NSMutableArray *WKNoteOpenPanelFiles(NSArray *paths);
300 void WKSyncSurfaceToView(NSView *view);
301 #endif
302
303 #if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
304 CFIndex WKGetHyphenationLocationBeforeIndex(CFStringRef string, CFIndex index);
305 #endif
306
307 #ifdef __cplusplus
308 }
309 #endif