2 * Copyright (C) 2010 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
27 #include "WebProcessCreationParameters.h"
29 #include "ArgumentCoders.h"
30 #if USE(CFURLSTORAGESESSIONS) && PLATFORM(WIN)
31 #include "ArgumentCodersCF.h"
36 WebProcessCreationParameters::WebProcessCreationParameters()
37 : shouldTrackVisitedLinks(false)
38 , shouldAlwaysUseComplexTextCodePath(false)
39 , shouldUseFontSmoothing(true)
40 , defaultRequestTimeoutInterval(INT_MAX)
42 , nsURLCacheMemoryCapacity(0)
43 , nsURLCacheDiskCapacity(0)
45 , shouldPaintNativeControls(false)
50 void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const
52 encoder->encode(injectedBundlePath);
53 encoder->encode(injectedBundlePathExtensionHandle);
54 encoder->encode(applicationCacheDirectory);
55 encoder->encode(databaseDirectory);
56 #if ENABLE(TIZEN_FILE_SYSTEM)
57 encoder->encode(localFileSystemDirectory);
59 encoder->encode(localStorageDirectory);
60 #if ENABLE(TIZEN_INDEXED_DATABASE)
61 encoder->encode(indexedDatabaseDirectory);
63 #if ENABLE(TIZEN_WEBKIT2_PROXY)
64 encoder->encode(proxyAddress);
66 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
67 encoder->encode(certificateFile);
69 encoder->encode(urlSchemesRegistererdAsEmptyDocument);
70 encoder->encode(urlSchemesRegisteredAsSecure);
71 encoder->encode(urlSchemesForWhichDomainRelaxationIsForbidden);
72 encoder->encode(mimeTypesWithCustomRepresentation);
73 encoder->encodeEnum(cacheModel);
74 encoder->encode(shouldTrackVisitedLinks);
75 encoder->encode(shouldAlwaysUseComplexTextCodePath);
76 encoder->encode(shouldUseFontSmoothing);
77 encoder->encode(iconDatabaseEnabled);
78 #if ENABLE(PLUGIN_PROCESS)
79 encoder->encode(disablePluginProcessMessageTimeout);
81 encoder->encode(languages);
82 encoder->encode(textCheckerState);
83 encoder->encode(fullKeyboardAccessEnabled);
84 encoder->encode(defaultRequestTimeoutInterval);
85 #if PLATFORM(MAC) || USE(CFURLSTORAGESESSIONS)
86 encoder->encode(uiProcessBundleIdentifier);
89 encoder->encode(parentProcessName);
90 encoder->encode(presenterApplicationPid);
91 encoder->encode(nsURLCachePath);
92 encoder->encode(nsURLCacheMemoryCapacity);
93 encoder->encode(nsURLCacheDiskCapacity);
94 encoder->encode(acceleratedCompositingPort);
95 encoder->encode(uiProcessBundleResourcePath);
96 encoder->encode(webInspectorBaseDirectory);
98 encoder->encode(shouldPaintNativeControls);
99 encoder->encode(cfURLCachePath);
100 encoder->encode(cfURLCacheDiskCapacity);
101 encoder->encode(cfURLCacheMemoryCapacity);
102 encoder->encode(initialHTTPCookieAcceptPolicy);
103 #if USE(CFURLSTORAGESESSIONS)
104 CFDataRef storageSession = serializedDefaultStorageSession.get();
105 encoder->encodeBool(storageSession);
107 CoreIPC::encode(encoder, storageSession);
108 #endif // USE(CFURLSTORAGESESSIONS)
111 encoder->encode(cookieStorageDirectory);
112 encoder->encode(diskCacheDirectory);
114 #if ENABLE(TIZEN_SOUP_COOKIE_CACHE_FOR_WEBKIT2)
116 encoder->encode(soupDataDirectory);
120 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
121 encoder->encode(notificationPermissions);
125 bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, WebProcessCreationParameters& parameters)
127 if (!decoder->decode(parameters.injectedBundlePath))
129 if (!decoder->decode(parameters.injectedBundlePathExtensionHandle))
131 if (!decoder->decode(parameters.applicationCacheDirectory))
133 if (!decoder->decode(parameters.databaseDirectory))
135 #if ENABLE(TIZEN_FILE_SYSTEM)
136 if (!decoder->decode(parameters.localFileSystemDirectory))
139 if (!decoder->decode(parameters.localStorageDirectory))
141 #if ENABLE(TIZEN_INDEXED_DATABASE)
142 if (!decoder->decode(parameters.indexedDatabaseDirectory))
145 #if ENABLE(TIZEN_WEBKIT2_PROXY)
146 if (!decoder->decode(parameters.proxyAddress))
149 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
150 if (!decoder->decode(parameters.certificateFile))
153 if (!decoder->decode(parameters.urlSchemesRegistererdAsEmptyDocument))
155 if (!decoder->decode(parameters.urlSchemesRegisteredAsSecure))
157 if (!decoder->decode(parameters.urlSchemesForWhichDomainRelaxationIsForbidden))
159 if (!decoder->decode(parameters.mimeTypesWithCustomRepresentation))
161 if (!decoder->decodeEnum(parameters.cacheModel))
163 if (!decoder->decode(parameters.shouldTrackVisitedLinks))
165 if (!decoder->decode(parameters.shouldAlwaysUseComplexTextCodePath))
167 if (!decoder->decode(parameters.shouldUseFontSmoothing))
169 if (!decoder->decode(parameters.iconDatabaseEnabled))
171 #if ENABLE(PLUGIN_PROCESS)
172 if (!decoder->decode(parameters.disablePluginProcessMessageTimeout))
176 if (!decoder->decode(parameters.languages))
178 if (!decoder->decode(parameters.textCheckerState))
180 if (!decoder->decode(parameters.fullKeyboardAccessEnabled))
182 if (!decoder->decode(parameters.defaultRequestTimeoutInterval))
184 #if PLATFORM(MAC) || USE(CFURLSTORAGESESSIONS)
185 if (!decoder->decode(parameters.uiProcessBundleIdentifier))
190 if (!decoder->decode(parameters.parentProcessName))
192 if (!decoder->decode(parameters.presenterApplicationPid))
194 if (!decoder->decode(parameters.nsURLCachePath))
196 if (!decoder->decode(parameters.nsURLCacheMemoryCapacity))
198 if (!decoder->decode(parameters.nsURLCacheDiskCapacity))
200 if (!decoder->decode(parameters.acceleratedCompositingPort))
202 if (!decoder->decode(parameters.uiProcessBundleResourcePath))
204 if (!decoder->decode(parameters.webInspectorBaseDirectory))
207 if (!decoder->decode(parameters.shouldPaintNativeControls))
209 if (!decoder->decode(parameters.cfURLCachePath))
211 if (!decoder->decode(parameters.cfURLCacheDiskCapacity))
213 if (!decoder->decode(parameters.cfURLCacheMemoryCapacity))
215 if (!decoder->decode(parameters.initialHTTPCookieAcceptPolicy))
217 #if USE(CFURLSTORAGESESSIONS)
218 bool hasStorageSession = false;
219 if (!decoder->decode(hasStorageSession))
221 if (hasStorageSession && !CoreIPC::decode(decoder, parameters.serializedDefaultStorageSession))
223 #endif // USE(CFURLSTORAGESESSIONS)
227 if (!decoder->decode(parameters.cookieStorageDirectory))
229 if (!decoder->decode(parameters.diskCacheDirectory))
232 #if ENABLE(TIZEN_SOUP_COOKIE_CACHE_FOR_WEBKIT2)
234 if (!decoder->decode(parameters.soupDataDirectory))
239 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
240 if (!decoder->decode(parameters.notificationPermissions))
247 } // namespace WebKit