1/*
2 * Copyright (C) 2017 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#pragma once
27
28#include "SandboxExtension.h"
29#include <WebCore/RegistrableDomain.h>
30#include <pal/SessionID.h>
31#include <wtf/Seconds.h>
32#include <wtf/URL.h>
33#include <wtf/text/WTFString.h>
34
35#if USE(SOUP)
36#include "SoupCookiePersistentStorageType.h"
37#endif
38
39#if USE(CURL)
40#include <WebCore/CurlProxySettings.h>
41#endif
42
43namespace IPC {
44class Encoder;
45class Decoder;
46}
47
48#if PLATFORM(COCOA)
49extern "C" CFStringRef const WebKit2HTTPProxyDefaultsKey;
50extern "C" CFStringRef const WebKit2HTTPSProxyDefaultsKey;
51#endif
52
53namespace WebKit {
54
55enum class AllowsCellularAccess : bool { No, Yes };
56enum class AllowsTLSFallback : bool { No, Yes };
57
58struct NetworkSessionCreationParameters {
59 void encode(IPC::Encoder&) const;
60 static Optional<NetworkSessionCreationParameters> decode(IPC::Decoder&);
61 static NetworkSessionCreationParameters privateSessionParameters(const PAL::SessionID&);
62
63 PAL::SessionID sessionID { PAL::SessionID::defaultSessionID() };
64 String boundInterfaceIdentifier;
65 AllowsCellularAccess allowsCellularAccess { AllowsCellularAccess::Yes };
66#if PLATFORM(COCOA)
67 RetainPtr<CFDictionaryRef> proxyConfiguration;
68 String sourceApplicationBundleIdentifier;
69 String sourceApplicationSecondaryIdentifier;
70 AllowsTLSFallback allowsTLSFallback { AllowsTLSFallback::Yes };
71 bool shouldLogCookieInformation { false };
72 Seconds loadThrottleLatency;
73 URL httpProxy;
74 URL httpsProxy;
75#endif
76#if USE(SOUP)
77 String cookiePersistentStoragePath;
78 SoupCookiePersistentStorageType cookiePersistentStorageType { SoupCookiePersistentStorageType::Text };
79#endif
80#if USE(CURL)
81 String cookiePersistentStorageFile;
82 WebCore::CurlProxySettings proxySettings;
83#endif
84 String resourceLoadStatisticsDirectory;
85 SandboxExtension::Handle resourceLoadStatisticsDirectoryExtensionHandle;
86 bool enableResourceLoadStatistics { false };
87 bool shouldIncludeLocalhostInResourceLoadStatistics { true };
88 bool enableResourceLoadStatisticsDebugMode { false };
89 bool deviceManagementRestrictionsEnabled { false };
90 bool allLoadsBlockedByDeviceManagementRestrictionsForTesting { false };
91 WebCore::RegistrableDomain resourceLoadStatisticsManualPrevalentResource { };
92
93 String localStorageDirectory;
94 SandboxExtension::Handle localStorageDirectoryExtensionHandle;
95};
96
97} // namespace WebKit
98