Only expose WKDataDetectorTypes and -[WKWebViewConfiguration dataDetectorTypes] on iOS
[WebKit-https.git] / Source / WebKit2 / UIProcess / API / Cocoa / WKWebViewConfiguration.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 "WKWebViewConfigurationInternal.h"
28
29 #if WK_API_ENABLED
30
31 #import "APIPageConfiguration.h"
32 #import "WKPreferences.h"
33 #import "WKProcessPool.h"
34 #import "WKUserContentController.h"
35 #import "WKWebViewContentProviderRegistry.h"
36 #import "WeakObjCPtr.h"
37 #import "_WKVisitedLinkProvider.h"
38 #import "_WKWebsiteDataStoreInternal.h"
39 #import <WebCore/RuntimeApplicationChecks.h>
40 #import <wtf/RetainPtr.h>
41
42 #if PLATFORM(IOS)
43 #import "UIKitSPI.h"
44 #import <WebCore/Device.h>
45 #endif
46
47 using namespace WebCore;
48
49 template<typename T> class LazyInitialized {
50 public:
51     typedef typename WTF::GetPtrHelper<T>::PtrType PtrType;
52
53     template<typename F>
54     PtrType get(F&& f)
55     {
56         if (!m_isInitialized) {
57             m_value = f();
58             m_isInitialized = true;
59         }
60
61         return m_value.get();
62     }
63
64     void set(PtrType t)
65     {
66         m_value = t;
67         m_isInitialized = true;
68     }
69
70     void set(T&& t)
71     {
72         m_value = WTFMove(t);
73         m_isInitialized = true;
74     }
75
76     PtrType peek()
77     {
78         return m_value.get();
79     }
80
81 private:
82     bool m_isInitialized = false;
83     T m_value;
84 };
85
86 @implementation WKWebViewConfiguration {
87     LazyInitialized<RetainPtr<WKProcessPool>> _processPool;
88     LazyInitialized<RetainPtr<WKPreferences>> _preferences;
89     LazyInitialized<RetainPtr<WKUserContentController>> _userContentController;
90     LazyInitialized<RetainPtr<_WKVisitedLinkStore>> _visitedLinkStore;
91     LazyInitialized<RetainPtr<WKWebsiteDataStore>> _websiteDataStore;
92     WebKit::WeakObjCPtr<WKWebView> _relatedWebView;
93     WebKit::WeakObjCPtr<WKWebView> _alternateWebViewForNavigationGestures;
94     BOOL _treatsSHA1SignedCertificatesAsInsecure;
95     RetainPtr<NSString> _groupIdentifier;
96     LazyInitialized<RetainPtr<NSString>> _applicationNameForUserAgent;
97     BOOL _respectsImageOrientation;
98     BOOL _printsBackgrounds;
99     CGFloat _incrementalRenderingSuppressionTimeout;
100     BOOL _allowsJavaScriptMarkup;
101     BOOL _convertsPositionStyleOnCopy;
102     BOOL _allowsMetaRefresh;
103     BOOL _allowUniversalAccessFromFileURLs;
104
105 #if PLATFORM(IOS)
106     LazyInitialized<RetainPtr<WKWebViewContentProviderRegistry>> _contentProviderRegistry;
107     BOOL _alwaysRunsAtForegroundPriority;
108     BOOL _allowsInlineMediaPlayback;
109     BOOL _inlineMediaPlaybackRequiresPlaysInlineAttribute;
110 #endif
111
112     BOOL _invisibleAutoplayNotPermitted;
113     BOOL _mediaDataLoadsAutomatically;
114     BOOL _attachmentElementEnabled;
115     BOOL _requiresUserActionForVideoPlayback;
116     BOOL _requiresUserActionForAudioPlayback;
117     BOOL _mainContentUserGestureOverrideEnabled;
118
119 #if PLATFORM(MAC)
120     BOOL _showsURLsInToolTips;
121     BOOL _serviceControlsEnabled;
122     BOOL _imageControlsEnabled;
123 #endif
124
125 #if USE(APPLE_INTERNAL_SDK)
126 #import <WebKitAdditions/WKWebViewConfigurationIvars.mm>
127 #endif
128 }
129
130 - (instancetype)init
131 {
132     if (!(self = [super init]))
133         return nil;
134     
135 #if PLATFORM(IOS)
136     _requiresUserActionForMediaPlayback = YES;
137     _allowsPictureInPictureMediaPlayback = YES;
138     _allowsInlineMediaPlayback = WebCore::deviceClass() == MGDeviceClassiPad;
139     _inlineMediaPlaybackRequiresPlaysInlineAttribute = !_allowsInlineMediaPlayback;
140     _mediaDataLoadsAutomatically = NO;
141 #else
142     _mediaDataLoadsAutomatically = YES;
143     _userInterfaceDirectionPolicy = WKUserInterfaceDirectionPolicyContent;
144 #endif
145     _requiresUserActionForVideoPlayback = NO;
146     _requiresUserActionForAudioPlayback = NO;
147     _mainContentUserGestureOverrideEnabled = NO;
148     _invisibleAutoplayNotPermitted = NO;
149
150 // FIXME: <rdar://problem/25135244> Should default to NO once clients have adopted the setting.
151 #if PLATFORM(IOS)
152     _attachmentElementEnabled = IOSApplication::isMobileMail();
153 #else
154     _attachmentElementEnabled = MacApplication::isAppleMail();
155 #endif
156
157 #if PLATFORM(IOS)
158     _respectsImageOrientation = YES;
159     _printsBackgrounds = YES;
160 #endif
161
162 #if PLATFORM(MAC)
163     _printsBackgrounds = NO;
164     _respectsImageOrientation = NO;
165     _showsURLsInToolTips = NO;
166     _serviceControlsEnabled = NO;
167     _imageControlsEnabled = NO;
168 #endif
169
170 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
171     _allowsAirPlayForMediaPlayback = YES;
172 #endif
173
174     _incrementalRenderingSuppressionTimeout = 5;
175     _allowsJavaScriptMarkup = YES;
176     _convertsPositionStyleOnCopy = NO;
177     _allowsMetaRefresh = YES;
178     _allowUniversalAccessFromFileURLs = NO;
179     _treatsSHA1SignedCertificatesAsInsecure = YES;
180
181     return self;
182 }
183
184 - (NSString *)description
185 {
186     return [NSString stringWithFormat:@"<%@: %p; processPool = %@; preferences = %@>", NSStringFromClass(self.class), self, self.processPool, self.preferences];
187 }
188
189 // FIXME: Encode the process pool, user content controller and website data store.
190
191 - (void)encodeWithCoder:(NSCoder *)coder
192 {
193     [coder encodeObject:self.processPool forKey:@"processPool"];
194     [coder encodeObject:self.preferences forKey:@"preferences"];
195     [coder encodeObject:self.userContentController forKey:@"userContentController"];
196     [coder encodeObject:self.websiteDataStore forKey:@"websiteDataStore"];
197
198     [coder encodeBool:self.suppressesIncrementalRendering forKey:@"suppressesIncrementalRendering"];
199     [coder encodeObject:self.applicationNameForUserAgent forKey:@"applicationNameForUserAgent"];
200     [coder encodeBool:self.allowsAirPlayForMediaPlayback forKey:@"allowsAirPlayForMediaPlayback"];
201
202 #if PLATFORM(IOS)
203     [coder encodeInteger:self.dataDetectorTypes forKey:@"dataDetectorTypes"];
204     [coder encodeBool:self.allowsInlineMediaPlayback forKey:@"allowsInlineMediaPlayback"];
205     [coder encodeBool:self.requiresUserActionForMediaPlayback forKey:@"requiresUserActionForMediaPlayback"];
206     [coder encodeInteger:self.selectionGranularity forKey:@"selectionGranularity"];
207     [coder encodeBool:self.allowsPictureInPictureMediaPlayback forKey:@"allowsPictureInPictureMediaPlayback"];
208 #else
209     [coder encodeInteger:self.userInterfaceDirectionPolicy forKey:@"userInterfaceDirectionPolicy"];
210 #endif
211 }
212
213 - (instancetype)initWithCoder:(NSCoder *)coder
214 {
215     if (!(self = [self init]))
216         return nil;
217
218     self.processPool = [coder decodeObjectForKey:@"processPool"];
219     self.preferences = [coder decodeObjectForKey:@"preferences"];
220     self.userContentController = [coder decodeObjectForKey:@"userContentController"];
221     self.websiteDataStore = [coder decodeObjectForKey:@"websiteDataStore"];
222
223     self.suppressesIncrementalRendering = [coder decodeBoolForKey:@"suppressesIncrementalRendering"];
224     self.applicationNameForUserAgent = [coder decodeObjectForKey:@"applicationNameForUserAgent"];
225     self.allowsAirPlayForMediaPlayback = [coder decodeBoolForKey:@"allowsAirPlayForMediaPlayback"];
226
227 #if PLATFORM(IOS)
228     self.dataDetectorTypes = [coder decodeIntegerForKey:@"dataDetectorTypes"];
229     self.allowsInlineMediaPlayback = [coder decodeBoolForKey:@"allowsInlineMediaPlayback"];
230     self.requiresUserActionForMediaPlayback = [coder decodeBoolForKey:@"requiresUserActionForMediaPlayback"];
231     self.selectionGranularity = static_cast<WKSelectionGranularity>([coder decodeIntegerForKey:@"selectionGranularity"]);
232     self.allowsPictureInPictureMediaPlayback = [coder decodeBoolForKey:@"allowsPictureInPictureMediaPlayback"];
233 #else
234     auto userInterfaceDirectionPolicyCandidate = static_cast<WKUserInterfaceDirectionPolicy>([coder decodeIntegerForKey:@"userInterfaceDirectionPolicy"]);
235     if (userInterfaceDirectionPolicyCandidate == WKUserInterfaceDirectionPolicyContent || userInterfaceDirectionPolicyCandidate == WKUserInterfaceDirectionPolicySystem)
236         self.userInterfaceDirectionPolicy = userInterfaceDirectionPolicyCandidate;
237 #endif
238
239     return self;
240 }
241
242 - (id)copyWithZone:(NSZone *)zone
243 {
244     WKWebViewConfiguration *configuration = [(WKWebViewConfiguration *)[[self class] allocWithZone:zone] init];
245
246     configuration.processPool = self.processPool;
247     configuration.preferences = self.preferences;
248     configuration.userContentController = self.userContentController;
249     configuration.websiteDataStore = self.websiteDataStore;
250     configuration._visitedLinkStore = self._visitedLinkStore;
251     configuration._relatedWebView = _relatedWebView.get().get();
252     configuration._alternateWebViewForNavigationGestures = _alternateWebViewForNavigationGestures.get().get();
253     configuration->_treatsSHA1SignedCertificatesAsInsecure = _treatsSHA1SignedCertificatesAsInsecure;
254 #if PLATFORM(IOS)
255     configuration._contentProviderRegistry = self._contentProviderRegistry;
256 #endif
257
258     configuration->_suppressesIncrementalRendering = self->_suppressesIncrementalRendering;
259     configuration.applicationNameForUserAgent = self.applicationNameForUserAgent;
260
261     configuration->_respectsImageOrientation = self->_respectsImageOrientation;
262     configuration->_printsBackgrounds = self->_printsBackgrounds;
263     configuration->_incrementalRenderingSuppressionTimeout = self->_incrementalRenderingSuppressionTimeout;
264     configuration->_allowsJavaScriptMarkup = self->_allowsJavaScriptMarkup;
265     configuration->_convertsPositionStyleOnCopy = self->_convertsPositionStyleOnCopy;
266     configuration->_allowsMetaRefresh = self->_allowsMetaRefresh;
267     configuration->_allowUniversalAccessFromFileURLs = self->_allowUniversalAccessFromFileURLs;
268
269     configuration->_invisibleAutoplayNotPermitted = self->_invisibleAutoplayNotPermitted;
270     configuration->_mediaDataLoadsAutomatically = self->_mediaDataLoadsAutomatically;
271     configuration->_attachmentElementEnabled = self->_attachmentElementEnabled;
272     configuration->_requiresUserActionForVideoPlayback = self->_requiresUserActionForVideoPlayback;
273     configuration->_requiresUserActionForAudioPlayback = self->_requiresUserActionForAudioPlayback;
274     configuration->_mainContentUserGestureOverrideEnabled = self->_mainContentUserGestureOverrideEnabled;
275
276 #if PLATFORM(IOS)
277     configuration->_allowsInlineMediaPlayback = self->_allowsInlineMediaPlayback;
278     configuration->_inlineMediaPlaybackRequiresPlaysInlineAttribute = self->_inlineMediaPlaybackRequiresPlaysInlineAttribute;
279     configuration->_requiresUserActionForMediaPlayback = self->_requiresUserActionForMediaPlayback;
280     configuration->_allowsPictureInPictureMediaPlayback = self->_allowsPictureInPictureMediaPlayback;
281     configuration->_alwaysRunsAtForegroundPriority = _alwaysRunsAtForegroundPriority;
282     configuration->_selectionGranularity = self->_selectionGranularity;
283 #endif
284 #if PLATFORM(MAC)
285     configuration->_userInterfaceDirectionPolicy = self->_userInterfaceDirectionPolicy;
286     configuration->_showsURLsInToolTips = self->_showsURLsInToolTips;
287     configuration->_serviceControlsEnabled = self->_serviceControlsEnabled;
288     configuration->_imageControlsEnabled = self->_imageControlsEnabled;
289 #endif
290 #if ENABLE(DATA_DETECTION) && PLATFORM(IOS)
291     configuration->_dataDetectorTypes = self->_dataDetectorTypes;
292 #endif
293 #if ENABLE(WIRELESS_TARGET_PLAYBACK)
294     configuration->_allowsAirPlayForMediaPlayback = self->_allowsAirPlayForMediaPlayback;
295 #endif
296
297 #if USE(APPLE_INTERNAL_SDK)
298 #import <WebKitAdditions/WKWebViewConfigurationCopy.mm>
299 #endif
300
301     return configuration;
302 }
303
304 - (WKProcessPool *)processPool
305 {
306     return _processPool.get([] { return adoptNS([[WKProcessPool alloc] init]); });
307 }
308
309 - (void)setProcessPool:(WKProcessPool *)processPool
310 {
311     _processPool.set(processPool);
312 }
313
314 - (WKPreferences *)preferences
315 {
316     return _preferences.get([] { return adoptNS([[WKPreferences alloc] init]); });
317 }
318
319 - (void)setPreferences:(WKPreferences *)preferences
320 {
321     _preferences.set(preferences);
322 }
323
324 - (WKUserContentController *)userContentController
325 {
326     return _userContentController.get([] { return adoptNS([[WKUserContentController alloc] init]); });
327 }
328
329 - (void)setUserContentController:(WKUserContentController *)userContentController
330 {
331     _userContentController.set(userContentController);
332 }
333
334 - (WKWebsiteDataStore *)websiteDataStore
335 {
336     return _websiteDataStore.get([] { return [WKWebsiteDataStore defaultDataStore]; });
337 }
338
339 - (void)setWebsiteDataStore:(WKWebsiteDataStore *)websiteDataStore
340 {
341     _websiteDataStore.set(websiteDataStore);
342 }
343
344 static NSString *defaultApplicationNameForUserAgent()
345 {
346 #if PLATFORM(IOS)
347     return [@"Mobile/" stringByAppendingString:[UIDevice currentDevice].buildVersion];
348 #else
349     return nil;
350 #endif
351 }
352
353 - (NSString *)applicationNameForUserAgent
354 {
355     return _applicationNameForUserAgent.get([] { return defaultApplicationNameForUserAgent(); });
356 }
357
358 - (void)setApplicationNameForUserAgent:(NSString *)applicationNameForUserAgent
359 {
360     _applicationNameForUserAgent.set(adoptNS([applicationNameForUserAgent copy]));
361 }
362
363 - (_WKVisitedLinkStore *)_visitedLinkStore
364 {
365     return _visitedLinkStore.get([] { return adoptNS([[_WKVisitedLinkStore alloc] init]); });
366 }
367
368 - (void)_setVisitedLinkStore:(_WKVisitedLinkStore *)visitedLinkStore
369 {
370     _visitedLinkStore.set(visitedLinkStore);
371 }
372
373 #pragma clang diagnostic push
374 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
375
376 - (_WKWebsiteDataStore *)_websiteDataStore
377 {
378     return self.websiteDataStore ? adoptNS([[_WKWebsiteDataStore alloc] initWithDataStore:self.websiteDataStore]).autorelease() : nullptr;
379 }
380
381 - (void)_setWebsiteDataStore:(_WKWebsiteDataStore *)websiteDataStore
382 {
383     self.websiteDataStore = websiteDataStore ? websiteDataStore->_dataStore.get() : nullptr;
384 }
385
386 -(_WKVisitedLinkProvider *)_visitedLinkProvider
387 {
388     return (_WKVisitedLinkProvider *)self._visitedLinkStore;
389 }
390
391 - (void)_setVisitedLinkProvider:(_WKVisitedLinkProvider *)_visitedLinkProvider
392 {
393     self._visitedLinkStore = _visitedLinkProvider;
394 }
395
396 #pragma clang diagnostic pop
397
398 #if PLATFORM(IOS)
399 - (WKWebViewContentProviderRegistry *)_contentProviderRegistry
400 {
401     return _contentProviderRegistry.get([] { return adoptNS([[WKWebViewContentProviderRegistry alloc] init]); });
402 }
403
404 - (void)_setContentProviderRegistry:(WKWebViewContentProviderRegistry *)registry
405 {
406     _contentProviderRegistry.set(registry);
407 }
408 #endif
409
410 - (void)_validate
411 {
412     if (!self.processPool)
413         [NSException raise:NSInvalidArgumentException format:@"configuration.processPool is nil"];
414
415     if (!self.preferences)
416         [NSException raise:NSInvalidArgumentException format:@"configuration.preferences is nil"];
417
418     if (!self.userContentController)
419         [NSException raise:NSInvalidArgumentException format:@"configuration.userContentController is nil"];
420
421     if (!self.websiteDataStore)
422         [NSException raise:NSInvalidArgumentException format:@"configuration.websiteDataStore is nil"];
423
424     if (!self._visitedLinkStore)
425         [NSException raise:NSInvalidArgumentException format:@"configuration._visitedLinkStore is nil"];
426
427 #if PLATFORM(IOS)
428     if (!self._contentProviderRegistry)
429         [NSException raise:NSInvalidArgumentException format:@"configuration._contentProviderRegistry is nil"];
430 #endif
431 }
432
433 @end
434
435 @implementation WKWebViewConfiguration (WKPrivate)
436
437 - (WKWebView *)_relatedWebView
438 {
439     return _relatedWebView.getAutoreleased();
440 }
441
442 - (void)_setRelatedWebView:(WKWebView *)relatedWebView
443 {
444     _relatedWebView = relatedWebView;
445 }
446
447 - (WKWebView *)_alternateWebViewForNavigationGestures
448 {
449     return _alternateWebViewForNavigationGestures.getAutoreleased();
450 }
451
452 - (void)_setAlternateWebViewForNavigationGestures:(WKWebView *)alternateView
453 {
454     _alternateWebViewForNavigationGestures = alternateView;
455 }
456
457 - (NSString *)_groupIdentifier
458 {
459     return _groupIdentifier.get();
460 }
461
462 - (void)_setGroupIdentifier:(NSString *)groupIdentifier
463 {
464     _groupIdentifier = groupIdentifier;
465 }
466
467 - (BOOL)_treatsSHA1SignedCertificatesAsInsecure
468 {
469     return _treatsSHA1SignedCertificatesAsInsecure;
470 }
471
472 - (void)_setTreatsSHA1SignedCertificatesAsInsecure:(BOOL)insecure
473 {
474     _treatsSHA1SignedCertificatesAsInsecure = insecure;
475 }
476
477 - (BOOL)_respectsImageOrientation
478 {
479     return _respectsImageOrientation;
480 }
481
482 - (void)_setRespectsImageOrientation:(BOOL)respectsImageOrientation
483 {
484     _respectsImageOrientation = respectsImageOrientation;
485 }
486
487 - (BOOL)_printsBackgrounds
488 {
489     return _printsBackgrounds;
490 }
491
492 - (void)_setPrintsBackgrounds:(BOOL)printsBackgrounds
493 {
494     _printsBackgrounds = printsBackgrounds;
495 }
496
497 - (CGFloat)_incrementalRenderingSuppressionTimeout
498 {
499     return _incrementalRenderingSuppressionTimeout;
500 }
501
502 - (void)_setIncrementalRenderingSuppressionTimeout:(CGFloat)incrementalRenderingSuppressionTimeout
503 {
504     _incrementalRenderingSuppressionTimeout = incrementalRenderingSuppressionTimeout;
505 }
506
507 - (BOOL)_allowsJavaScriptMarkup
508 {
509     return _allowsJavaScriptMarkup;
510 }
511
512 - (void)_setAllowsJavaScriptMarkup:(BOOL)allowsJavaScriptMarkup
513 {
514     _allowsJavaScriptMarkup = allowsJavaScriptMarkup;
515 }
516
517 - (BOOL)_allowUniversalAccessFromFileURLs
518 {
519     return _allowUniversalAccessFromFileURLs;
520 }
521
522 - (void)_setAllowUniversalAccessFromFileURLs:(BOOL)allowUniversalAccessFromFileURLs
523 {
524     _allowUniversalAccessFromFileURLs = allowUniversalAccessFromFileURLs;
525 }
526
527 - (BOOL)_convertsPositionStyleOnCopy
528 {
529     return _convertsPositionStyleOnCopy;
530 }
531
532 - (void)_setConvertsPositionStyleOnCopy:(BOOL)convertsPositionStyleOnCopy
533 {
534     _convertsPositionStyleOnCopy = convertsPositionStyleOnCopy;
535 }
536
537 - (BOOL)_allowsMetaRefresh
538 {
539     return _allowsMetaRefresh;
540 }
541
542 - (void)_setAllowsMetaRefresh:(BOOL)allowsMetaRefresh
543 {
544     _allowsMetaRefresh = allowsMetaRefresh;
545 }
546
547 #if PLATFORM(IOS)
548 - (BOOL)_alwaysRunsAtForegroundPriority
549 {
550     return _alwaysRunsAtForegroundPriority;
551 }
552
553 - (void)_setAlwaysRunsAtForegroundPriority:(BOOL)alwaysRunsAtForegroundPriority
554 {
555     _alwaysRunsAtForegroundPriority = alwaysRunsAtForegroundPriority;
556 }
557
558 - (BOOL)_inlineMediaPlaybackRequiresPlaysInlineAttribute
559 {
560     return _inlineMediaPlaybackRequiresPlaysInlineAttribute;
561 }
562
563 - (void)_setInlineMediaPlaybackRequiresPlaysInlineAttribute:(BOOL)requires
564 {
565     _inlineMediaPlaybackRequiresPlaysInlineAttribute = requires;
566 }
567 #endif // PLATFORM(IOS)
568
569 - (BOOL)_invisibleAutoplayNotPermitted
570 {
571     return _invisibleAutoplayNotPermitted;
572 }
573
574 - (void)_setInvisibleAutoplayNotPermitted:(BOOL)notPermitted
575 {
576     _invisibleAutoplayNotPermitted = notPermitted;
577 }
578
579 - (BOOL)_mediaDataLoadsAutomatically
580 {
581     return _mediaDataLoadsAutomatically;
582 }
583
584 - (void)_setMediaDataLoadsAutomatically:(BOOL)mediaDataLoadsAutomatically
585 {
586     _mediaDataLoadsAutomatically = mediaDataLoadsAutomatically;
587 }
588
589 - (BOOL)_attachmentElementEnabled
590 {
591     return _attachmentElementEnabled;
592 }
593
594 - (void)_setAttachmentElementEnabled:(BOOL)attachmentElementEnabled
595 {
596     _attachmentElementEnabled = attachmentElementEnabled;
597 }
598
599 - (BOOL)_requiresUserActionForVideoPlayback
600 {
601     return _requiresUserActionForVideoPlayback;
602 }
603
604 - (void)_setRequiresUserActionForVideoPlayback:(BOOL)requiresUserActionForVideoPlayback
605 {
606     _requiresUserActionForVideoPlayback = requiresUserActionForVideoPlayback;
607 }
608
609 - (BOOL)_requiresUserActionForAudioPlayback
610 {
611     return _requiresUserActionForAudioPlayback;
612 }
613
614 - (void)_setRequiresUserActionForAudioPlayback:(BOOL)requiresUserActionForAudioPlayback
615 {
616     _requiresUserActionForAudioPlayback = requiresUserActionForAudioPlayback;
617 }
618
619 - (BOOL)_mainContentUserGestureOverrideEnabled
620 {
621     return _mainContentUserGestureOverrideEnabled;
622 }
623
624 - (void)_setMainContentUserGestureOverrideEnabled:(BOOL)mainContentUserGestureOverrideEnabled
625 {
626     _mainContentUserGestureOverrideEnabled = mainContentUserGestureOverrideEnabled;
627 }
628
629 #if PLATFORM(MAC)
630 - (BOOL)_showsURLsInToolTips
631 {
632     return _showsURLsInToolTips;
633 }
634
635 - (void)_setShowsURLsInToolTips:(BOOL)showsURLsInToolTips
636 {
637     _showsURLsInToolTips = showsURLsInToolTips;
638 }
639
640 - (BOOL)_serviceControlsEnabled
641 {
642     return _serviceControlsEnabled;
643 }
644
645 - (void)_setServiceControlsEnabled:(BOOL)serviceControlsEnabled
646 {
647     _serviceControlsEnabled = serviceControlsEnabled;
648 }
649
650 - (BOOL)_imageControlsEnabled
651 {
652     return _imageControlsEnabled;
653 }
654
655 - (void)_setImageControlsEnabled:(BOOL)imageControlsEnabled
656 {
657     _imageControlsEnabled = imageControlsEnabled;
658 }
659 #endif // PLATFORM(MAC)
660
661 #if USE(APPLE_INTERNAL_SDK)
662 #import <WebKitAdditions/WKWebViewConfigurationPrivateMethods.mm>
663 #endif
664
665 @end
666
667 @implementation WKWebViewConfiguration (WKDeprecated)
668
669 #if PLATFORM(IOS)
670 - (BOOL)mediaPlaybackAllowsAirPlay
671 {
672     return self.allowsAirPlayForMediaPlayback;
673 }
674
675 - (void)setMediaPlaybackAllowsAirPlay:(BOOL)allowed
676 {
677     self.allowsAirPlayForMediaPlayback = allowed;
678 }
679
680 - (BOOL)mediaPlaybackRequiresUserAction
681 {
682     return self.requiresUserActionForMediaPlayback;
683 }
684
685 - (void)setMediaPlaybackRequiresUserAction:(BOOL)required
686 {
687     self.requiresUserActionForMediaPlayback = required;
688 }
689 #endif // PLATFORM(IOS)
690
691 @end
692
693 #endif // WK_API_ENABLED