1/*
2 * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
3 * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24 * THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef WKAPICast_h
28#define WKAPICast_h
29
30#include "CacheModel.h"
31#include "HTTPCookieAcceptPolicy.h"
32#include "InjectedBundleHitTestResultMediaType.h"
33#include "PluginModuleInfo.h"
34#include "ProcessTerminationReason.h"
35#include "ResourceCachesToClear.h"
36#include "WKBundleHitTestResult.h"
37#include "WKContext.h"
38#include "WKCookieManager.h"
39#include "WKCredentialTypes.h"
40#include "WKPage.h"
41#include "WKPreferencesRef.h"
42#include "WKPreferencesRefPrivate.h"
43#include "WKProcessTerminationReason.h"
44#include "WKProtectionSpaceTypes.h"
45#include "WKResourceCacheManager.h"
46#include "WKSharedAPICast.h"
47#include <WebCore/Credential.h>
48#include <WebCore/FrameLoaderTypes.h>
49#include <WebCore/PluginData.h>
50#include <WebCore/ProtectionSpace.h>
51#include <WebCore/Settings.h>
52
53namespace API {
54class ContentRuleList;
55class ContentRuleListStore;
56class InternalDebugFeature;
57class ExperimentalFeature;
58class FrameHandle;
59class FrameInfo;
60class HitTestResult;
61class Navigation;
62class NavigationAction;
63class NavigationData;
64class NavigationResponse;
65class OpenPanelParameters;
66class PageConfiguration;
67class ProcessPoolConfiguration;
68class SessionState;
69class UserScript;
70class WebsiteDataStore;
71class WebsitePolicies;
72class WindowFeatures;
73}
74
75namespace WebKit {
76
77class AuthenticationChallengeProxy;
78class AuthenticationDecisionListener;
79class DownloadProxy;
80class GeolocationPermissionRequest;
81class NotificationPermissionRequest;
82class UserMediaPermissionCheckProxy;
83class UserMediaPermissionRequestProxy;
84class WebBackForwardList;
85class WebBackForwardListItem;
86class WebColorPickerResultListenerProxy;
87class WebContextMenuListenerProxy;
88class WebCookieManagerProxy;
89class WebCredential;
90class WebFormSubmissionListenerProxy;
91class WebFramePolicyListenerProxy;
92class WebFrameProxy;
93class WebGeolocationManagerProxy;
94class WebGeolocationPosition;
95class WebIconDatabase;
96class WebInspectorProxy;
97class WebMediaSessionFocusManager;
98class WebMediaSessionMetadata;
99class WebNotification;
100class WebNotificationManagerProxy;
101class WebNotificationProvider;
102class WebOpenPanelResultListenerProxy;
103class WebPageGroup;
104class WebPageProxy;
105class WebPreferences;
106class WebProcessPool;
107class WebProtectionSpace;
108class WebRenderLayer;
109class WebRenderObject;
110class WebResourceLoadStatisticsManager;
111class WebTextChecker;
112class WebUserContentControllerProxy;
113class WebViewportAttributes;
114
115WK_ADD_API_MAPPING(WKAuthenticationChallengeRef, AuthenticationChallengeProxy)
116WK_ADD_API_MAPPING(WKAuthenticationDecisionListenerRef, AuthenticationDecisionListener)
117WK_ADD_API_MAPPING(WKBackForwardListItemRef, WebBackForwardListItem)
118WK_ADD_API_MAPPING(WKBackForwardListRef, WebBackForwardList)
119WK_ADD_API_MAPPING(WKBundleHitTestResultMediaType, BundleHitTestResultMediaType)
120WK_ADD_API_MAPPING(WKColorPickerResultListenerRef, WebColorPickerResultListenerProxy)
121WK_ADD_API_MAPPING(WKContextRef, WebProcessPool)
122WK_ADD_API_MAPPING(WKContextConfigurationRef, API::ProcessPoolConfiguration)
123WK_ADD_API_MAPPING(WKContextMenuListenerRef, WebContextMenuListenerProxy)
124WK_ADD_API_MAPPING(WKCookieManagerRef, WebCookieManagerProxy)
125WK_ADD_API_MAPPING(WKCredentialRef, WebCredential)
126WK_ADD_API_MAPPING(WKDownloadRef, DownloadProxy)
127WK_ADD_API_MAPPING(WKFormSubmissionListenerRef, WebFormSubmissionListenerProxy)
128WK_ADD_API_MAPPING(WKFramePolicyListenerRef, WebFramePolicyListenerProxy)
129WK_ADD_API_MAPPING(WKFrameHandleRef, API::FrameHandle)
130WK_ADD_API_MAPPING(WKFrameInfoRef, API::FrameInfo)
131WK_ADD_API_MAPPING(WKFrameRef, WebFrameProxy)
132WK_ADD_API_MAPPING(WKGeolocationManagerRef, WebGeolocationManagerProxy)
133WK_ADD_API_MAPPING(WKGeolocationPermissionRequestRef, GeolocationPermissionRequest)
134WK_ADD_API_MAPPING(WKGeolocationPositionRef, WebGeolocationPosition)
135WK_ADD_API_MAPPING(WKHitTestResultRef, API::HitTestResult)
136WK_ADD_API_MAPPING(WKIconDatabaseRef, WebIconDatabase)
137WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy)
138WK_ADD_API_MAPPING(WKMediaSessionFocusManagerRef, WebMediaSessionFocusManager)
139WK_ADD_API_MAPPING(WKMediaSessionMetadataRef, WebMediaSessionMetadata)
140WK_ADD_API_MAPPING(WKNavigationActionRef, API::NavigationAction)
141WK_ADD_API_MAPPING(WKNavigationDataRef, API::NavigationData)
142WK_ADD_API_MAPPING(WKNavigationRef, API::Navigation)
143WK_ADD_API_MAPPING(WKNavigationResponseRef, API::NavigationResponse)
144WK_ADD_API_MAPPING(WKNotificationManagerRef, WebNotificationManagerProxy)
145WK_ADD_API_MAPPING(WKNotificationPermissionRequestRef, NotificationPermissionRequest)
146WK_ADD_API_MAPPING(WKNotificationProviderRef, WebNotificationProvider)
147WK_ADD_API_MAPPING(WKNotificationRef, WebNotification)
148WK_ADD_API_MAPPING(WKOpenPanelParametersRef, API::OpenPanelParameters)
149WK_ADD_API_MAPPING(WKOpenPanelResultListenerRef, WebOpenPanelResultListenerProxy)
150WK_ADD_API_MAPPING(WKPageGroupRef, WebPageGroup)
151WK_ADD_API_MAPPING(WKPageConfigurationRef, API::PageConfiguration)
152WK_ADD_API_MAPPING(WKPageRef, WebPageProxy)
153WK_ADD_API_MAPPING(WKPreferencesRef, WebPreferences)
154WK_ADD_API_MAPPING(WKProtectionSpaceRef, WebProtectionSpace)
155WK_ADD_API_MAPPING(WKRenderLayerRef, WebRenderLayer)
156WK_ADD_API_MAPPING(WKRenderObjectRef, WebRenderObject)
157WK_ADD_API_MAPPING(WKResourceLoadStatisticsManagerRef, WebResourceLoadStatisticsManager)
158WK_ADD_API_MAPPING(WKSessionStateRef, API::SessionState)
159WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker)
160WK_ADD_API_MAPPING(WKUserContentControllerRef, WebUserContentControllerProxy)
161WK_ADD_API_MAPPING(WKUserContentExtensionStoreRef, API::ContentRuleListStore)
162WK_ADD_API_MAPPING(WKUserContentFilterRef, API::ContentRuleList)
163WK_ADD_API_MAPPING(WKUserMediaPermissionCheckRef, UserMediaPermissionCheckProxy)
164WK_ADD_API_MAPPING(WKUserMediaPermissionRequestRef, UserMediaPermissionRequestProxy)
165WK_ADD_API_MAPPING(WKUserScriptRef, API::UserScript)
166WK_ADD_API_MAPPING(WKViewportAttributesRef, WebViewportAttributes)
167WK_ADD_API_MAPPING(WKWebsiteDataStoreRef, API::WebsiteDataStore)
168WK_ADD_API_MAPPING(WKWebsitePoliciesRef, API::WebsitePolicies)
169WK_ADD_API_MAPPING(WKWindowFeaturesRef, API::WindowFeatures)
170
171/* Enum conversions */
172
173inline BundleHitTestResultMediaType toBundleHitTestResultMediaType(WKBundleHitTestResultMediaType wkMediaType)
174{
175 switch (wkMediaType) {
176 case kWKBundleHitTestResultMediaTypeNone:
177 return BundleHitTestResultMediaTypeNone;
178 case kWKBundleHitTestResultMediaTypeAudio:
179 return BundleHitTestResultMediaTypeAudio;
180 case kWKBundleHitTestResultMediaTypeVideo:
181 return BundleHitTestResultMediaTypeVideo;
182 }
183
184 ASSERT_NOT_REACHED();
185 return BundleHitTestResultMediaTypeNone;
186}
187
188inline WKBundleHitTestResultMediaType toAPI(BundleHitTestResultMediaType mediaType)
189{
190 switch (mediaType) {
191 case BundleHitTestResultMediaTypeNone:
192 return kWKBundleHitTestResultMediaTypeNone;
193 case BundleHitTestResultMediaTypeAudio:
194 return kWKBundleHitTestResultMediaTypeAudio;
195 case BundleHitTestResultMediaTypeVideo:
196 return kWKBundleHitTestResultMediaTypeVideo;
197 }
198
199 ASSERT_NOT_REACHED();
200 return kWKBundleHitTestResultMediaTypeNone;
201}
202
203inline CacheModel toCacheModel(WKCacheModel wkCacheModel)
204{
205 switch (wkCacheModel) {
206 case kWKCacheModelDocumentViewer:
207 return CacheModel::DocumentViewer;
208 case kWKCacheModelDocumentBrowser:
209 return CacheModel::DocumentBrowser;
210 case kWKCacheModelPrimaryWebBrowser:
211 return CacheModel::PrimaryWebBrowser;
212 }
213
214 ASSERT_NOT_REACHED();
215 return CacheModel::DocumentViewer;
216}
217
218inline WKCacheModel toAPI(CacheModel cacheModel)
219{
220 switch (cacheModel) {
221 case CacheModel::DocumentViewer:
222 return kWKCacheModelDocumentViewer;
223 case CacheModel::DocumentBrowser:
224 return kWKCacheModelDocumentBrowser;
225 case CacheModel::PrimaryWebBrowser:
226 return kWKCacheModelPrimaryWebBrowser;
227 }
228
229 return kWKCacheModelDocumentViewer;
230}
231
232inline WKProcessTerminationReason toAPI(ProcessTerminationReason reason)
233{
234 switch (reason) {
235 case ProcessTerminationReason::ExceededMemoryLimit:
236 return kWKProcessTerminationReasonExceededMemoryLimit;
237 case ProcessTerminationReason::ExceededCPULimit:
238 return kWKProcessTerminationReasonExceededCPULimit;
239 case ProcessTerminationReason::NavigationSwap:
240 // We probably shouldn't bother coming up with a new C-API type for process-swapping.
241 // "Requested by client" seems like the best match for existing types.
242 FALLTHROUGH;
243 case ProcessTerminationReason::RequestedByClient:
244 return kWKProcessTerminationReasonRequestedByClient;
245 case ProcessTerminationReason::Crash:
246 return kWKProcessTerminationReasonCrash;
247 }
248
249 return kWKProcessTerminationReasonCrash;
250}
251
252inline WKEditableLinkBehavior toAPI(WebCore::EditableLinkBehavior behavior)
253{
254 switch (behavior) {
255 case WebCore::EditableLinkDefaultBehavior:
256 return kWKEditableLinkBehaviorDefault;
257 case WebCore::EditableLinkAlwaysLive:
258 return kWKEditableLinkBehaviorAlwaysLive;
259 case WebCore::EditableLinkOnlyLiveWithShiftKey:
260 return kWKEditableLinkBehaviorOnlyLiveWithShiftKey;
261 case WebCore::EditableLinkLiveWhenNotFocused:
262 return kWKEditableLinkBehaviorLiveWhenNotFocused;
263 case WebCore::EditableLinkNeverLive:
264 return kWKEditableLinkBehaviorNeverLive;
265 }
266
267 ASSERT_NOT_REACHED();
268 return kWKEditableLinkBehaviorNeverLive;
269}
270
271inline WebCore::EditableLinkBehavior toEditableLinkBehavior(WKEditableLinkBehavior wkBehavior)
272{
273 switch (wkBehavior) {
274 case kWKEditableLinkBehaviorDefault:
275 return WebCore::EditableLinkDefaultBehavior;
276 case kWKEditableLinkBehaviorAlwaysLive:
277 return WebCore::EditableLinkAlwaysLive;
278 case kWKEditableLinkBehaviorOnlyLiveWithShiftKey:
279 return WebCore::EditableLinkOnlyLiveWithShiftKey;
280 case kWKEditableLinkBehaviorLiveWhenNotFocused:
281 return WebCore::EditableLinkLiveWhenNotFocused;
282 case kWKEditableLinkBehaviorNeverLive:
283 return WebCore::EditableLinkNeverLive;
284 }
285
286 ASSERT_NOT_REACHED();
287 return WebCore::EditableLinkNeverLive;
288}
289
290inline WKProtectionSpaceServerType toAPI(WebCore::ProtectionSpaceServerType type)
291{
292 switch (type) {
293 case WebCore::ProtectionSpaceServerHTTP:
294 return kWKProtectionSpaceServerTypeHTTP;
295 case WebCore::ProtectionSpaceServerHTTPS:
296 return kWKProtectionSpaceServerTypeHTTPS;
297 case WebCore::ProtectionSpaceServerFTP:
298 return kWKProtectionSpaceServerTypeFTP;
299 case WebCore::ProtectionSpaceServerFTPS:
300 return kWKProtectionSpaceServerTypeFTPS;
301 case WebCore::ProtectionSpaceProxyHTTP:
302 return kWKProtectionSpaceProxyTypeHTTP;
303 case WebCore::ProtectionSpaceProxyHTTPS:
304 return kWKProtectionSpaceProxyTypeHTTPS;
305 case WebCore::ProtectionSpaceProxyFTP:
306 return kWKProtectionSpaceProxyTypeFTP;
307 case WebCore::ProtectionSpaceProxySOCKS:
308 return kWKProtectionSpaceProxyTypeSOCKS;
309 }
310 return kWKProtectionSpaceServerTypeHTTP;
311}
312
313inline WKProtectionSpaceAuthenticationScheme toAPI(WebCore::ProtectionSpaceAuthenticationScheme type)
314{
315 switch (type) {
316 case WebCore::ProtectionSpaceAuthenticationSchemeDefault:
317 return kWKProtectionSpaceAuthenticationSchemeDefault;
318 case WebCore::ProtectionSpaceAuthenticationSchemeHTTPBasic:
319 return kWKProtectionSpaceAuthenticationSchemeHTTPBasic;
320 case WebCore::ProtectionSpaceAuthenticationSchemeHTTPDigest:
321 return kWKProtectionSpaceAuthenticationSchemeHTTPDigest;
322 case WebCore::ProtectionSpaceAuthenticationSchemeHTMLForm:
323 return kWKProtectionSpaceAuthenticationSchemeHTMLForm;
324 case WebCore::ProtectionSpaceAuthenticationSchemeNTLM:
325 return kWKProtectionSpaceAuthenticationSchemeNTLM;
326 case WebCore::ProtectionSpaceAuthenticationSchemeNegotiate:
327 return kWKProtectionSpaceAuthenticationSchemeNegotiate;
328 case WebCore::ProtectionSpaceAuthenticationSchemeClientCertificateRequested:
329 return kWKProtectionSpaceAuthenticationSchemeClientCertificateRequested;
330 case WebCore::ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested:
331 return kWKProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested;
332 case WebCore::ProtectionSpaceAuthenticationSchemeOAuth:
333 return kWKProtectionSpaceAuthenticationSchemeOAuth;
334 default:
335 return kWKProtectionSpaceAuthenticationSchemeUnknown;
336 }
337}
338
339inline WebCore::CredentialPersistence toCredentialPersistence(WKCredentialPersistence type)
340{
341 switch (type) {
342 case kWKCredentialPersistenceNone:
343 return WebCore::CredentialPersistenceNone;
344 case kWKCredentialPersistenceForSession:
345 return WebCore::CredentialPersistenceForSession;
346 case kWKCredentialPersistencePermanent:
347 return WebCore::CredentialPersistencePermanent;
348 default:
349 return WebCore::CredentialPersistenceNone;
350 }
351}
352
353inline ResourceCachesToClear toResourceCachesToClear(WKResourceCachesToClear wkResourceCachesToClear)
354{
355 switch (wkResourceCachesToClear) {
356 case WKResourceCachesToClearAll:
357 return AllResourceCaches;
358 case WKResourceCachesToClearInMemoryOnly:
359 return InMemoryResourceCachesOnly;
360 }
361
362 ASSERT_NOT_REACHED();
363 return AllResourceCaches;
364}
365
366inline HTTPCookieAcceptPolicy toHTTPCookieAcceptPolicy(WKHTTPCookieAcceptPolicy policy)
367{
368 switch (policy) {
369 case kWKHTTPCookieAcceptPolicyAlways:
370 return HTTPCookieAcceptPolicyAlways;
371 case kWKHTTPCookieAcceptPolicyNever:
372 return HTTPCookieAcceptPolicyNever;
373 case kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
374 return HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
375 case kWKHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain:
376 return HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain;
377 }
378
379 ASSERT_NOT_REACHED();
380 return HTTPCookieAcceptPolicyAlways;
381}
382
383inline WKHTTPCookieAcceptPolicy toAPI(HTTPCookieAcceptPolicy policy)
384{
385 switch (policy) {
386 case HTTPCookieAcceptPolicyAlways:
387 return kWKHTTPCookieAcceptPolicyAlways;
388 case HTTPCookieAcceptPolicyNever:
389 return kWKHTTPCookieAcceptPolicyNever;
390 case HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
391 return kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
392 case HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain:
393 return kWKHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain;
394 }
395
396 ASSERT_NOT_REACHED();
397 return kWKHTTPCookieAcceptPolicyAlways;
398}
399
400inline WebCore::SecurityOrigin::StorageBlockingPolicy toStorageBlockingPolicy(WKStorageBlockingPolicy policy)
401{
402 switch (policy) {
403 case kWKAllowAllStorage:
404 return WebCore::SecurityOrigin::AllowAllStorage;
405 case kWKBlockThirdPartyStorage:
406 return WebCore::SecurityOrigin::BlockThirdPartyStorage;
407 case kWKBlockAllStorage:
408 return WebCore::SecurityOrigin::BlockAllStorage;
409 }
410
411 ASSERT_NOT_REACHED();
412 return WebCore::SecurityOrigin::AllowAllStorage;
413}
414
415inline WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPolicy policy)
416{
417 switch (policy) {
418 case WebCore::SecurityOrigin::AllowAllStorage:
419 return kWKAllowAllStorage;
420 case WebCore::SecurityOrigin::BlockThirdPartyStorage:
421 return kWKBlockThirdPartyStorage;
422 case WebCore::SecurityOrigin::BlockAllStorage:
423 return kWKBlockAllStorage;
424 }
425
426 ASSERT_NOT_REACHED();
427 return kWKAllowAllStorage;
428}
429
430inline WKPluginLoadPolicy toWKPluginLoadPolicy(PluginModuleLoadPolicy pluginModuleLoadPolicy)
431{
432 switch (pluginModuleLoadPolicy) {
433 case PluginModuleLoadNormally:
434 return kWKPluginLoadPolicyLoadNormally;
435 case PluginModuleLoadUnsandboxed:
436 return kWKPluginLoadPolicyLoadUnsandboxed;
437 case PluginModuleBlockedForSecurity:
438 return kWKPluginLoadPolicyBlocked;
439 case PluginModuleBlockedForCompatibility:
440 return kWKPluginLoadPolicyBlockedForCompatibility;
441 }
442
443 ASSERT_NOT_REACHED();
444 return kWKPluginLoadPolicyBlocked;
445}
446
447inline WKPluginLoadClientPolicy toWKPluginLoadClientPolicy(WebCore::PluginLoadClientPolicy PluginLoadClientPolicy)
448{
449 switch (PluginLoadClientPolicy) {
450 case WebCore::PluginLoadClientPolicyUndefined:
451 return kWKPluginLoadClientPolicyUndefined;
452 case WebCore::PluginLoadClientPolicyBlock:
453 return kWKPluginLoadClientPolicyBlock;
454 case WebCore::PluginLoadClientPolicyAsk:
455 return kWKPluginLoadClientPolicyAsk;
456 case WebCore::PluginLoadClientPolicyAllow:
457 return kWKPluginLoadClientPolicyAllow;
458 case WebCore::PluginLoadClientPolicyAllowAlways:
459 return kWKPluginLoadClientPolicyAllowAlways;
460 }
461
462 ASSERT_NOT_REACHED();
463 return kWKPluginLoadClientPolicyBlock;
464}
465
466inline PluginModuleLoadPolicy toPluginModuleLoadPolicy(WKPluginLoadPolicy pluginLoadPolicy)
467{
468 switch (pluginLoadPolicy) {
469 case kWKPluginLoadPolicyLoadNormally:
470 return PluginModuleLoadNormally;
471 case kWKPluginLoadPolicyBlocked:
472 return PluginModuleBlockedForSecurity;
473 case kWKPluginLoadPolicyBlockedForCompatibility:
474 return PluginModuleBlockedForCompatibility;
475 case kWKPluginLoadPolicyLoadUnsandboxed:
476 return PluginModuleLoadUnsandboxed;
477 }
478
479 ASSERT_NOT_REACHED();
480 return PluginModuleBlockedForSecurity;
481}
482
483inline WebCore::PluginLoadClientPolicy toPluginLoadClientPolicy(WKPluginLoadClientPolicy pluginLoadClientPolicy)
484{
485 switch (pluginLoadClientPolicy) {
486 case kWKPluginLoadClientPolicyUndefined:
487 return WebCore::PluginLoadClientPolicyUndefined;
488 case kWKPluginLoadClientPolicyBlock:
489 return WebCore::PluginLoadClientPolicyBlock;
490 case kWKPluginLoadClientPolicyAsk:
491 return WebCore::PluginLoadClientPolicyAsk;
492 case kWKPluginLoadClientPolicyAllow:
493 return WebCore::PluginLoadClientPolicyAllow;
494 case kWKPluginLoadClientPolicyAllowAlways:
495 return WebCore::PluginLoadClientPolicyAllowAlways;
496 }
497
498 ASSERT_NOT_REACHED();
499 return WebCore::PluginLoadClientPolicyBlock;
500}
501
502inline WebCore::WebGLLoadPolicy toWebGLLoadPolicy(WKWebGLLoadPolicy webGLLoadPolicy)
503{
504 switch (webGLLoadPolicy) {
505 case kWKWebGLLoadPolicyLoadNormally:
506 return WebCore::WebGLAllowCreation;
507 case kWKWebGLLoadPolicyBlocked:
508 return WebCore::WebGLBlockCreation;
509 case kWKWebGLLoadPolicyPending:
510 return WebCore::WebGLPendingCreation;
511 }
512
513 ASSERT_NOT_REACHED();
514 return WebCore::WebGLAllowCreation;
515}
516
517inline WKWebGLLoadPolicy toAPI(WebCore::WebGLLoadPolicy webGLLoadPolicy)
518{
519 switch (webGLLoadPolicy) {
520 case WebCore::WebGLAllowCreation:
521 return kWKWebGLLoadPolicyLoadNormally;
522 case WebCore::WebGLBlockCreation:
523 return kWKWebGLLoadPolicyBlocked;
524 case WebCore::WebGLPendingCreation:
525 return kWKWebGLLoadPolicyPending;
526 }
527
528 ASSERT_NOT_REACHED();
529 return kWKWebGLLoadPolicyLoadNormally;
530}
531
532} // namespace WebKit
533
534#if defined(BUILDING_GTK__)
535#include "WKAPICastGtk.h"
536#endif
537
538#if defined(BUILDING_WPE__)
539#include "WKAPICastWPE.h"
540#endif
541
542#if defined(WIN32) || defined(_WIN32)
543#include "WKAPICastWin.h"
544#endif
545
546#endif // WKAPICast_h
547