2 * Copyright (C) 2013 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 #import "NetworkProcess.h"
29 #if PLATFORM(IOS) && !ENABLE(MINIMAL_SIMULATOR)
31 #import "NetworkCache.h"
32 #import "NetworkProcessCreationParameters.h"
33 #import "ResourceCachesToClear.h"
34 #import "SandboxInitializationParameters.h"
35 #import "SecItemShim.h"
36 #import <WebCore/CertificateInfo.h>
37 #import <WebCore/NotImplemented.h>
38 #import <WebCore/WebCoreThreadSystemInterface.h>
39 #import <pal/spi/cf/CFNetworkSPI.h>
41 #define ENABLE_MANUAL_NETWORK_SANDBOXING 0
43 using namespace WebCore;
47 void NetworkProcess::initializeProcess(const ChildProcessInitializationParameters&)
49 InitWebCoreThreadSystemInterface();
52 void NetworkProcess::initializeProcessName(const ChildProcessInitializationParameters&)
57 void NetworkProcess::initializeSandbox(const ChildProcessInitializationParameters& parameters, SandboxInitializationParameters& sandboxParameters)
59 #if ENABLE_MANUAL_NETWORK_SANDBOXING
60 // Need to override the default, because service has a different bundle ID.
61 NSBundle *webkit2Bundle = [NSBundle bundleForClass:NSClassFromString(@"WKWebView")];
62 sandboxParameters.setOverrideSandboxProfilePath([webkit2Bundle pathForResource:@"com.apple.WebKit.NetworkProcess" ofType:@"sb"]);
64 ChildProcess::initializeSandbox(parameters, sandboxParameters);
66 UNUSED_PARAM(parameters);
67 UNUSED_PARAM(sandboxParameters);
71 void NetworkProcess::allowSpecificHTTPSCertificateForHost(const CertificateInfo& certificateInfo, const String& host)
73 [NSURLRequest setAllowsSpecificHTTPSCertificate:(NSArray *)certificateInfo.certificateChain() forHost:host];
76 void NetworkProcess::clearCacheForAllOrigins(uint32_t cachesToClear)
78 ResourceCachesToClear resourceCachesToClear = static_cast<ResourceCachesToClear>(cachesToClear);
79 if (resourceCachesToClear == InMemoryResourceCachesOnly)
85 void NetworkProcess::platformInitializeNetworkProcess(const NetworkProcessCreationParameters& parameters)
87 #if ENABLE(SEC_ITEM_SHIM)
88 // SecItemShim is needed for CFNetwork APIs that query Keychains beneath us.
89 initializeSecItemShim(*this);
91 platformInitializeNetworkProcessCocoa(parameters);
94 void NetworkProcess::platformTerminate()
101 #endif // PLATFORM(IOS)