DeprecatedGlobalSettings.cpp [plain text]
#include "config.h"
#include "DeprecatedGlobalSettings.h"
#include "AudioSession.h"
#include "HTMLMediaElement.h"
#include <wtf/NeverDestroyed.h>
namespace WebCore {
#if USE(AVFOUNDATION)
bool DeprecatedGlobalSettings::gAVFoundationEnabled = true;
bool DeprecatedGlobalSettings::gAVFoundationNSURLSessionEnabled = true;
#endif
#if USE(GSTREAMER)
bool DeprecatedGlobalSettings::gGStreamerEnabled = true;
#endif
bool DeprecatedGlobalSettings::gMockScrollbarsEnabled = false;
bool DeprecatedGlobalSettings::gUsesOverlayScrollbars = false;
bool DeprecatedGlobalSettings::gMockScrollAnimatorEnabled = false;
#if PLATFORM(WIN)
bool DeprecatedGlobalSettings::gShouldUseHighResolutionTimers = true;
#endif
bool DeprecatedGlobalSettings::gShouldRespectPriorityInCSSAttributeSetters = false;
bool DeprecatedGlobalSettings::gLowPowerVideoAudioBufferSizeEnabled = false;
bool DeprecatedGlobalSettings::gResourceLoadStatisticsEnabledEnabled = false;
bool DeprecatedGlobalSettings::gAllowsAnySSLCertificate = false;
#if PLATFORM(IOS_FAMILY)
bool DeprecatedGlobalSettings::gNetworkDataUsageTrackingEnabled = false;
bool DeprecatedGlobalSettings::gAVKitEnabled = false;
bool DeprecatedGlobalSettings::gShouldOptOutOfNetworkStateObservation = false;
bool DeprecatedGlobalSettings::gDisableScreenSizeOverride = false;
#endif
bool DeprecatedGlobalSettings::gManageAudioSession = false;
#if PLATFORM(WIN)
void DeprecatedGlobalSettings::setShouldUseHighResolutionTimers(bool shouldUseHighResolutionTimers)
{
gShouldUseHighResolutionTimers = shouldUseHighResolutionTimers;
}
#endif
#if USE(AVFOUNDATION)
void DeprecatedGlobalSettings::setAVFoundationEnabled(bool enabled)
{
if (gAVFoundationEnabled == enabled)
return;
gAVFoundationEnabled = enabled;
HTMLMediaElement::resetMediaEngines();
}
void DeprecatedGlobalSettings::setAVFoundationNSURLSessionEnabled(bool enabled)
{
if (gAVFoundationNSURLSessionEnabled == enabled)
return;
gAVFoundationNSURLSessionEnabled = enabled;
}
#endif
#if USE(GSTREAMER)
void DeprecatedGlobalSettings::setGStreamerEnabled(bool enabled)
{
if (gGStreamerEnabled == enabled)
return;
gGStreamerEnabled = enabled;
#if ENABLE(VIDEO)
HTMLMediaElement::resetMediaEngines();
#endif
}
#endif
void DeprecatedGlobalSettings::setMockScrollbarsEnabled(bool flag)
{
gMockScrollbarsEnabled = flag;
}
bool DeprecatedGlobalSettings::mockScrollbarsEnabled()
{
return gMockScrollbarsEnabled;
}
void DeprecatedGlobalSettings::setUsesOverlayScrollbars(bool flag)
{
gUsesOverlayScrollbars = flag;
}
bool DeprecatedGlobalSettings::usesOverlayScrollbars()
{
return gUsesOverlayScrollbars;
}
void DeprecatedGlobalSettings::setUsesMockScrollAnimator(bool flag)
{
gMockScrollAnimatorEnabled = flag;
}
bool DeprecatedGlobalSettings::usesMockScrollAnimator()
{
return gMockScrollAnimatorEnabled;
}
void DeprecatedGlobalSettings::setShouldRespectPriorityInCSSAttributeSetters(bool flag)
{
gShouldRespectPriorityInCSSAttributeSetters = flag;
}
bool DeprecatedGlobalSettings::shouldRespectPriorityInCSSAttributeSetters()
{
return gShouldRespectPriorityInCSSAttributeSetters;
}
void DeprecatedGlobalSettings::setLowPowerVideoAudioBufferSizeEnabled(bool flag)
{
gLowPowerVideoAudioBufferSizeEnabled = flag;
}
void DeprecatedGlobalSettings::setResourceLoadStatisticsEnabled(bool flag)
{
gResourceLoadStatisticsEnabledEnabled = flag;
}
#if PLATFORM(IOS_FAMILY)
void DeprecatedGlobalSettings::setAudioSessionCategoryOverride(unsigned sessionCategory)
{
AudioSession::sharedSession().setCategoryOverride(static_cast<AudioSession::CategoryType>(sessionCategory));
}
unsigned DeprecatedGlobalSettings::audioSessionCategoryOverride()
{
return AudioSession::sharedSession().categoryOverride();
}
void DeprecatedGlobalSettings::setNetworkDataUsageTrackingEnabled(bool trackingEnabled)
{
gNetworkDataUsageTrackingEnabled = trackingEnabled;
}
bool DeprecatedGlobalSettings::networkDataUsageTrackingEnabled()
{
return gNetworkDataUsageTrackingEnabled;
}
static String& sharedNetworkInterfaceNameGlobal()
{
static NeverDestroyed<String> networkInterfaceName;
return networkInterfaceName;
}
void DeprecatedGlobalSettings::setNetworkInterfaceName(const String& networkInterfaceName)
{
sharedNetworkInterfaceNameGlobal() = networkInterfaceName;
}
const String& DeprecatedGlobalSettings::networkInterfaceName()
{
return sharedNetworkInterfaceNameGlobal();
}
#endif
void DeprecatedGlobalSettings::setAllowsAnySSLCertificate(bool allowAnySSLCertificate)
{
gAllowsAnySSLCertificate = allowAnySSLCertificate;
}
bool DeprecatedGlobalSettings::allowsAnySSLCertificate()
{
return gAllowsAnySSLCertificate;
}
}