1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
|
/*
* Copyright (C) 2015-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include "APIObject.h"
#include <WebCore/ShouldRelaxThirdPartyCookieBlocking.h>
#include <wtf/Forward.h>
#include <wtf/GetPtr.h>
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/text/WTFString.h>
#if PLATFORM(IOS_FAMILY)
OBJC_PROTOCOL(_UIClickInteractionDriving);
#include <wtf/RetainPtr.h>
#endif
namespace WebKit {
class VisitedLinkStore;
class WebPageGroup;
class WebPageProxy;
class WebPreferences;
class WebProcessPool;
class WebURLSchemeHandler;
class WebUserContentControllerProxy;
class WebsiteDataStore;
#if PLATFORM(IOS_FAMILY)
enum class AttributionOverrideTesting : uint8_t {
NoOverride,
UserInitiated,
AppInitiated
};
#endif
}
namespace API {
class ApplicationManifest;
class WebsitePolicies;
class PageConfiguration : public ObjectImpl<Object::Type::PageConfiguration> {
public:
static Ref<PageConfiguration> create();
explicit PageConfiguration();
virtual ~PageConfiguration();
Ref<PageConfiguration> copy() const;
// FIXME: The configuration properties should return their default values
// rather than nullptr.
WebKit::WebProcessPool* processPool();
void setProcessPool(WebKit::WebProcessPool*);
WebKit::WebUserContentControllerProxy* userContentController();
void setUserContentController(WebKit::WebUserContentControllerProxy*);
WebKit::WebPageGroup* pageGroup();
void setPageGroup(WebKit::WebPageGroup*);
WebKit::WebPreferences* preferences();
void setPreferences(WebKit::WebPreferences*);
WebKit::WebPageProxy* relatedPage() const;
void setRelatedPage(WebKit::WebPageProxy*);
WebKit::VisitedLinkStore* visitedLinkStore();
void setVisitedLinkStore(WebKit::VisitedLinkStore*);
WebKit::WebsiteDataStore* websiteDataStore();
void setWebsiteDataStore(WebKit::WebsiteDataStore*);
WebsitePolicies* defaultWebsitePolicies() const;
void setDefaultWebsitePolicies(WebsitePolicies*);
#if PLATFORM(IOS_FAMILY)
bool clientNavigationsRunAtForegroundPriority() const { return m_clientNavigationsRunAtForegroundPriority; }
void setClientNavigationsRunAtForegroundPriority(bool value) { m_clientNavigationsRunAtForegroundPriority = value; }
bool canShowWhileLocked() const { return m_canShowWhileLocked; }
void setCanShowWhileLocked(bool canShowWhileLocked) { m_canShowWhileLocked = canShowWhileLocked; }
const RetainPtr<_UIClickInteractionDriving>& clickInteractionDriverForTesting() const { return m_clickInteractionDriverForTesting; }
void setClickInteractionDriverForTesting(RetainPtr<_UIClickInteractionDriving>&& driver) { m_clickInteractionDriverForTesting = WTFMove(driver); }
#endif
bool initialCapitalizationEnabled() { return m_initialCapitalizationEnabled; }
void setInitialCapitalizationEnabled(bool initialCapitalizationEnabled) { m_initialCapitalizationEnabled = initialCapitalizationEnabled; }
std::optional<double> cpuLimit() const { return m_cpuLimit; }
void setCPULimit(double cpuLimit) { m_cpuLimit = cpuLimit; }
bool waitsForPaintAfterViewDidMoveToWindow() const { return m_waitsForPaintAfterViewDidMoveToWindow; }
void setWaitsForPaintAfterViewDidMoveToWindow(bool shouldSynchronize) { m_waitsForPaintAfterViewDidMoveToWindow = shouldSynchronize; }
bool drawsBackground() const { return m_drawsBackground; }
void setDrawsBackground(bool drawsBackground) { m_drawsBackground = drawsBackground; }
bool isControlledByAutomation() const { return m_controlledByAutomation; }
void setControlledByAutomation(bool controlledByAutomation) { m_controlledByAutomation = controlledByAutomation; }
const WTF::String& overrideContentSecurityPolicy() const { return m_overrideContentSecurityPolicy; }
void setOverrideContentSecurityPolicy(const WTF::String& overrideContentSecurityPolicy) { m_overrideContentSecurityPolicy = overrideContentSecurityPolicy; }
#if PLATFORM(COCOA)
const WTF::Vector<WTF::String>& additionalSupportedImageTypes() const { return m_additionalSupportedImageTypes; }
void setAdditionalSupportedImageTypes(WTF::Vector<WTF::String>&& additionalSupportedImageTypes) { m_additionalSupportedImageTypes = WTFMove(additionalSupportedImageTypes); }
#endif
#if ENABLE(APPLICATION_MANIFEST)
ApplicationManifest* applicationManifest() const;
void setApplicationManifest(ApplicationManifest*);
#endif
RefPtr<WebKit::WebURLSchemeHandler> urlSchemeHandlerForURLScheme(const WTF::String&);
void setURLSchemeHandlerForURLScheme(Ref<WebKit::WebURLSchemeHandler>&&, const WTF::String&);
const HashMap<WTF::String, Ref<WebKit::WebURLSchemeHandler>>& urlSchemeHandlers() { return m_urlSchemeHandlers; }
const Vector<WTF::String>& corsDisablingPatterns() const { return m_corsDisablingPatterns; }
void setCORSDisablingPatterns(Vector<WTF::String>&& patterns) { m_corsDisablingPatterns = WTFMove(patterns); }
bool userScriptsShouldWaitUntilNotification() const { return m_userScriptsShouldWaitUntilNotification; }
void setUserScriptsShouldWaitUntilNotification(bool value) { m_userScriptsShouldWaitUntilNotification = value; }
bool crossOriginAccessControlCheckEnabled() const { return m_crossOriginAccessControlCheckEnabled; }
void setCrossOriginAccessControlCheckEnabled(bool enabled) { m_crossOriginAccessControlCheckEnabled = enabled; }
const WTF::String& processDisplayName() const { return m_processDisplayName; }
void setProcessDisplayName(const WTF::String& name) { m_processDisplayName = name; }
bool loadsSubresources() const { return m_loadsSubresources; }
void setLoadsSubresources(bool loads) { m_loadsSubresources = loads; }
const std::optional<HashSet<WTF::String>>& allowedNetworkHosts() const { return m_allowedNetworkHosts; }
void setAllowedNetworkHosts(std::optional<HashSet<WTF::String>>&& hosts) { m_allowedNetworkHosts = WTFMove(hosts); }
#if ENABLE(APP_BOUND_DOMAINS)
bool ignoresAppBoundDomains() const { return m_ignoresAppBoundDomains; }
void setIgnoresAppBoundDomains(bool shouldIgnore) { m_ignoresAppBoundDomains = shouldIgnore; }
bool limitsNavigationsToAppBoundDomains() const { return m_limitsNavigationsToAppBoundDomains; }
void setLimitsNavigationsToAppBoundDomains(bool limits) { m_limitsNavigationsToAppBoundDomains = limits; }
#endif
void setMediaCaptureEnabled(bool value) { m_mediaCaptureEnabled = value; }
bool mediaCaptureEnabled() const { return m_mediaCaptureEnabled; }
void setHTTPSUpgradeEnabled(bool enabled) { m_httpsUpgradeEnabled = enabled; }
bool httpsUpgradeEnabled() const { return m_httpsUpgradeEnabled; }
void setShouldRelaxThirdPartyCookieBlocking(WebCore::ShouldRelaxThirdPartyCookieBlocking value) { m_shouldRelaxThirdPartyCookieBlocking = value; }
WebCore::ShouldRelaxThirdPartyCookieBlocking shouldRelaxThirdPartyCookieBlocking() const { return m_shouldRelaxThirdPartyCookieBlocking; }
void setAttributedBundleIdentifier(WTF::String&& identifier) { m_attributedBundleIdentifier = WTFMove(identifier); }
const WTF::String& attributedBundleIdentifier() const { return m_attributedBundleIdentifier; }
#if PLATFORM(IOS_FAMILY)
WebKit::AttributionOverrideTesting appInitiatedOverrideValueForTesting() const { return m_appInitiatedOverrideValueForTesting; }
void setAppInitiatedOverrideValueForTesting(WebKit::AttributionOverrideTesting appInitiatedOverrideValueForTesting) { m_appInitiatedOverrideValueForTesting = appInitiatedOverrideValueForTesting; }
#endif
#if HAVE(TOUCH_BAR)
bool requiresUserActionForEditingControlsManager() const { return m_requiresUserActionForEditingControlsManager; }
void setRequiresUserActionForEditingControlsManager(bool value) { m_requiresUserActionForEditingControlsManager = value; }
#endif
bool isCaptivePortalModeExplicitlySet() const;
bool captivePortalModeEnabled() const;
private:
RefPtr<WebKit::WebProcessPool> m_processPool;
RefPtr<WebKit::WebUserContentControllerProxy> m_userContentController;
RefPtr<WebKit::WebPageGroup> m_pageGroup;
RefPtr<WebKit::WebPreferences> m_preferences;
RefPtr<WebKit::WebPageProxy> m_relatedPage;
RefPtr<WebKit::VisitedLinkStore> m_visitedLinkStore;
RefPtr<WebKit::WebsiteDataStore> m_websiteDataStore;
RefPtr<WebsitePolicies> m_defaultWebsitePolicies;
#if PLATFORM(IOS_FAMILY)
bool m_clientNavigationsRunAtForegroundPriority { true };
bool m_canShowWhileLocked { false };
RetainPtr<_UIClickInteractionDriving> m_clickInteractionDriverForTesting;
#endif
bool m_initialCapitalizationEnabled { true };
bool m_waitsForPaintAfterViewDidMoveToWindow { true };
bool m_drawsBackground { true };
bool m_controlledByAutomation { false };
std::optional<double> m_cpuLimit;
WTF::String m_overrideContentSecurityPolicy;
#if PLATFORM(COCOA)
WTF::Vector<WTF::String> m_additionalSupportedImageTypes;
#endif
#if ENABLE(APPLICATION_MANIFEST)
RefPtr<ApplicationManifest> m_applicationManifest;
#endif
HashMap<WTF::String, Ref<WebKit::WebURLSchemeHandler>> m_urlSchemeHandlers;
Vector<WTF::String> m_corsDisablingPatterns;
bool m_userScriptsShouldWaitUntilNotification { true };
bool m_crossOriginAccessControlCheckEnabled { true };
WTF::String m_processDisplayName;
bool m_loadsSubresources { true };
std::optional<HashSet<WTF::String>> m_allowedNetworkHosts;
#if ENABLE(APP_BOUND_DOMAINS)
bool m_ignoresAppBoundDomains { false };
bool m_limitsNavigationsToAppBoundDomains { false };
#endif
bool m_mediaCaptureEnabled { false };
bool m_httpsUpgradeEnabled { true };
WebCore::ShouldRelaxThirdPartyCookieBlocking m_shouldRelaxThirdPartyCookieBlocking { WebCore::ShouldRelaxThirdPartyCookieBlocking::No };
WTF::String m_attributedBundleIdentifier;
#if PLATFORM(IOS_FAMILY)
WebKit::AttributionOverrideTesting m_appInitiatedOverrideValueForTesting { WebKit::AttributionOverrideTesting::NoOverride };
#endif
#if HAVE(TOUCH_BAR)
bool m_requiresUserActionForEditingControlsManager { false };
#endif
};
} // namespace API
|