WebKitSystemInterface.h revision 8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2
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
60void WKAdvanceDefaultButtonPulseAnimation(NSButtonCell *button);
61
62NSString *WKMouseMovedNotification(void);
63NSString *WKWindowWillOrderOnScreenNotification(void);
64void WKSetNSWindowShouldPostEventNotifications(NSWindow *window, BOOL post);
65
66CFTypeID WKGetAXTextMarkerTypeID(void);
67CFTypeID WKGetAXTextMarkerRangeTypeID(void);
68CFTypeRef WKCreateAXTextMarker(const void *bytes, size_t len);
69BOOL WKGetBytesFromAXTextMarker(CFTypeRef textMarker, void *bytes, size_t length);
70CFTypeRef WKCreateAXTextMarkerRange(CFTypeRef start, CFTypeRef end);
71CFTypeRef WKCopyAXTextMarkerRangeStart(CFTypeRef range);
72CFTypeRef WKCopyAXTextMarkerRangeEnd(CFTypeRef range);
73void WKAccessibilityHandleFocusChanged(void);
74AXUIElementRef WKCreateAXUIElementRef(id element);
75void WKUnregisterUniqueIdForElement(id element);
76
77void WKSetUpFontCache(void);
78
79void WKSignalCFReadStreamEnd(CFReadStreamRef stream);
80void WKSignalCFReadStreamHasBytes(CFReadStreamRef stream);
81void WKSignalCFReadStreamError(CFReadStreamRef stream, CFStreamError *error);
82
83CFReadStreamRef WKCreateCustomCFReadStream(void *(*formCreate)(CFReadStreamRef, void *),
84    void (*formFinalize)(CFReadStreamRef, void *),
85    Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *),
86    CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *),
87    Boolean (*formCanRead)(CFReadStreamRef, void *),
88    void (*formClose)(CFReadStreamRef, void *),
89    void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
90    void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
91    void *context);
92
93void WKDrawCapsLockIndicator(CGContextRef, CGRect);
94
95void WKDrawFocusRing(CGContextRef context, CGColorRef color, int radius);
96    // The CG context's current path is the focus ring's path.
97    // A color of 0 means "use system focus ring color".
98    // A radius of 0 means "use default focus ring radius".
99
100void WKSetDragImage(NSImage *image, NSPoint offset);
101
102void WKDrawBezeledTextFieldCell(NSRect, BOOL enabled);
103void WKDrawTextFieldCellFocusRing(NSTextFieldCell*, NSRect);
104void WKDrawBezeledTextArea(NSRect, BOOL enabled);
105void WKPopupMenu(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
106
107void WKSendUserChangeNotifications(void);
108#ifndef __LP64__
109BOOL WKConvertNSEventToCarbonEvent(EventRecord *carbonEvent, NSEvent *cocoaEvent);
110void WKSendKeyEventToTSM(NSEvent *theEvent);
111void WKCallDrawingNotification(CGrafPtr port, Rect *bounds);
112#endif
113
114BOOL WKGetGlyphTransformedAdvances(CGFontRef, NSFont*, CGAffineTransform *m, ATSGlyphRef *glyph, CGSize *advance);
115NSFont *WKGetFontInLanguageForRange(NSFont *font, NSString *string, NSRange range);
116NSFont *WKGetFontInLanguageForCharacter(NSFont *font, UniChar ch);
117void WKSetCGFontRenderingMode(CGContextRef cgContext, NSFont *font);
118BOOL WKCGContextGetShouldSmoothFonts(CGContextRef cgContext);
119
120#ifdef BUILDING_ON_TIGER
121// CGFontGetAscent, CGFontGetDescent, CGFontGetLeading and CGFontGetUnitsPerEm were not available until Leopard
122void WKGetFontMetrics(CGFontRef font, int *ascent, int *descent, int *lineGap, unsigned *unitsPerEm);
123// CTFontCopyGraphicsFont was not available until Leopard
124CGFontRef WKGetCGFontFromNSFont(NSFont *font);
125// CTFontGetPlatformFont was not available until Leopard
126ATSUFontID WKGetNSFontATSUFontId(NSFont *font);
127// CGFontCopyFullName was not available until Leopard
128CFStringRef WKCopyFullFontName(CGFontRef font);
129#endif
130
131void WKSetPatternBaseCTM(CGContextRef, CGAffineTransform);
132void WKSetPatternPhaseInUserSpace(CGContextRef, CGPoint);
133
134#ifndef BUILDING_ON_TIGER
135void WKGetGlyphsForCharacters(CGFontRef, const UniChar[], CGGlyph[], size_t);
136#else
137typedef void *WKGlyphVectorRef;
138OSStatus WKConvertCharToGlyphs(void *styleGroup, const UniChar *characters, unsigned numCharacters, WKGlyphVectorRef glyphs);
139OSStatus WKGetATSStyleGroup(ATSUStyle fontStyle, void **styleGroup);
140void WKReleaseStyleGroup(void *group);
141OSStatus WKInitializeGlyphVector(int count, WKGlyphVectorRef glyphs);
142void WKClearGlyphVector(WKGlyphVectorRef glyphs);
143
144int WKGetGlyphVectorNumGlyphs(WKGlyphVectorRef glyphVector);
145ATSLayoutRecord *WKGetGlyphVectorFirstRecord(WKGlyphVectorRef glyphVector);
146size_t WKGetGlyphVectorRecordSize(WKGlyphVectorRef glyphVector);
147#endif
148
149#ifndef __LP64__
150NSEvent *WKCreateNSEventWithCarbonEvent(EventRef eventRef);
151NSEvent *WKCreateNSEventWithCarbonMouseMoveEvent(EventRef inEvent, NSWindow *window);
152NSEvent *WKCreateNSEventWithCarbonClickEvent(EventRef inEvent, WindowRef windowRef);
153#endif
154
155CGContextRef WKNSWindowOverrideCGContext(NSWindow *, CGContextRef);
156void WKNSWindowRestoreCGContext(NSWindow *, CGContextRef);
157
158void WKNSWindowMakeBottomCornersSquare(NSWindow *);
159
160#ifdef BUILDING_ON_TIGER
161// WKSupportsMultipartXMixedReplace is not required on Leopard as multipart/x-mixed-replace is always handled by NSURLRequest
162BOOL WKSupportsMultipartXMixedReplace(NSMutableURLRequest *request);
163#endif
164
165BOOL WKCGContextIsBitmapContext(CGContextRef context);
166
167void WKGetWheelEventDeltas(NSEvent *, float *deltaX, float *deltaY, BOOL *continuous);
168
169BOOL WKAppVersionCheckLessThan(NSString *, int, double);
170
171int WKQTMovieDataRate(QTMovie* movie);
172float WKQTMovieMaxTimeLoaded(QTMovie* movie);
173void WKQTMovieViewSetDrawSynchronously(QTMovieView* view, BOOL sync);
174
175CFStringRef WKCopyFoundationCacheDirectory(void);
176
177void WKDrawMediaFullscreenButton(CGContextRef context, CGRect rect, BOOL active);
178void WKDrawMediaMuteButton(CGContextRef context, CGRect rect, BOOL active);
179void WKDrawMediaPauseButton(CGContextRef context, CGRect rect, BOOL active);
180void WKDrawMediaPlayButton(CGContextRef context, CGRect rect, BOOL active);
181void WKDrawMediaSeekBackButton(CGContextRef context, CGRect rect, BOOL active);
182void WKDrawMediaSeekForwardButton(CGContextRef context, CGRect rect, BOOL active);
183void WKDrawMediaSliderTrack(CGContextRef context, CGRect rect, float percentLoaded);
184void WKDrawMediaSliderThumb(CGContextRef context, CGRect rect, BOOL active);
185void WKDrawMediaUnMuteButton(CGContextRef context, CGRect rect, BOOL active);
186
187#ifdef __cplusplus
188}
189#endif
190