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