1/*
2 * Copyright (C) 2018 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 "APIObject.h"
29#include <WebCore/StorageQuotaManager.h>
30#include <wtf/URL.h>
31#include <wtf/text/WTFString.h>
32
33namespace WebKit {
34
35class WebsiteDataStoreConfiguration : public API::ObjectImpl<API::Object::Type::WebsiteDataStoreConfiguration> {
36public:
37 static Ref<WebsiteDataStoreConfiguration> create() { return adoptRef(*new WebsiteDataStoreConfiguration); }
38
39 Ref<WebsiteDataStoreConfiguration> copy();
40
41 bool isPersistent() const { return m_isPersistent; }
42 void setPersistent(bool isPersistent) { m_isPersistent = isPersistent; }
43
44 uint64_t perOriginStorageQuota() const { return m_perOriginStorageQuota; }
45 void setPerOriginStorageQuota(uint64_t quota) { m_perOriginStorageQuota = quota; }
46
47 const String& applicationCacheDirectory() const { return m_applicationCacheDirectory; }
48 void setApplicationCacheDirectory(String&& directory) { m_applicationCacheDirectory = WTFMove(directory); }
49
50 const String& mediaCacheDirectory() const { return m_mediaCacheDirectory; }
51 void setMediaCacheDirectory(String&& directory) { m_mediaCacheDirectory = WTFMove(directory); }
52
53 const String& mediaKeysStorageDirectory() const { return m_mediaKeysStorageDirectory; }
54 void setMediaKeysStorageDirectory(String&& directory) { m_mediaKeysStorageDirectory = WTFMove(directory); }
55
56 const String& javaScriptConfigurationDirectory() const { return m_javaScriptConfigurationDirectory; }
57 void setJavaScriptConfigurationDirectory(String&& directory) { m_javaScriptConfigurationDirectory = WTFMove(directory); }
58
59 const String& webStorageDirectory() const { return m_webStorageDirectory; }
60 void setWebStorageDirectory(String&& directory) { m_webStorageDirectory = WTFMove(directory); }
61
62 const String& indexedDBDatabaseDirectory() const { return m_indexedDBDatabaseDirectory; }
63 void setIndexedDBDatabaseDirectory(String&& directory) { m_indexedDBDatabaseDirectory = WTFMove(directory); }
64
65 const String& webSQLDatabaseDirectory() const { return m_webSQLDatabaseDirectory; }
66 void setWebSQLDatabaseDirectory(String&& directory) { m_webSQLDatabaseDirectory = WTFMove(directory); }
67
68 const String& localStorageDirectory() const { return m_localStorageDirectory; }
69 void setLocalStorageDirectory(String&& directory) { m_localStorageDirectory = WTFMove(directory); }
70
71 const String& deviceIdHashSaltsStorageDirectory() const { return m_deviceIdHashSaltsStorageDirectory; }
72 void setDeviceIdHashSaltsStorageDirectory(String&& directory) { m_deviceIdHashSaltsStorageDirectory = WTFMove(directory); }
73
74 const String& cookieStorageFile() const { return m_cookieStorageFile; }
75 void setCookieStorageFile(String&& directory) { m_cookieStorageFile = WTFMove(directory); }
76
77 const String& resourceLoadStatisticsDirectory() const { return m_resourceLoadStatisticsDirectory; }
78 void setResourceLoadStatisticsDirectory(String&& directory) { m_resourceLoadStatisticsDirectory = WTFMove(directory); }
79
80 const String& networkCacheDirectory() const { return m_networkCacheDirectory; }
81 void setNetworkCacheDirectory(String&& directory) { m_networkCacheDirectory = WTFMove(directory); }
82
83 const String& cacheStorageDirectory() const { return m_cacheStorageDirectory; }
84 void setCacheStorageDirectory(String&& directory) { m_cacheStorageDirectory = WTFMove(directory); }
85
86 const String& applicationCacheFlatFileSubdirectoryName() const { return m_applicationCacheFlatFileSubdirectoryName; }
87 void setApplicationCacheFlatFileSubdirectoryName(String&& directory) { m_applicationCacheFlatFileSubdirectoryName = WTFMove(directory); }
88
89 const String& serviceWorkerRegistrationDirectory() const { return m_serviceWorkerRegistrationDirectory; }
90 void setServiceWorkerRegistrationDirectory(String&& directory) { m_serviceWorkerRegistrationDirectory = WTFMove(directory); }
91
92 const String& sourceApplicationBundleIdentifier() const { return m_sourceApplicationBundleIdentifier; }
93 void setSourceApplicationBundleIdentifier(String&& identifier) { m_sourceApplicationBundleIdentifier = WTFMove(identifier); }
94
95 const String& sourceApplicationSecondaryIdentifier() const { return m_sourceApplicationSecondaryIdentifier; }
96 void setSourceApplicationSecondaryIdentifier(String&& identifier) { m_sourceApplicationSecondaryIdentifier = WTFMove(identifier); }
97
98 const URL& httpProxy() const { return m_httpProxy; }
99 void setHTTPProxy(URL&& proxy) { m_httpProxy = WTFMove(proxy); }
100
101 const URL& httpsProxy() const { return m_httpsProxy; }
102 void setHTTPSProxy(URL&& proxy) { m_httpsProxy = WTFMove(proxy); }
103
104 bool deviceManagementRestrictionsEnabled() const { return m_deviceManagementRestrictionsEnabled; }
105 void setDeviceManagementRestrictionsEnabled(bool enabled) { m_deviceManagementRestrictionsEnabled = enabled; }
106
107 bool allLoadsBlockedByDeviceManagementRestrictionsForTesting() const { return m_allLoadsBlockedByDeviceManagementRestrictionsForTesting; }
108 void setAllLoadsBlockedByDeviceManagementRestrictionsForTesting(bool blocked) { m_allLoadsBlockedByDeviceManagementRestrictionsForTesting = blocked; }
109
110private:
111 WebsiteDataStoreConfiguration();
112
113 bool m_isPersistent { false };
114
115 String m_cacheStorageDirectory;
116 uint64_t m_perOriginStorageQuota { WebCore::StorageQuotaManager::defaultQuota() };
117 String m_networkCacheDirectory;
118 String m_applicationCacheDirectory;
119 String m_applicationCacheFlatFileSubdirectoryName;
120 String m_webStorageDirectory;
121 String m_mediaCacheDirectory;
122 String m_indexedDBDatabaseDirectory;
123 String m_serviceWorkerRegistrationDirectory;
124 String m_webSQLDatabaseDirectory;
125 String m_localStorageDirectory;
126 String m_mediaKeysStorageDirectory;
127 String m_deviceIdHashSaltsStorageDirectory;
128 String m_resourceLoadStatisticsDirectory;
129 String m_javaScriptConfigurationDirectory;
130 String m_cookieStorageFile;
131 String m_sourceApplicationBundleIdentifier;
132 String m_sourceApplicationSecondaryIdentifier;
133 URL m_httpProxy;
134 URL m_httpsProxy;
135 bool m_deviceManagementRestrictionsEnabled { false };
136 bool m_allLoadsBlockedByDeviceManagementRestrictionsForTesting { false };
137};
138
139}
140