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