1 | /* |
2 | * Copyright (C) 2010, 2012 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 INC. AND ITS CONTRIBUTORS ``AS IS'' |
14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
23 | * THE POSSIBILITY OF SUCH DAMAGE. |
24 | */ |
25 | |
26 | #ifndef WKContextPrivate_h |
27 | #define WKContextPrivate_h |
28 | |
29 | #include <WebKit/WKBase.h> |
30 | #include <WebKit/WKContext.h> |
31 | |
32 | #if defined(WIN32) || defined(_WIN32) |
33 | typedef int WKProcessID; |
34 | #else |
35 | #include <unistd.h> |
36 | typedef pid_t WKProcessID; |
37 | #endif |
38 | |
39 | #ifdef __cplusplus |
40 | extern "C" { |
41 | #endif |
42 | |
43 | struct WKContextStatistics { |
44 | unsigned wkViewCount; |
45 | unsigned wkPageCount; |
46 | unsigned wkFrameCount; |
47 | }; |
48 | typedef struct WKContextStatistics WKContextStatistics; |
49 | |
50 | WK_EXPORT void WKContextGetGlobalStatistics(WKContextStatistics* statistics); |
51 | |
52 | WK_EXPORT void WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKStringRef pluginsDirectory); |
53 | |
54 | WK_EXPORT void WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef context, WKStringRef urlScheme); |
55 | |
56 | WK_EXPORT void WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef context, bool alwaysUseComplexTextCodePath); |
57 | |
58 | WK_EXPORT void WKContextSetShouldUseFontSmoothing(WKContextRef context, bool useFontSmoothing); |
59 | |
60 | WK_EXPORT void WKContextRegisterURLSchemeAsSecure(WKContextRef context, WKStringRef urlScheme); |
61 | |
62 | WK_EXPORT void WKContextRegisterURLSchemeAsBypassingContentSecurityPolicy(WKContextRef context, WKStringRef urlScheme); |
63 | |
64 | WK_EXPORT void WKContextRegisterURLSchemeAsCachePartitioned(WKContextRef context, WKStringRef urlScheme); |
65 | |
66 | WK_EXPORT void WKContextRegisterURLSchemeAsCanDisplayOnlyIfCanRequest(WKContextRef context, WKStringRef urlScheme); |
67 | |
68 | WK_EXPORT void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef context, WKStringRef urlScheme); |
69 | |
70 | WK_EXPORT void WKContextSetCanHandleHTTPSServerTrustEvaluation(WKContextRef context, bool value); |
71 | |
72 | WK_EXPORT void WKContextSetPrewarmsProcessesAutomatically(WKContextRef context, bool value); |
73 | |
74 | WK_EXPORT void WKContextSetDiskCacheSpeculativeValidationEnabled(WKContextRef context, bool value); |
75 | |
76 | WK_EXPORT void WKContextSetIconDatabasePath(WKContextRef context, WKStringRef iconDatabasePath); |
77 | |
78 | WK_EXPORT void WKContextAllowSpecificHTTPSCertificateForHost(WKContextRef context, WKCertificateInfoRef certificate, WKStringRef host); |
79 | |
80 | // FIXME: This is a workaround for testing purposes only and should be removed once a better |
81 | // solution has been found for testing. |
82 | WK_EXPORT void WKContextDisableProcessTermination(WKContextRef context); |
83 | WK_EXPORT void WKContextEnableProcessTermination(WKContextRef context); |
84 | |
85 | WK_EXPORT void WKContextSetHTTPPipeliningEnabled(WKContextRef context, bool enabled); |
86 | |
87 | WK_EXPORT void WKContextWarmInitialProcess(WKContextRef context); |
88 | |
89 | // FIXME: This function is temporary and useful during the development of the NetworkProcess feature. |
90 | // At some point it should be removed. |
91 | WK_EXPORT void WKContextSetUsesNetworkProcess(WKContextRef, bool); |
92 | |
93 | WK_EXPORT void WKContextTerminateNetworkProcess(WKContextRef); |
94 | WK_EXPORT void WKContextTerminateServiceWorkerProcess(WKContextRef); |
95 | |
96 | WK_EXPORT void WKContextSetAllowsAnySSLCertificateForWebSocketTesting(WKContextRef, bool); |
97 | WK_EXPORT void WKContextSetAllowsAnySSLCertificateForServiceWorkerTesting(WKContextRef, bool); |
98 | |
99 | // Test only. Should be called before any secondary processes are started. |
100 | WK_EXPORT void WKContextUseTestingNetworkSession(WKContextRef context); |
101 | |
102 | // Test only. Should be called before running a test. |
103 | WK_EXPORT void WKContextClearCachedCredentials(WKContextRef context); |
104 | |
105 | typedef void (*WKContextInvalidMessageFunction)(WKStringRef messageName); |
106 | WK_EXPORT void WKContextSetInvalidMessageFunction(WKContextInvalidMessageFunction invalidMessageFunction); |
107 | |
108 | WK_EXPORT void WKContextSetMemoryCacheDisabled(WKContextRef, bool disabled); |
109 | |
110 | WK_EXPORT void WKContextSetFontWhitelist(WKContextRef, WKArrayRef); |
111 | |
112 | WK_EXPORT void WKContextPreconnectToServer(WKContextRef context, WKURLRef serverURL); |
113 | |
114 | WK_EXPORT WKProcessID WKContextGetNetworkProcessIdentifier(WKContextRef context); |
115 | |
116 | WK_EXPORT void WKContextAddSupportedPlugin(WKContextRef context, WKStringRef domain, WKStringRef name, WKArrayRef mimeTypes, WKArrayRef extensions); |
117 | WK_EXPORT void WKContextClearSupportedPlugins(WKContextRef context); |
118 | |
119 | WK_EXPORT void WKContextSetIDBPerOriginQuota(WKContextRef context, uint64_t quota); |
120 | |
121 | WK_EXPORT void WKContextClearCurrentModifierStateForTesting(WKContextRef context); |
122 | |
123 | #ifdef __cplusplus |
124 | } |
125 | #endif |
126 | |
127 | #endif /* WKContextPrivate_h */ |
128 | |