2010-09-09 Jer Noble <jer.noble@apple.com>
[WebKit-https.git] / WebKitLibraries / win / include / WebKitSystemInterface / WebKitSystemInterface.h
1 /*
2  * Copyright (C) 2007, 2008, 2009 Apple 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 #ifndef WebKitSystemInterface_h
27 #define WebKitSystemInterface_h
28
29 struct CGAffineTransform;
30 struct CGPoint;
31 struct CGRect;
32 struct CGSize;
33
34 typedef const struct __CFData* CFDataRef;
35 typedef const struct __CFString* CFStringRef;
36 typedef struct CGColor* CGColorRef;
37 typedef struct CGContext* CGContextRef;
38 typedef unsigned short CGFontIndex;
39 typedef struct CGFont* CGFontRef;
40 typedef CGFontIndex CGGlyph;
41 typedef wchar_t UChar;
42 typedef struct _CFURLResponse* CFURLResponseRef;
43 typedef struct OpaqueCFHTTPCookieStorage*  CFHTTPCookieStorageRef;
44 typedef struct _CFURLRequest* CFMutableURLRequestRef;
45 typedef const struct _CFURLRequest* CFURLRequestRef;
46 typedef struct _CFURLCredential* CFURLCredentialRef;
47 typedef struct __CFHTTPMessage* CFHTTPMessageRef;
48 typedef const struct __CFNumber* CFNumberRef;
49 typedef struct __CFReadStream* CFReadStreamRef;
50 typedef const struct __CFURL* CFURLRef;
51 typedef struct _CFURLProtectionSpace* CFURLProtectionSpaceRef;
52 typedef struct tagLOGFONTW LOGFONTW;
53 typedef LOGFONTW LOGFONT;
54
55 void wkSetFontSmoothingLevel(int type);
56 int wkGetFontSmoothingLevel();
57 void wkSetFontSmoothingContrast(CGFloat);
58 CGFloat wkGetFontSmoothingContrast();
59 void wkSystemFontSmoothingChanged();
60 uint32_t wkSetFontSmoothingStyle(CGContextRef cg, bool fontAllowsSmoothing);
61 void wkRestoreFontSmoothingStyle(CGContextRef cg, uint32_t oldStyle);
62 void wkSetCGContextFontRenderingStyle(CGContextRef, bool isSystemFont, bool isPrinterFont, bool usePlatformNativeGlyphs);
63 void wkGetGlyphAdvances(CGFontRef, const CGAffineTransform&, bool isSystemFont, bool isPrinterFont, CGGlyph, CGSize& advance);
64 void wkGetGlyphs(CGFontRef, const UChar[], CGGlyph[], size_t count);
65 void wkSetUpFontCache(size_t s);
66
67 void wkSetPatternBaseCTM(CGContextRef, CGAffineTransform);
68 void wkSetPatternPhaseInUserSpace(CGContextRef, CGPoint phasePoint);
69 CGAffineTransform wkGetUserToBaseCTM(CGContextRef);
70
71 void wkDrawFocusRing(CGContextRef, CGColorRef, float radius);
72
73 CFDictionaryRef wkGetSSLCertificateInfo(CFURLResponseRef);
74 void* wkGetSSLPeerCertificateData(CFDictionaryRef);
75 CFHTTPCookieStorageRef wkGetDefaultHTTPCookieStorage();
76 void wkSetCFURLRequestShouldContentSniff(CFMutableURLRequestRef, bool);
77 CFStringRef wkCopyFoundationCacheDirectory();
78 void wkSetClientCertificateInSSLProperties(CFMutableDictionaryRef, CFDataRef);
79
80 CFArrayRef wkCFURLRequestCopyHTTPRequestBodyParts(CFURLRequestRef);
81 void wkCFURLRequestSetHTTPRequestBodyParts(CFMutableURLRequestRef, CFArrayRef bodyParts);
82
83 unsigned wkInitializeMaximumHTTPConnectionCountPerHost(unsigned preferredConnectionCount);
84
85 void wkSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
86 void wkSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString);
87 CFHTTPMessageRef wkCopyCONNECTProxyResponse(CFReadStreamRef, CFURLRef responseURL);
88
89 CFURLCredentialRef wkCopyCredentialFromCFPersistentStorage(CFURLProtectionSpaceRef protectionSpace);
90
91 CFStringRef wkCFNetworkErrorGetLocalizedDescription(CFIndex errorCode);
92
93 typedef enum {
94     WKMediaUIPartFullscreenButton   = 0,
95     WKMediaUIPartMuteButton,
96     WKMediaUIPartPlayButton,
97     WKMediaUIPartSeekBackButton,
98     WKMediaUIPartSeekForwardButton,
99     WKMediaUIPartTimelineSlider,
100     WKMediaUIPartTimelineSliderThumb,
101     WKMediaUIPartRewindButton,
102     WKMediaUIPartSeekToRealtimeButton,
103     WKMediaUIPartShowClosedCaptionsButton,
104     WKMediaUIPartHideClosedCaptionsButton,
105     WKMediaUIPartUnMuteButton,
106     WKMediaUIPartPauseButton,
107     WKMediaUIPartBackground,
108     WKMediaUIPartCurrentTimeDisplay,
109     WKMediaUIPartTimeRemainingDisplay,
110     WKMediaUIPartStatusDisplay,
111     WKMediaUIPartControlsPanel,
112     WKMediaUIPartVolumeSliderContainer,
113     WKMediaUIPartVolumeSlider,
114     WKMediaUIPartVolumeSliderThumb
115 } WKMediaUIPart;
116
117 typedef enum {
118     WKMediaControllerThemeClassic   = 1,
119     WKMediaControllerThemeQuickTime = 2
120 } WKMediaControllerThemeStyle;
121
122 typedef enum {
123     WKMediaControllerFlagDisabled = 1 << 0,
124     WKMediaControllerFlagPressed = 1 << 1,
125     WKMediaControllerFlagDrawEndCaps = 1 << 3,
126     WKMediaControllerFlagFocused = 1 << 4
127 } WKMediaControllerThemeState;
128
129 bool WKMediaControllerThemeAvailable(int themeStyle);
130 bool WKHitTestMediaUIPart(int part, int themeStyle, CGRect bounds, CGPoint point);
131 void WKMeasureMediaUIPart(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
132 void WKDrawMediaUIPart(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
133 void WKDrawMediaSliderTrack(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration, unsigned state);
134
135 #endif // WebKitSystemInterface_h