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)
33typedef int WKProcessID;
34#else
35#include <unistd.h>
36typedef pid_t WKProcessID;
37#endif
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43struct WKContextStatistics {
44 unsigned wkViewCount;
45 unsigned wkPageCount;
46 unsigned wkFrameCount;
47};
48typedef struct WKContextStatistics WKContextStatistics;
49
50WK_EXPORT void WKContextGetGlobalStatistics(WKContextStatistics* statistics);
51
52WK_EXPORT void WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKStringRef pluginsDirectory);
53
54WK_EXPORT void WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef context, WKStringRef urlScheme);
55
56WK_EXPORT void WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef context, bool alwaysUseComplexTextCodePath);
57
58WK_EXPORT void WKContextSetShouldUseFontSmoothing(WKContextRef context, bool useFontSmoothing);
59
60WK_EXPORT void WKContextRegisterURLSchemeAsSecure(WKContextRef context, WKStringRef urlScheme);
61
62WK_EXPORT void WKContextRegisterURLSchemeAsBypassingContentSecurityPolicy(WKContextRef context, WKStringRef urlScheme);
63
64WK_EXPORT void WKContextRegisterURLSchemeAsCachePartitioned(WKContextRef context, WKStringRef urlScheme);
65
66WK_EXPORT void WKContextRegisterURLSchemeAsCanDisplayOnlyIfCanRequest(WKContextRef context, WKStringRef urlScheme);
67
68WK_EXPORT void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef context, WKStringRef urlScheme);
69
70WK_EXPORT void WKContextSetCanHandleHTTPSServerTrustEvaluation(WKContextRef context, bool value);
71
72WK_EXPORT void WKContextSetPrewarmsProcessesAutomatically(WKContextRef context, bool value);
73
74WK_EXPORT void WKContextSetDiskCacheSpeculativeValidationEnabled(WKContextRef context, bool value);
75
76WK_EXPORT void WKContextSetIconDatabasePath(WKContextRef context, WKStringRef iconDatabasePath);
77
78WK_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.
82WK_EXPORT void WKContextDisableProcessTermination(WKContextRef context);
83WK_EXPORT void WKContextEnableProcessTermination(WKContextRef context);
84
85WK_EXPORT void WKContextSetHTTPPipeliningEnabled(WKContextRef context, bool enabled);
86
87WK_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.
91WK_EXPORT void WKContextSetUsesNetworkProcess(WKContextRef, bool);
92
93WK_EXPORT void WKContextTerminateNetworkProcess(WKContextRef);
94WK_EXPORT void WKContextTerminateServiceWorkerProcess(WKContextRef);
95
96WK_EXPORT void WKContextSetAllowsAnySSLCertificateForWebSocketTesting(WKContextRef, bool);
97WK_EXPORT void WKContextSetAllowsAnySSLCertificateForServiceWorkerTesting(WKContextRef, bool);
98
99// Test only. Should be called before any secondary processes are started.
100WK_EXPORT void WKContextUseTestingNetworkSession(WKContextRef context);
101
102// Test only. Should be called before running a test.
103WK_EXPORT void WKContextClearCachedCredentials(WKContextRef context);
104
105typedef void (*WKContextInvalidMessageFunction)(WKStringRef messageName);
106WK_EXPORT void WKContextSetInvalidMessageFunction(WKContextInvalidMessageFunction invalidMessageFunction);
107
108WK_EXPORT void WKContextSetMemoryCacheDisabled(WKContextRef, bool disabled);
109
110WK_EXPORT void WKContextSetFontWhitelist(WKContextRef, WKArrayRef);
111
112WK_EXPORT void WKContextPreconnectToServer(WKContextRef context, WKURLRef serverURL);
113
114WK_EXPORT WKProcessID WKContextGetNetworkProcessIdentifier(WKContextRef context);
115
116WK_EXPORT void WKContextAddSupportedPlugin(WKContextRef context, WKStringRef domain, WKStringRef name, WKArrayRef mimeTypes, WKArrayRef extensions);
117WK_EXPORT void WKContextClearSupportedPlugins(WKContextRef context);
118
119WK_EXPORT void WKContextSetIDBPerOriginQuota(WKContextRef context, uint64_t quota);
120
121WK_EXPORT void WKContextClearCurrentModifierStateForTesting(WKContextRef context);
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif /* WKContextPrivate_h */
128