[Tools] --wincairo should imply --64-bit by default.
[WebKit-https.git] / WebKitLibraries / WebKitSystemInterface.h
1 /*      
2     WebKitSystemInterface.h
3     Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
4
5     Public header file.
6 */
7
8 #import <Foundation/Foundation.h>
9 #import <dispatch/dispatch.h>
10
11 #if !TARGET_OS_IPHONE
12 #import <AppKit/AppKit.h>
13 #import <Carbon/Carbon.h>
14 #else
15 #import <CoreImage/CoreImage.h>
16 #import <CoreText/CoreText.h>
17 #endif
18
19 @class AVAsset;
20 @class AVPlayer;
21 @class CALayer;
22 @class QTMovie;
23 @class QTMovieView;
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #pragma mark Shared
30
31 typedef struct _CFURLResponse* CFURLResponseRef;
32 typedef const struct _CFURLRequest* CFURLRequestRef;
33 typedef struct _CFURLRequest* CFMutableURLRequestRef;
34
35 typedef struct _CFURLCredential* WKCFURLCredentialRef;
36 typedef struct _CFURLProtectionSpace* CFURLProtectionSpaceRef;
37
38 typedef enum {
39     WKCertificateParseResultSucceeded  = 0,
40     WKCertificateParseResultFailed     = 1,
41     WKCertificateParseResultPKCS7      = 2,
42 } WKCertificateParseResult;
43
44 CFStringRef WKSignedPublicKeyAndChallengeString(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
45 WKCertificateParseResult WKAddCertificatesToKeychainFromData(const void *bytes, unsigned length);
46
47 CFStringEncoding WKGetWebDefaultCFStringEncoding(void);
48
49 void WKSetMetadataURL(NSString *URLString, NSString *referrer, NSString *path);
50     
51 typedef enum {
52     WKPlugInModuleLoadPolicyLoadNormally = 0,
53     WKPlugInModuleLoadPolicyLoadUnsandboxed,
54     WKPlugInModuleLoadPolicyBlockedForSecurity,
55     WKPlugInModuleLoadPolicyBlockedForCompatibility,
56 } WKPlugInModuleLoadPolicy;
57
58 WKPlugInModuleLoadPolicy WKLoadPolicyForPluginVersion(NSString *bundleIdentifier, NSString *bundleVersionString);
59 BOOL WKShouldBlockPlugin(NSString *bundleIdentifier, NSString *bundleVersionString);
60 BOOL WKIsPluginUpdateAvailable(NSString *bundleIdentifier);
61
62 BOOL WKShouldBlockWebGL();
63 BOOL WKShouldSuggestBlockingWebGL();
64
65 enum {
66     WKCTFontTransformApplyShaping = (1 << 0),
67     WKCTFontTransformApplyPositioning = (1 << 1)
68 };
69 typedef int WKCTFontTransformOptions;
70
71 typedef enum {
72     WKPatternTilingNoDistortion,
73     WKPatternTilingConstantSpacingMinimalDistortion,
74     WKPatternTilingConstantSpacing
75 } WKPatternTiling;
76
77 CGPatternRef WKCGPatternCreateWithImageAndTransform(CGImageRef image, CGAffineTransform transform, int tiling);
78
79 BOOL WKCGContextIsBitmapContext(CGContextRef context);
80 bool WKCGContextIsPDFContext(CGContextRef context);
81
82 CFStringRef WKCopyFoundationCacheDirectory(void);
83
84 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
85 CFURLStorageSessionRef WKCreatePrivateStorageSession(CFStringRef);
86 NSURLRequest *WKCopyRequestWithStorageSession(CFURLStorageSessionRef, NSURLRequest *);
87 NSCachedURLResponse *WKCachedResponseForRequest(CFURLStorageSessionRef, NSURLRequest *);
88
89 typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
90 unsigned WKGetHTTPCookieAcceptPolicy(CFHTTPCookieStorageRef);
91 NSArray *WKHTTPCookies(CFHTTPCookieStorageRef);
92 NSArray *WKHTTPCookiesForURL(CFHTTPCookieStorageRef, NSURL *, NSURL *);
93 void WKSetHTTPCookiesForURL(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *);
94 void WKDeleteAllHTTPCookies(CFHTTPCookieStorageRef);
95 void WKDeleteHTTPCookie(CFHTTPCookieStorageRef, NSHTTPCookie *);
96
97 CFURLRef WKCopyBundleURLForExecutableURL(CFURLRef);
98
99
100 CALayer *WKMakeRenderLayer(uint32_t contextID);
101
102 typedef struct __WKCAContextRef *WKCAContextRef;
103 WKCAContextRef WKCAContextMakeRemoteWithServerPort(mach_port_t port);
104 void WKDestroyRenderingResources(void);
105
106 void WKCALayerEnumerateRectsBeingDrawnWithBlock(CALayer *layer, CGContextRef context, void (^block)(CGRect rect));
107
108 void WKSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
109 void WKSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString);
110 CFHTTPMessageRef WKCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL, CFStringRef proxyHost, CFNumberRef proxyPort);
111
112 CFDictionaryRef WKNSURLRequestCreateSerializableRepresentation(NSURLRequest *request, CFTypeRef tokenNull);
113 NSURLRequest *WKNSURLRequestFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
114 CFDictionaryRef WKCFURLRequestCreateSerializableRepresentation(CFURLRequestRef cfRequest, CFTypeRef tokenNull);
115 CFURLRequestRef WKCreateCFURLRequestFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
116
117 CFArrayRef WKCFURLCacheCopyAllHostNamesInPersistentStore(void);
118 void WKCFURLCacheDeleteHostNamesInPersistentStore(CFArrayRef hostArray);    
119
120 typedef enum {
121     WKSandboxExtensionTypeReadOnly,
122     WKSandboxExtensionTypeReadWrite,
123     WKSandboxExtensionTypeGeneric,
124 } WKSandboxExtensionType;
125 typedef struct __WKSandboxExtension *WKSandboxExtensionRef;
126
127 WKSandboxExtensionRef WKSandboxExtensionCreate(const char* path, WKSandboxExtensionType type);
128 void WKSandboxExtensionDestroy(WKSandboxExtensionRef sandboxExtension);
129
130 bool WKSandboxExtensionConsume(WKSandboxExtensionRef sandboxExtension);
131 bool WKSandboxExtensionInvalidate(WKSandboxExtensionRef sandboxExtension);
132
133 const char* WKSandboxExtensionGetSerializedFormat(WKSandboxExtensionRef sandboxExtension, size_t* length);
134 WKSandboxExtensionRef WKSandboxExtensionCreateFromSerializedFormat(const char* serializationFormat, size_t length);
135
136 void WKSetCrashReportApplicationSpecificInformation(CFStringRef);
137
138 bool WKIsPublicSuffix(NSString *domain);
139
140 CFArrayRef WKCFURLCacheCopyAllHostNamesInPersistentStoreForPartition(CFStringRef partition);
141 typedef void (^CFURLCacheCopyAllPartitionNamesResultsNotification)(CFArrayRef partitionNames);
142
143 void WKCFURLCacheDeleteHostNamesInPersistentStoreForPartition(CFArrayRef hostArray, CFStringRef partition);
144 CFStringRef WKCachePartitionKey(void);
145 void WKCFURLCacheCopyAllPartitionNames(CFURLCacheCopyAllPartitionNamesResultsNotification resultsBlock);
146
147 typedef enum {
148     WKExternalPlaybackTypeNone,
149     WKExternalPlaybackTypeAirPlay,
150     WKExternalPlaybackTypeTVOut,
151 } WKExternalPlaybackType;
152
153 int WKExernalDeviceTypeForPlayer(AVPlayer *);
154 NSString *WKExernalDeviceDisplayNameForPlayer(AVPlayer *);
155
156 bool WKQueryDecoderAvailability(void);
157
158 #pragma mark Mac Only
159
160 #if !TARGET_OS_IPHONE
161
162 void WKShowKeyAndMain(void);
163
164 void WKAdvanceDefaultButtonPulseAnimation(NSButtonCell *button);
165
166 NSString *WKWindowWillOrderOnScreenNotification(void);
167 NSString *WKWindowWillOrderOffScreenNotification(void);
168 void WKSetNSWindowShouldPostEventNotifications(NSWindow *window, BOOL post);
169
170 CFTypeID WKGetAXTextMarkerTypeID(void);
171 CFTypeID WKGetAXTextMarkerRangeTypeID(void);
172 CFTypeRef WKCreateAXTextMarker(const void *bytes, size_t len);
173 BOOL WKGetBytesFromAXTextMarker(CFTypeRef textMarker, void *bytes, size_t length);
174 CFTypeRef WKCreateAXTextMarkerRange(CFTypeRef start, CFTypeRef end);
175 CFTypeRef WKCopyAXTextMarkerRangeStart(CFTypeRef range);
176 CFTypeRef WKCopyAXTextMarkerRangeEnd(CFTypeRef range);
177 void WKAccessibilityHandleFocusChanged(void);
178 AXUIElementRef WKCreateAXUIElementRef(id element);
179 void WKUnregisterUniqueIdForElement(id element);
180     
181 NSArray *WKSpeechSynthesisGetVoiceIdentifiers(void);
182 NSString *WKSpeechSynthesisGetDefaultVoiceIdentifierForLocale(NSLocale*);
183
184 // Remote Accessibility API.
185 void WKAXInitializeElementWithPresenterPid(id, pid_t);
186 NSData *WKAXRemoteTokenForElement(id);
187 id WKAXRemoteElementForToken(NSData *);
188 void WKAXSetWindowForRemoteElement(id remoteWindow, id remoteElement);
189 void WKAXRegisterRemoteProcess(bool registerProcess, pid_t);
190 pid_t WKAXRemoteProcessIdentifier(id remoteElement);
191
192 // The CG context's current path is the focus ring's path.
193 // Color and radius are ignored. Older versions of WebKit expected to
194 // be able to change the rendering of the system focus ring.
195 void WKDrawFocusRing(CGContextRef context, CGColorRef color, int radius);
196 bool WKDrawFocusRingAtTime(CGContextRef context, NSTimeInterval time);
197 bool WKDrawCellFocusRingWithFrameAtTime(NSCell *cell, NSRect cellFrame, NSView *controlView, NSTimeInterval time);
198
199 void WKSetDragImage(NSImage *image, NSPoint offset);
200
201 void WKDrawBezeledTextArea(NSRect, BOOL enabled);
202
203 void WKPopupMenu(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize, bool usesCustomAppearance);
204 void WKPopupContextMenu(NSMenu *menu, NSPoint screenLocation);
205 void WKSendUserChangeNotifications(void);
206
207 bool WKCGContextDrawsWithCorrectShadowOffsets(CGContextRef);
208
209 CGContextRef WKNSWindowOverrideCGContext(NSWindow *, CGContextRef);
210 void WKNSWindowRestoreCGContext(NSWindow *, CGContextRef);
211
212 void WKGetWheelEventDeltas(NSEvent *, float *deltaX, float *deltaY, BOOL *continuous);
213
214 BOOL WKAppVersionCheckLessThan(NSString *, int, double);
215
216 typedef enum {
217     WKMovieTypeUnknown,
218     WKMovieTypeDownload,
219     WKMovieTypeStoredStream,
220     WKMovieTypeLiveStream
221 } WKMovieType;
222
223 int WKQTMovieGetType(QTMovie* movie);
224
225 BOOL WKQTMovieHasClosedCaptions(QTMovie* movie);
226 void WKQTMovieSetShowClosedCaptions(QTMovie* movie, BOOL showClosedCaptions);
227 void WKQTMovieSelectPreferredAlternates(QTMovie* movie);
228
229 unsigned WKQTIncludeOnlyModernMediaFileTypes(void);
230 float WKQTMovieMaxTimeLoaded(QTMovie* movie);
231 NSString *WKQTMovieMaxTimeLoadedChangeNotification(void);
232 void WKQTMovieDisableComponent(uint32_t[5]);
233 NSURL *WKQTMovieResolvedURL(QTMovie* movie);
234
235 void WKSetVisibleApplicationName(CFStringRef);
236 void WKSetApplicationInformationItem(CFStringRef key, CFTypeRef value);
237
238 typedef enum {
239     WKMediaUIPartFullscreenButton   = 0,
240     WKMediaUIPartMuteButton,
241     WKMediaUIPartPlayButton,
242     WKMediaUIPartSeekBackButton,
243     WKMediaUIPartSeekForwardButton,
244     WKMediaUIPartTimelineSlider,
245     WKMediaUIPartTimelineSliderThumb,
246     WKMediaUIPartRewindButton,
247     WKMediaUIPartSeekToRealtimeButton,
248     WKMediaUIPartShowClosedCaptionsButton,
249     WKMediaUIPartHideClosedCaptionsButton,
250     WKMediaUIPartUnMuteButton,
251     WKMediaUIPartPauseButton,
252     WKMediaUIPartBackground,
253     WKMediaUIPartCurrentTimeDisplay,
254     WKMediaUIPartTimeRemainingDisplay,
255     WKMediaUIPartStatusDisplay,
256     WKMediaUIPartControlsPanel,
257     WKMediaUIPartVolumeSliderContainer,
258     WKMediaUIPartVolumeSlider,
259     WKMediaUIPartVolumeSliderThumb,
260     WKMediaUIPartFullScreenVolumeSlider,
261     WKMediaUIPartFullScreenVolumeSliderThumb,
262     WKMediaUIPartVolumeSliderMuteButton,
263     WKMediaUIPartTextTrackDisplayContainer,
264     WKMediaUIPartTextTrackDisplay,
265     WKMediaUIPartExitFullscreenButton,
266 } WKMediaUIPart;
267
268 typedef enum {
269     WKMediaControllerFlagDisabled = 1 << 0,
270     WKMediaControllerFlagPressed = 1 << 1,
271     WKMediaControllerFlagDrawEndCaps = 1 << 3,
272     WKMediaControllerFlagFocused = 1 << 4
273 } WKMediaControllerThemeState;
274
275 BOOL WKHitTestMediaUIPart(int part, CGRect bounds, CGPoint point);
276 void WKMeasureMediaUIPart(int part, CGRect *bounds, CGSize *naturalSize);
277 void WKDrawMediaUIPart(int part, CGContextRef context, CGRect rect, unsigned state);
278 void WKDrawMediaSliderTrack(CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration, unsigned state);
279 NSView *WKCreateMediaUIBackgroundView(void);
280
281 typedef enum {
282     WKMediaUIControlTimeline,
283     WKMediaUIControlSlider,
284     WKMediaUIControlPlayPauseButton,
285     WKMediaUIControlExitFullscreenButton,
286     WKMediaUIControlRewindButton,
287     WKMediaUIControlFastForwardButton,
288     WKMediaUIControlVolumeUpButton,
289     WKMediaUIControlVolumeDownButton
290 } WKMediaUIControlType;
291     
292 NSControl *WKCreateMediaUIControl(int controlType);
293
294 NSArray *WKQTGetSitesInMediaDownloadCache();
295 void WKQTClearMediaDownloadCacheForSite(NSString *site);
296 void WKQTClearMediaDownloadCache();
297     
298 mach_port_t WKInitializeRenderServer(void);
299
300 typedef struct __WKSoftwareCARendererRef *WKSoftwareCARendererRef;
301
302 WKSoftwareCARendererRef WKSoftwareCARendererCreate(uint32_t contextID);
303 void WKSoftwareCARendererDestroy(WKSoftwareCARendererRef);
304 void WKSoftwareCARendererRender(WKSoftwareCARendererRef, CGContextRef, CGRect);
305 WKCAContextRef WKCAContextMakeRemoteForWindowServer(void);
306
307 void WKWindowSetClipRect(NSWindow*, NSRect);
308
309 NSUInteger WKGetInputPanelWindowStyle(void);
310 UInt8 WKGetNSEventKeyChar(NSEvent *);
311
312 void WKWindowSetAlpha(NSWindow *window, float alphaValue);
313 void WKWindowSetScaledFrame(NSWindow *window, NSRect scaleFrame, NSRect nonScaledFrame);
314
315 void WKEnableSettingCursorWhenInBackground(void);
316
317 OSStatus WKEnableSandboxStyleFileQuarantine(void);
318
319 int WKRecommendedScrollerStyle(void);
320
321 bool WKExecutableWasLinkedOnOrBeforeSnowLeopard(void);
322
323 CFStringRef WKCopyDefaultSearchProviderDisplayName(void);
324
325 NSCursor *WKCursor(const char *name);
326
327 bool WKExecutableWasLinkedOnOrBeforeLion(void);
328
329 CGFloat WKNSElasticDeltaForTimeDelta(CGFloat initialPosition, CGFloat initialVelocity, CGFloat elapsedTime);
330 CGFloat WKNSElasticDeltaForReboundDelta(CGFloat delta);
331 CGFloat WKNSReboundDeltaForElasticDelta(CGFloat delta);
332
333 typedef enum {
334     WKOcclusionNotificationTypeApplicationBecameVisible,
335     WKOcclusionNotificationTypeApplicationBecameOccluded,
336     WKOcclusionNotificationTypeApplicationWindowModificationsStarted,
337     WKOcclusionNotificationTypeApplicationWindowModificationsStopped,
338     WKOcclusionNotificationTypeWindowBecameVisible,
339     WKOcclusionNotificationTypeWindowBecameOccluded,
340 } WKOcclusionNotificationType;
341
342 typedef uint32_t WKWindowID;
343
344 typedef void (*WKOcclusionNotificationHandler)(uint32_t, void* data, uint32_t dataLength, void*, uint32_t);
345
346 bool WKRegisterOcclusionNotificationHandler(WKOcclusionNotificationType, WKOcclusionNotificationHandler);
347 bool WKEnableWindowOcclusionNotifications(NSInteger windowID, bool *outCurrentOcclusionState);
348
349 #if defined(__x86_64__)
350 #import <mach/mig.h>
351 CFRunLoopSourceRef WKCreateMIGServerSource(mig_subsystem_t subsystem, mach_port_t serverPort);
352 #endif
353
354
355 #ifndef __LP64__
356
357 OSStatus WKSyncWindowWithCGAfterMove(WindowRef);
358 unsigned WKCarbonWindowMask(void);
359 void *WKGetNativeWindowFromWindowRef(WindowRef);
360 OSType WKCarbonWindowPropertyCreator(void);
361 OSType WKCarbonWindowPropertyTag(void);
362
363 unsigned WKGetNSAutoreleasePoolCount(void);
364
365 BOOL WKConvertNSEventToCarbonEvent(EventRecord *carbonEvent, NSEvent *cocoaEvent);
366 void WKSendKeyEventToTSM(NSEvent *theEvent);
367 void WKCallDrawingNotification(CGrafPtr port, Rect *bounds);
368
369 NSEvent *WKCreateNSEventWithCarbonEvent(EventRef eventRef);
370 NSEvent *WKCreateNSEventWithCarbonMouseMoveEvent(EventRef inEvent, NSWindow *window);
371 NSEvent *WKCreateNSEventWithCarbonClickEvent(EventRef inEvent, WindowRef windowRef);
372
373 ScriptCode WKGetScriptCodeFromCurrentKeyboardInputSource(void);
374
375 #endif /* __LP64__ */
376
377 #endif /* !TARGET_OS_IPHONE */
378
379 #ifdef __cplusplus
380 }
381 #endif