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