f8f1b83eca33382a48db8fd01411ab8c44d92d5f
[WebKit-https.git] / Source / WebKit2 / UIProcess / API / C / WKAPICast.h
1 /*
2  * Copyright (C) 2010, 2011 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 "FontSmoothingLevel.h"
32 #include "HTTPCookieAcceptPolicy.h"
33 #include "InjectedBundleHitTestResultMediaType.h"
34 #include "PluginModuleInfo.h"
35 #include "ProcessModel.h"
36 #include "ResourceCachesToClear.h"
37 #include "WKBundleHitTestResult.h"
38 #include "WKContext.h"
39 #include "WKCookieManager.h"
40 #include "WKCredentialTypes.h"
41 #include "WKPage.h"
42 #include "WKPreferencesRef.h"
43 #include "WKPreferencesRefPrivate.h"
44 #include "WKProtectionSpaceTypes.h"
45 #include "WKResourceCacheManager.h"
46 #include "WKSharedAPICast.h"
47 #include "WebGrammarDetail.h"
48 #include <WebCore/Credential.h>
49 #include <WebCore/FrameLoaderTypes.h>
50 #include <WebCore/ProtectionSpace.h>
51 #include <WebCore/Settings.h>
52
53 namespace API {
54 class NavigationData;
55 class PageConfiguration;
56 class ProcessPoolConfiguration;
57 class SessionState;
58 class UserContentFilter;
59 class UserScript;
60 }
61
62 namespace WebKit {
63
64 class AuthenticationChallengeProxy;
65 class AuthenticationDecisionListener;
66 class DownloadProxy;
67 class GeolocationPermissionRequestProxy;
68 class NotificationPermissionRequest;
69 class UserMediaPermissionRequestProxy;
70 class WebApplicationCacheManagerProxy;
71 class WebBackForwardList;
72 class WebBackForwardListItem;
73 class WebBatteryManagerProxy;
74 class WebBatteryStatus;
75 class WebColorPickerResultListenerProxy;
76 class WebCookieManagerProxy;
77 class WebCredential;
78 class WebDatabaseManagerProxy;
79 class WebFormSubmissionListenerProxy;
80 class WebFramePolicyListenerProxy;
81 class WebFrameProxy;
82 class WebGeolocationManagerProxy;
83 class WebGeolocationPosition;
84 class WebGrammarDetail;
85 class WebHitTestResult;
86 class WebIconDatabase;
87 class WebInspectorProxy;
88 class WebKeyValueStorageManager;
89 class WebMediaCacheManagerProxy;
90 class WebNotification;
91 class WebNotificationManagerProxy;
92 class WebNotificationProvider;
93 class WebOpenPanelParameters;
94 class WebOpenPanelResultListenerProxy;
95 class WebOriginDataManagerProxy;
96 class WebPageGroup;
97 class WebPageProxy;
98 class WebPluginSiteDataManager;
99 class WebPreferences;
100 class WebProcessPool;
101 class WebProtectionSpace;
102 class WebRenderLayer;
103 class WebRenderObject;
104 class WebResourceCacheManagerProxy;
105 class WebTextChecker;
106 class WebUserContentControllerProxy;
107 class WebVibrationProxy;
108 class WebViewportAttributes;
109
110 WK_ADD_API_MAPPING(WKApplicationCacheManagerRef, WebApplicationCacheManagerProxy)
111 WK_ADD_API_MAPPING(WKAuthenticationChallengeRef, AuthenticationChallengeProxy)
112 WK_ADD_API_MAPPING(WKAuthenticationDecisionListenerRef, AuthenticationDecisionListener)
113 WK_ADD_API_MAPPING(WKBackForwardListItemRef, WebBackForwardListItem)
114 WK_ADD_API_MAPPING(WKBackForwardListRef, WebBackForwardList)
115 WK_ADD_API_MAPPING(WKBatteryManagerRef, WebBatteryManagerProxy)
116 WK_ADD_API_MAPPING(WKBatteryStatusRef, WebBatteryStatus)
117 WK_ADD_API_MAPPING(WKBundleHitTestResultMediaType, BundleHitTestResultMediaType)
118 WK_ADD_API_MAPPING(WKResourceCacheManagerRef, WebResourceCacheManagerProxy)
119 WK_ADD_API_MAPPING(WKColorPickerResultListenerRef, WebColorPickerResultListenerProxy)
120 WK_ADD_API_MAPPING(WKContextRef, WebProcessPool)
121 WK_ADD_API_MAPPING(WKContextConfigurationRef, API::ProcessPoolConfiguration)
122 WK_ADD_API_MAPPING(WKCookieManagerRef, WebCookieManagerProxy)
123 WK_ADD_API_MAPPING(WKCredentialRef, WebCredential)
124 WK_ADD_API_MAPPING(WKDatabaseManagerRef, WebDatabaseManagerProxy)
125 WK_ADD_API_MAPPING(WKDownloadRef, DownloadProxy)
126 WK_ADD_API_MAPPING(WKFormSubmissionListenerRef, WebFormSubmissionListenerProxy)
127 WK_ADD_API_MAPPING(WKFramePolicyListenerRef, WebFramePolicyListenerProxy)
128 WK_ADD_API_MAPPING(WKFrameRef, WebFrameProxy)
129 WK_ADD_API_MAPPING(WKGeolocationManagerRef, WebGeolocationManagerProxy)
130 WK_ADD_API_MAPPING(WKGeolocationPermissionRequestRef, GeolocationPermissionRequestProxy)
131 WK_ADD_API_MAPPING(WKGeolocationPositionRef, WebGeolocationPosition)
132 WK_ADD_API_MAPPING(WKGrammarDetailRef, WebGrammarDetail)
133 WK_ADD_API_MAPPING(WKHitTestResultRef, WebHitTestResult)
134 WK_ADD_API_MAPPING(WKIconDatabaseRef, WebIconDatabase)
135 WK_ADD_API_MAPPING(WKKeyValueStorageManagerRef, WebKeyValueStorageManager)
136 WK_ADD_API_MAPPING(WKMediaCacheManagerRef, WebMediaCacheManagerProxy)
137 WK_ADD_API_MAPPING(WKNavigationDataRef, API::NavigationData)
138 WK_ADD_API_MAPPING(WKNotificationManagerRef, WebNotificationManagerProxy)
139 WK_ADD_API_MAPPING(WKNotificationPermissionRequestRef, NotificationPermissionRequest)
140 WK_ADD_API_MAPPING(WKNotificationProviderRef, WebNotificationProvider)
141 WK_ADD_API_MAPPING(WKNotificationRef, WebNotification)
142 WK_ADD_API_MAPPING(WKOpenPanelParametersRef, WebOpenPanelParameters)
143 WK_ADD_API_MAPPING(WKOpenPanelResultListenerRef, WebOpenPanelResultListenerProxy)
144 WK_ADD_API_MAPPING(WKOriginDataManagerRef, WebOriginDataManagerProxy)
145 WK_ADD_API_MAPPING(WKPageGroupRef, WebPageGroup)
146 WK_ADD_API_MAPPING(WKPageConfigurationRef, API::PageConfiguration)
147 WK_ADD_API_MAPPING(WKPageRef, WebPageProxy)
148 WK_ADD_API_MAPPING(WKPluginSiteDataManagerRef, WebPluginSiteDataManager)
149 WK_ADD_API_MAPPING(WKPreferencesRef, WebPreferences)
150 WK_ADD_API_MAPPING(WKProtectionSpaceRef, WebProtectionSpace)
151 WK_ADD_API_MAPPING(WKRenderLayerRef, WebRenderLayer)
152 WK_ADD_API_MAPPING(WKRenderObjectRef, WebRenderObject)
153 WK_ADD_API_MAPPING(WKSessionStateRef, API::SessionState)
154 WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker)
155 WK_ADD_API_MAPPING(WKUserContentControllerRef, WebUserContentControllerProxy)
156 WK_ADD_API_MAPPING(WKUserContentFilterRef, API::UserContentFilter)
157 WK_ADD_API_MAPPING(WKUserMediaPermissionRequestRef, UserMediaPermissionRequestProxy)
158 WK_ADD_API_MAPPING(WKUserScriptRef, API::UserScript)
159 WK_ADD_API_MAPPING(WKVibrationRef, WebVibrationProxy)
160 WK_ADD_API_MAPPING(WKViewportAttributesRef, WebViewportAttributes)
161 WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy)
162
163 /* Enum conversions */
164
165 inline BundleHitTestResultMediaType toBundleHitTestResultMediaType(WKBundleHitTestResultMediaType wkMediaType)
166 {
167     switch (wkMediaType) {
168     case kWKBundleHitTestResultMediaTypeNone:
169         return BundleHitTestResultMediaTypeNone;
170     case kWKBundleHitTestResultMediaTypeAudio:
171         return BundleHitTestResultMediaTypeAudio;
172     case kWKBundleHitTestResultMediaTypeVideo:
173         return BundleHitTestResultMediaTypeVideo;
174     }
175     
176     ASSERT_NOT_REACHED();
177     return BundleHitTestResultMediaTypeNone;
178 }
179     
180 inline WKBundleHitTestResultMediaType toAPI(BundleHitTestResultMediaType mediaType)
181 {
182     switch (mediaType) {
183     case BundleHitTestResultMediaTypeNone:
184         return kWKBundleHitTestResultMediaTypeNone;
185     case BundleHitTestResultMediaTypeAudio:
186         return kWKBundleHitTestResultMediaTypeAudio;
187     case BundleHitTestResultMediaTypeVideo:
188         return kWKBundleHitTestResultMediaTypeVideo;
189     }
190     
191     ASSERT_NOT_REACHED();
192     return kWKBundleHitTestResultMediaTypeNone;
193 }
194
195 inline CacheModel toCacheModel(WKCacheModel wkCacheModel)
196 {
197     switch (wkCacheModel) {
198     case kWKCacheModelDocumentViewer:
199         return CacheModelDocumentViewer;
200     case kWKCacheModelDocumentBrowser:
201         return CacheModelDocumentBrowser;
202     case kWKCacheModelPrimaryWebBrowser:
203         return CacheModelPrimaryWebBrowser;
204     }
205
206     ASSERT_NOT_REACHED();
207     return CacheModelDocumentViewer;
208 }
209
210 inline WKCacheModel toAPI(CacheModel cacheModel)
211 {
212     switch (cacheModel) {
213     case CacheModelDocumentViewer:
214         return kWKCacheModelDocumentViewer;
215     case CacheModelDocumentBrowser:
216         return kWKCacheModelDocumentBrowser;
217     case CacheModelPrimaryWebBrowser:
218         return kWKCacheModelPrimaryWebBrowser;
219     }
220     
221     return kWKCacheModelDocumentViewer;
222 }
223
224 inline ProcessModel toProcessModel(WKProcessModel wkProcessModel)
225 {
226     switch (wkProcessModel) {
227     case kWKProcessModelSharedSecondaryProcess:
228         return ProcessModelSharedSecondaryProcess;
229     case kWKProcessModelMultipleSecondaryProcesses:
230         return ProcessModelMultipleSecondaryProcesses;
231     }
232
233     ASSERT_NOT_REACHED();
234     return ProcessModelSharedSecondaryProcess;
235 }
236
237 inline WKProcessModel toAPI(ProcessModel processModel)
238 {
239     switch (processModel) {
240     case ProcessModelSharedSecondaryProcess:
241         return kWKProcessModelSharedSecondaryProcess;
242     case ProcessModelMultipleSecondaryProcesses:
243         return kWKProcessModelMultipleSecondaryProcesses;
244     }
245     
246     return kWKProcessModelSharedSecondaryProcess;
247 }
248
249 inline FontSmoothingLevel toFontSmoothingLevel(WKFontSmoothingLevel wkLevel)
250 {
251     switch (wkLevel) {
252     case kWKFontSmoothingLevelNoSubpixelAntiAliasing:
253         return FontSmoothingLevelNoSubpixelAntiAliasing;
254     case kWKFontSmoothingLevelLight:
255         return FontSmoothingLevelLight;
256     case kWKFontSmoothingLevelMedium:
257         return FontSmoothingLevelMedium;
258     case kWKFontSmoothingLevelStrong:
259         return FontSmoothingLevelStrong;
260     }
261
262     ASSERT_NOT_REACHED();
263     return FontSmoothingLevelMedium;
264 }
265
266
267 inline WKFontSmoothingLevel toAPI(FontSmoothingLevel level)
268 {
269     switch (level) {
270     case FontSmoothingLevelNoSubpixelAntiAliasing:
271         return kWKFontSmoothingLevelNoSubpixelAntiAliasing;
272     case FontSmoothingLevelLight:
273         return kWKFontSmoothingLevelLight;
274     case FontSmoothingLevelMedium:
275         return kWKFontSmoothingLevelMedium;
276     case FontSmoothingLevelStrong:
277         return kWKFontSmoothingLevelStrong;
278     }
279
280     ASSERT_NOT_REACHED();
281     return kWKFontSmoothingLevelMedium;
282 }
283
284 inline WKEditableLinkBehavior toAPI(WebCore::EditableLinkBehavior behavior)
285 {
286     switch (behavior) {
287     case WebCore::EditableLinkDefaultBehavior:
288         return kWKEditableLinkBehaviorDefault;
289     case WebCore::EditableLinkAlwaysLive:
290         return kWKEditableLinkBehaviorAlwaysLive;
291     case WebCore::EditableLinkOnlyLiveWithShiftKey:
292         return kWKEditableLinkBehaviorOnlyLiveWithShiftKey;
293     case WebCore::EditableLinkLiveWhenNotFocused:
294         return kWKEditableLinkBehaviorLiveWhenNotFocused;
295     case WebCore::EditableLinkNeverLive:
296         return kWKEditableLinkBehaviorNeverLive;
297     }
298     
299     ASSERT_NOT_REACHED();
300     return kWKEditableLinkBehaviorNeverLive;
301 }
302
303 inline WebCore::EditableLinkBehavior toEditableLinkBehavior(WKEditableLinkBehavior wkBehavior)
304 {
305     switch (wkBehavior) {
306     case kWKEditableLinkBehaviorDefault:
307         return WebCore::EditableLinkDefaultBehavior;
308     case kWKEditableLinkBehaviorAlwaysLive:
309         return WebCore::EditableLinkAlwaysLive;
310     case kWKEditableLinkBehaviorOnlyLiveWithShiftKey:
311         return WebCore::EditableLinkOnlyLiveWithShiftKey;
312     case kWKEditableLinkBehaviorLiveWhenNotFocused:
313         return WebCore::EditableLinkLiveWhenNotFocused;
314     case kWKEditableLinkBehaviorNeverLive:
315         return WebCore::EditableLinkNeverLive;
316     }
317     
318     ASSERT_NOT_REACHED();
319     return WebCore::EditableLinkNeverLive;
320 }
321     
322 inline WKProtectionSpaceServerType toAPI(WebCore::ProtectionSpaceServerType type)
323 {
324     switch (type) {
325     case WebCore::ProtectionSpaceServerHTTP:
326         return kWKProtectionSpaceServerTypeHTTP;
327     case WebCore::ProtectionSpaceServerHTTPS:
328         return kWKProtectionSpaceServerTypeHTTPS;
329     case WebCore::ProtectionSpaceServerFTP:
330         return kWKProtectionSpaceServerTypeFTP;
331     case WebCore::ProtectionSpaceServerFTPS:
332         return kWKProtectionSpaceServerTypeFTPS;
333     case WebCore::ProtectionSpaceProxyHTTP:
334         return kWKProtectionSpaceProxyTypeHTTP;
335     case WebCore::ProtectionSpaceProxyHTTPS:
336         return kWKProtectionSpaceProxyTypeHTTPS;
337     case WebCore::ProtectionSpaceProxyFTP:
338         return kWKProtectionSpaceProxyTypeFTP;
339     case WebCore::ProtectionSpaceProxySOCKS:
340         return kWKProtectionSpaceProxyTypeSOCKS;
341     }
342     return kWKProtectionSpaceServerTypeHTTP;
343 }
344
345 inline WKProtectionSpaceAuthenticationScheme toAPI(WebCore::ProtectionSpaceAuthenticationScheme type)
346 {
347     switch (type) {
348     case WebCore::ProtectionSpaceAuthenticationSchemeDefault:
349         return kWKProtectionSpaceAuthenticationSchemeDefault;
350     case WebCore::ProtectionSpaceAuthenticationSchemeHTTPBasic:
351         return kWKProtectionSpaceAuthenticationSchemeHTTPBasic;
352     case WebCore::ProtectionSpaceAuthenticationSchemeHTTPDigest:
353         return kWKProtectionSpaceAuthenticationSchemeHTTPDigest;
354     case WebCore::ProtectionSpaceAuthenticationSchemeHTMLForm:
355         return kWKProtectionSpaceAuthenticationSchemeHTMLForm;
356     case WebCore::ProtectionSpaceAuthenticationSchemeNTLM:
357         return kWKProtectionSpaceAuthenticationSchemeNTLM;
358     case WebCore::ProtectionSpaceAuthenticationSchemeNegotiate:
359         return kWKProtectionSpaceAuthenticationSchemeNegotiate;
360     case WebCore::ProtectionSpaceAuthenticationSchemeClientCertificateRequested:
361         return kWKProtectionSpaceAuthenticationSchemeClientCertificateRequested;
362     case WebCore::ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested:
363         return kWKProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested;
364     default:
365         return kWKProtectionSpaceAuthenticationSchemeUnknown;
366     }
367 }
368
369 inline WebCore::CredentialPersistence toCredentialPersistence(WKCredentialPersistence type)
370 {
371     switch (type) {
372     case kWKCredentialPersistenceNone:
373         return WebCore::CredentialPersistenceNone;
374     case kWKCredentialPersistenceForSession:
375         return WebCore::CredentialPersistenceForSession;
376     case kWKCredentialPersistencePermanent:
377         return WebCore::CredentialPersistencePermanent;
378     default:
379         return WebCore::CredentialPersistenceNone;
380     }
381 }
382
383 inline ResourceCachesToClear toResourceCachesToClear(WKResourceCachesToClear wkResourceCachesToClear)
384 {
385     switch (wkResourceCachesToClear) {
386     case WKResourceCachesToClearAll:
387         return AllResourceCaches;
388     case WKResourceCachesToClearInMemoryOnly:
389         return InMemoryResourceCachesOnly;
390     }
391
392     ASSERT_NOT_REACHED();
393     return AllResourceCaches;
394 }
395
396 inline HTTPCookieAcceptPolicy toHTTPCookieAcceptPolicy(WKHTTPCookieAcceptPolicy policy)
397 {
398     switch (policy) {
399     case kWKHTTPCookieAcceptPolicyAlways:
400         return HTTPCookieAcceptPolicyAlways;
401     case kWKHTTPCookieAcceptPolicyNever:
402         return HTTPCookieAcceptPolicyNever;
403     case kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
404         return HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
405     case kWKHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain:
406         return HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain;
407     }
408
409     ASSERT_NOT_REACHED();
410     return HTTPCookieAcceptPolicyAlways;
411 }
412
413 inline WKHTTPCookieAcceptPolicy toAPI(HTTPCookieAcceptPolicy policy)
414 {
415     switch (policy) {
416     case HTTPCookieAcceptPolicyAlways:
417         return kWKHTTPCookieAcceptPolicyAlways;
418     case HTTPCookieAcceptPolicyNever:
419         return kWKHTTPCookieAcceptPolicyNever;
420     case HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
421         return kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
422     case HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain:
423         return kWKHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain;
424     }
425
426     ASSERT_NOT_REACHED();
427     return kWKHTTPCookieAcceptPolicyAlways;
428 }
429
430 inline WebCore::SecurityOrigin::StorageBlockingPolicy toStorageBlockingPolicy(WKStorageBlockingPolicy policy)
431 {
432     switch (policy) {
433     case kWKAllowAllStorage:
434         return WebCore::SecurityOrigin::AllowAllStorage;
435     case kWKBlockThirdPartyStorage:
436         return WebCore::SecurityOrigin::BlockThirdPartyStorage;
437     case kWKBlockAllStorage:
438         return WebCore::SecurityOrigin::BlockAllStorage;
439     }
440
441     ASSERT_NOT_REACHED();
442     return WebCore::SecurityOrigin::AllowAllStorage;
443 }
444
445 inline WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPolicy policy)
446 {
447     switch (policy) {
448     case WebCore::SecurityOrigin::AllowAllStorage:
449         return kWKAllowAllStorage;
450     case WebCore::SecurityOrigin::BlockThirdPartyStorage:
451         return kWKBlockThirdPartyStorage;
452     case WebCore::SecurityOrigin::BlockAllStorage:
453         return kWKBlockAllStorage;
454     }
455
456     ASSERT_NOT_REACHED();
457     return kWKAllowAllStorage;
458 }
459
460 inline WKPluginLoadPolicy toWKPluginLoadPolicy(PluginModuleLoadPolicy pluginModuleLoadPolicy)
461 {
462     switch (pluginModuleLoadPolicy) {
463     case PluginModuleLoadNormally:
464         return kWKPluginLoadPolicyLoadNormally;
465     case PluginModuleLoadUnsandboxed:
466         return kWKPluginLoadPolicyLoadUnsandboxed;
467     case PluginModuleBlocked:
468         return kWKPluginLoadPolicyBlocked;
469     }
470     
471     ASSERT_NOT_REACHED();
472     return kWKPluginLoadPolicyBlocked;
473 }
474
475 inline PluginModuleLoadPolicy toPluginModuleLoadPolicy(WKPluginLoadPolicy pluginLoadPolicy)
476 {
477     switch (pluginLoadPolicy) {
478     case kWKPluginLoadPolicyLoadNormally:
479         return PluginModuleLoadNormally;
480     case kWKPluginLoadPolicyBlocked:
481         return PluginModuleBlocked;
482     case kWKPluginLoadPolicyLoadUnsandboxed:
483         return PluginModuleLoadUnsandboxed;
484     }
485     
486     ASSERT_NOT_REACHED();
487     return PluginModuleBlocked;
488 }
489
490 inline WebCore::WebGLLoadPolicy toWebGLLoadPolicy(WKWebGLLoadPolicy webGLLoadPolicy)
491 {
492     switch (webGLLoadPolicy) {
493     case kWKWebGLLoadPolicyLoadNormally:
494         return WebCore::WebGLAllowCreation;
495     case kWKWebGLLoadPolicyBlocked:
496         return WebCore::WebGLBlockCreation;
497     case kWKWebGLLoadPolicyPending:
498         return WebCore::WebGLPendingCreation;
499     }
500     
501     ASSERT_NOT_REACHED();
502     return WebCore::WebGLAllowCreation;
503 }
504
505 inline WKWebGLLoadPolicy toAPI(WebCore::WebGLLoadPolicy webGLLoadPolicy)
506 {
507     switch (webGLLoadPolicy) {
508     case WebCore::WebGLAllowCreation:
509         return kWKWebGLLoadPolicyLoadNormally;
510     case WebCore::WebGLBlockCreation:
511         return kWKWebGLLoadPolicyBlocked;
512     case WebCore::WebGLPendingCreation:
513         return kWKWebGLLoadPolicyPending;
514     }
515
516     ASSERT_NOT_REACHED();
517     return kWKWebGLLoadPolicyLoadNormally;
518 }
519
520 inline ProxyingRefPtr<WebGrammarDetail> toAPI(const WebCore::GrammarDetail& grammarDetail)
521 {
522     return ProxyingRefPtr<WebGrammarDetail>(WebGrammarDetail::create(grammarDetail));
523 }
524
525 } // namespace WebKit
526
527 #if defined(BUILDING_GTK__)
528 #include "WKAPICastGtk.h"
529 #endif
530
531 #if USE(SOUP)
532 #include "WKAPICastSoup.h"
533 #endif
534
535 #if defined(BUILDING_EFL__)
536 #include "WKAPICastEfl.h"
537 #endif
538
539 #endif // WKAPICast_h