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 } WKSandboxExtensionType;
124 typedef struct __WKSandboxExtension *WKSandboxExtensionRef;
126 WKSandboxExtensionRef WKSandboxExtensionCreate(const char* path, WKSandboxExtensionType type);
127 void WKSandboxExtensionDestroy(WKSandboxExtensionRef sandboxExtension);
129 bool WKSandboxExtensionConsume(WKSandboxExtensionRef sandboxExtension);
130 bool WKSandboxExtensionInvalidate(WKSandboxExtensionRef sandboxExtension);
132 const char* WKSandboxExtensionGetSerializedFormat(WKSandboxExtensionRef sandboxExtension, size_t* length);
133 WKSandboxExtensionRef WKSandboxExtensionCreateFromSerializedFormat(const char* serializationFormat, size_t length);
135 void WKSetCrashReportApplicationSpecificInformation(CFStringRef);
137 bool WKIsPublicSuffix(NSString *domain);
139 CFArrayRef WKCFURLCacheCopyAllHostNamesInPersistentStoreForPartition(CFStringRef partition);
140 typedef void (^CFURLCacheCopyAllPartitionNamesResultsNotification)(CFArrayRef partitionNames);
142 void WKCFURLCacheDeleteHostNamesInPersistentStoreForPartition(CFArrayRef hostArray, CFStringRef partition);
143 CFStringRef WKCachePartitionKey(void);
144 void WKCFURLCacheCopyAllPartitionNames(CFURLCacheCopyAllPartitionNamesResultsNotification resultsBlock);
147 WKExternalPlaybackTypeNone,
148 WKExternalPlaybackTypeAirPlay,
149 WKExternalPlaybackTypeTVOut,
150 } WKExternalPlaybackType;
152 int WKExernalDeviceTypeForPlayer(AVPlayer *);
153 NSString *WKExernalDeviceDisplayNameForPlayer(AVPlayer *);
155 bool WKQueryDecoderAvailability(void);
157 #pragma mark Mac Only
159 #if !TARGET_OS_IPHONE
161 void WKShowKeyAndMain(void);
163 void WKAdvanceDefaultButtonPulseAnimation(NSButtonCell *button);
165 NSString *WKWindowWillOrderOnScreenNotification(void);
166 NSString *WKWindowWillOrderOffScreenNotification(void);
167 void WKSetNSWindowShouldPostEventNotifications(NSWindow *window, BOOL post);
169 CFTypeID WKGetAXTextMarkerTypeID(void);
170 CFTypeID WKGetAXTextMarkerRangeTypeID(void);
171 CFTypeRef WKCreateAXTextMarker(const void *bytes, size_t len);
172 BOOL WKGetBytesFromAXTextMarker(CFTypeRef textMarker, void *bytes, size_t length);
173 CFTypeRef WKCreateAXTextMarkerRange(CFTypeRef start, CFTypeRef end);
174 CFTypeRef WKCopyAXTextMarkerRangeStart(CFTypeRef range);
175 CFTypeRef WKCopyAXTextMarkerRangeEnd(CFTypeRef range);
176 void WKAccessibilityHandleFocusChanged(void);
177 AXUIElementRef WKCreateAXUIElementRef(id element);
178 void WKUnregisterUniqueIdForElement(id element);
180 NSArray *WKSpeechSynthesisGetVoiceIdentifiers(void);
181 NSString *WKSpeechSynthesisGetDefaultVoiceIdentifierForLocale(NSLocale*);
183 // Remote Accessibility API.
184 void WKAXInitializeElementWithPresenterPid(id, pid_t);
185 NSData *WKAXRemoteTokenForElement(id);
186 id WKAXRemoteElementForToken(NSData *);
187 void WKAXSetWindowForRemoteElement(id remoteWindow, id remoteElement);
188 void WKAXRegisterRemoteProcess(bool registerProcess, pid_t);
189 pid_t WKAXRemoteProcessIdentifier(id remoteElement);
191 // The CG context's current path is the focus ring's path.
192 // Color and radius are ignored. Older versions of WebKit expected to
193 // be able to change the rendering of the system focus ring.
194 void WKDrawFocusRing(CGContextRef context, CGColorRef color, int radius);
195 bool WKDrawFocusRingAtTime(CGContextRef context, NSTimeInterval time);
196 bool WKDrawCellFocusRingWithFrameAtTime(NSCell *cell, NSRect cellFrame, NSView *controlView, NSTimeInterval time);
198 void WKSetDragImage(NSImage *image, NSPoint offset);
200 void WKDrawBezeledTextArea(NSRect, BOOL enabled);
202 void WKPopupMenu(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize, bool usesCustomAppearance);
203 void WKPopupContextMenu(NSMenu *menu, NSPoint screenLocation);
204 void WKSendUserChangeNotifications(void);
206 bool WKCGContextDrawsWithCorrectShadowOffsets(CGContextRef);
208 CGContextRef WKNSWindowOverrideCGContext(NSWindow *, CGContextRef);
209 void WKNSWindowRestoreCGContext(NSWindow *, CGContextRef);
211 void WKGetWheelEventDeltas(NSEvent *, float *deltaX, float *deltaY, BOOL *continuous);
213 BOOL WKAppVersionCheckLessThan(NSString *, int, double);
218 WKMovieTypeStoredStream,
219 WKMovieTypeLiveStream
222 int WKQTMovieGetType(QTMovie* movie);
224 BOOL WKQTMovieHasClosedCaptions(QTMovie* movie);
225 void WKQTMovieSetShowClosedCaptions(QTMovie* movie, BOOL showClosedCaptions);
226 void WKQTMovieSelectPreferredAlternates(QTMovie* movie);
228 unsigned WKQTIncludeOnlyModernMediaFileTypes(void);
229 float WKQTMovieMaxTimeLoaded(QTMovie* movie);
230 NSString *WKQTMovieMaxTimeLoadedChangeNotification(void);
231 void WKQTMovieDisableComponent(uint32_t[5]);
232 NSURL *WKQTMovieResolvedURL(QTMovie* movie);
234 void WKSetVisibleApplicationName(CFStringRef);
235 void WKSetApplicationInformationItem(CFStringRef key, CFTypeRef value);
238 WKMediaUIPartFullscreenButton = 0,
239 WKMediaUIPartMuteButton,
240 WKMediaUIPartPlayButton,
241 WKMediaUIPartSeekBackButton,
242 WKMediaUIPartSeekForwardButton,
243 WKMediaUIPartTimelineSlider,
244 WKMediaUIPartTimelineSliderThumb,
245 WKMediaUIPartRewindButton,
246 WKMediaUIPartSeekToRealtimeButton,
247 WKMediaUIPartShowClosedCaptionsButton,
248 WKMediaUIPartHideClosedCaptionsButton,
249 WKMediaUIPartUnMuteButton,
250 WKMediaUIPartPauseButton,
251 WKMediaUIPartBackground,
252 WKMediaUIPartCurrentTimeDisplay,
253 WKMediaUIPartTimeRemainingDisplay,
254 WKMediaUIPartStatusDisplay,
255 WKMediaUIPartControlsPanel,
256 WKMediaUIPartVolumeSliderContainer,
257 WKMediaUIPartVolumeSlider,
258 WKMediaUIPartVolumeSliderThumb,
259 WKMediaUIPartFullScreenVolumeSlider,
260 WKMediaUIPartFullScreenVolumeSliderThumb,
261 WKMediaUIPartVolumeSliderMuteButton,
262 WKMediaUIPartTextTrackDisplayContainer,
263 WKMediaUIPartTextTrackDisplay,
264 WKMediaUIPartExitFullscreenButton,
268 WKMediaControllerFlagDisabled = 1 << 0,
269 WKMediaControllerFlagPressed = 1 << 1,
270 WKMediaControllerFlagDrawEndCaps = 1 << 3,
271 WKMediaControllerFlagFocused = 1 << 4
272 } WKMediaControllerThemeState;
274 BOOL WKHitTestMediaUIPart(int part, CGRect bounds, CGPoint point);
275 void WKMeasureMediaUIPart(int part, CGRect *bounds, CGSize *naturalSize);
276 void WKDrawMediaUIPart(int part, CGContextRef context, CGRect rect, unsigned state);
277 void WKDrawMediaSliderTrack(CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration, unsigned state);
278 NSView *WKCreateMediaUIBackgroundView(void);
281 WKMediaUIControlTimeline,
282 WKMediaUIControlSlider,
283 WKMediaUIControlPlayPauseButton,
284 WKMediaUIControlExitFullscreenButton,
285 WKMediaUIControlRewindButton,
286 WKMediaUIControlFastForwardButton,
287 WKMediaUIControlVolumeUpButton,
288 WKMediaUIControlVolumeDownButton
289 } WKMediaUIControlType;
291 NSControl *WKCreateMediaUIControl(int controlType);
293 NSArray *WKQTGetSitesInMediaDownloadCache();
294 void WKQTClearMediaDownloadCacheForSite(NSString *site);
295 void WKQTClearMediaDownloadCache();
297 mach_port_t WKInitializeRenderServer(void);
299 typedef struct __WKSoftwareCARendererRef *WKSoftwareCARendererRef;
301 WKSoftwareCARendererRef WKSoftwareCARendererCreate(uint32_t contextID);
302 void WKSoftwareCARendererDestroy(WKSoftwareCARendererRef);
303 void WKSoftwareCARendererRender(WKSoftwareCARendererRef, CGContextRef, CGRect);
304 WKCAContextRef WKCAContextMakeRemoteForWindowServer(void);
306 void WKWindowSetClipRect(NSWindow*, NSRect);
308 NSUInteger WKGetInputPanelWindowStyle(void);
309 UInt8 WKGetNSEventKeyChar(NSEvent *);
311 void WKWindowSetAlpha(NSWindow *window, float alphaValue);
312 void WKWindowSetScaledFrame(NSWindow *window, NSRect scaleFrame, NSRect nonScaledFrame);
314 void WKEnableSettingCursorWhenInBackground(void);
316 OSStatus WKEnableSandboxStyleFileQuarantine(void);
318 int WKRecommendedScrollerStyle(void);
320 bool WKExecutableWasLinkedOnOrBeforeSnowLeopard(void);
322 CFStringRef WKCopyDefaultSearchProviderDisplayName(void);
324 NSCursor *WKCursor(const char *name);
326 bool WKExecutableWasLinkedOnOrBeforeLion(void);
328 CGFloat WKNSElasticDeltaForTimeDelta(CGFloat initialPosition, CGFloat initialVelocity, CGFloat elapsedTime);
329 CGFloat WKNSElasticDeltaForReboundDelta(CGFloat delta);
330 CGFloat WKNSReboundDeltaForElasticDelta(CGFloat delta);
333 WKOcclusionNotificationTypeApplicationBecameVisible,
334 WKOcclusionNotificationTypeApplicationBecameOccluded,
335 WKOcclusionNotificationTypeApplicationWindowModificationsStarted,
336 WKOcclusionNotificationTypeApplicationWindowModificationsStopped,
337 WKOcclusionNotificationTypeWindowBecameVisible,
338 WKOcclusionNotificationTypeWindowBecameOccluded,
339 } WKOcclusionNotificationType;
341 typedef uint32_t WKWindowID;
343 typedef void (*WKOcclusionNotificationHandler)(uint32_t, void* data, uint32_t dataLength, void*, uint32_t);
345 bool WKRegisterOcclusionNotificationHandler(WKOcclusionNotificationType, WKOcclusionNotificationHandler);
346 bool WKEnableWindowOcclusionNotifications(NSInteger windowID, bool *outCurrentOcclusionState);
348 #if defined(__x86_64__)
350 CFRunLoopSourceRef WKCreateMIGServerSource(mig_subsystem_t subsystem, mach_port_t serverPort);
356 OSStatus WKSyncWindowWithCGAfterMove(WindowRef);
357 unsigned WKCarbonWindowMask(void);
358 void *WKGetNativeWindowFromWindowRef(WindowRef);
359 OSType WKCarbonWindowPropertyCreator(void);
360 OSType WKCarbonWindowPropertyTag(void);
362 unsigned WKGetNSAutoreleasePoolCount(void);
364 BOOL WKConvertNSEventToCarbonEvent(EventRecord *carbonEvent, NSEvent *cocoaEvent);
365 void WKSendKeyEventToTSM(NSEvent *theEvent);
366 void WKCallDrawingNotification(CGrafPtr port, Rect *bounds);
368 NSEvent *WKCreateNSEventWithCarbonEvent(EventRef eventRef);
369 NSEvent *WKCreateNSEventWithCarbonMouseMoveEvent(EventRef inEvent, NSWindow *window);
370 NSEvent *WKCreateNSEventWithCarbonClickEvent(EventRef inEvent, WindowRef windowRef);
372 ScriptCode WKGetScriptCodeFromCurrentKeyboardInputSource(void);
374 #endif /* __LP64__ */
376 #endif /* !TARGET_OS_IPHONE */