2 WebKitSystemInterface.h
3 Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
8 #import <Foundation/Foundation.h>
9 #import <dispatch/dispatch.h>
12 #import <AppKit/AppKit.h>
13 #import <Carbon/Carbon.h>
15 #import <CoreImage/CoreImage.h>
16 #import <CoreText/CoreText.h>
31 typedef struct _CFURLResponse* CFURLResponseRef;
32 typedef const struct _CFURLRequest* CFURLRequestRef;
33 typedef struct _CFURLRequest* CFMutableURLRequestRef;
35 typedef struct _CFURLCredential* WKCFURLCredentialRef;
36 typedef struct _CFURLProtectionSpace* CFURLProtectionSpaceRef;
39 WKCertificateParseResultSucceeded = 0,
40 WKCertificateParseResultFailed = 1,
41 WKCertificateParseResultPKCS7 = 2,
42 } WKCertificateParseResult;
44 CFStringRef WKSignedPublicKeyAndChallengeString(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
45 WKCertificateParseResult WKAddCertificatesToKeychainFromData(const void *bytes, unsigned length);
47 CFStringEncoding WKGetWebDefaultCFStringEncoding(void);
49 void WKSetMetadataURL(NSString *URLString, NSString *referrer, NSString *path);
52 WKPlugInModuleLoadPolicyLoadNormally = 0,
53 WKPlugInModuleLoadPolicyLoadUnsandboxed,
54 WKPlugInModuleLoadPolicyBlockedForSecurity,
55 WKPlugInModuleLoadPolicyBlockedForCompatibility,
56 } WKPlugInModuleLoadPolicy;
58 WKPlugInModuleLoadPolicy WKLoadPolicyForPluginVersion(NSString *bundleIdentifier, NSString *bundleVersionString);
59 BOOL WKShouldBlockPlugin(NSString *bundleIdentifier, NSString *bundleVersionString);
60 BOOL WKIsPluginUpdateAvailable(NSString *bundleIdentifier);
62 BOOL WKShouldBlockWebGL();
63 BOOL WKShouldSuggestBlockingWebGL();
66 WKCTFontTransformApplyShaping = (1 << 0),
67 WKCTFontTransformApplyPositioning = (1 << 1)
69 typedef int WKCTFontTransformOptions;
72 WKPatternTilingNoDistortion,
73 WKPatternTilingConstantSpacingMinimalDistortion,
74 WKPatternTilingConstantSpacing
77 CGPatternRef WKCGPatternCreateWithImageAndTransform(CGImageRef image, CGAffineTransform transform, int tiling);
79 BOOL WKCGContextIsBitmapContext(CGContextRef context);
80 bool WKCGContextIsPDFContext(CGContextRef context);
82 CFStringRef WKCopyFoundationCacheDirectory(void);
84 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
85 CFURLStorageSessionRef WKCreatePrivateStorageSession(CFStringRef);
86 NSURLRequest *WKCopyRequestWithStorageSession(CFURLStorageSessionRef, NSURLRequest *);
87 NSCachedURLResponse *WKCachedResponseForRequest(CFURLStorageSessionRef, NSURLRequest *);
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 *);
97 CFURLRef WKCopyBundleURLForExecutableURL(CFURLRef);
100 CALayer *WKMakeRenderLayer(uint32_t contextID);
102 typedef struct __WKCAContextRef *WKCAContextRef;
103 WKCAContextRef WKCAContextMakeRemoteWithServerPort(mach_port_t port);
104 void WKDestroyRenderingResources(void);
106 void WKCALayerEnumerateRectsBeingDrawnWithBlock(CALayer *layer, CGContextRef context, void (^block)(CGRect rect));
108 void WKSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
109 void WKSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString);
110 CFHTTPMessageRef WKCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL, CFStringRef proxyHost, CFNumberRef proxyPort);
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);
117 CFArrayRef WKCFURLCacheCopyAllHostNamesInPersistentStore(void);
118 void WKCFURLCacheDeleteHostNamesInPersistentStore(CFArrayRef hostArray);
121 WKSandboxExtensionTypeReadOnly,
122 WKSandboxExtensionTypeReadWrite,
123 WKSandboxExtensionTypeGeneric,
124 } WKSandboxExtensionType;
125 typedef struct __WKSandboxExtension *WKSandboxExtensionRef;
127 WKSandboxExtensionRef WKSandboxExtensionCreate(const char* path, WKSandboxExtensionType type);
128 void WKSandboxExtensionDestroy(WKSandboxExtensionRef sandboxExtension);
130 bool WKSandboxExtensionConsume(WKSandboxExtensionRef sandboxExtension);
131 bool WKSandboxExtensionInvalidate(WKSandboxExtensionRef sandboxExtension);
133 const char* WKSandboxExtensionGetSerializedFormat(WKSandboxExtensionRef sandboxExtension, size_t* length);
134 WKSandboxExtensionRef WKSandboxExtensionCreateFromSerializedFormat(const char* serializationFormat, size_t length);
136 void WKSetCrashReportApplicationSpecificInformation(CFStringRef);
138 bool WKIsPublicSuffix(NSString *domain);
140 CFArrayRef WKCFURLCacheCopyAllHostNamesInPersistentStoreForPartition(CFStringRef partition);
141 typedef void (^CFURLCacheCopyAllPartitionNamesResultsNotification)(CFArrayRef partitionNames);
143 void WKCFURLCacheDeleteHostNamesInPersistentStoreForPartition(CFArrayRef hostArray, CFStringRef partition);
144 CFStringRef WKCachePartitionKey(void);
145 void WKCFURLCacheCopyAllPartitionNames(CFURLCacheCopyAllPartitionNamesResultsNotification resultsBlock);
148 WKExternalPlaybackTypeNone,
149 WKExternalPlaybackTypeAirPlay,
150 WKExternalPlaybackTypeTVOut,
151 } WKExternalPlaybackType;
153 int WKExernalDeviceTypeForPlayer(AVPlayer *);
154 NSString *WKExernalDeviceDisplayNameForPlayer(AVPlayer *);
156 bool WKQueryDecoderAvailability(void);
158 #pragma mark Mac Only
160 #if !TARGET_OS_IPHONE
162 void WKShowKeyAndMain(void);
164 void WKAdvanceDefaultButtonPulseAnimation(NSButtonCell *button);
166 NSString *WKWindowWillOrderOnScreenNotification(void);
167 NSString *WKWindowWillOrderOffScreenNotification(void);
168 void WKSetNSWindowShouldPostEventNotifications(NSWindow *window, BOOL post);
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);
181 NSArray *WKSpeechSynthesisGetVoiceIdentifiers(void);
182 NSString *WKSpeechSynthesisGetDefaultVoiceIdentifierForLocale(NSLocale*);
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);
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);
199 void WKSetDragImage(NSImage *image, NSPoint offset);
201 void WKDrawBezeledTextArea(NSRect, BOOL enabled);
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);
207 bool WKCGContextDrawsWithCorrectShadowOffsets(CGContextRef);
209 CGContextRef WKNSWindowOverrideCGContext(NSWindow *, CGContextRef);
210 void WKNSWindowRestoreCGContext(NSWindow *, CGContextRef);
212 void WKGetWheelEventDeltas(NSEvent *, float *deltaX, float *deltaY, BOOL *continuous);
214 BOOL WKAppVersionCheckLessThan(NSString *, int, double);
219 WKMovieTypeStoredStream,
220 WKMovieTypeLiveStream
223 int WKQTMovieGetType(QTMovie* movie);
225 BOOL WKQTMovieHasClosedCaptions(QTMovie* movie);
226 void WKQTMovieSetShowClosedCaptions(QTMovie* movie, BOOL showClosedCaptions);
227 void WKQTMovieSelectPreferredAlternates(QTMovie* movie);
229 unsigned WKQTIncludeOnlyModernMediaFileTypes(void);
230 float WKQTMovieMaxTimeLoaded(QTMovie* movie);
231 NSString *WKQTMovieMaxTimeLoadedChangeNotification(void);
232 void WKQTMovieDisableComponent(uint32_t[5]);
233 NSURL *WKQTMovieResolvedURL(QTMovie* movie);
235 void WKSetVisibleApplicationName(CFStringRef);
236 void WKSetApplicationInformationItem(CFStringRef key, CFTypeRef value);
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,
269 WKMediaControllerFlagDisabled = 1 << 0,
270 WKMediaControllerFlagPressed = 1 << 1,
271 WKMediaControllerFlagDrawEndCaps = 1 << 3,
272 WKMediaControllerFlagFocused = 1 << 4
273 } WKMediaControllerThemeState;
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);
282 WKMediaUIControlTimeline,
283 WKMediaUIControlSlider,
284 WKMediaUIControlPlayPauseButton,
285 WKMediaUIControlExitFullscreenButton,
286 WKMediaUIControlRewindButton,
287 WKMediaUIControlFastForwardButton,
288 WKMediaUIControlVolumeUpButton,
289 WKMediaUIControlVolumeDownButton
290 } WKMediaUIControlType;
292 NSControl *WKCreateMediaUIControl(int controlType);
294 NSArray *WKQTGetSitesInMediaDownloadCache();
295 void WKQTClearMediaDownloadCacheForSite(NSString *site);
296 void WKQTClearMediaDownloadCache();
298 mach_port_t WKInitializeRenderServer(void);
300 typedef struct __WKSoftwareCARendererRef *WKSoftwareCARendererRef;
302 WKSoftwareCARendererRef WKSoftwareCARendererCreate(uint32_t contextID);
303 void WKSoftwareCARendererDestroy(WKSoftwareCARendererRef);
304 void WKSoftwareCARendererRender(WKSoftwareCARendererRef, CGContextRef, CGRect);
305 WKCAContextRef WKCAContextMakeRemoteForWindowServer(void);
307 void WKWindowSetClipRect(NSWindow*, NSRect);
309 NSUInteger WKGetInputPanelWindowStyle(void);
310 UInt8 WKGetNSEventKeyChar(NSEvent *);
312 void WKWindowSetAlpha(NSWindow *window, float alphaValue);
313 void WKWindowSetScaledFrame(NSWindow *window, NSRect scaleFrame, NSRect nonScaledFrame);
315 void WKEnableSettingCursorWhenInBackground(void);
317 OSStatus WKEnableSandboxStyleFileQuarantine(void);
319 int WKRecommendedScrollerStyle(void);
321 bool WKExecutableWasLinkedOnOrBeforeSnowLeopard(void);
323 CFStringRef WKCopyDefaultSearchProviderDisplayName(void);
325 NSCursor *WKCursor(const char *name);
327 bool WKExecutableWasLinkedOnOrBeforeLion(void);
329 CGFloat WKNSElasticDeltaForTimeDelta(CGFloat initialPosition, CGFloat initialVelocity, CGFloat elapsedTime);
330 CGFloat WKNSElasticDeltaForReboundDelta(CGFloat delta);
331 CGFloat WKNSReboundDeltaForElasticDelta(CGFloat delta);
334 WKOcclusionNotificationTypeApplicationBecameVisible,
335 WKOcclusionNotificationTypeApplicationBecameOccluded,
336 WKOcclusionNotificationTypeApplicationWindowModificationsStarted,
337 WKOcclusionNotificationTypeApplicationWindowModificationsStopped,
338 WKOcclusionNotificationTypeWindowBecameVisible,
339 WKOcclusionNotificationTypeWindowBecameOccluded,
340 } WKOcclusionNotificationType;
342 typedef uint32_t WKWindowID;
344 typedef void (*WKOcclusionNotificationHandler)(uint32_t, void* data, uint32_t dataLength, void*, uint32_t);
346 bool WKRegisterOcclusionNotificationHandler(WKOcclusionNotificationType, WKOcclusionNotificationHandler);
347 bool WKEnableWindowOcclusionNotifications(NSInteger windowID, bool *outCurrentOcclusionState);
349 #if defined(__x86_64__)
351 CFRunLoopSourceRef WKCreateMIGServerSource(mig_subsystem_t subsystem, mach_port_t serverPort);
357 OSStatus WKSyncWindowWithCGAfterMove(WindowRef);
358 unsigned WKCarbonWindowMask(void);
359 void *WKGetNativeWindowFromWindowRef(WindowRef);
360 OSType WKCarbonWindowPropertyCreator(void);
361 OSType WKCarbonWindowPropertyTag(void);
363 unsigned WKGetNSAutoreleasePoolCount(void);
365 BOOL WKConvertNSEventToCarbonEvent(EventRecord *carbonEvent, NSEvent *cocoaEvent);
366 void WKSendKeyEventToTSM(NSEvent *theEvent);
367 void WKCallDrawingNotification(CGrafPtr port, Rect *bounds);
369 NSEvent *WKCreateNSEventWithCarbonEvent(EventRef eventRef);
370 NSEvent *WKCreateNSEventWithCarbonMouseMoveEvent(EventRef inEvent, NSWindow *window);
371 NSEvent *WKCreateNSEventWithCarbonClickEvent(EventRef inEvent, WindowRef windowRef);
373 ScriptCode WKGetScriptCodeFromCurrentKeyboardInputSource(void);
375 #endif /* __LP64__ */
377 #endif /* !TARGET_OS_IPHONE */