Build fix.
[WebKit-https.git] / WebKitLibraries / WebKitSystemInterface.h
1 /*      
2     WebKitSystemInterface.h
3     Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 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 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
37 CFArrayRef WKCopyNSURLResponseCertificateChain(NSURLResponse *response);
38 #endif
39
40 CFStringEncoding WKGetWebDefaultCFStringEncoding(void);
41
42 void WKSetMetadataURL(NSString *URLString, NSString *referrer, NSString *path);
43 void WKSetNSURLConnectionDefersCallbacks(NSURLConnection *connection, BOOL defers);
44
45 void WKShowKeyAndMain(void);
46 #ifndef __LP64__
47 OSStatus WKSyncWindowWithCGAfterMove(WindowRef);
48 unsigned WKCarbonWindowMask(void);
49 void *WKGetNativeWindowFromWindowRef(WindowRef);
50 OSType WKCarbonWindowPropertyCreator(void);
51 OSType WKCarbonWindowPropertyTag(void);
52 #endif
53
54 typedef id WKNSURLConnectionDelegateProxyPtr;
55
56 WKNSURLConnectionDelegateProxyPtr WKCreateNSURLConnectionDelegateProxy(void);
57
58 void WKDisableCGDeferredUpdates(void);
59
60 Class WKNSURLProtocolClassForRequest(NSURLRequest *request);
61 void WKSetNSURLRequestShouldContentSniff(NSMutableURLRequest *request, BOOL shouldContentSniff);
62
63 void WKSetCookieStoragePrivateBrowsingEnabled(BOOL enabled);
64
65 unsigned WKGetNSAutoreleasePoolCount(void);
66
67 void WKAdvanceDefaultButtonPulseAnimation(NSButtonCell *button);
68
69 NSString *WKMouseMovedNotification(void);
70 NSString *WKWindowWillOrderOnScreenNotification(void);
71 void WKSetNSWindowShouldPostEventNotifications(NSWindow *window, BOOL post);
72
73 CFTypeID WKGetAXTextMarkerTypeID(void);
74 CFTypeID WKGetAXTextMarkerRangeTypeID(void);
75 CFTypeRef WKCreateAXTextMarker(const void *bytes, size_t len);
76 BOOL WKGetBytesFromAXTextMarker(CFTypeRef textMarker, void *bytes, size_t length);
77 CFTypeRef WKCreateAXTextMarkerRange(CFTypeRef start, CFTypeRef end);
78 CFTypeRef WKCopyAXTextMarkerRangeStart(CFTypeRef range);
79 CFTypeRef WKCopyAXTextMarkerRangeEnd(CFTypeRef range);
80 void WKAccessibilityHandleFocusChanged(void);
81 AXUIElementRef WKCreateAXUIElementRef(id element);
82 void WKUnregisterUniqueIdForElement(id element);
83
84
85 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
86 // Remote Accessibility API.
87 void WKAXRegisterRemoteApp(void);
88 void WKAXInitializeElementWithPresenterPid(id, pid_t);
89 CFDataRef WKAXRemoteTokenForElement(id);
90 id WKAXRemoteElementForToken(CFDataRef);
91 void WKAXInitializeRemoteElementWithWindow(id remoteElement, id window);
92 #endif
93
94 void WKSetUpFontCache(void);
95
96 void WKSignalCFReadStreamEnd(CFReadStreamRef stream);
97 void WKSignalCFReadStreamHasBytes(CFReadStreamRef stream);
98 void WKSignalCFReadStreamError(CFReadStreamRef stream, CFStreamError *error);
99
100 CFReadStreamRef WKCreateCustomCFReadStream(void *(*formCreate)(CFReadStreamRef, void *), 
101     void (*formFinalize)(CFReadStreamRef, void *), 
102     Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *), 
103     CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *), 
104     Boolean (*formCanRead)(CFReadStreamRef, void *), 
105     void (*formClose)(CFReadStreamRef, void *), 
106     void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *), 
107     void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
108     void *context);
109
110 void WKDrawCapsLockIndicator(CGContextRef, CGRect);
111
112 void WKDrawFocusRing(CGContextRef context, CGColorRef color, int radius);
113     // The CG context's current path is the focus ring's path.
114     // A color of 0 means "use system focus ring color".
115     // A radius of 0 means "use default focus ring radius".
116
117 void WKSetDragImage(NSImage *image, NSPoint offset);
118
119 void WKDrawBezeledTextFieldCell(NSRect, BOOL enabled);
120 void WKDrawTextFieldCellFocusRing(NSTextFieldCell*, NSRect);
121 void WKDrawBezeledTextArea(NSRect, BOOL enabled);
122 void WKPopupMenu(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
123 void WKPopupContextMenu(NSMenu *menu, NSPoint screenLocation);
124 void WKSendUserChangeNotifications(void);
125 #ifndef __LP64__
126 BOOL WKConvertNSEventToCarbonEvent(EventRecord *carbonEvent, NSEvent *cocoaEvent);
127 void WKSendKeyEventToTSM(NSEvent *theEvent);
128 void WKCallDrawingNotification(CGrafPtr port, Rect *bounds);
129 #endif
130
131 BOOL WKGetGlyphTransformedAdvances(CGFontRef, NSFont*, CGAffineTransform *m, ATSGlyphRef *glyph, CGSize *advance);
132 NSFont *WKGetFontInLanguageForRange(NSFont *font, NSString *string, NSRange range);
133 NSFont *WKGetFontInLanguageForCharacter(NSFont *font, UniChar ch);
134 void WKSetCGFontRenderingMode(CGContextRef cgContext, NSFont *font);
135 BOOL WKCGContextGetShouldSmoothFonts(CGContextRef cgContext);
136
137 #ifdef BUILDING_ON_TIGER
138 // CGFontGetAscent, CGFontGetDescent, CGFontGetLeading and CGFontGetUnitsPerEm were not available until Leopard
139 void WKGetFontMetrics(CGFontRef font, int *ascent, int *descent, int *lineGap, unsigned *unitsPerEm);
140 // CTFontCopyGraphicsFont was not available until Leopard
141 CGFontRef WKGetCGFontFromNSFont(NSFont *font);
142 // CTFontGetPlatformFont was not available until Leopard
143 ATSUFontID WKGetNSFontATSUFontId(NSFont *font);
144 // CGFontCopyFullName was not available until Leopard
145 CFStringRef WKCopyFullFontName(CGFontRef font);
146 #endif
147
148 void WKSetPatternBaseCTM(CGContextRef, CGAffineTransform);
149 void WKSetPatternPhaseInUserSpace(CGContextRef, CGPoint);
150 CGAffineTransform WKGetUserToBaseCTM(CGContextRef);
151
152 #ifndef BUILDING_ON_TIGER
153 void WKGetGlyphsForCharacters(CGFontRef, const UniChar[], CGGlyph[], size_t);
154 #else
155 typedef void *WKGlyphVectorRef;
156 OSStatus WKConvertCharToGlyphs(void *styleGroup, const UniChar* characters, unsigned numCharacters, WKGlyphVectorRef glyphs);
157 OSStatus WKGetATSStyleGroup(ATSUStyle fontStyle, void **styleGroup);
158 void WKReleaseStyleGroup(void *group);
159 OSStatus WKInitializeGlyphVector(int count, WKGlyphVectorRef glyphs);
160 void WKClearGlyphVector(WKGlyphVectorRef glyphs);
161
162 int WKGetGlyphVectorNumGlyphs(WKGlyphVectorRef glyphVector);
163 ATSLayoutRecord *WKGetGlyphVectorFirstRecord(WKGlyphVectorRef glyphVector);
164 size_t WKGetGlyphVectorRecordSize(WKGlyphVectorRef glyphVector);
165 #endif
166
167 CTLineRef WKCreateCTLineWithUniCharProvider(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
168 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
169 CTTypesetterRef WKCreateCTTypesetterWithUniCharProviderAndOptions(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
170
171 CGContextRef WKIOSurfaceContextCreate(IOSurfaceRef, unsigned width, unsigned height, CGColorSpaceRef);
172 CGImageRef WKIOSurfaceContextCreateImage(CGContextRef context);
173 #endif
174
175 #ifndef __LP64__
176 NSEvent *WKCreateNSEventWithCarbonEvent(EventRef eventRef);
177 NSEvent *WKCreateNSEventWithCarbonMouseMoveEvent(EventRef inEvent, NSWindow *window);
178 NSEvent *WKCreateNSEventWithCarbonClickEvent(EventRef inEvent, WindowRef windowRef);
179 #endif
180
181 CGContextRef WKNSWindowOverrideCGContext(NSWindow *, CGContextRef);
182 void WKNSWindowRestoreCGContext(NSWindow *, CGContextRef);
183
184 void WKNSWindowMakeBottomCornersSquare(NSWindow *);
185
186 // These constants match the ones used by ThemeScrollbarArrowStyle (some of the values are private, so we can't just
187 // use that enum directly).
188 typedef enum {
189     WKThemeScrollBarArrowsSingle     = 0,
190     WKThemeScrollBarArrowsLowerRight = 1,
191     WKThemeScrollBarArrowsDouble     = 2,
192     WKThemeScrollBarArrowsUpperLeft  = 3,
193 } WKThemeScrollBarArrowStyle;
194
195 OSStatus WKThemeDrawTrack(const HIThemeTrackDrawInfo* inDrawInfo, CGContextRef inContext, int inArrowStyle);
196
197 #ifdef BUILDING_ON_TIGER
198 // WKSupportsMultipartXMixedReplace is not required on Leopard as multipart/x-mixed-replace is always handled by NSURLRequest
199 BOOL WKSupportsMultipartXMixedReplace(NSMutableURLRequest *request);
200 #endif
201
202 BOOL WKCGContextIsBitmapContext(CGContextRef context);
203
204 void WKGetWheelEventDeltas(NSEvent *, float *deltaX, float *deltaY, BOOL *continuous);
205
206 BOOL WKAppVersionCheckLessThan(NSString *, int, double);
207
208 typedef enum {
209     WKMovieTypeUnknown,
210     WKMovieTypeDownload,
211     WKMovieTypeStoredStream,
212     WKMovieTypeLiveStream
213 } WKMovieType;
214
215 int WKQTMovieGetType(QTMovie* movie);
216
217 BOOL WKQTMovieHasClosedCaptions(QTMovie* movie);
218 void WKQTMovieSetShowClosedCaptions(QTMovie* movie, BOOL showClosedCaptions);
219 void WKQTMovieSelectPreferredAlternates(QTMovie* movie);
220 void WKQTMovieSelectPreferredAlternateTrackForMediaType(QTMovie* movie, NSString* mediaType);
221
222 unsigned WKQTIncludeOnlyModernMediaFileTypes(void);
223 int WKQTMovieDataRate(QTMovie* movie);
224 float WKQTMovieMaxTimeLoaded(QTMovie* movie);
225 float WKQTMovieMaxTimeSeekable(QTMovie* movie);
226 NSString *WKQTMovieMaxTimeLoadedChangeNotification(void);
227 void WKQTMovieViewSetDrawSynchronously(QTMovieView* view, BOOL sync);
228 void WKQTMovieDisableComponent(uint32_t[5]);
229
230 CFStringRef WKCopyFoundationCacheDirectory(void);
231
232 void WKSetVisibleApplicationName(CFStringRef);
233
234 typedef enum {
235     WKMediaUIPartFullscreenButton   = 0,
236     WKMediaUIPartMuteButton,
237     WKMediaUIPartPlayButton,
238     WKMediaUIPartSeekBackButton,
239     WKMediaUIPartSeekForwardButton,
240     WKMediaUIPartTimelineSlider,
241     WKMediaUIPartTimelineSliderThumb,
242     WKMediaUIPartRewindButton,
243     WKMediaUIPartSeekToRealtimeButton,
244     WKMediaUIPartShowClosedCaptionsButton,
245     WKMediaUIPartHideClosedCaptionsButton,
246     WKMediaUIPartUnMuteButton,
247     WKMediaUIPartPauseButton,
248     WKMediaUIPartBackground,
249     WKMediaUIPartCurrentTimeDisplay,
250     WKMediaUIPartTimeRemainingDisplay,
251     WKMediaUIPartStatusDisplay,
252     WKMediaUIPartControlsPanel,
253     WKMediaUIPartVolumeSliderContainer,
254     WKMediaUIPartVolumeSlider,
255     WKMediaUIPartVolumeSliderThumb
256 } WKMediaUIPart;
257
258 typedef enum {
259     WKMediaControllerThemeClassic   = 1,
260     WKMediaControllerThemeQuickTime = 2
261 } WKMediaControllerThemeStyle;
262
263 typedef enum {
264     WKMediaControllerFlagDisabled = 1 << 0,
265     WKMediaControllerFlagPressed = 1 << 1,
266     WKMediaControllerFlagDrawEndCaps = 1 << 3,
267     WKMediaControllerFlagFocused = 1 << 4
268 } WKMediaControllerThemeState;
269
270 BOOL WKMediaControllerThemeAvailable(int themeStyle);
271 BOOL WKHitTestMediaUIPart(int part, int themeStyle, CGRect bounds, CGPoint point);
272 void WKMeasureMediaUIPart(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
273 void WKDrawMediaUIPart(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
274 void WKDrawMediaSliderTrack(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration, unsigned state);
275 NSView *WKCreateMediaUIBackgroundView(void);
276
277 typedef enum {
278     WKMediaUIControlTimeline,
279     WKMediaUIControlSlider,
280     WKMediaUIControlPlayPauseButton,
281     WKMediaUIControlExitFullscreenButton,
282     WKMediaUIControlRewindButton,
283     WKMediaUIControlFastForwardButton,
284     WKMediaUIControlVolumeUpButton,
285     WKMediaUIControlVolumeDownButton
286 } WKMediaUIControlType;
287     
288 NSControl *WKCreateMediaUIControl(int controlType);
289
290 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
291 mach_port_t WKInitializeRenderServer(void);
292     
293 @class CALayer;
294
295 CALayer *WKMakeRenderLayer(uint32_t contextID);
296     
297 typedef struct __WKSoftwareCARendererRef *WKSoftwareCARendererRef;
298
299 WKSoftwareCARendererRef WKSoftwareCARendererCreate(uint32_t contextID);
300 void WKSoftwareCARendererDestroy(WKSoftwareCARendererRef);
301 void WKSoftwareCARendererRender(WKSoftwareCARendererRef, CGContextRef, CGRect);
302
303 typedef struct __WKCARemoteLayerClientRef *WKCARemoteLayerClientRef;
304
305 WKCARemoteLayerClientRef WKCARemoteLayerClientMakeWithServerPort(mach_port_t port);
306 void WKCARemoteLayerClientInvalidate(WKCARemoteLayerClientRef);
307 uint32_t WKCARemoteLayerClientGetClientId(WKCARemoteLayerClientRef);
308 void WKCARemoteLayerClientSetLayer(WKCARemoteLayerClientRef, CALayer *);
309 CALayer *WKCARemoteLayerClientGetLayer(WKCARemoteLayerClientRef);
310
311 @class CARenderer;
312
313 void WKCARendererAddChangeNotificationObserver(CARenderer *, void (*callback)(void*), void* context);
314 void WKCARendererRemoveChangeNotificationObserver(CARenderer *, void (*callback)(void*), void* context);
315
316 typedef struct __WKWindowBounceAnimationContext *WKWindowBounceAnimationContextRef;
317
318 WKWindowBounceAnimationContextRef WKWindowBounceAnimationContextCreate(NSWindow *window);
319 void WKWindowBounceAnimationContextDestroy(WKWindowBounceAnimationContextRef context);
320 void WKWindowBounceAnimationSetAnimationProgress(WKWindowBounceAnimationContextRef context, double animationProgress);
321
322 #if defined(__x86_64__)
323 #import <mach/mig.h>
324 CFRunLoopSourceRef WKCreateMIGServerSource(mig_subsystem_t subsystem, mach_port_t serverPort);
325 #endif // defined(__x86_64__)
326
327 NSUInteger WKGetInputPanelWindowStyle(void);
328 UInt8 WKGetNSEventKeyChar(NSEvent *);
329 #endif // !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
330
331 @class CAPropertyAnimation;
332 void WKSetCAAnimationValueFunction(CAPropertyAnimation*, NSString* function);
333
334 unsigned WKInitializeMaximumHTTPConnectionCountPerHost(unsigned preferredConnectionCount);
335 int WKGetHTTPPipeliningPriority(NSURLRequest *);
336 void WKSetHTTPPipeliningPriority(NSMutableURLRequest *, int priority);
337
338 void WKSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
339 void WKSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString);
340 CFHTTPMessageRef WKCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL);
341
342 BOOL WKIsLatchingWheelEvent(NSEvent *);
343
344 #ifndef BUILDING_ON_TIGER
345 void WKWindowSetAlpha(NSWindow *window, float alphaValue);
346 void WKWindowSetScaledFrame(NSWindow *window, NSRect scaleFrame, NSRect nonScaledFrame);
347 #endif
348
349 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
350 void WKSyncSurfaceToView(NSView *view);
351
352 void WKEnableSettingCursorWhenInBackground(void);
353
354 CFDictionaryRef WKNSURLRequestCreateSerializableRepresentation(NSURLRequest *request, CFTypeRef tokenNull);
355 NSURLRequest *WKNSURLRequestFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
356
357 CFDictionaryRef WKNSURLResponseCreateSerializableRepresentation(NSURLResponse *response, CFTypeRef tokenNull);
358 NSURLResponse *WKNSURLResponseFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
359
360 #ifndef __LP64__
361 ScriptCode WKGetScriptCodeFromCurrentKeyboardInputSource(void);
362 #endif
363
364 #endif
365
366 #if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
367 CFIndex WKGetHyphenationLocationBeforeIndex(CFStringRef string, CFIndex index);
368 #endif
369
370 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
371 typedef enum {
372     WKSandboxExtensionTypeReadOnly,
373     WKSandboxExtensionTypeWriteOnly,    
374     WKSandboxExtensionTypeReadWrite,
375 } WKSandboxExtensionType;
376 typedef struct __WKSandboxExtension *WKSandboxExtensionRef;
377
378 WKSandboxExtensionRef WKSandboxExtensionCreate(const char* path, WKSandboxExtensionType type);
379 void WKSandboxExtensionDestroy(WKSandboxExtensionRef sandboxExtension);
380
381 bool WKSandboxExtensionConsume(WKSandboxExtensionRef sandboxExtension);
382 bool WKSandboxExtensionInvalidate(WKSandboxExtensionRef sandboxExtension);
383
384 const char* WKSandboxExtensionGetSerializedFormat(WKSandboxExtensionRef sandboxExtension, size_t* length);
385 WKSandboxExtensionRef WKSandboxExtensionCreateFromSerializedFormat(const char* serializationFormat, size_t length);
386
387 typedef struct __WKScrollbarPainter *WKScrollbarPainterRef;
388 WKScrollbarPainterRef WKMakeScrollbarPainter(int controlSize, bool isHorizontal);
389 void WKScrollbarPainterPaint(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect);
390 int WKScrollbarThickness(int controlSize);
391 int WKScrollbarMinimumThumbLength(WKScrollbarPainterRef);
392 int WKScrollbarMinimumTotalLengthNeededForThumb(WKScrollbarPainterRef);
393
394 #endif
395
396 #ifdef __cplusplus
397 }
398 #endif