b876b56d8ddf7eac43e97eaa9b5bf9d13a0475fc
[WebKit-https.git] / Source / WebKit / UIProcess / API / Cocoa / WKPreferences.mm
1 /*
2  * Copyright (C) 2014-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  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #import "config.h"
27 #import "WKPreferencesInternal.h"
28
29 #if WK_API_ENABLED
30
31 #import "APIArray.h"
32 #import "WKNSArray.h"
33 #import "WebPreferences.h"
34 #import "_WKExperimentalFeature.h"
35 #import "_WKExperimentalFeatureInternal.h"
36 #import <WebCore/SecurityOrigin.h>
37 #import <wtf/RetainPtr.h>
38
39 @implementation WKPreferences
40
41 - (instancetype)init
42 {
43     if (!(self = [super init]))
44         return nil;
45
46     API::Object::constructInWrapper<WebKit::WebPreferences>(self, String(), "WebKit", "WebKitDebug");
47     return self;
48 }
49
50 - (void)dealloc
51 {
52     _preferences->~WebPreferences();
53
54     [super dealloc];
55 }
56
57 // FIXME: We currently only encode/decode API preferences. We should consider whether we should
58 // encode/decode SPI preferences as well.
59
60 - (void)encodeWithCoder:(NSCoder *)coder
61 {
62     [coder encodeDouble:self.minimumFontSize forKey:@"minimumFontSize"];
63     [coder encodeBool:self.javaScriptEnabled forKey:@"javaScriptEnabled"];
64     [coder encodeBool:self.javaScriptCanOpenWindowsAutomatically forKey:@"javaScriptCanOpenWindowsAutomatically"];
65
66 #if PLATFORM(MAC)
67     [coder encodeBool:self.javaEnabled forKey:@"javaEnabled"];
68     [coder encodeBool:self.plugInsEnabled forKey:@"plugInsEnabled"];
69     [coder encodeBool:self.tabFocusesLinks forKey:@"tabFocusesLinks"];
70 #endif
71 }
72
73 - (instancetype)initWithCoder:(NSCoder *)coder
74 {
75     if (!(self = [self init]))
76         return nil;
77
78     self.minimumFontSize = [coder decodeDoubleForKey:@"minimumFontSize"];
79     self.javaScriptEnabled = [coder decodeBoolForKey:@"javaScriptEnabled"];
80     self.javaScriptCanOpenWindowsAutomatically = [coder decodeBoolForKey:@"javaScriptCanOpenWindowsAutomatically"];
81
82 #if PLATFORM(MAC)
83     self.javaEnabled = [coder decodeBoolForKey:@"javaEnabled"];
84     self.plugInsEnabled = [coder decodeBoolForKey:@"plugInsEnabled"];
85     self.tabFocusesLinks = [coder decodeBoolForKey:@"tabFocusesLinks"];
86 #endif
87
88     return self;
89 }
90
91 - (id)copyWithZone:(NSZone *)zone
92 {
93     return wrapper(_preferences->copy().leakRef());
94 }
95
96 - (CGFloat)minimumFontSize
97 {
98     return _preferences->minimumFontSize();
99 }
100
101 - (void)setMinimumFontSize:(CGFloat)minimumFontSize
102 {
103     _preferences->setMinimumFontSize(minimumFontSize);
104 }
105
106 - (BOOL)javaScriptEnabled
107 {
108     return _preferences->javaScriptEnabled();
109 }
110
111 - (void)setJavaScriptEnabled:(BOOL)javaScriptEnabled
112 {
113     _preferences->setJavaScriptEnabled(javaScriptEnabled);
114 }
115
116 - (BOOL)javaScriptCanOpenWindowsAutomatically
117 {
118     return _preferences->javaScriptCanOpenWindowsAutomatically();
119 }
120
121 - (void)setJavaScriptCanOpenWindowsAutomatically:(BOOL)javaScriptCanOpenWindowsAutomatically
122 {
123     _preferences->setJavaScriptCanOpenWindowsAutomatically(javaScriptCanOpenWindowsAutomatically);
124 }
125
126 #pragma mark OS X-specific methods
127
128 #if PLATFORM(MAC)
129
130 - (BOOL)javaEnabled
131 {
132     return _preferences->javaEnabled();
133 }
134
135 - (void)setJavaEnabled:(BOOL)javaEnabled
136 {
137     _preferences->setJavaEnabled(javaEnabled);
138 }
139
140 - (BOOL)plugInsEnabled
141 {
142     return _preferences->pluginsEnabled();
143 }
144
145 - (void)setPlugInsEnabled:(BOOL)plugInsEnabled
146 {
147     _preferences->setPluginsEnabled(plugInsEnabled);
148 }
149
150 - (BOOL)tabFocusesLinks
151 {
152     return _preferences->tabsToLinks();
153 }
154
155 - (void)setTabFocusesLinks:(BOOL)tabFocusesLinks
156 {
157     _preferences->setTabsToLinks(tabFocusesLinks);
158 }
159
160 #endif
161
162 #pragma mark WKObject protocol implementation
163
164 - (API::Object&)_apiObject
165 {
166     return *_preferences;
167 }
168
169 @end
170
171 @implementation WKPreferences (WKPrivate)
172
173 - (BOOL)_telephoneNumberDetectionIsEnabled
174 {
175     return _preferences->telephoneNumberParsingEnabled();
176 }
177
178 - (void)_setTelephoneNumberDetectionIsEnabled:(BOOL)telephoneNumberDetectionIsEnabled
179 {
180     _preferences->setTelephoneNumberParsingEnabled(telephoneNumberDetectionIsEnabled);
181 }
182
183 static WebCore::SecurityOrigin::StorageBlockingPolicy toStorageBlockingPolicy(_WKStorageBlockingPolicy policy)
184 {
185     switch (policy) {
186     case _WKStorageBlockingPolicyAllowAll:
187         return WebCore::SecurityOrigin::AllowAllStorage;
188     case _WKStorageBlockingPolicyBlockThirdParty:
189         return WebCore::SecurityOrigin::BlockThirdPartyStorage;
190     case _WKStorageBlockingPolicyBlockAll:
191         return WebCore::SecurityOrigin::BlockAllStorage;
192     }
193
194     ASSERT_NOT_REACHED();
195     return WebCore::SecurityOrigin::AllowAllStorage;
196 }
197
198 static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPolicy policy)
199 {
200     switch (policy) {
201     case WebCore::SecurityOrigin::AllowAllStorage:
202         return _WKStorageBlockingPolicyAllowAll;
203     case WebCore::SecurityOrigin::BlockThirdPartyStorage:
204         return _WKStorageBlockingPolicyBlockThirdParty;
205     case WebCore::SecurityOrigin::BlockAllStorage:
206         return _WKStorageBlockingPolicyBlockAll;
207     }
208
209     ASSERT_NOT_REACHED();
210     return _WKStorageBlockingPolicyAllowAll;
211 }
212
213 - (_WKStorageBlockingPolicy)_storageBlockingPolicy
214 {
215     return toAPI(static_cast<WebCore::SecurityOrigin::StorageBlockingPolicy>(_preferences->storageBlockingPolicy()));
216 }
217
218 - (void)_setStorageBlockingPolicy:(_WKStorageBlockingPolicy)policy
219 {
220     _preferences->setStorageBlockingPolicy(toStorageBlockingPolicy(policy));
221 }
222
223 - (BOOL)_offlineApplicationCacheIsEnabled
224 {
225     return _preferences->offlineWebApplicationCacheEnabled();
226 }
227
228 - (void)_setOfflineApplicationCacheIsEnabled:(BOOL)offlineApplicationCacheIsEnabled
229 {
230     _preferences->setOfflineWebApplicationCacheEnabled(offlineApplicationCacheIsEnabled);
231 }
232
233 - (BOOL)_fullScreenEnabled
234 {
235     return _preferences->fullScreenEnabled();
236 }
237
238 - (void)_setFullScreenEnabled:(BOOL)fullScreenEnabled
239 {
240     _preferences->setFullScreenEnabled(fullScreenEnabled);
241 }
242
243 - (BOOL)_allowsPictureInPictureMediaPlayback
244 {
245     return _preferences->allowsPictureInPictureMediaPlayback();
246 }
247
248 - (void)_setAllowsPictureInPictureMediaPlayback:(BOOL)allowed
249 {
250     _preferences->setAllowsPictureInPictureMediaPlayback(allowed);
251 }
252
253 - (BOOL)_compositingBordersVisible
254 {
255     return _preferences->compositingBordersVisible();
256 }
257
258 - (void)_setCompositingBordersVisible:(BOOL)compositingBordersVisible
259 {
260     _preferences->setCompositingBordersVisible(compositingBordersVisible);
261 }
262
263 - (BOOL)_compositingRepaintCountersVisible
264 {
265     return _preferences->compositingRepaintCountersVisible();
266 }
267
268 - (void)_setCompositingRepaintCountersVisible:(BOOL)repaintCountersVisible
269 {
270     _preferences->setCompositingRepaintCountersVisible(repaintCountersVisible);
271 }
272
273 - (BOOL)_tiledScrollingIndicatorVisible
274 {
275     return _preferences->tiledScrollingIndicatorVisible();
276 }
277
278 - (void)_setTiledScrollingIndicatorVisible:(BOOL)tiledScrollingIndicatorVisible
279 {
280     _preferences->setTiledScrollingIndicatorVisible(tiledScrollingIndicatorVisible);
281 }
282
283 - (BOOL)_resourceUsageOverlayVisible
284 {
285     return _preferences->resourceUsageOverlayVisible();
286 }
287
288 - (void)_setResourceUsageOverlayVisible:(BOOL)resourceUsageOverlayVisible
289 {
290     _preferences->setResourceUsageOverlayVisible(resourceUsageOverlayVisible);
291 }
292
293 - (_WKDebugOverlayRegions)_visibleDebugOverlayRegions
294 {
295     return _preferences->visibleDebugOverlayRegions();
296 }
297
298 - (void)_setVisibleDebugOverlayRegions:(_WKDebugOverlayRegions)regionFlags
299 {
300     _preferences->setVisibleDebugOverlayRegions(regionFlags);
301 }
302
303 - (BOOL)_simpleLineLayoutEnabled
304 {
305     return _preferences->simpleLineLayoutEnabled();
306 }
307
308 - (void)_setSimpleLineLayoutEnabled:(BOOL)simpleLineLayoutEnabled
309 {
310     _preferences->setSimpleLineLayoutEnabled(simpleLineLayoutEnabled);
311 }
312
313 - (BOOL)_simpleLineLayoutDebugBordersEnabled
314 {
315     return _preferences->simpleLineLayoutDebugBordersEnabled();
316 }
317
318 - (void)_setSimpleLineLayoutDebugBordersEnabled:(BOOL)simpleLineLayoutDebugBordersEnabled
319 {
320     _preferences->setSimpleLineLayoutDebugBordersEnabled(simpleLineLayoutDebugBordersEnabled);
321 }
322
323 - (BOOL)_acceleratedDrawingEnabled
324 {
325     return _preferences->acceleratedDrawingEnabled();
326 }
327
328 - (void)_setAcceleratedDrawingEnabled:(BOOL)acceleratedDrawingEnabled
329 {
330     _preferences->setAcceleratedDrawingEnabled(acceleratedDrawingEnabled);
331 }
332
333 - (BOOL)_displayListDrawingEnabled
334 {
335     return _preferences->displayListDrawingEnabled();
336 }
337
338 - (void)_setDisplayListDrawingEnabled:(BOOL)displayListDrawingEnabled
339 {
340     _preferences->setDisplayListDrawingEnabled(displayListDrawingEnabled);
341 }
342
343 - (BOOL)_visualViewportEnabled
344 {
345     return _preferences->visualViewportEnabled();
346 }
347
348 - (void)_setVisualViewportEnabled:(BOOL)_visualViewportEnabled
349 {
350     _preferences->setVisualViewportEnabled(_visualViewportEnabled);
351 }
352
353 - (BOOL)_largeImageAsyncDecodingEnabled
354 {
355     return _preferences->largeImageAsyncDecodingEnabled();
356 }
357
358 - (void)_setLargeImageAsyncDecodingEnabled:(BOOL)_largeImageAsyncDecodingEnabled
359 {
360     _preferences->setLargeImageAsyncDecodingEnabled(_largeImageAsyncDecodingEnabled);
361 }
362
363 - (BOOL)_animatedImageAsyncDecodingEnabled
364 {
365     return _preferences->animatedImageAsyncDecodingEnabled();
366 }
367
368 - (void)_setAnimatedImageAsyncDecodingEnabled:(BOOL)_animatedImageAsyncDecodingEnabled
369 {
370     _preferences->setAnimatedImageAsyncDecodingEnabled(_animatedImageAsyncDecodingEnabled);
371 }
372
373 - (BOOL)_textAutosizingEnabled
374 {
375     return _preferences->textAutosizingEnabled();
376 }
377
378 - (void)_setTextAutosizingEnabled:(BOOL)enabled
379 {
380     _preferences->setTextAutosizingEnabled(enabled);
381 }
382
383 - (BOOL)_subpixelAntialiasedLayerTextEnabled
384 {
385     return _preferences->subpixelAntialiasedLayerTextEnabled();
386 }
387
388 - (void)_setSubpixelAntialiasedLayerTextEnabled:(BOOL)enabled
389 {
390     _preferences->setSubpixelAntialiasedLayerTextEnabled(enabled);
391 }
392
393 - (BOOL)_developerExtrasEnabled
394 {
395     return _preferences->developerExtrasEnabled();
396 }
397
398 - (void)_setDeveloperExtrasEnabled:(BOOL)developerExtrasEnabled
399 {
400     _preferences->setDeveloperExtrasEnabled(developerExtrasEnabled);
401 }
402
403 - (BOOL)_logsPageMessagesToSystemConsoleEnabled
404 {
405     return _preferences->logsPageMessagesToSystemConsoleEnabled();
406 }
407
408 - (void)_setLogsPageMessagesToSystemConsoleEnabled:(BOOL)logsPageMessagesToSystemConsoleEnabled
409 {
410     _preferences->setLogsPageMessagesToSystemConsoleEnabled(logsPageMessagesToSystemConsoleEnabled);
411 }
412
413 - (BOOL)_hiddenPageDOMTimerThrottlingEnabled
414 {
415     return _preferences->hiddenPageDOMTimerThrottlingEnabled();
416 }
417
418 - (void)_setHiddenPageDOMTimerThrottlingEnabled:(BOOL)hiddenPageDOMTimerThrottlingEnabled
419 {
420     _preferences->setHiddenPageDOMTimerThrottlingEnabled(hiddenPageDOMTimerThrottlingEnabled);
421 }
422
423 - (BOOL)_hiddenPageDOMTimerThrottlingAutoIncreases
424 {
425     return _preferences->hiddenPageDOMTimerThrottlingAutoIncreases();
426 }
427
428 - (void)_setHiddenPageDOMTimerThrottlingAutoIncreases:(BOOL)hiddenPageDOMTimerThrottlingAutoIncreases
429 {
430     _preferences->setHiddenPageDOMTimerThrottlingAutoIncreases(hiddenPageDOMTimerThrottlingAutoIncreases);
431 }
432
433 - (BOOL)_pageVisibilityBasedProcessSuppressionEnabled
434 {
435     return _preferences->pageVisibilityBasedProcessSuppressionEnabled();
436 }
437
438 - (void)_setPageVisibilityBasedProcessSuppressionEnabled:(BOOL)pageVisibilityBasedProcessSuppressionEnabled
439 {
440     _preferences->setPageVisibilityBasedProcessSuppressionEnabled(pageVisibilityBasedProcessSuppressionEnabled);
441 }
442
443 - (BOOL)_allowFileAccessFromFileURLs
444 {
445     return _preferences->allowFileAccessFromFileURLs();
446 }
447
448 - (void)_setAllowFileAccessFromFileURLs:(BOOL)allowFileAccessFromFileURLs
449 {
450     _preferences->setAllowFileAccessFromFileURLs(allowFileAccessFromFileURLs);
451 }
452
453 - (_WKJavaScriptRuntimeFlags)_javaScriptRuntimeFlags
454 {
455     return _preferences->javaScriptRuntimeFlags();
456 }
457
458 - (void)_setJavaScriptRuntimeFlags:(_WKJavaScriptRuntimeFlags)javaScriptRuntimeFlags
459 {
460     _preferences->setJavaScriptRuntimeFlags(javaScriptRuntimeFlags);
461 }
462
463 - (BOOL)_isStandalone
464 {
465     return _preferences->standalone();
466 }
467
468 - (void)_setStandalone:(BOOL)standalone
469 {
470     _preferences->setStandalone(standalone);
471 }
472
473 - (BOOL)_diagnosticLoggingEnabled
474 {
475     return _preferences->diagnosticLoggingEnabled();
476 }
477
478 - (void)_setDiagnosticLoggingEnabled:(BOOL)diagnosticLoggingEnabled
479 {
480     _preferences->setDiagnosticLoggingEnabled(diagnosticLoggingEnabled);
481 }
482
483 - (NSUInteger)_defaultFontSize
484 {
485     return _preferences->defaultFontSize();
486 }
487
488 - (void)_setDefaultFontSize:(NSUInteger)defaultFontSize
489 {
490     _preferences->setDefaultFontSize(defaultFontSize);
491 }
492
493 - (NSUInteger)_defaultFixedPitchFontSize
494 {
495     return _preferences->defaultFixedFontSize();
496 }
497
498 - (void)_setDefaultFixedPitchFontSize:(NSUInteger)defaultFixedPitchFontSize
499 {
500     _preferences->setDefaultFixedFontSize(defaultFixedPitchFontSize);
501 }
502
503 - (NSString *)_fixedPitchFontFamily
504 {
505     return _preferences->fixedFontFamily();
506 }
507
508 - (void)_setFixedPitchFontFamily:(NSString *)fixedPitchFontFamily
509 {
510     _preferences->setFixedFontFamily(fixedPitchFontFamily);
511 }
512
513 + (NSArray<_WKExperimentalFeature *> *)_experimentalFeatures
514 {
515     auto features = WebKit::WebPreferences::experimentalFeatures();
516     return [wrapper(API::Array::create(WTFMove(features)).leakRef()) autorelease];
517 }
518
519 - (BOOL)_isEnabledForFeature:(_WKExperimentalFeature *)feature
520 {
521     return _preferences->isEnabledForFeature(*feature->_experimentalFeature);
522 }
523
524 - (void)_setEnabled:(BOOL)value forFeature:(_WKExperimentalFeature *)feature
525 {
526     _preferences->setEnabledForFeature(value, *feature->_experimentalFeature);
527 }
528
529 - (BOOL)_applePayCapabilityDisclosureAllowed
530 {
531 #if ENABLE(APPLE_PAY)
532     return _preferences->applePayCapabilityDisclosureAllowed();
533 #else
534     return NO;
535 #endif
536 }
537
538 - (void)_setApplePayCapabilityDisclosureAllowed:(BOOL)applePayCapabilityDisclosureAllowed
539 {
540 #if ENABLE(APPLE_PAY)
541     _preferences->setApplePayCapabilityDisclosureAllowed(applePayCapabilityDisclosureAllowed);
542 #endif
543 }
544
545 - (BOOL)_shouldSuppressKeyboardInputDuringProvisionalNavigation
546 {
547     return _preferences->shouldSuppressTextInputFromEditingDuringProvisionalNavigation();
548 }
549
550 - (void)_setShouldSuppressKeyboardInputDuringProvisionalNavigation:(BOOL)shouldSuppress
551 {
552     _preferences->setShouldSuppressTextInputFromEditingDuringProvisionalNavigation(shouldSuppress);
553 }
554
555 - (BOOL)_loadsImagesAutomatically
556 {
557     return _preferences->loadsImagesAutomatically();
558 }
559
560 - (void)_setLoadsImagesAutomatically:(BOOL)loadsImagesAutomatically
561 {
562     _preferences->setLoadsImagesAutomatically(loadsImagesAutomatically);
563 }
564
565 - (BOOL)_peerConnectionEnabled
566 {
567     return _preferences->peerConnectionEnabled();
568 }
569
570 - (void)_setPeerConnectionEnabled:(BOOL)enabled
571 {
572     _preferences->setPeerConnectionEnabled(enabled);
573 }
574
575 - (BOOL)_mediaDevicesEnabled
576 {
577     return _preferences->mediaDevicesEnabled();
578 }
579
580 - (void)_setMediaDevicesEnabled:(BOOL)enabled
581 {
582     _preferences->setMediaDevicesEnabled(enabled);
583 }
584
585 - (BOOL)_mockCaptureDevicesEnabled
586 {
587     return _preferences->mockCaptureDevicesEnabled();
588 }
589
590 - (void)_setMockCaptureDevicesEnabled:(BOOL)enabled
591 {
592     _preferences->setMockCaptureDevicesEnabled(enabled);
593 }
594
595 - (BOOL)_mockCaptureDevicesPromptEnabled
596 {
597     return _preferences->mockCaptureDevicesPromptEnabled();
598 }
599
600 - (void)_setMockCaptureDevicesPromptEnabled:(BOOL)enabled
601 {
602     _preferences->setMockCaptureDevicesPromptEnabled(enabled);
603 }
604
605 - (BOOL)_mediaCaptureRequiresSecureConnection
606 {
607     return _preferences->mediaCaptureRequiresSecureConnection();
608 }
609
610 - (void)_setMediaCaptureRequiresSecureConnection:(BOOL)requiresSecureConnection
611 {
612     _preferences->setMediaCaptureRequiresSecureConnection(requiresSecureConnection);
613 }
614
615 - (double)_inactiveMediaCaptureSteamRepromptIntervalInMinutes
616 {
617     return _preferences->inactiveMediaCaptureSteamRepromptIntervalInMinutes();
618 }
619
620 - (void)_setInactiveMediaCaptureSteamRepromptIntervalInMinutes:(double)interval
621 {
622     _preferences->setInactiveMediaCaptureSteamRepromptIntervalInMinutes(interval);
623 }
624
625 - (BOOL)_enumeratingAllNetworkInterfacesEnabled
626 {
627     return _preferences->enumeratingAllNetworkInterfacesEnabled();
628 }
629
630 - (void)_setEnumeratingAllNetworkInterfacesEnabled:(BOOL)enabled
631 {
632     _preferences->setEnumeratingAllNetworkInterfacesEnabled(enabled);
633 }
634
635 - (BOOL)_iceCandidateFilteringEnabled
636 {
637     return _preferences->iceCandidateFilteringEnabled();
638 }
639
640 - (void)_setICECandidateFilteringEnabled:(BOOL)enabled
641 {
642     _preferences->setICECandidateFilteringEnabled(enabled);
643 }
644
645 - (BOOL)_webRTCLegacyAPIEnabled
646 {
647     return !_preferences->webRTCLegacyAPIDisabled();
648 }
649
650 - (void)_setWebRTCLegacyAPIEnabled:(BOOL)enabled
651 {
652     _preferences->setWebRTCLegacyAPIDisabled(!enabled);
653 }
654
655 - (void)_setJavaScriptCanAccessClipboard:(BOOL)javaScriptCanAccessClipboard
656 {
657     _preferences->setJavaScriptCanAccessClipboard(javaScriptCanAccessClipboard);
658 }
659
660 #if PLATFORM(MAC)
661 - (void)_setJavaEnabledForLocalFiles:(BOOL)enabled
662 {
663     _preferences->setJavaEnabledForLocalFiles(enabled);
664 }
665
666 - (BOOL)_javaEnabledForLocalFiles
667 {
668     return _preferences->javaEnabledForLocalFiles();
669 }
670
671 - (void)_setCanvasUsesAcceleratedDrawing:(BOOL)enabled
672 {
673     _preferences->setCanvasUsesAcceleratedDrawing(enabled);
674 }
675
676 - (BOOL)_canvasUsesAcceleratedDrawing
677 {
678     return _preferences->canvasUsesAcceleratedDrawing();
679 }
680
681 - (void)_setAcceleratedCompositingEnabled:(BOOL)enabled
682 {
683     _preferences->setAcceleratedCompositingEnabled(enabled);
684 }
685
686 - (BOOL)_acceleratedCompositingEnabled
687 {
688     return _preferences->acceleratedCompositingEnabled();
689 }
690
691 - (void)_setDefaultTextEncodingName:(NSString *)name
692 {
693     _preferences->setDefaultTextEncodingName(name);
694 }
695
696 - (NSString *)_defaultTextEncodingName
697 {
698     return _preferences->defaultTextEncodingName();
699 }
700
701 - (void)_setNeedsSiteSpecificQuirks:(BOOL)enabled
702 {
703     _preferences->setNeedsSiteSpecificQuirks(enabled);
704 }
705
706 - (BOOL)_needsSiteSpecificQuirks
707 {
708     return _preferences->needsSiteSpecificQuirks();
709 }
710
711 - (void)_setAuthorAndUserStylesEnabled:(BOOL)enabled
712 {
713     _preferences->setAuthorAndUserStylesEnabled(enabled);
714 }
715
716 - (BOOL)_authorAndUserStylesEnabled
717 {
718     return _preferences->authorAndUserStylesEnabled();
719 }
720
721 - (void)_setDOMTimersThrottlingEnabled:(BOOL)enabled
722 {
723     _preferences->setDOMTimersThrottlingEnabled(enabled);
724 }
725
726 - (BOOL)_domTimersThrottlingEnabled
727 {
728     return _preferences->domTimersThrottlingEnabled();
729 }
730
731 - (void)_setWebArchiveDebugModeEnabled:(BOOL)enabled
732 {
733     _preferences->setWebArchiveDebugModeEnabled(enabled);
734 }
735
736 - (BOOL)_webArchiveDebugModeEnabled
737 {
738     return _preferences->webArchiveDebugModeEnabled();
739 }
740
741 - (void)_setLocalFileContentSniffingEnabled:(BOOL)enabled
742 {
743     _preferences->setLocalFileContentSniffingEnabled(enabled);
744 }
745
746 - (BOOL)_localFileContentSniffingEnabled
747 {
748     return _preferences->localFileContentSniffingEnabled();
749 }
750
751 - (void)_setUsesPageCache:(BOOL)enabled
752 {
753     _preferences->setUsesPageCache(enabled);
754 }
755
756 - (BOOL)_usesPageCache
757 {
758     return _preferences->usesPageCache();
759 }
760
761 - (void)_setPageCacheSupportsPlugins:(BOOL)enabled
762 {
763     _preferences->setPageCacheSupportsPlugins(enabled);
764 }
765
766 - (BOOL)_pageCacheSupportsPlugins
767 {
768     return _preferences->pageCacheSupportsPlugins();
769 }
770
771 - (void)_setShouldPrintBackgrounds:(BOOL)enabled
772 {
773     _preferences->setShouldPrintBackgrounds(enabled);
774 }
775
776 - (BOOL)_shouldPrintBackgrounds
777 {
778     return _preferences->shouldPrintBackgrounds();
779 }
780
781 - (void)_setWebSecurityEnabled:(BOOL)enabled
782 {
783     _preferences->setWebSecurityEnabled(enabled);
784 }
785
786 - (BOOL)_webSecurityEnabled
787 {
788     return _preferences->webSecurityEnabled();
789 }
790
791 - (void)_setUniversalAccessFromFileURLsAllowed:(BOOL)enabled
792 {
793     _preferences->setAllowUniversalAccessFromFileURLs(enabled);
794 }
795
796 - (BOOL)_universalAccessFromFileURLsAllowed
797 {
798     return _preferences->allowUniversalAccessFromFileURLs();
799 }
800
801 - (void)_setAVFoundationEnabled:(BOOL)enabled
802 {
803     _preferences->setAVFoundationEnabled(enabled);
804 }
805
806 - (BOOL)_avFoundationEnabled
807 {
808     return _preferences->isAVFoundationEnabled();
809 }
810
811 - (void)_setSuppressesIncrementalRendering:(BOOL)enabled
812 {
813     _preferences->setSuppressesIncrementalRendering(enabled);
814 }
815
816 - (BOOL)_suppressesIncrementalRendering
817 {
818     return _preferences->suppressesIncrementalRendering();
819 }
820
821 - (void)_setAsynchronousPluginInitializationEnabled:(BOOL)enabled
822 {
823     _preferences->setAsynchronousPluginInitializationEnabled(enabled);
824 }
825
826 - (BOOL)_asynchronousPluginInitializationEnabled
827 {
828     return _preferences->asynchronousPluginInitializationEnabled();
829 }
830
831 - (void)_setArtificialPluginInitializationDelayEnabled:(BOOL)enabled
832 {
833     _preferences->setArtificialPluginInitializationDelayEnabled(enabled);
834 }
835
836 - (BOOL)_artificialPluginInitializationDelayEnabled
837 {
838     return _preferences->artificialPluginInitializationDelayEnabled();
839 }
840
841 - (void)_setCookieEnabled:(BOOL)enabled
842 {
843     _preferences->setCookieEnabled(enabled);
844 }
845
846 - (BOOL)_cookieEnabled
847 {
848     return _preferences->cookieEnabled();
849 }
850
851 - (void)_setPlugInSnapshottingEnabled:(BOOL)enabled
852 {
853     _preferences->setPlugInSnapshottingEnabled(enabled);
854 }
855
856 - (BOOL)_plugInSnapshottingEnabled
857 {
858     return _preferences->plugInSnapshottingEnabled();
859 }
860
861 - (void)_setQTKitEnabled:(BOOL)enabled
862 {
863     _preferences->setQTKitEnabled(enabled);
864 }
865
866 - (BOOL)_qtKitEnabled
867 {
868     return _preferences->isQTKitEnabled();
869 }
870
871 - (void)_setSubpixelCSSOMElementMetricsEnabled:(BOOL)enabled
872 {
873     _preferences->setSubpixelCSSOMElementMetricsEnabled(enabled);
874 }
875
876 - (BOOL)_subpixelCSSOMElementMetricsEnabled
877 {
878     return _preferences->subpixelCSSOMElementMetricsEnabled();
879 }
880
881 - (void)_setMediaSourceEnabled:(BOOL)enabled
882 {
883     _preferences->setMediaSourceEnabled(enabled);
884 }
885
886 - (BOOL)_mediaSourceEnabled
887 {
888     return _preferences->mediaSourceEnabled();
889 }
890
891 - (void)_setViewGestureDebuggingEnabled:(BOOL)enabled
892 {
893     _preferences->setViewGestureDebuggingEnabled(enabled);
894 }
895
896 - (BOOL)_viewGestureDebuggingEnabled
897 {
898     return _preferences->viewGestureDebuggingEnabled();
899 }
900
901 - (void)_setCSSAnimationTriggersEnabled:(BOOL)enabled
902 {
903     _preferences->setCSSAnimationTriggersEnabled(enabled);
904 }
905
906 - (BOOL)_cssAnimationTriggersEnabled
907 {
908     return _preferences->cssAnimationTriggersEnabled();
909 }
910
911 - (void)_setStandardFontFamily:(NSString *)family
912 {
913     _preferences->setStandardFontFamily(family);
914 }
915
916 - (NSString *)_standardFontFamily
917 {
918     return _preferences->standardFontFamily();
919 }
920
921 - (void)_setNotificationsEnabled:(BOOL)enabled
922 {
923     _preferences->setNotificationsEnabled(enabled);
924 }
925
926 - (BOOL)_notificationsEnabled
927 {
928     return _preferences->notificationsEnabled();
929 }
930
931 - (void)_setBackspaceKeyNavigationEnabled:(BOOL)enabled
932 {
933     _preferences->setBackspaceKeyNavigationEnabled(enabled);
934 }
935
936 - (BOOL)_backspaceKeyNavigationEnabled
937 {
938     return _preferences->backspaceKeyNavigationEnabled();
939 }
940
941 - (void)_setWebGLEnabled:(BOOL)enabled
942 {
943     _preferences->setWebGLEnabled(enabled);
944 }
945
946 - (BOOL)_webGLEnabled
947 {
948     return _preferences->webGLEnabled();
949 }
950 #endif // PLATFORM(MAC)
951
952 - (BOOL)_javaScriptCanAccessClipboard
953 {
954     return _preferences->javaScriptCanAccessClipboard();
955 }
956
957 - (void)_setDOMPasteAllowed:(BOOL)domPasteAllowed
958 {
959     _preferences->setDOMPasteAllowed(domPasteAllowed);
960 }
961
962 - (BOOL)_domPasteAllowed
963 {
964     return _preferences->domPasteAllowed();
965 }
966
967 @end
968
969 #endif // WK_API_ENABLED