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 | |
53 | namespace API { |
54 | class ContentRuleList; |
55 | class ContentRuleListStore; |
56 | class InternalDebugFeature; |
57 | class ExperimentalFeature; |
58 | class FrameHandle; |
59 | class FrameInfo; |
60 | class HitTestResult; |
61 | class Navigation; |
62 | class NavigationAction; |
63 | class NavigationData; |
64 | class NavigationResponse; |
65 | class OpenPanelParameters; |
66 | class PageConfiguration; |
67 | class ProcessPoolConfiguration; |
68 | class SessionState; |
69 | class UserScript; |
70 | class WebsiteDataStore; |
71 | class WebsitePolicies; |
72 | class WindowFeatures; |
73 | } |
74 | |
75 | namespace WebKit { |
76 | |
77 | class AuthenticationChallengeProxy; |
78 | class AuthenticationDecisionListener; |
79 | class DownloadProxy; |
80 | class GeolocationPermissionRequest; |
81 | class NotificationPermissionRequest; |
82 | class UserMediaPermissionCheckProxy; |
83 | class UserMediaPermissionRequestProxy; |
84 | class WebBackForwardList; |
85 | class WebBackForwardListItem; |
86 | class WebColorPickerResultListenerProxy; |
87 | class ; |
88 | class WebCookieManagerProxy; |
89 | class WebCredential; |
90 | class WebFormSubmissionListenerProxy; |
91 | class WebFramePolicyListenerProxy; |
92 | class WebFrameProxy; |
93 | class WebGeolocationManagerProxy; |
94 | class WebGeolocationPosition; |
95 | class WebIconDatabase; |
96 | class WebInspectorProxy; |
97 | class WebMediaSessionFocusManager; |
98 | class WebMediaSessionMetadata; |
99 | class WebNotification; |
100 | class WebNotificationManagerProxy; |
101 | class WebNotificationProvider; |
102 | class WebOpenPanelResultListenerProxy; |
103 | class WebPageGroup; |
104 | class WebPageProxy; |
105 | class WebPreferences; |
106 | class WebProcessPool; |
107 | class WebProtectionSpace; |
108 | class WebRenderLayer; |
109 | class WebRenderObject; |
110 | class WebResourceLoadStatisticsManager; |
111 | class WebTextChecker; |
112 | class WebUserContentControllerProxy; |
113 | class WebViewportAttributes; |
114 | |
115 | WK_ADD_API_MAPPING(WKAuthenticationChallengeRef, AuthenticationChallengeProxy) |
116 | WK_ADD_API_MAPPING(WKAuthenticationDecisionListenerRef, AuthenticationDecisionListener) |
117 | WK_ADD_API_MAPPING(WKBackForwardListItemRef, WebBackForwardListItem) |
118 | WK_ADD_API_MAPPING(WKBackForwardListRef, WebBackForwardList) |
119 | WK_ADD_API_MAPPING(WKBundleHitTestResultMediaType, BundleHitTestResultMediaType) |
120 | WK_ADD_API_MAPPING(WKColorPickerResultListenerRef, WebColorPickerResultListenerProxy) |
121 | WK_ADD_API_MAPPING(WKContextRef, WebProcessPool) |
122 | WK_ADD_API_MAPPING(WKContextConfigurationRef, API::ProcessPoolConfiguration) |
123 | WK_ADD_API_MAPPING(WKContextMenuListenerRef, WebContextMenuListenerProxy) |
124 | WK_ADD_API_MAPPING(WKCookieManagerRef, WebCookieManagerProxy) |
125 | WK_ADD_API_MAPPING(WKCredentialRef, WebCredential) |
126 | WK_ADD_API_MAPPING(WKDownloadRef, DownloadProxy) |
127 | WK_ADD_API_MAPPING(WKFormSubmissionListenerRef, WebFormSubmissionListenerProxy) |
128 | WK_ADD_API_MAPPING(WKFramePolicyListenerRef, WebFramePolicyListenerProxy) |
129 | WK_ADD_API_MAPPING(WKFrameHandleRef, API::FrameHandle) |
130 | WK_ADD_API_MAPPING(WKFrameInfoRef, API::FrameInfo) |
131 | WK_ADD_API_MAPPING(WKFrameRef, WebFrameProxy) |
132 | WK_ADD_API_MAPPING(WKGeolocationManagerRef, WebGeolocationManagerProxy) |
133 | WK_ADD_API_MAPPING(WKGeolocationPermissionRequestRef, GeolocationPermissionRequest) |
134 | WK_ADD_API_MAPPING(WKGeolocationPositionRef, WebGeolocationPosition) |
135 | WK_ADD_API_MAPPING(WKHitTestResultRef, API::HitTestResult) |
136 | WK_ADD_API_MAPPING(WKIconDatabaseRef, WebIconDatabase) |
137 | WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy) |
138 | WK_ADD_API_MAPPING(WKMediaSessionFocusManagerRef, WebMediaSessionFocusManager) |
139 | WK_ADD_API_MAPPING(WKMediaSessionMetadataRef, WebMediaSessionMetadata) |
140 | WK_ADD_API_MAPPING(WKNavigationActionRef, API::NavigationAction) |
141 | WK_ADD_API_MAPPING(WKNavigationDataRef, API::NavigationData) |
142 | WK_ADD_API_MAPPING(WKNavigationRef, API::Navigation) |
143 | WK_ADD_API_MAPPING(WKNavigationResponseRef, API::NavigationResponse) |
144 | WK_ADD_API_MAPPING(WKNotificationManagerRef, WebNotificationManagerProxy) |
145 | WK_ADD_API_MAPPING(WKNotificationPermissionRequestRef, NotificationPermissionRequest) |
146 | WK_ADD_API_MAPPING(WKNotificationProviderRef, WebNotificationProvider) |
147 | WK_ADD_API_MAPPING(WKNotificationRef, WebNotification) |
148 | WK_ADD_API_MAPPING(WKOpenPanelParametersRef, API::OpenPanelParameters) |
149 | WK_ADD_API_MAPPING(WKOpenPanelResultListenerRef, WebOpenPanelResultListenerProxy) |
150 | WK_ADD_API_MAPPING(WKPageGroupRef, WebPageGroup) |
151 | WK_ADD_API_MAPPING(WKPageConfigurationRef, API::PageConfiguration) |
152 | WK_ADD_API_MAPPING(WKPageRef, WebPageProxy) |
153 | WK_ADD_API_MAPPING(WKPreferencesRef, WebPreferences) |
154 | WK_ADD_API_MAPPING(WKProtectionSpaceRef, WebProtectionSpace) |
155 | WK_ADD_API_MAPPING(WKRenderLayerRef, WebRenderLayer) |
156 | WK_ADD_API_MAPPING(WKRenderObjectRef, WebRenderObject) |
157 | WK_ADD_API_MAPPING(WKResourceLoadStatisticsManagerRef, WebResourceLoadStatisticsManager) |
158 | WK_ADD_API_MAPPING(WKSessionStateRef, API::SessionState) |
159 | WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker) |
160 | WK_ADD_API_MAPPING(WKUserContentControllerRef, WebUserContentControllerProxy) |
161 | WK_ADD_API_MAPPING(WKUserContentExtensionStoreRef, API::ContentRuleListStore) |
162 | WK_ADD_API_MAPPING(WKUserContentFilterRef, API::ContentRuleList) |
163 | WK_ADD_API_MAPPING(WKUserMediaPermissionCheckRef, UserMediaPermissionCheckProxy) |
164 | WK_ADD_API_MAPPING(WKUserMediaPermissionRequestRef, UserMediaPermissionRequestProxy) |
165 | WK_ADD_API_MAPPING(WKUserScriptRef, API::UserScript) |
166 | WK_ADD_API_MAPPING(WKViewportAttributesRef, WebViewportAttributes) |
167 | WK_ADD_API_MAPPING(WKWebsiteDataStoreRef, API::WebsiteDataStore) |
168 | WK_ADD_API_MAPPING(WKWebsitePoliciesRef, API::WebsitePolicies) |
169 | WK_ADD_API_MAPPING(WKWindowFeaturesRef, API::WindowFeatures) |
170 | |
171 | /* Enum conversions */ |
172 | |
173 | inline 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 | |
188 | inline 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 | |
203 | inline 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 | |
218 | inline 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 | |
232 | inline 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 | |
252 | inline 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 | |
271 | inline 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 | |
290 | inline 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 | |
313 | inline 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 | |
339 | inline 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 | |
353 | inline 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 | |
366 | inline 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 | |
383 | inline 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 | |
400 | inline 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 | |
415 | inline 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 | |
430 | inline 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 | |
447 | inline 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 | |
466 | inline 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 | |
483 | inline 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 | |
502 | inline 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 | |
517 | inline 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 | |