Source/WebCore: [WebKit2] Changing the cookie accept policy in Private Browsing doesn...
[WebKit-https.git] / Source / WebCore / platform / mac / WebCoreSystemInterface.mm
1 /*
2  * Copyright 2006, 2007, 2008, 2009, 2010 Apple Computer, Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24  */
25
26 #import "config.h"
27 #import "WebCoreSystemInterface.h"
28 #import <Foundation/Foundation.h>
29
30 void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *);
31 BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef);
32 CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef);
33 NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*);
34 NSString* (*wkCreateURLPasteboardFlavorTypeName)(void);
35 NSString* (*wkCreateURLNPasteboardFlavorTypeName)(void);
36 void (*wkDrawBezeledTextFieldCell)(NSRect, BOOL enabled);
37 void (*wkDrawTextFieldCellFocusRing)(NSTextFieldCell*, NSRect);
38 void (*wkDrawCapsLockIndicator)(CGContextRef, CGRect);
39 void (*wkDrawBezeledTextArea)(NSRect, BOOL enabled);
40 void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius);
41 NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange);
42 NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar);
43 BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance);
44 void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, 
45     float duration, unsigned state);
46 BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point);
47 void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
48 void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
49 NSView *(*wkCreateMediaUIBackgroundView)(void);
50 NSControl *(*wkCreateMediaUIControl)(int);
51 void (*wkWindowSetAlpha)(NSWindow *, float);
52 void (*wkWindowSetScaledFrame)(NSWindow *, NSRect, NSRect);
53 BOOL (*wkMediaControllerThemeAvailable)(int themeStyle);
54 NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
55 CFStringRef (*wkSignedPublicKeyAndChallengeString)(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
56 NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
57 NSString* (*wkGetMIMETypeForExtension)(NSString*);
58 NSTimeInterval (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response);
59 NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
60 BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
61 void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
62 void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
63 unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
64 int (*wkQTMovieDataRate)(QTMovie*);
65 void (*wkQTMovieDisableComponent)(uint32_t[5]);
66 float (*wkQTMovieMaxTimeLoaded)(QTMovie*);
67 NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void);
68 float (*wkQTMovieMaxTimeSeekable)(QTMovie*);
69 int (*wkQTMovieGetType)(QTMovie*);
70 BOOL (*wkQTMovieHasClosedCaptions)(QTMovie*);
71 NSURL *(*wkQTMovieResolvedURL)(QTMovie*);
72 void (*wkQTMovieSetShowClosedCaptions)(QTMovie*, BOOL);
73 void (*wkQTMovieSelectPreferredAlternates)(QTMovie*);
74 void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL);
75 NSArray *(*wkQTGetSitesInMediaDownloadCache)();
76 void (*wkQTClearMediaDownloadCacheForSite)(NSString *site);
77 void (*wkQTClearMediaDownloadCache)();
78
79 void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*);
80 void (*wkSetCookieStoragePrivateBrowsingEnabled)(BOOL);
81 void (*wkSetDragImage)(NSImage*, NSPoint offset);
82 void (*wkSetPatternBaseCTM)(CGContextRef, CGAffineTransform);
83 void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint point);
84 CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef);
85 void (*wkSetUpFontCache)();
86 void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream);
87 void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream);
88 void (*wkSignalCFReadStreamError)(CFReadStreamRef stream, CFStreamError *error);
89 CFReadStreamRef (*wkCreateCustomCFReadStream)(void *(*formCreate)(CFReadStreamRef, void *), 
90     void (*formFinalize)(CFReadStreamRef, void *), 
91     Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *), 
92     CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *), 
93     Boolean (*formCanRead)(CFReadStreamRef, void *), 
94     void (*formClose)(CFReadStreamRef, void *), 
95     void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *), 
96     void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
97     void *context);
98 void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL);
99 void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL);
100 id (*wkCreateNSURLConnectionDelegateProxy)(void);
101 unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount);
102 int (*wkGetHTTPPipeliningPriority)(CFURLRequestRef);
103 void (*wkSetHTTPPipeliningMaximumPriority)(int priority);
104 void (*wkSetHTTPPipeliningPriority)(CFURLRequestRef, int priority);
105 void (*wkSetHTTPPipeliningMinimumFastLanePriority)(int priority);
106 void (*wkSetCONNECTProxyForStream)(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
107 void (*wkSetCONNECTProxyAuthorizationForStream)(CFReadStreamRef, CFStringRef proxyAuthorizationString);
108 CFHTTPMessageRef (*wkCopyCONNECTProxyResponse)(CFReadStreamRef, CFURLRef responseURL);
109
110 #if USE(CFNETWORK)
111 CFHTTPCookieStorageRef (*wkGetDefaultHTTPCookieStorage)();
112 WKCFURLCredentialRef (*wkCopyCredentialFromCFPersistentStorage)(CFURLProtectionSpaceRef protectionSpace);
113 void (*wkSetCFURLRequestShouldContentSniff)(CFMutableURLRequestRef, bool);
114 CFArrayRef (*wkCFURLRequestCopyHTTPRequestBodyParts)(CFURLRequestRef);
115 void (*wkCFURLRequestSetHTTPRequestBodyParts)(CFMutableURLRequestRef, CFArrayRef bodyParts);
116 void (*wkSetRequestStorageSession)(CFURLStorageSessionRef, CFMutableURLRequestRef);
117 #endif
118
119 void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t);
120
121 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
122 void* wkGetHyphenationLocationBeforeIndex;
123 #else
124 CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index);
125 int (*wkGetNSEventMomentumPhase)(NSEvent *);
126 #endif
127
128 CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
129 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
130 CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
131
132 CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace);
133 CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context);
134
135 WKScrollbarPainterRef (*wkMakeScrollbarPainter)(int controlSize, bool isHorizontal);
136 WKScrollbarPainterRef (*wkMakeScrollbarReplacementPainter)(WKScrollbarPainterRef oldPainter, int newStyle, int controlSize, bool isHorizontal);
137 void (*wkScrollbarPainterSetDelegate)(WKScrollbarPainterRef, id scrollbarPainterDelegate);
138 void (*wkScrollbarPainterSetEnabled)(WKScrollbarPainterRef, bool enabled);
139 void (*wkScrollbarPainterPaint)(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect);
140 void (*wkScrollbarPainterForceFlashScrollers)(WKScrollbarPainterControllerRef);
141 int (*wkScrollbarThickness)(int controlSize);
142 int (*wkScrollbarMinimumThumbLength)(WKScrollbarPainterRef);
143 int (*wkScrollbarMinimumTotalLengthNeededForThumb)(WKScrollbarPainterRef);
144 CGFloat (*wkScrollbarPainterKnobAlpha)(WKScrollbarPainterRef);
145 void (*wkSetScrollbarPainterKnobAlpha)(WKScrollbarPainterRef, CGFloat);
146 CGFloat (*wkScrollbarPainterTrackAlpha)(WKScrollbarPainterRef);
147 void (*wkSetScrollbarPainterTrackAlpha)(WKScrollbarPainterRef, CGFloat);
148 bool (*wkScrollbarPainterIsHorizontal)(WKScrollbarPainterRef);
149 CGRect (*wkScrollbarPainterKnobRect)(WKScrollbarPainterRef);
150 void (*wkScrollbarPainterSetOverlayState)(WKScrollbarPainterRef, int overlayScrollerState);
151 void (*wkSetScrollbarPainterKnobStyle)(WKScrollbarPainterRef, wkScrollerKnobStyle);
152
153 WKScrollbarPainterControllerRef (*wkMakeScrollbarPainterController)(id painterControllerDelegate);
154 void (*wkSetPainterForPainterController)(WKScrollbarPainterControllerRef, WKScrollbarPainterRef, bool isHorizontal);
155 WKScrollbarPainterRef (*wkVerticalScrollbarPainterForController)(WKScrollbarPainterControllerRef);
156 WKScrollbarPainterRef (*wkHorizontalScrollbarPainterForController)(WKScrollbarPainterControllerRef);
157 int (*wkScrollbarPainterControllerStyle)(WKScrollbarPainterControllerRef);
158 void (*wkSetScrollbarPainterControllerStyle)(WKScrollbarPainterControllerRef, int newStyle);
159 void (*wkContentAreaScrolled)(WKScrollbarPainterControllerRef);
160 void (*wkContentAreaWillPaint)(WKScrollbarPainterControllerRef);
161 void (*wkMouseEnteredContentArea)(WKScrollbarPainterControllerRef);
162 void (*wkMouseExitedContentArea)(WKScrollbarPainterControllerRef);
163 void (*wkMouseMovedInContentArea)(WKScrollbarPainterControllerRef);
164 void (*wkWillStartLiveResize)(WKScrollbarPainterControllerRef);
165 void (*wkContentAreaResized)(WKScrollbarPainterControllerRef);
166 void (*wkWillEndLiveResize)(WKScrollbarPainterControllerRef);
167 void (*wkContentAreaDidShow)(WKScrollbarPainterControllerRef);
168 void (*wkContentAreaDidHide)(WKScrollbarPainterControllerRef);
169 void (*wkDidBeginScrollGesture)(WKScrollbarPainterControllerRef);
170 void (*wkDidEndScrollGesture)(WKScrollbarPainterControllerRef);
171
172 bool (*wkScrollbarPainterUsesOverlayScrollers)(void);
173
174 bool (*wkExecutableWasLinkedOnOrBeforeSnowLeopard)(void);
175
176 CFStringRef (*wkCopyDefaultSearchProviderDisplayName)(void);
177
178 NSURL *(*wkAVAssetResolvedURL)(AVAsset*);
179
180 NSCursor *(*wkCursor)(const char*);
181
182 #endif
183
184 void (*wkUnregisterUniqueIdForElement)(id element);
185 void (*wkAccessibilityHandleFocusChanged)(void);
186 CFTypeID (*wkGetAXTextMarkerTypeID)(void);
187 CFTypeID (*wkGetAXTextMarkerRangeTypeID)(void);
188 CFTypeRef (*wkCreateAXTextMarkerRange)(CFTypeRef start, CFTypeRef end);
189 CFTypeRef (*wkCopyAXTextMarkerRangeStart)(CFTypeRef range);
190 CFTypeRef (*wkCopyAXTextMarkerRangeEnd)(CFTypeRef range);
191 CFTypeRef (*wkCreateAXTextMarker)(const void *bytes, size_t len);
192 BOOL (*wkGetBytesFromAXTextMarker)(CFTypeRef textMarker, void *bytes, size_t length);
193 AXUIElementRef (*wkCreateAXUIElementRef)(id element);
194
195 CFURLStorageSessionRef (*wkCreatePrivateStorageSession)(CFStringRef);
196 NSURLRequest* (*wkCopyRequestWithStorageSession)(CFURLStorageSessionRef, NSURLRequest*);
197 CFHTTPCookieStorageRef (*wkCopyHTTPCookieStorage)(CFURLStorageSessionRef);
198 unsigned (*wkGetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef);
199 void (*wkSetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef, unsigned);
200 NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL *);
201 void (*wkSetHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *);
202 void (*wkDeleteHTTPCookie)(CFHTTPCookieStorageRef, NSHTTPCookie *);
203
204 CFStringRef (*wkGetCFURLResponseMIMEType)(CFURLResponseRef);
205 CFURLRef (*wkGetCFURLResponseURL)(CFURLResponseRef);
206 CFHTTPMessageRef (*wkGetCFURLResponseHTTPResponse)(CFURLResponseRef);
207 CFStringRef (*wkCopyCFURLResponseSuggestedFilename)(CFURLResponseRef);
208 void (*wkSetCFURLResponseMIMEType)(CFURLResponseRef, CFStringRef mimeType);