1/* 2 * Copyright (C) 2005, 2007, 2011, 2012 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 35typedef enum { 36 WebKitEditableLinkDefaultBehavior, 37 WebKitEditableLinkAlwaysLive, 38 WebKitEditableLinkOnlyLiveWithShiftKey, 39 WebKitEditableLinkLiveWhenNotFocused, 40 WebKitEditableLinkNeverLive 41} WebKitEditableLinkBehavior; 42 43typedef enum { 44 WebTextDirectionSubmenuNeverIncluded, 45 WebTextDirectionSubmenuAutomaticallyIncluded, 46 WebTextDirectionSubmenuAlwaysIncluded 47} WebTextDirectionSubmenuInclusionBehavior; 48 49typedef enum { 50 WebAllowAllStorage = 0, 51 WebBlockThirdPartyStorage, 52 WebBlockAllStorage 53} WebStorageBlockingPolicy; 54 55extern NSString *WebPreferencesChangedNotification; 56extern NSString *WebPreferencesRemovedNotification; 57extern NSString *WebPreferencesChangedInternalNotification; 58extern NSString *WebPreferencesCacheModelChangedInternalNotification; 59 60@interface WebPreferences (WebPrivate) 61 62// Preferences that might be public in a future release 63 64- (BOOL)isDNSPrefetchingEnabled; 65- (void)setDNSPrefetchingEnabled:(BOOL)flag; 66 67- (BOOL)developerExtrasEnabled; 68- (void)setDeveloperExtrasEnabled:(BOOL)flag; 69 70- (BOOL)javaScriptExperimentsEnabled; 71- (void)setJavaScriptExperimentsEnabled:(BOOL)flag; 72 73- (BOOL)authorAndUserStylesEnabled; 74- (void)setAuthorAndUserStylesEnabled:(BOOL)flag; 75 76- (BOOL)applicationChromeModeEnabled; 77- (void)setApplicationChromeModeEnabled:(BOOL)flag; 78 79- (BOOL)usesEncodingDetector; 80- (void)setUsesEncodingDetector:(BOOL)flag; 81 82#if !TARGET_OS_IPHONE 83- (BOOL)respectStandardStyleKeyEquivalents; 84- (void)setRespectStandardStyleKeyEquivalents:(BOOL)flag; 85 86- (BOOL)showsURLsInToolTips; 87- (void)setShowsURLsInToolTips:(BOOL)flag; 88 89- (BOOL)showsToolTipOverTruncatedText; 90- (void)setShowsToolTipOverTruncatedText:(BOOL)flag; 91 92- (BOOL)textAreasAreResizable; 93- (void)setTextAreasAreResizable:(BOOL)flag; 94 95- (PDFDisplayMode)PDFDisplayMode; 96- (void)setPDFDisplayMode:(PDFDisplayMode)mode; 97#endif 98 99- (BOOL)shrinksStandaloneImagesToFit; 100- (void)setShrinksStandaloneImagesToFit:(BOOL)flag; 101 102- (BOOL)automaticallyDetectsCacheModel; 103- (void)setAutomaticallyDetectsCacheModel:(BOOL)automaticallyDetectsCacheModel; 104 105- (BOOL)webArchiveDebugModeEnabled; 106- (void)setWebArchiveDebugModeEnabled:(BOOL)webArchiveDebugModeEnabled; 107 108- (BOOL)localFileContentSniffingEnabled; 109- (void)setLocalFileContentSniffingEnabled:(BOOL)localFileContentSniffingEnabled; 110 111- (BOOL)offlineWebApplicationCacheEnabled; 112- (void)setOfflineWebApplicationCacheEnabled:(BOOL)offlineWebApplicationCacheEnabled; 113 114- (BOOL)databasesEnabled; 115- (void)setDatabasesEnabled:(BOOL)databasesEnabled; 116 117#if TARGET_OS_IPHONE 118- (BOOL)storageTrackerEnabled; 119- (void)setStorageTrackerEnabled:(BOOL)storageTrackerEnabled; 120#endif 121 122- (BOOL)localStorageEnabled; 123- (void)setLocalStorageEnabled:(BOOL)localStorageEnabled; 124 125- (BOOL)isWebSecurityEnabled; 126- (void)setWebSecurityEnabled:(BOOL)flag; 127 128- (BOOL)allowUniversalAccessFromFileURLs; 129- (void)setAllowUniversalAccessFromFileURLs:(BOOL)flag; 130 131- (BOOL)allowFileAccessFromFileURLs; 132- (void)setAllowFileAccessFromFileURLs:(BOOL)flag; 133 134- (BOOL)zoomsTextOnly; 135- (void)setZoomsTextOnly:(BOOL)zoomsTextOnly; 136 137- (BOOL)javaScriptCanAccessClipboard; 138- (void)setJavaScriptCanAccessClipboard:(BOOL)flag; 139 140- (BOOL)isXSSAuditorEnabled; 141- (void)setXSSAuditorEnabled:(BOOL)flag; 142 143- (BOOL)experimentalNotificationsEnabled; 144- (void)setExperimentalNotificationsEnabled:(BOOL)notificationsEnabled; 145 146- (BOOL)isFrameFlatteningEnabled; 147- (void)setFrameFlatteningEnabled:(BOOL)flag; 148 149- (BOOL)isSpatialNavigationEnabled; 150- (void)setSpatialNavigationEnabled:(BOOL)flag; 151 152#if !TARGET_OS_IPHONE 153// zero means do AutoScale 154- (float)PDFScaleFactor; 155- (void)setPDFScaleFactor:(float)scale; 156#endif 157 158- (int64_t)applicationCacheTotalQuota; 159- (void)setApplicationCacheTotalQuota:(int64_t)quota; 160 161- (int64_t)applicationCacheDefaultOriginQuota; 162- (void)setApplicationCacheDefaultOriginQuota:(int64_t)quota; 163 164- (WebKitEditableLinkBehavior)editableLinkBehavior; 165- (void)setEditableLinkBehavior:(WebKitEditableLinkBehavior)behavior; 166 167- (WebTextDirectionSubmenuInclusionBehavior)textDirectionSubmenuInclusionBehavior; 168- (void)setTextDirectionSubmenuInclusionBehavior:(WebTextDirectionSubmenuInclusionBehavior)behavior; 169 170// Used to set preference specified in the test via LayoutTestController.overridePreference(..). 171// For use with DumpRenderTree only. 172- (void)_setPreferenceForTestWithValue:(NSString *)value forKey:(NSString *)key; 173 174// If site-specific spoofing is enabled, some pages that do inappropriate user-agent string checks will be 175// passed a nonstandard user-agent string to get them to work correctly. This method might be removed in 176// the future when there's no more need for it. 177- (BOOL)_useSiteSpecificSpoofing; 178- (void)_setUseSiteSpecificSpoofing:(BOOL)newValue; 179 180// WARNING: Allowing paste through the DOM API opens a security hole. We only use it for testing purposes. 181- (BOOL)isDOMPasteAllowed; 182- (void)setDOMPasteAllowed:(BOOL)DOMPasteAllowed; 183 184- (NSString *)_ftpDirectoryTemplatePath; 185- (void)_setFTPDirectoryTemplatePath:(NSString *)path; 186 187- (void)_setForceFTPDirectoryListings:(BOOL)force; 188- (BOOL)_forceFTPDirectoryListings; 189 190- (NSString *)_localStorageDatabasePath; 191- (void)_setLocalStorageDatabasePath:(NSString *)path; 192 193- (BOOL)acceleratedDrawingEnabled; 194- (void)setAcceleratedDrawingEnabled:(BOOL)enabled; 195 196- (BOOL)canvasUsesAcceleratedDrawing; 197- (void)setCanvasUsesAcceleratedDrawing:(BOOL)enabled; 198 199- (BOOL)acceleratedCompositingEnabled; 200- (void)setAcceleratedCompositingEnabled:(BOOL)enabled; 201 202- (BOOL)cssRegionsEnabled; 203- (void)setCSSRegionsEnabled:(BOOL)enabled; 204 205- (BOOL)cssCompositingEnabled; 206- (void)setCSSCompositingEnabled:(BOOL)enabled; 207 208- (BOOL)showDebugBorders; 209- (void)setShowDebugBorders:(BOOL)show; 210 211- (BOOL)showRepaintCounter; 212- (void)setShowRepaintCounter:(BOOL)show; 213 214- (BOOL)webAudioEnabled; 215- (void)setWebAudioEnabled:(BOOL)enabled; 216 217- (BOOL)subpixelCSSOMElementMetricsEnabled; 218- (void)setSubpixelCSSOMElementMetricsEnabled:(BOOL)enabled; 219 220- (BOOL)webGLEnabled; 221- (void)setWebGLEnabled:(BOOL)enabled; 222 223- (BOOL)multithreadedWebGLEnabled; 224- (void)setMultithreadedWebGLEnabled:(BOOL)enabled; 225 226- (BOOL)forceSoftwareWebGLRendering; 227- (void)setForceSoftwareWebGLRendering:(BOOL)forced; 228 229- (BOOL)accelerated2dCanvasEnabled; 230- (void)setAccelerated2dCanvasEnabled:(BOOL)enabled; 231 232- (BOOL)paginateDuringLayoutEnabled; 233- (void)setPaginateDuringLayoutEnabled:(BOOL)flag; 234 235- (BOOL)hyperlinkAuditingEnabled; 236- (void)setHyperlinkAuditingEnabled:(BOOL)enabled; 237 238- (void)setMediaPlaybackRequiresUserGesture:(BOOL)flag; 239- (BOOL)mediaPlaybackRequiresUserGesture; 240 241- (void)setMediaPlaybackAllowsInline:(BOOL)flag; 242- (BOOL)mediaPlaybackAllowsInline; 243 244- (NSString *)pictographFontFamily; 245- (void)setPictographFontFamily:(NSString *)family; 246 247- (BOOL)pageCacheSupportsPlugins; 248- (void)setPageCacheSupportsPlugins:(BOOL)flag; 249 250// This is a global setting. 251- (BOOL)mockScrollbarsEnabled; 252- (void)setMockScrollbarsEnabled:(BOOL)flag; 253 254#if TARGET_OS_IPHONE 255// This is a global setting. 256- (unsigned)audioSessionCategoryOverride; 257- (void)setAudioSessionCategoryOverride:(unsigned)override; 258 259- (BOOL)avKitEnabled; 260- (void)setAVKitEnabled:(bool)flag; 261 262// WARNING: this affect network performance. This must not be enabled for production use. 263// Enabling this makes WebCore reports the network data usage. 264// This is a global setting. 265- (void)setNetworkDataUsageTrackingEnabled:(bool)trackingEnabled; 266- (BOOL)networkDataUsageTrackingEnabled; 267 268- (void)setNetworkInterfaceName:(NSString *)name; 269- (NSString *)networkInterfaceName; 270 271- (void)_setMinimumZoomFontSize:(float)size; 272- (float)_minimumZoomFontSize; 273 274- (BOOL)diskImageCacheEnabled; 275- (void)setDiskImageCacheEnabled:(BOOL)enabled; 276 277- (unsigned)diskImageCacheMinimumImageSize; 278- (void)setDiskImageCacheMinimumImageSize:(unsigned)minimumSize; 279 280- (unsigned)diskImageCacheMaximumCacheSize; 281- (void)setDiskImageCacheMaximumCacheSize:(unsigned)maximumSize; 282 283- (NSString *)_diskImageCacheSavedCacheDirectory; 284- (void)_setDiskImageCacheSavedCacheDirectory:(NSString *)path; 285 286- (void)setMediaPlaybackAllowsAirPlay:(BOOL)flag; 287- (BOOL)mediaPlaybackAllowsAirPlay; 288#endif 289 290- (BOOL)isInheritURIQueryComponentEnabled; 291- (void)setEnableInheritURIQueryComponent:(BOOL)flag; 292 293// Other private methods 294#if TARGET_OS_IPHONE 295- (BOOL)_standalone; 296- (void)_setStandalone:(BOOL)flag; 297- (void)_setTelephoneNumberParsingEnabled:(BOOL)flag; 298- (BOOL)_telephoneNumberParsingEnabled; 299- (void)_setAlwaysUseBaselineOfPrimaryFont:(BOOL)flag; 300- (BOOL)_alwaysUseBaselineOfPrimaryFont; 301- (void)_setAllowMultiElementImplicitFormSubmission:(BOOL)flag; 302- (BOOL)_allowMultiElementImplicitFormSubmission; 303- (void)_setAlwaysRequestGeolocationPermission:(BOOL)flag; 304- (BOOL)_alwaysRequestGeolocationPermission; 305- (void)_setAlwaysUseAcceleratedOverflowScroll:(BOOL)flag; 306- (BOOL)_alwaysUseAcceleratedOverflowScroll; 307- (void)_setLayoutInterval:(int)l; 308- (int)_layoutInterval; 309- (void)_setMaxParseDuration:(float)d; 310- (float)_maxParseDuration; 311- (void)_setPageCacheSize:(int)size; 312- (int)_pageCacheSize; 313- (void)_setObjectCacheSize:(int)size; 314- (int)_objectCacheSize; 315- (void)_setInterpolationQuality:(int)quality; 316- (int)_interpolationQuality; 317- (BOOL)_allowPasswordEcho; 318- (float)_passwordEchoDuration; 319#endif 320- (void)_postPreferencesChangedNotification; 321- (void)_postPreferencesChangedAPINotification; 322+ (WebPreferences *)_getInstanceForIdentifier:(NSString *)identifier; 323+ (void)_setInstance:(WebPreferences *)instance forIdentifier:(NSString *)identifier; 324+ (void)_removeReferenceForIdentifier:(NSString *)identifier; 325- (NSTimeInterval)_backForwardCacheExpirationInterval; 326+ (CFStringEncoding)_systemCFStringEncoding; 327+ (void)_setInitialDefaultTextEncodingToSystemEncoding; 328+ (void)_setIBCreatorID:(NSString *)string; 329 330// For DumpRenderTree use only. 331+ (void)_switchNetworkLoaderToNewTestingSession; 332+ (void)_setCurrentNetworkLoaderSessionCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)cookieAcceptPolicy; 333 334+ (void)setWebKitLinkTimeVersion:(int)version; 335 336// For WebView's use only. 337- (void)willAddToWebView; 338- (void)didRemoveFromWebView; 339 340// Full screen support is dependent on WebCore/WebKit being 341// compiled with ENABLE_FULLSCREEN_API. 342- (void)setFullScreenEnabled:(BOOL)flag; 343- (BOOL)fullScreenEnabled; 344 345- (void)setAsynchronousSpellCheckingEnabled:(BOOL)flag; 346- (BOOL)asynchronousSpellCheckingEnabled; 347 348- (void)setUsePreHTML5ParserQuirks:(BOOL)flag; 349- (BOOL)usePreHTML5ParserQuirks; 350 351- (void)setLoadsSiteIconsIgnoringImageLoadingPreference: (BOOL)flag; 352- (BOOL)loadsSiteIconsIgnoringImageLoadingPreference; 353 354// AVFoundation support is dependent on WebCore/WebKit being 355// compiled with USE_AVFOUNDATION. 356- (void)setAVFoundationEnabled:(BOOL)flag; 357- (BOOL)isAVFoundationEnabled; 358 359- (void)setQTKitEnabled:(BOOL)flag; 360- (BOOL)isQTKitEnabled; 361 362// Deprecated, has no effect. 363- (void)setVideoPluginProxyEnabled:(BOOL)flag; 364- (BOOL)isVideoPluginProxyEnabled; 365 366// WebSocket support depends on ENABLE(WEB_SOCKETS). 367- (void)setHixie76WebSocketProtocolEnabled:(BOOL)flag; 368- (BOOL)isHixie76WebSocketProtocolEnabled; 369 370#if TARGET_OS_IPHONE 371- (void)_invalidateCachedPreferences; 372- (void)_synchronizeWebStoragePolicyWithCookiePolicy; 373#endif 374 375- (void)setBackspaceKeyNavigationEnabled:(BOOL)flag; 376- (BOOL)backspaceKeyNavigationEnabled; 377 378- (void)setWantsBalancedSetDefersLoadingBehavior:(BOOL)flag; 379- (BOOL)wantsBalancedSetDefersLoadingBehavior; 380 381- (void)setShouldDisplaySubtitles:(BOOL)flag; 382- (BOOL)shouldDisplaySubtitles; 383 384- (void)setShouldDisplayCaptions:(BOOL)flag; 385- (BOOL)shouldDisplayCaptions; 386 387- (void)setShouldDisplayTextDescriptions:(BOOL)flag; 388- (BOOL)shouldDisplayTextDescriptions; 389 390- (void)setNotificationsEnabled:(BOOL)flag; 391- (BOOL)notificationsEnabled; 392 393- (void)setShouldRespectImageOrientation:(BOOL)flag; 394- (BOOL)shouldRespectImageOrientation; 395 396- (BOOL)requestAnimationFrameEnabled; 397- (void)setRequestAnimationFrameEnabled:(BOOL)enabled; 398 399- (void)setIncrementalRenderingSuppressionTimeoutInSeconds:(NSTimeInterval)timeout; 400- (NSTimeInterval)incrementalRenderingSuppressionTimeoutInSeconds; 401 402- (BOOL)diagnosticLoggingEnabled; 403- (void)setDiagnosticLoggingEnabled:(BOOL)enabled; 404 405- (BOOL)screenFontSubstitutionEnabled; 406- (void)setScreenFontSubstitutionEnabled:(BOOL)enabled; 407 408- (void)setStorageBlockingPolicy:(WebStorageBlockingPolicy)storageBlockingPolicy; 409- (WebStorageBlockingPolicy)storageBlockingPolicy; 410 411- (BOOL)plugInSnapshottingEnabled; 412- (void)setPlugInSnapshottingEnabled:(BOOL)enabled; 413 414- (BOOL)hiddenPageDOMTimerThrottlingEnabled; 415- (void)setHiddenPageDOMTimerThrottlingEnabled:(BOOL)flag; 416 417- (BOOL)hiddenPageCSSAnimationSuspensionEnabled; 418- (void)setHiddenPageCSSAnimationSuspensionEnabled:(BOOL)flag; 419 420- (BOOL)lowPowerVideoAudioBufferSizeEnabled; 421- (void)setLowPowerVideoAudioBufferSizeEnabled:(BOOL)enabled; 422 423- (void)setUseLegacyTextAlignPositionedElementBehavior:(BOOL)flag; 424- (BOOL)useLegacyTextAlignPositionedElementBehavior; 425 426- (void)setMediaSourceEnabled:(BOOL)flag; 427- (BOOL)mediaSourceEnabled; 428 429- (void)setShouldConvertPositionStyleOnCopy:(BOOL)flag; 430- (BOOL)shouldConvertPositionStyleOnCopy; 431 432- (void)setImageControlsEnabled:(BOOL)flag; 433- (BOOL)imageControlsEnabled; 434 435- (void)setGamepadsEnabled:(BOOL)flag; 436- (BOOL)gamepadsEnabled; 437 438#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < 80000 439- (void)_setAllowCompositingLayerVisualDegradation:(BOOL)flag; 440#endif 441 442@end 443