WebKitSystemInterface.h revision d8543bb6618c17b12da906afa77d216f58cf4058
1/*
2    WebKitSystemInterface.h
3    Copyright (C) 2005, 2006, 2007, 2008 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
15extern "C" {
16#endif
17
18typedef enum {
19    WKCertificateParseResultSucceeded  = 0,
20    WKCertificateParseResultFailed     = 1,
21    WKCertificateParseResultPKCS7      = 2,
22} WKCertificateParseResult;
23
24CFStringRef WKCopyCFLocalizationPreferredName(CFStringRef localization);
25CFStringRef WKSignedPublicKeyAndChallengeString(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
26WKCertificateParseResult WKAddCertificatesToKeychainFromData(const void *bytes, unsigned length);
27
28NSString *WKGetPreferredExtensionForMIMEType(NSString *type);
29NSArray *WKGetExtensionsForMIMEType(NSString *type);
30NSString *WKGetMIMETypeForExtension(NSString *extension);
31
32NSDate *WKGetNSURLResponseLastModifiedDate(NSURLResponse *response);
33NSTimeInterval WKGetNSURLResponseFreshnessLifetime(NSURLResponse *response);
34
35CFStringEncoding WKGetWebDefaultCFStringEncoding(void);
36
37void WKSetMetadataURL(NSString *URLString, NSString *referrer, NSString *path);
38void WKSetNSURLConnectionDefersCallbacks(NSURLConnection *connection, BOOL defers);
39
40void WKShowKeyAndMain(void);
41#ifndef __LP64__
42OSStatus WKSyncWindowWithCGAfterMove(WindowRef);
43unsigned WKCarbonWindowMask(void);
44void *WKGetNativeWindowFromWindowRef(WindowRef);
45OSType WKCarbonWindowPropertyCreator(void);
46OSType WKCarbonWindowPropertyTag(void);
47#endif
48
49typedef id WKNSURLConnectionDelegateProxyPtr;
50
51WKNSURLConnectionDelegateProxyPtr WKCreateNSURLConnectionDelegateProxy(void);
52
53void WKDisableCGDeferredUpdates(void);
54
55Class WKNSURLProtocolClassForRequest(NSURLRequest *request);
56void WKSetNSURLRequestShouldContentSniff(NSMutableURLRequest *request, BOOL shouldContentSniff);
57
58unsigned WKGetNSAutoreleasePoolCount(void);
59
60NSString *WKMouseMovedNotification(void);
61void WKSetNSWindowShouldPostEventNotifications(NSWindow *window, BOOL post);
62
63CFTypeID WKGetAXTextMarkerTypeID(void);
64CFTypeID WKGetAXTextMarkerRangeTypeID(void);
65CFTypeRef WKCreateAXTextMarker(const void *bytes, size_t len);
66BOOL WKGetBytesFromAXTextMarker(CFTypeRef textMarker, void *bytes, size_t length);
67CFTypeRef WKCreateAXTextMarkerRange(CFTypeRef start, CFTypeRef end);
68CFTypeRef WKCopyAXTextMarkerRangeStart(CFTypeRef range);
69CFTypeRef WKCopyAXTextMarkerRangeEnd(CFTypeRef range);
70void WKAccessibilityHandleFocusChanged(void);
71AXUIElementRef WKCreateAXUIElementRef(id element);
72void WKUnregisterUniqueIdForElement(id element);
73
74BOOL WKFontSmoothingModeIsLCD(int mode);
75void WKSetUpFontCache(size_t s);
76
77void WKSignalCFReadStreamEnd(CFReadStreamRef stream);
78void WKSignalCFReadStreamHasBytes(CFReadStreamRef stream);
79void WKSignalCFReadStreamError(CFReadStreamRef stream, CFStreamError *error);
80
81CFReadStreamRef WKCreateCustomCFReadStream(void *(*formCreate)(CFReadStreamRef, void *),
82    void (*formFinalize)(CFReadStreamRef, void *),
83    Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *),
84    CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *),
85    Boolean (*formCanRead)(CFReadStreamRef, void *),
86    void (*formClose)(CFReadStreamRef, void *),
87    void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
88    void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
89    void *context);
90
91void WKDrawCapsLockIndicator(CGContextRef, CGRect);
92
93void WKDrawFocusRing(CGContextRef context, CGColorRef color, int radius);
94    // The CG context's current path is the focus ring's path.
95    // A color of 0 means "use system focus ring color".
96    // A radius of 0 means "use default focus ring radius".
97
98void WKSetDragImage(NSImage *image, NSPoint offset);
99
100void WKDrawBezeledTextFieldCell(NSRect, BOOL enabled);
101void WKDrawTextFieldCellFocusRing(NSTextFieldCell*, NSRect);
102void WKDrawBezeledTextArea(NSRect, BOOL enabled);
103void WKPopupMenu(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
104
105void WKSendUserChangeNotifications(void);
106#ifndef __LP64__
107BOOL WKConvertNSEventToCarbonEvent(EventRecord *carbonEvent, NSEvent *cocoaEvent);
108void WKSendKeyEventToTSM(NSEvent *theEvent);
109void WKCallDrawingNotification(CGrafPtr port, Rect *bounds);
110#endif
111
112BOOL WKGetGlyphTransformedAdvances(CGFontRef, NSFont*, CGAffineTransform *m, ATSGlyphRef *glyph, CGSize *advance);
113CGFontRef WKGetCGFontFromNSFont(NSFont *font);
114NSFont *WKGetFontInLanguageForRange(NSFont *font, NSString *string, NSRange range);
115NSFont *WKGetFontInLanguageForCharacter(NSFont *font, UniChar ch);
116void WKSetCGFontRenderingMode(CGContextRef cgContext, NSFont *font);
117ATSUFontID WKGetNSFontATSUFontId(NSFont *font);
118void WKReleaseStyleGroup(void *group);
119BOOL WKCGContextGetShouldSmoothFonts(CGContextRef cgContext);
120
121#ifdef BUILDING_ON_TIGER
122// CGFontGetAscent, CGFontGetDescent, CGFontGetLeading and CGFontGetUnitsPerEm were not available until Leopard
123void WKGetFontMetrics(CGFontRef font, int *ascent, int *descent, int *lineGap, unsigned *unitsPerEm);
124#endif
125
126void WKSetPatternBaseCTM(CGContextRef, CGAffineTransform);
127void WKSetPatternPhaseInUserSpace(CGContextRef, CGPoint);
128
129typedef void *WKGlyphVectorRef;
130OSStatus WKConvertCharToGlyphs(void *styleGroup, const UniChar *characters, unsigned numCharacters, WKGlyphVectorRef glyphs);
131OSStatus WKGetATSStyleGroup(ATSUStyle fontStyle, void **styleGroup);
132OSStatus WKInitializeGlyphVector(int count, WKGlyphVectorRef glyphs);
133void WKClearGlyphVector(WKGlyphVectorRef glyphs);
134
135int WKGetGlyphVectorNumGlyphs(WKGlyphVectorRef glyphVector);
136ATSLayoutRecord *WKGetGlyphVectorFirstRecord(WKGlyphVectorRef glyphVector);
137size_t WKGetGlyphVectorRecordSize(WKGlyphVectorRef glyphVector);
138
139#ifndef __LP64__
140NSEvent *WKCreateNSEventWithCarbonEvent(EventRef eventRef);
141NSEvent *WKCreateNSEventWithCarbonMouseMoveEvent(EventRef inEvent, NSWindow *window);
142NSEvent *WKCreateNSEventWithCarbonClickEvent(EventRef inEvent, WindowRef windowRef);
143#endif
144
145CGContextRef WKNSWindowOverrideCGContext(NSWindow *, CGContextRef);
146void WKNSWindowRestoreCGContext(NSWindow *, CGContextRef);
147
148void WKNSWindowMakeBottomCornersSquare(NSWindow *);
149
150#ifdef BUILDING_ON_TIGER
151// WKSupportsMultipartXMixedReplace is not required on Leopard as multipart/x-mixed-replace is always handled by NSURLRequest
152BOOL WKSupportsMultipartXMixedReplace(NSMutableURLRequest *request);
153#endif
154
155BOOL WKCGContextIsBitmapContext(CGContextRef context);
156
157void WKGetWheelEventDeltas(NSEvent *, float *deltaX, float *deltaY, BOOL *continuous);
158
159BOOL WKAppVersionCheckLessThan(NSString *, int, double);
160
161int WKQTMovieDataRate(QTMovie* movie);
162float WKQTMovieMaxTimeLoaded(QTMovie* movie);
163void WKQTMovieViewSetDrawSynchronously(QTMovieView* view, BOOL sync);
164
165CFStringRef WKCopyFoundationCacheDirectory(void);
166
167void WKDrawMediaFullscreenButton(CGContextRef context, CGRect rect, BOOL active);
168void WKDrawMediaMuteButton(CGContextRef context, CGRect rect, BOOL active);
169void WKDrawMediaPauseButton(CGContextRef context, CGRect rect, BOOL active);
170void WKDrawMediaPlayButton(CGContextRef context, CGRect rect, BOOL active);
171void WKDrawMediaSeekBackButton(CGContextRef context, CGRect rect, BOOL active);
172void WKDrawMediaSeekForwardButton(CGContextRef context, CGRect rect, BOOL active);
173void WKDrawMediaSliderTrack(CGContextRef context, CGRect rect, float percentLoaded);
174void WKDrawMediaSliderThumb(CGContextRef context, CGRect rect, BOOL active);
175void WKDrawMediaUnMuteButton(CGContextRef context, CGRect rect, BOOL active);
176
177#ifdef __cplusplus
178}
179#endif
180