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