Turning off custom pasteboard data doesn't actually turn it off in WK2
[WebKit-https.git] / Source / WebCore / page / DeprecatedGlobalSettings.h
1 /*
2  * Copyright (C) 2003-2016 Apple Inc. All rights reserved.
3  *           (C) 2006 Graham Dennis (graham.dennis@gmail.com)
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
15  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
18  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
25  */
26
27 #pragma once
28
29 #include <wtf/Forward.h>
30
31 namespace WebCore {
32
33 class DeprecatedGlobalSettings {
34 public:
35     DeprecatedGlobalSettings() = delete;
36
37 #if PLATFORM(WIN)
38     static void setShouldUseHighResolutionTimers(bool);
39     static bool shouldUseHighResolutionTimers() { return gShouldUseHighResolutionTimers; }
40 #endif
41
42     static bool isPostLoadCPUUsageMeasurementEnabled();
43     static bool isPostBackgroundingCPUUsageMeasurementEnabled();
44     static bool isPerActivityStateCPUUsageMeasurementEnabled();
45
46     static bool isPostLoadMemoryUsageMeasurementEnabled();
47     static bool isPostBackgroundingMemoryUsageMeasurementEnabled();
48
49     static bool globalConstRedeclarationShouldThrow();
50
51 #if USE(AVFOUNDATION)
52     WEBCORE_EXPORT static void setAVFoundationEnabled(bool flag);
53     static bool isAVFoundationEnabled() { return gAVFoundationEnabled; }
54     WEBCORE_EXPORT static void setAVFoundationNSURLSessionEnabled(bool flag);
55     static bool isAVFoundationNSURLSessionEnabled() { return gAVFoundationNSURLSessionEnabled; }
56 #endif
57
58 #if PLATFORM(COCOA)
59     WEBCORE_EXPORT static void setQTKitEnabled(bool flag);
60     static bool isQTKitEnabled() { return gQTKitEnabled; }
61 #else
62     static bool isQTKitEnabled() { return false; }
63 #endif
64
65 #if USE(GSTREAMER)
66     WEBCORE_EXPORT static void setGStreamerEnabled(bool flag);
67     static bool isGStreamerEnabled() { return gGStreamerEnabled; }
68 #endif
69
70     WEBCORE_EXPORT static void setMockScrollbarsEnabled(bool flag);
71     WEBCORE_EXPORT static bool mockScrollbarsEnabled();
72
73     WEBCORE_EXPORT static void setUsesOverlayScrollbars(bool flag);
74     static bool usesOverlayScrollbars();
75
76     WEBCORE_EXPORT static void setUsesMockScrollAnimator(bool);
77     static bool usesMockScrollAnimator();
78
79     WEBCORE_EXPORT static void setShouldRespectPriorityInCSSAttributeSetters(bool);
80     static bool shouldRespectPriorityInCSSAttributeSetters();
81
82     static bool lowPowerVideoAudioBufferSizeEnabled() { return gLowPowerVideoAudioBufferSizeEnabled; }
83     WEBCORE_EXPORT static void setLowPowerVideoAudioBufferSizeEnabled(bool);
84
85     static bool resourceLoadStatisticsEnabled() { return gResourceLoadStatisticsEnabledEnabled; }
86     WEBCORE_EXPORT static void setResourceLoadStatisticsEnabled(bool);
87
88 #if PLATFORM(IOS)
89     WEBCORE_EXPORT static void setAudioSessionCategoryOverride(unsigned);
90     static unsigned audioSessionCategoryOverride();
91
92     WEBCORE_EXPORT static void setNetworkDataUsageTrackingEnabled(bool);
93     static bool networkDataUsageTrackingEnabled();
94
95     WEBCORE_EXPORT static void setNetworkInterfaceName(const String&);
96     static const String& networkInterfaceName();
97
98 #if HAVE(AVKIT)
99     static void setAVKitEnabled(bool flag) { gAVKitEnabled = flag; }
100 #endif
101     static bool avKitEnabled() { return gAVKitEnabled; }
102
103     static void setShouldOptOutOfNetworkStateObservation(bool flag) { gShouldOptOutOfNetworkStateObservation = flag; }
104     static bool shouldOptOutOfNetworkStateObservation() { return gShouldOptOutOfNetworkStateObservation; }
105 #endif
106
107 #if USE(AUDIO_SESSION)
108     static void setShouldManageAudioSessionCategory(bool flag) { gManageAudioSession = flag; }
109     static bool shouldManageAudioSessionCategory() { return gManageAudioSession; }
110 #endif
111     
112 #if ENABLE(MEDIA_STREAM)
113     static bool mockCaptureDevicesEnabled();
114     WEBCORE_EXPORT static void setMockCaptureDevicesEnabled(bool);
115
116     static bool mediaCaptureRequiresSecureConnection();
117     WEBCORE_EXPORT static void setMediaCaptureRequiresSecureConnection(bool);
118 #endif
119
120     WEBCORE_EXPORT static void setAllowsAnySSLCertificate(bool);
121     static bool allowsAnySSLCertificate();
122
123 private:
124 #if USE(AVFOUNDATION)
125     WEBCORE_EXPORT static bool gAVFoundationEnabled;
126     WEBCORE_EXPORT static bool gAVFoundationNSURLSessionEnabled;
127 #endif
128
129 #if PLATFORM(COCOA)
130     WEBCORE_EXPORT static bool gQTKitEnabled;
131 #endif
132
133 #if USE(GSTREAMER)
134     WEBCORE_EXPORT static bool gGStreamerEnabled;
135 #endif
136
137     static bool gMockScrollbarsEnabled;
138     static bool gUsesOverlayScrollbars;
139     static bool gMockScrollAnimatorEnabled;
140
141 #if PLATFORM(WIN)
142     static bool gShouldUseHighResolutionTimers;
143 #endif
144     static bool gShouldRespectPriorityInCSSAttributeSetters;
145 #if PLATFORM(IOS)
146     static bool gNetworkDataUsageTrackingEnabled;
147     WEBCORE_EXPORT static bool gAVKitEnabled;
148     WEBCORE_EXPORT static bool gShouldOptOutOfNetworkStateObservation;
149 #endif
150     WEBCORE_EXPORT static bool gManageAudioSession;
151     WEBCORE_EXPORT static bool gCustomPasteboardDataEnabled;
152     
153 #if ENABLE(MEDIA_STREAM)
154     static bool gMockCaptureDevicesEnabled;
155     static bool gMediaCaptureRequiresSecureConnection;
156 #endif
157
158     static bool gLowPowerVideoAudioBufferSizeEnabled;
159     static bool gResourceLoadStatisticsEnabledEnabled;
160     static bool gAllowsAnySSLCertificate;
161 };
162
163 inline bool DeprecatedGlobalSettings::isPostLoadCPUUsageMeasurementEnabled()
164 {
165 #if PLATFORM(COCOA)
166     return true;
167 #else
168     return false;
169 #endif
170 }
171
172 inline bool DeprecatedGlobalSettings::isPostBackgroundingCPUUsageMeasurementEnabled()
173 {
174 #if PLATFORM(MAC)
175     return true;
176 #else
177     return false;
178 #endif
179 }
180
181 inline bool DeprecatedGlobalSettings::isPerActivityStateCPUUsageMeasurementEnabled()
182 {
183 #if PLATFORM(MAC)
184     return true;
185 #else
186     return false;
187 #endif
188 }
189
190 inline bool DeprecatedGlobalSettings::isPostLoadMemoryUsageMeasurementEnabled()
191 {
192 #if PLATFORM(COCOA)
193     return true;
194 #else
195     return false;
196 #endif
197 }
198
199 inline bool DeprecatedGlobalSettings::isPostBackgroundingMemoryUsageMeasurementEnabled()
200 {
201 #if PLATFORM(MAC)
202     return true;
203 #else
204     return false;
205 #endif
206 }
207
208 } // namespace WebCore