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