Make <a download> a runtime enabled option
[WebKit-https.git] / Source / WebKit / mac / WebView / WebPreferencesPrivate.h
1 /*
2  * Copyright (C) 2005-2016 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  *
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  * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
14  *     its contributors may be used to endorse or promote products derived
15  *     from this software without specific prior written permission. 
16  *
17  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28
29 #import <WebKitLegacy/WebPreferences.h>
30
31 #if !TARGET_OS_IPHONE
32 #import <Quartz/Quartz.h>
33 #endif
34
35 typedef enum {
36     WebKitEditableLinkDefaultBehavior,
37     WebKitEditableLinkAlwaysLive,
38     WebKitEditableLinkOnlyLiveWithShiftKey,
39     WebKitEditableLinkLiveWhenNotFocused,
40     WebKitEditableLinkNeverLive
41 } WebKitEditableLinkBehavior;
42
43 typedef enum {
44     WebTextDirectionSubmenuNeverIncluded,
45     WebTextDirectionSubmenuAutomaticallyIncluded,
46     WebTextDirectionSubmenuAlwaysIncluded
47 } WebTextDirectionSubmenuInclusionBehavior;
48
49 typedef enum {
50     WebAllowAllStorage = 0,
51     WebBlockThirdPartyStorage,
52     WebBlockAllStorage
53 } WebStorageBlockingPolicy;
54
55 typedef enum {
56     WebKitJavaScriptRuntimeFlagsAllEnabled = 0
57 } WebKitJavaScriptRuntimeFlags;
58
59 extern NSString *WebPreferencesChangedNotification;
60 extern NSString *WebPreferencesRemovedNotification;
61 extern NSString *WebPreferencesChangedInternalNotification;
62 extern NSString *WebPreferencesCacheModelChangedInternalNotification;
63
64 @interface WebPreferences (WebPrivate)
65
66 // Preferences that might be public in a future release
67
68 - (BOOL)isDNSPrefetchingEnabled;
69 - (void)setDNSPrefetchingEnabled:(BOOL)flag;
70
71 - (BOOL)developerExtrasEnabled;
72 - (void)setDeveloperExtrasEnabled:(BOOL)flag;
73
74 - (WebKitJavaScriptRuntimeFlags)javaScriptRuntimeFlags;
75 - (void)setJavaScriptRuntimeFlags:(WebKitJavaScriptRuntimeFlags)flags;
76
77 - (BOOL)authorAndUserStylesEnabled;
78 - (void)setAuthorAndUserStylesEnabled:(BOOL)flag;
79
80 - (BOOL)applicationChromeModeEnabled;
81 - (void)setApplicationChromeModeEnabled:(BOOL)flag;
82
83 - (BOOL)usesEncodingDetector;
84 - (void)setUsesEncodingDetector:(BOOL)flag;
85
86 #if !TARGET_OS_IPHONE
87 - (BOOL)respectStandardStyleKeyEquivalents;
88 - (void)setRespectStandardStyleKeyEquivalents:(BOOL)flag;
89
90 - (BOOL)showsURLsInToolTips;
91 - (void)setShowsURLsInToolTips:(BOOL)flag;
92
93 - (BOOL)showsToolTipOverTruncatedText;
94 - (void)setShowsToolTipOverTruncatedText:(BOOL)flag;
95
96 - (BOOL)textAreasAreResizable;
97 - (void)setTextAreasAreResizable:(BOOL)flag;
98
99 - (PDFDisplayMode)PDFDisplayMode;
100 - (void)setPDFDisplayMode:(PDFDisplayMode)mode;
101 #endif
102
103 - (BOOL)shrinksStandaloneImagesToFit;
104 - (void)setShrinksStandaloneImagesToFit:(BOOL)flag;
105
106 - (BOOL)automaticallyDetectsCacheModel;
107 - (void)setAutomaticallyDetectsCacheModel:(BOOL)automaticallyDetectsCacheModel;
108
109 - (BOOL)domTimersThrottlingEnabled;
110 - (void)setDOMTimersThrottlingEnabled:(BOOL)domTimersThrottlingEnabled;
111
112 - (BOOL)webArchiveDebugModeEnabled;
113 - (void)setWebArchiveDebugModeEnabled:(BOOL)webArchiveDebugModeEnabled;
114
115 - (BOOL)localFileContentSniffingEnabled;
116 - (void)setLocalFileContentSniffingEnabled:(BOOL)localFileContentSniffingEnabled;
117
118 - (BOOL)offlineWebApplicationCacheEnabled;
119 - (void)setOfflineWebApplicationCacheEnabled:(BOOL)offlineWebApplicationCacheEnabled;
120
121 - (BOOL)databasesEnabled;
122 - (void)setDatabasesEnabled:(BOOL)databasesEnabled;
123
124 #if TARGET_OS_IPHONE
125 - (BOOL)storageTrackerEnabled;
126 - (void)setStorageTrackerEnabled:(BOOL)storageTrackerEnabled;
127 #endif
128
129 - (BOOL)localStorageEnabled;
130 - (void)setLocalStorageEnabled:(BOOL)localStorageEnabled;
131
132 - (BOOL)isWebSecurityEnabled;
133 - (void)setWebSecurityEnabled:(BOOL)flag;
134
135 - (BOOL)allowUniversalAccessFromFileURLs;
136 - (void)setAllowUniversalAccessFromFileURLs:(BOOL)flag;
137
138 - (BOOL)allowFileAccessFromFileURLs;
139 - (void)setAllowFileAccessFromFileURLs:(BOOL)flag;
140
141 - (BOOL)zoomsTextOnly;
142 - (void)setZoomsTextOnly:(BOOL)zoomsTextOnly;
143
144 - (BOOL)javaScriptCanAccessClipboard;
145 - (void)setJavaScriptCanAccessClipboard:(BOOL)flag;
146
147 - (BOOL)isXSSAuditorEnabled;
148 - (void)setXSSAuditorEnabled:(BOOL)flag;
149
150 - (BOOL)experimentalNotificationsEnabled;
151 - (void)setExperimentalNotificationsEnabled:(BOOL)notificationsEnabled;
152
153 - (BOOL)isFrameFlatteningEnabled;
154 - (void)setFrameFlatteningEnabled:(BOOL)flag;
155
156 - (BOOL)isSpatialNavigationEnabled;
157 - (void)setSpatialNavigationEnabled:(BOOL)flag;
158
159 #if !TARGET_OS_IPHONE
160 // zero means do AutoScale
161 - (float)PDFScaleFactor;
162 - (void)setPDFScaleFactor:(float)scale;
163 #endif
164
165 - (int64_t)applicationCacheTotalQuota;
166 - (void)setApplicationCacheTotalQuota:(int64_t)quota;
167
168 - (int64_t)applicationCacheDefaultOriginQuota;
169 - (void)setApplicationCacheDefaultOriginQuota:(int64_t)quota;
170
171 - (WebKitEditableLinkBehavior)editableLinkBehavior;
172 - (void)setEditableLinkBehavior:(WebKitEditableLinkBehavior)behavior;
173
174 - (WebTextDirectionSubmenuInclusionBehavior)textDirectionSubmenuInclusionBehavior;
175 - (void)setTextDirectionSubmenuInclusionBehavior:(WebTextDirectionSubmenuInclusionBehavior)behavior;
176
177 // Used to set preference specified in the test via LayoutTestController.overridePreference(..).
178 // For use with DumpRenderTree only.
179 - (void)_setPreferenceForTestWithValue:(NSString *)value forKey:(NSString *)key;
180
181 // If site-specific spoofing is enabled, some pages that do inappropriate user-agent string checks will be
182 // passed a nonstandard user-agent string to get them to work correctly. This method might be removed in
183 // the future when there's no more need for it.
184 - (BOOL)_useSiteSpecificSpoofing;
185 - (void)_setUseSiteSpecificSpoofing:(BOOL)newValue;
186
187 // WARNING: Allowing paste through the DOM API opens a security hole. We only use it for testing purposes.
188 - (BOOL)isDOMPasteAllowed;
189 - (void)setDOMPasteAllowed:(BOOL)DOMPasteAllowed;
190
191 - (NSString *)_ftpDirectoryTemplatePath;
192 - (void)_setFTPDirectoryTemplatePath:(NSString *)path;
193
194 - (void)_setForceFTPDirectoryListings:(BOOL)force;
195 - (BOOL)_forceFTPDirectoryListings;
196
197 - (NSString *)_localStorageDatabasePath;
198 - (void)_setLocalStorageDatabasePath:(NSString *)path;
199
200 - (BOOL)acceleratedDrawingEnabled;
201 - (void)setAcceleratedDrawingEnabled:(BOOL)enabled;
202
203 - (BOOL)displayListDrawingEnabled;
204 - (void)setDisplayListDrawingEnabled:(BOOL)enabled;
205
206 - (BOOL)resourceLoadStatisticsEnabled;
207 - (void)setResourceLoadStatisticsEnabled:(BOOL)enabled;
208
209 - (BOOL)canvasUsesAcceleratedDrawing;
210 - (void)setCanvasUsesAcceleratedDrawing:(BOOL)enabled;
211
212 - (BOOL)acceleratedCompositingEnabled;
213 - (void)setAcceleratedCompositingEnabled:(BOOL)enabled;
214
215 - (BOOL)cssRegionsEnabled;
216 - (void)setCSSRegionsEnabled:(BOOL)enabled;
217
218 - (BOOL)cssCompositingEnabled;
219 - (void)setCSSCompositingEnabled:(BOOL)enabled;
220
221 - (BOOL)showDebugBorders;
222 - (void)setShowDebugBorders:(BOOL)show;
223
224 - (BOOL)simpleLineLayoutDebugBordersEnabled;
225 - (void)setSimpleLineLayoutDebugBordersEnabled:(BOOL)enabled;
226
227 - (BOOL)showRepaintCounter;
228 - (void)setShowRepaintCounter:(BOOL)show;
229
230 - (BOOL)webAudioEnabled;
231 - (void)setWebAudioEnabled:(BOOL)enabled;
232
233 - (BOOL)subpixelCSSOMElementMetricsEnabled;
234 - (void)setSubpixelCSSOMElementMetricsEnabled:(BOOL)enabled;
235
236 - (BOOL)webGLEnabled;
237 - (void)setWebGLEnabled:(BOOL)enabled;
238
239 - (BOOL)webGL2Enabled;
240 - (void)setWebGL2Enabled:(BOOL)enabled;
241
242 - (BOOL)forceSoftwareWebGLRendering;
243 - (void)setForceSoftwareWebGLRendering:(BOOL)forced;
244
245 - (BOOL)accelerated2dCanvasEnabled;
246 - (void)setAccelerated2dCanvasEnabled:(BOOL)enabled;
247
248 - (BOOL)paginateDuringLayoutEnabled;
249 - (void)setPaginateDuringLayoutEnabled:(BOOL)flag;
250
251 - (BOOL)hyperlinkAuditingEnabled;
252 - (void)setHyperlinkAuditingEnabled:(BOOL)enabled;
253
254 // Deprecated. Use -setVideoPlaybackRequiresUserGesture and -setAudioPlaybackRequiresUserGesture instead.
255 - (void)setMediaPlaybackRequiresUserGesture:(BOOL)flag;
256 // Deprecated. Use -videoPlaybackRequiresUserGesture and -audioPlaybackRequiresUserGesture instead.
257 - (BOOL)mediaPlaybackRequiresUserGesture;
258
259 - (void)setVideoPlaybackRequiresUserGesture:(BOOL)flag;
260 - (BOOL)videoPlaybackRequiresUserGesture;
261
262 - (void)setAudioPlaybackRequiresUserGesture:(BOOL)flag;
263 - (BOOL)audioPlaybackRequiresUserGesture;
264
265 - (void)setOverrideUserGestureRequirementForMainContent:(BOOL)flag;
266 - (BOOL)overrideUserGestureRequirementForMainContent;
267
268 - (void)setMediaPlaybackAllowsInline:(BOOL)flag;
269 - (BOOL)mediaPlaybackAllowsInline;
270
271 - (void)setInlineMediaPlaybackRequiresPlaysInlineAttribute:(BOOL)flag;
272 - (BOOL)inlineMediaPlaybackRequiresPlaysInlineAttribute;
273
274 - (void)setInvisibleAutoplayNotPermitted:(BOOL)flag;
275 - (BOOL)invisibleAutoplayNotPermitted;
276
277 - (void)setMediaControlsScaleWithPageZoom:(BOOL)flag;
278 - (BOOL)mediaControlsScaleWithPageZoom;
279
280 - (void)setAllowsAlternateFullscreen:(BOOL)flag;
281 - (BOOL)allowsAlternateFullscreen;
282
283 - (void)setAllowsPictureInPictureMediaPlayback:(BOOL)flag;
284 - (BOOL)allowsPictureInPictureMediaPlayback;
285
286 - (NSString *)pictographFontFamily;
287 - (void)setPictographFontFamily:(NSString *)family;
288
289 - (BOOL)pageCacheSupportsPlugins;
290 - (void)setPageCacheSupportsPlugins:(BOOL)flag;
291
292 // This is a global setting.
293 - (BOOL)mockScrollbarsEnabled;
294 - (void)setMockScrollbarsEnabled:(BOOL)flag;
295
296 #if TARGET_OS_IPHONE
297 // This is a global setting.
298 - (unsigned)audioSessionCategoryOverride;
299 - (void)setAudioSessionCategoryOverride:(unsigned)override;
300
301 - (BOOL)avKitEnabled;
302 - (void)setAVKitEnabled:(bool)flag;
303
304 // WARNING: this affect network performance. This must not be enabled for production use.
305 // Enabling this makes WebCore reports the network data usage.
306 // This is a global setting.
307 - (void)setNetworkDataUsageTrackingEnabled:(bool)trackingEnabled;
308 - (BOOL)networkDataUsageTrackingEnabled;
309
310 - (void)setNetworkInterfaceName:(NSString *)name;
311 - (NSString *)networkInterfaceName;
312
313 - (void)_setMinimumZoomFontSize:(float)size;
314 - (float)_minimumZoomFontSize;
315
316 // Deprecated. Has no effect.
317 - (void)setDiskImageCacheEnabled:(BOOL)enabled;
318
319 - (void)setMediaPlaybackAllowsAirPlay:(BOOL)flag;
320 - (BOOL)mediaPlaybackAllowsAirPlay;
321 #endif
322
323 - (BOOL)isInheritURIQueryComponentEnabled;
324 - (void)setEnableInheritURIQueryComponent:(BOOL)flag;
325
326 // Other private methods
327 #if TARGET_OS_IPHONE
328 - (BOOL)_standalone;
329 - (void)_setStandalone:(BOOL)flag;
330 - (void)_setTelephoneNumberParsingEnabled:(BOOL)flag;
331 - (BOOL)_telephoneNumberParsingEnabled;
332 - (void)_setAllowMultiElementImplicitFormSubmission:(BOOL)flag;
333 - (BOOL)_allowMultiElementImplicitFormSubmission;
334 - (void)_setAlwaysRequestGeolocationPermission:(BOOL)flag;
335 - (BOOL)_alwaysRequestGeolocationPermission;
336 - (void)_setAlwaysUseAcceleratedOverflowScroll:(BOOL)flag;
337 - (BOOL)_alwaysUseAcceleratedOverflowScroll;
338 - (void)_setLayoutInterval:(int)l;
339 - (int)_layoutInterval;
340 - (void)_setMaxParseDuration:(float)d;
341 - (float)_maxParseDuration;
342 - (void)_setInterpolationQuality:(int)quality;
343 - (int)_interpolationQuality;
344 - (BOOL)_allowPasswordEcho;
345 - (float)_passwordEchoDuration;
346 #endif
347 - (void)_postPreferencesChangedNotification;
348 - (void)_postPreferencesChangedAPINotification;
349 + (WebPreferences *)_getInstanceForIdentifier:(NSString *)identifier;
350 + (void)_setInstance:(WebPreferences *)instance forIdentifier:(NSString *)identifier;
351 + (void)_removeReferenceForIdentifier:(NSString *)identifier;
352 - (NSTimeInterval)_backForwardCacheExpirationInterval;
353 + (CFStringEncoding)_systemCFStringEncoding;
354 + (void)_setInitialDefaultTextEncodingToSystemEncoding;
355 + (void)_setIBCreatorID:(NSString *)string;
356
357 // For DumpRenderTree use only.
358 + (void)_switchNetworkLoaderToNewTestingSession;
359 + (void)_setCurrentNetworkLoaderSessionCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)cookieAcceptPolicy;
360 + (void)_clearNetworkLoaderSession;
361
362 + (void)setWebKitLinkTimeVersion:(int)version;
363
364 // For WebView's use only.
365 - (void)willAddToWebView;
366 - (void)didRemoveFromWebView;
367
368 // Full screen support is dependent on WebCore/WebKit being
369 // compiled with ENABLE_FULLSCREEN_API. 
370 - (void)setFullScreenEnabled:(BOOL)flag;
371 - (BOOL)fullScreenEnabled;
372
373 - (void)setAsynchronousSpellCheckingEnabled:(BOOL)flag;
374 - (BOOL)asynchronousSpellCheckingEnabled;
375
376 - (void)setUsePreHTML5ParserQuirks:(BOOL)flag;
377 - (BOOL)usePreHTML5ParserQuirks;
378
379 - (void)setLoadsSiteIconsIgnoringImageLoadingPreference: (BOOL)flag;
380 - (BOOL)loadsSiteIconsIgnoringImageLoadingPreference;
381
382 // AVFoundation support is dependent on WebCore/WebKit being
383 // compiled with USE_AVFOUNDATION.
384 - (void)setAVFoundationEnabled:(BOOL)flag;
385 - (BOOL)isAVFoundationEnabled;
386
387 - (void)setAVFoundationNSURLSessionEnabled:(BOOL)flag;
388 - (BOOL)isAVFoundationNSURLSessionEnabled;
389
390 - (void)setQTKitEnabled:(BOOL)flag;
391 - (BOOL)isQTKitEnabled;
392
393 // Deprecated, has no effect.
394 - (void)setVideoPluginProxyEnabled:(BOOL)flag;
395 - (BOOL)isVideoPluginProxyEnabled;
396
397 // WebSocket support depends on ENABLE(WEB_SOCKETS).
398 - (void)setHixie76WebSocketProtocolEnabled:(BOOL)flag;
399 - (BOOL)isHixie76WebSocketProtocolEnabled;
400
401 #if TARGET_OS_IPHONE
402 - (void)_invalidateCachedPreferences;
403 - (void)_synchronizeWebStoragePolicyWithCookiePolicy;
404 #endif
405
406 - (void)setBackspaceKeyNavigationEnabled:(BOOL)flag;
407 - (BOOL)backspaceKeyNavigationEnabled;
408
409 - (void)setWantsBalancedSetDefersLoadingBehavior:(BOOL)flag;
410 - (BOOL)wantsBalancedSetDefersLoadingBehavior;
411
412 - (void)setShouldDisplaySubtitles:(BOOL)flag;
413 - (BOOL)shouldDisplaySubtitles;
414
415 - (void)setShouldDisplayCaptions:(BOOL)flag;
416 - (BOOL)shouldDisplayCaptions;
417
418 - (void)setShouldDisplayTextDescriptions:(BOOL)flag;
419 - (BOOL)shouldDisplayTextDescriptions;
420
421 - (void)setNotificationsEnabled:(BOOL)flag;
422 - (BOOL)notificationsEnabled;
423
424 - (void)setShouldRespectImageOrientation:(BOOL)flag;
425 - (BOOL)shouldRespectImageOrientation;
426
427 - (BOOL)requestAnimationFrameEnabled;
428 - (void)setRequestAnimationFrameEnabled:(BOOL)enabled;
429
430 - (void)setIncrementalRenderingSuppressionTimeoutInSeconds:(NSTimeInterval)timeout;
431 - (NSTimeInterval)incrementalRenderingSuppressionTimeoutInSeconds;
432
433 - (BOOL)diagnosticLoggingEnabled;
434 - (void)setDiagnosticLoggingEnabled:(BOOL)enabled;
435
436 - (void)setStorageBlockingPolicy:(WebStorageBlockingPolicy)storageBlockingPolicy;
437 - (WebStorageBlockingPolicy)storageBlockingPolicy;
438
439 - (BOOL)plugInSnapshottingEnabled;
440 - (void)setPlugInSnapshottingEnabled:(BOOL)enabled;
441
442 - (BOOL)hiddenPageDOMTimerThrottlingEnabled;
443 - (void)setHiddenPageDOMTimerThrottlingEnabled:(BOOL)flag;
444
445 - (BOOL)hiddenPageCSSAnimationSuspensionEnabled;
446 - (void)setHiddenPageCSSAnimationSuspensionEnabled:(BOOL)flag;
447
448 - (BOOL)lowPowerVideoAudioBufferSizeEnabled;
449 - (void)setLowPowerVideoAudioBufferSizeEnabled:(BOOL)enabled;
450
451 - (void)setUseLegacyTextAlignPositionedElementBehavior:(BOOL)flag;
452 - (BOOL)useLegacyTextAlignPositionedElementBehavior;
453
454 - (void)setMediaSourceEnabled:(BOOL)flag;
455 - (BOOL)mediaSourceEnabled;
456
457 - (void)setShouldConvertPositionStyleOnCopy:(BOOL)flag;
458 - (BOOL)shouldConvertPositionStyleOnCopy;
459
460 - (void)setImageControlsEnabled:(BOOL)flag;
461 - (BOOL)imageControlsEnabled;
462
463 - (void)setServiceControlsEnabled:(BOOL)flag;
464 - (BOOL)serviceControlsEnabled;
465
466 - (void)setGamepadsEnabled:(BOOL)flag;
467 - (BOOL)gamepadsEnabled;
468
469 - (void)setMediaKeysStorageDirectory:(NSString *)directory;
470 - (NSString *)mediaKeysStorageDirectory;
471
472 - (void)setMetaRefreshEnabled:(BOOL)flag;
473 - (BOOL)metaRefreshEnabled;
474
475 - (void)setHTTPEquivEnabled:(BOOL)flag;
476 - (BOOL)httpEquivEnabled;
477
478 - (void)setMockCaptureDevicesEnabled:(BOOL)flag;
479 - (BOOL)mockCaptureDevicesEnabled;
480
481 - (void)setShadowDOMEnabled:(BOOL)flag;
482 - (BOOL)shadowDOMEnabled;
483
484 - (void)setCustomElementsEnabled:(BOOL)flag;
485 - (BOOL)customElementsEnabled;
486
487 - (void)setFetchAPIEnabled:(BOOL)flag;
488 - (BOOL)fetchAPIEnabled;
489
490 - (void)setDownloadAttributeEnabled:(BOOL)flag;
491 - (BOOL)downloadAttributeEnabled;
492
493 @property (nonatomic) BOOL javaScriptMarkupEnabled;
494 @property (nonatomic) BOOL mediaDataLoadsAutomatically;
495 @property (nonatomic) BOOL attachmentElementEnabled;
496
497 @end