diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/API/C')
155 files changed, 6940 insertions, 3368 deletions
diff --git a/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp b/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp index 2ed74d376..b14b99503 100644 --- a/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp +++ b/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp @@ -23,23 +23,19 @@ #include "WKView.h" +#include "APIPageConfiguration.h" #include "WKAPICast.h" #include "WebView.h" using namespace WebCore; using namespace WebKit; -WKViewRef WKViewCreate(WKContextRef contextRef, WKPageGroupRef pageGroupRef) +WKViewRef WKViewCreate(WKContextRef context, WKPageConfigurationRef pageConfiguration) { - RefPtr<WebView> webView = WebView::create(toImpl(contextRef), toImpl(pageGroupRef)); + RefPtr<WebView> webView = WebView::create(toImpl(context), *toImpl(pageConfiguration)); return toAPI(webView.release().leakRef()); } -void WKViewInitialize(WKViewRef viewRef) -{ - toImpl(viewRef)->initialize(); -} - WKSize WKViewGetSize(WKViewRef viewRef) { return toAPI(toImpl(viewRef)->size()); @@ -50,11 +46,21 @@ void WKViewSetSize(WKViewRef viewRef, WKSize size) toImpl(viewRef)->setSize(toIntSize(size)); } -void WKViewSetViewClient(WKViewRef viewRef, const WKViewClient* client) +void WKViewSetViewClient(WKViewRef viewRef, const WKViewClientBase* client) { toImpl(viewRef)->initializeClient(client); } +bool WKViewIsActive(WKViewRef viewRef) +{ + return toImpl(viewRef)->isActive(); +} + +void WKViewSetIsActive(WKViewRef viewRef, bool isActive) +{ + toImpl(viewRef)->setActive(isActive); +} + bool WKViewIsFocused(WKViewRef viewRef) { return toImpl(viewRef)->isFocused(); @@ -159,20 +165,10 @@ void WKViewResumeActiveDOMObjectsAndAnimations(WKViewRef viewRef) toImpl(viewRef)->resumeActiveDOMObjectsAndAnimations(); } -void WKViewSetShowsAsSource(WKViewRef viewRef, bool flag) -{ - toImpl(viewRef)->setShowsAsSource(flag); -} - -bool WKViewGetShowsAsSource(WKViewRef viewRef) -{ - return toImpl(viewRef)->showsAsSource(); -} - bool WKViewExitFullScreen(WKViewRef viewRef) { #if ENABLE(FULLSCREEN_API) - return toImpl(viewRef)->exitFullScreen(); + return toImpl(viewRef)->requestExitFullScreen(); #else UNUSED_PARAM(viewRef); return false; @@ -191,8 +187,19 @@ double WKViewOpacity(WKViewRef view) void WKViewFindZoomableAreaForRect(WKViewRef viewRef, WKRect wkRect) { +#if USE(COORDINATED_GRAPHICS_MULTIPROCESS) IntRect rect = toIntRect(wkRect); toImpl(viewRef)->findZoomableAreaForPoint(rect.center(), rect.size()); +#else + UNUSED_PARAM(viewRef); + UNUSED_PARAM(wkRect); +#endif +} + +WKSize WKViewGetContentsSize(WKViewRef viewRef) +{ + const WebCore::IntSize& size = toImpl(viewRef)->contentsSize(); + return WKSizeMake(size.width(), size.height()); } #endif // USE(COORDINATED_GRAPHICS) diff --git a/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h b/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h index 1ee55ea34..60f4239e0 100644 --- a/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h +++ b/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h @@ -21,8 +21,8 @@ #ifndef WKView_h #define WKView_h -#include <WebKit2/WKBase.h> -#include <WebKit2/WKGeometry.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKGeometry.h> #ifndef __cplusplus #include <stdbool.h> @@ -43,10 +43,13 @@ typedef void (*WKViewPageDidChangeTooltipCallback)(WKViewRef view, WKStringRef n typedef void (*WKViewDidFindZoomableAreaCallback)(WKViewRef view, WKPoint point, WKRect area, const void* clientInfo); typedef void (*WKViewDoneWithTouchEventCallback)(WKViewRef view, WKTouchEventRef touchEvent, bool wasEventHandled, const void* clientInfo); -struct WKViewClient { +typedef struct WKViewClientBase { int version; const void* clientInfo; +} WKViewClientBase; +typedef struct WKViewClientV0 { + WKViewClientBase base; // Version 0 WKViewViewNeedsDisplayCallback viewNeedsDisplay; WKViewPageDidChangeContentsSizeCallback didChangeContentsSize; @@ -59,19 +62,17 @@ struct WKViewClient { WKViewPageDidChangeTooltipCallback didChangeTooltip; WKViewDidFindZoomableAreaCallback didFindZoomableArea; WKViewDoneWithTouchEventCallback doneWithTouchEvent; -}; -typedef struct WKViewClient WKViewClient; +} WKViewClientV0; -enum { kWKViewClientCurrentVersion = 0 }; - -WK_EXPORT WKViewRef WKViewCreate(WKContextRef context, WKPageGroupRef pageGroup); - -WK_EXPORT void WKViewInitialize(WKViewRef); +WK_EXPORT WKViewRef WKViewCreate(WKContextRef context, WKPageConfigurationRef pageConfiguration); WK_EXPORT WKSize WKViewGetSize(WKViewRef); WK_EXPORT void WKViewSetSize(WKViewRef, WKSize size); -WK_EXPORT void WKViewSetViewClient(WKViewRef, const WKViewClient*); +WK_EXPORT void WKViewSetViewClient(WKViewRef, const WKViewClientBase*); + +WK_EXPORT bool WKViewIsActive(WKViewRef); +WK_EXPORT void WKViewSetIsActive(WKViewRef, bool); WK_EXPORT bool WKViewIsFocused(WKViewRef); WK_EXPORT void WKViewSetIsFocused(WKViewRef, bool); @@ -103,9 +104,6 @@ WK_EXPORT bool WKViewGetDrawsTransparentBackground(WKViewRef); WK_EXPORT void WKViewSuspendActiveDOMObjectsAndAnimations(WKViewRef); WK_EXPORT void WKViewResumeActiveDOMObjectsAndAnimations(WKViewRef); -WK_EXPORT void WKViewSetShowsAsSource(WKViewRef, bool); -WK_EXPORT bool WKViewGetShowsAsSource(WKViewRef); - WK_EXPORT bool WKViewExitFullScreen(WKViewRef); WK_EXPORT void WKViewSetOpacity(WKViewRef view, double opacity); @@ -113,6 +111,8 @@ WK_EXPORT double WKViewOpacity(WKViewRef view); WK_EXPORT void WKViewFindZoomableAreaForRect(WKViewRef, WKRect); +WK_EXPORT WKSize WKViewGetContentsSize(WKViewRef); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKAPICast.h b/Source/WebKit2/UIProcess/API/C/WKAPICast.h index 64c8d1abf..ee7f2dfc5 100644 --- a/Source/WebKit2/UIProcess/API/C/WKAPICast.h +++ b/Source/WebKit2/UIProcess/API/C/WKAPICast.h @@ -32,24 +32,41 @@ #include "HTTPCookieAcceptPolicy.h" #include "InjectedBundleHitTestResultMediaType.h" #include "PluginModuleInfo.h" -#include "ProcessModel.h" #include "ResourceCachesToClear.h" #include "WKBundleHitTestResult.h" #include "WKContext.h" #include "WKCookieManager.h" #include "WKCredentialTypes.h" #include "WKPage.h" -#include "WKPreferences.h" -#include "WKPreferencesPrivate.h" +#include "WKPreferencesRef.h" +#include "WKPreferencesRefPrivate.h" #include "WKProtectionSpaceTypes.h" #include "WKResourceCacheManager.h" #include "WKSharedAPICast.h" #include "WebGrammarDetail.h" #include <WebCore/Credential.h> #include <WebCore/FrameLoaderTypes.h> +#include <WebCore/PluginData.h> #include <WebCore/ProtectionSpace.h> #include <WebCore/Settings.h> +namespace API { +class FrameInfo; +class HitTestResult; +class Navigation; +class NavigationAction; +class NavigationData; +class NavigationResponse; +class PageConfiguration; +class ProcessPoolConfiguration; +class SessionState; +class UserContentExtension; +class UserContentExtensionStore; +class UserScript; +class WebsiteDataStore; +class WindowFeatures; +} + namespace WebKit { class AuthenticationChallengeProxy; @@ -57,48 +74,42 @@ class AuthenticationDecisionListener; class DownloadProxy; class GeolocationPermissionRequestProxy; class NotificationPermissionRequest; -class WebApplicationCacheManagerProxy; +class UserMediaPermissionCheckProxy; +class UserMediaPermissionRequestProxy; class WebBackForwardList; class WebBackForwardListItem; class WebBatteryManagerProxy; class WebBatteryStatus; -class WebResourceCacheManagerProxy; class WebColorPickerResultListenerProxy; -class WebContext; class WebCookieManagerProxy; class WebCredential; -class WebDatabaseManagerProxy; class WebFormSubmissionListenerProxy; class WebFramePolicyListenerProxy; class WebFrameProxy; class WebGeolocationManagerProxy; class WebGeolocationPosition; class WebGrammarDetail; -class WebHitTestResult; class WebIconDatabase; class WebInspectorProxy; -class WebKeyValueStorageManager; -class WebMediaCacheManagerProxy; -class WebNavigationData; -class WebNetworkInfoManagerProxy; -class WebNetworkInfo; +class WebMediaSessionFocusManager; +class WebMediaSessionMetadata; class WebNotification; -class WebNotificationProvider; class WebNotificationManagerProxy; +class WebNotificationProvider; class WebOpenPanelParameters; class WebOpenPanelResultListenerProxy; class WebPageGroup; class WebPageProxy; -class WebPluginSiteDataManager; class WebPreferences; +class WebProcessPool; class WebProtectionSpace; class WebRenderLayer; class WebRenderObject; class WebTextChecker; +class WebUserContentControllerProxy; class WebVibrationProxy; class WebViewportAttributes; -WK_ADD_API_MAPPING(WKApplicationCacheManagerRef, WebApplicationCacheManagerProxy) WK_ADD_API_MAPPING(WKAuthenticationChallengeRef, AuthenticationChallengeProxy) WK_ADD_API_MAPPING(WKAuthenticationDecisionListenerRef, AuthenticationDecisionListener) WK_ADD_API_MAPPING(WKBackForwardListItemRef, WebBackForwardListItem) @@ -106,27 +117,29 @@ WK_ADD_API_MAPPING(WKBackForwardListRef, WebBackForwardList) WK_ADD_API_MAPPING(WKBatteryManagerRef, WebBatteryManagerProxy) WK_ADD_API_MAPPING(WKBatteryStatusRef, WebBatteryStatus) WK_ADD_API_MAPPING(WKBundleHitTestResultMediaType, BundleHitTestResultMediaType) -WK_ADD_API_MAPPING(WKResourceCacheManagerRef, WebResourceCacheManagerProxy) WK_ADD_API_MAPPING(WKColorPickerResultListenerRef, WebColorPickerResultListenerProxy) -WK_ADD_API_MAPPING(WKContextRef, WebContext) +WK_ADD_API_MAPPING(WKContextRef, WebProcessPool) +WK_ADD_API_MAPPING(WKContextConfigurationRef, API::ProcessPoolConfiguration) WK_ADD_API_MAPPING(WKCookieManagerRef, WebCookieManagerProxy) WK_ADD_API_MAPPING(WKCredentialRef, WebCredential) -WK_ADD_API_MAPPING(WKDatabaseManagerRef, WebDatabaseManagerProxy) WK_ADD_API_MAPPING(WKDownloadRef, DownloadProxy) WK_ADD_API_MAPPING(WKFormSubmissionListenerRef, WebFormSubmissionListenerProxy) WK_ADD_API_MAPPING(WKFramePolicyListenerRef, WebFramePolicyListenerProxy) +WK_ADD_API_MAPPING(WKFrameInfoRef, API::FrameInfo) WK_ADD_API_MAPPING(WKFrameRef, WebFrameProxy) WK_ADD_API_MAPPING(WKGeolocationManagerRef, WebGeolocationManagerProxy) WK_ADD_API_MAPPING(WKGeolocationPermissionRequestRef, GeolocationPermissionRequestProxy) WK_ADD_API_MAPPING(WKGeolocationPositionRef, WebGeolocationPosition) WK_ADD_API_MAPPING(WKGrammarDetailRef, WebGrammarDetail) -WK_ADD_API_MAPPING(WKHitTestResultRef, WebHitTestResult) +WK_ADD_API_MAPPING(WKHitTestResultRef, API::HitTestResult) WK_ADD_API_MAPPING(WKIconDatabaseRef, WebIconDatabase) -WK_ADD_API_MAPPING(WKKeyValueStorageManagerRef, WebKeyValueStorageManager) -WK_ADD_API_MAPPING(WKMediaCacheManagerRef, WebMediaCacheManagerProxy) -WK_ADD_API_MAPPING(WKNavigationDataRef, WebNavigationData) -WK_ADD_API_MAPPING(WKNetworkInfoManagerRef, WebNetworkInfoManagerProxy) -WK_ADD_API_MAPPING(WKNetworkInfoRef, WebNetworkInfo) +WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy) +WK_ADD_API_MAPPING(WKMediaSessionFocusManagerRef, WebMediaSessionFocusManager) +WK_ADD_API_MAPPING(WKMediaSessionMetadataRef, WebMediaSessionMetadata) +WK_ADD_API_MAPPING(WKNavigationActionRef, API::NavigationAction) +WK_ADD_API_MAPPING(WKNavigationDataRef, API::NavigationData) +WK_ADD_API_MAPPING(WKNavigationRef, API::Navigation) +WK_ADD_API_MAPPING(WKNavigationResponseRef, API::NavigationResponse) WK_ADD_API_MAPPING(WKNotificationManagerRef, WebNotificationManagerProxy) WK_ADD_API_MAPPING(WKNotificationPermissionRequestRef, NotificationPermissionRequest) WK_ADD_API_MAPPING(WKNotificationProviderRef, WebNotificationProvider) @@ -134,16 +147,24 @@ WK_ADD_API_MAPPING(WKNotificationRef, WebNotification) WK_ADD_API_MAPPING(WKOpenPanelParametersRef, WebOpenPanelParameters) WK_ADD_API_MAPPING(WKOpenPanelResultListenerRef, WebOpenPanelResultListenerProxy) WK_ADD_API_MAPPING(WKPageGroupRef, WebPageGroup) +WK_ADD_API_MAPPING(WKPageConfigurationRef, API::PageConfiguration) WK_ADD_API_MAPPING(WKPageRef, WebPageProxy) -WK_ADD_API_MAPPING(WKPluginSiteDataManagerRef, WebPluginSiteDataManager) WK_ADD_API_MAPPING(WKPreferencesRef, WebPreferences) WK_ADD_API_MAPPING(WKProtectionSpaceRef, WebProtectionSpace) WK_ADD_API_MAPPING(WKRenderLayerRef, WebRenderLayer) WK_ADD_API_MAPPING(WKRenderObjectRef, WebRenderObject) +WK_ADD_API_MAPPING(WKSessionStateRef, API::SessionState) WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker) +WK_ADD_API_MAPPING(WKUserContentControllerRef, WebUserContentControllerProxy) +WK_ADD_API_MAPPING(WKUserContentExtensionStoreRef, API::UserContentExtensionStore) +WK_ADD_API_MAPPING(WKUserContentFilterRef, API::UserContentExtension) +WK_ADD_API_MAPPING(WKUserMediaPermissionCheckRef, UserMediaPermissionCheckProxy) +WK_ADD_API_MAPPING(WKUserMediaPermissionRequestRef, UserMediaPermissionRequestProxy) +WK_ADD_API_MAPPING(WKUserScriptRef, API::UserScript) WK_ADD_API_MAPPING(WKVibrationRef, WebVibrationProxy) WK_ADD_API_MAPPING(WKViewportAttributesRef, WebViewportAttributes) -WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy) +WK_ADD_API_MAPPING(WKWebsiteDataStoreRef, API::WebsiteDataStore) +WK_ADD_API_MAPPING(WKWindowFeaturesRef, API::WindowFeatures) /* Enum conversions */ @@ -206,31 +227,6 @@ inline WKCacheModel toAPI(CacheModel cacheModel) return kWKCacheModelDocumentViewer; } -inline ProcessModel toProcessModel(WKProcessModel wkProcessModel) -{ - switch (wkProcessModel) { - case kWKProcessModelSharedSecondaryProcess: - return ProcessModelSharedSecondaryProcess; - case kWKProcessModelMultipleSecondaryProcesses: - return ProcessModelMultipleSecondaryProcesses; - } - - ASSERT_NOT_REACHED(); - return ProcessModelSharedSecondaryProcess; -} - -inline WKProcessModel toAPI(ProcessModel processModel) -{ - switch (processModel) { - case ProcessModelSharedSecondaryProcess: - return kWKProcessModelSharedSecondaryProcess; - case ProcessModelMultipleSecondaryProcesses: - return kWKProcessModelMultipleSecondaryProcesses; - } - - return kWKProcessModelSharedSecondaryProcess; -} - inline FontSmoothingLevel toFontSmoothingLevel(WKFontSmoothingLevel wkLevel) { switch (wkLevel) { @@ -387,6 +383,8 @@ inline HTTPCookieAcceptPolicy toHTTPCookieAcceptPolicy(WKHTTPCookieAcceptPolicy return HTTPCookieAcceptPolicyNever; case kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain: return HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain; + case kWKHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain: + return HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain; } ASSERT_NOT_REACHED(); @@ -402,6 +400,8 @@ inline WKHTTPCookieAcceptPolicy toAPI(HTTPCookieAcceptPolicy policy) return kWKHTTPCookieAcceptPolicyNever; case HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain: return kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain; + case HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain: + return kWKHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain; } ASSERT_NOT_REACHED(); @@ -445,27 +445,99 @@ inline WKPluginLoadPolicy toWKPluginLoadPolicy(PluginModuleLoadPolicy pluginModu return kWKPluginLoadPolicyLoadNormally; case PluginModuleLoadUnsandboxed: return kWKPluginLoadPolicyLoadUnsandboxed; - case PluginModuleBlocked: + case PluginModuleBlockedForSecurity: return kWKPluginLoadPolicyBlocked; + case PluginModuleBlockedForCompatibility: + return kWKPluginLoadPolicyBlockedForCompatibility; } ASSERT_NOT_REACHED(); return kWKPluginLoadPolicyBlocked; } +inline WKPluginLoadClientPolicy toWKPluginLoadClientPolicy(WebCore::PluginLoadClientPolicy PluginLoadClientPolicy) +{ + switch (PluginLoadClientPolicy) { + case WebCore::PluginLoadClientPolicyUndefined: + return kWKPluginLoadClientPolicyUndefined; + case WebCore::PluginLoadClientPolicyBlock: + return kWKPluginLoadClientPolicyBlock; + case WebCore::PluginLoadClientPolicyAsk: + return kWKPluginLoadClientPolicyAsk; + case WebCore::PluginLoadClientPolicyAllow: + return kWKPluginLoadClientPolicyAllow; + case WebCore::PluginLoadClientPolicyAllowAlways: + return kWKPluginLoadClientPolicyAllowAlways; + } + + ASSERT_NOT_REACHED(); + return kWKPluginLoadClientPolicyBlock; +} + inline PluginModuleLoadPolicy toPluginModuleLoadPolicy(WKPluginLoadPolicy pluginLoadPolicy) { switch (pluginLoadPolicy) { case kWKPluginLoadPolicyLoadNormally: return PluginModuleLoadNormally; case kWKPluginLoadPolicyBlocked: - return PluginModuleBlocked; + return PluginModuleBlockedForSecurity; + case kWKPluginLoadPolicyBlockedForCompatibility: + return PluginModuleBlockedForCompatibility; case kWKPluginLoadPolicyLoadUnsandboxed: return PluginModuleLoadUnsandboxed; } ASSERT_NOT_REACHED(); - return PluginModuleBlocked; + return PluginModuleBlockedForSecurity; +} + +inline WebCore::PluginLoadClientPolicy toPluginLoadClientPolicy(WKPluginLoadClientPolicy pluginLoadClientPolicy) +{ + switch (pluginLoadClientPolicy) { + case kWKPluginLoadClientPolicyUndefined: + return WebCore::PluginLoadClientPolicyUndefined; + case kWKPluginLoadClientPolicyBlock: + return WebCore::PluginLoadClientPolicyBlock; + case kWKPluginLoadClientPolicyAsk: + return WebCore::PluginLoadClientPolicyAsk; + case kWKPluginLoadClientPolicyAllow: + return WebCore::PluginLoadClientPolicyAllow; + case kWKPluginLoadClientPolicyAllowAlways: + return WebCore::PluginLoadClientPolicyAllowAlways; + } + + ASSERT_NOT_REACHED(); + return WebCore::PluginLoadClientPolicyBlock; +} + +inline WebCore::WebGLLoadPolicy toWebGLLoadPolicy(WKWebGLLoadPolicy webGLLoadPolicy) +{ + switch (webGLLoadPolicy) { + case kWKWebGLLoadPolicyLoadNormally: + return WebCore::WebGLAllowCreation; + case kWKWebGLLoadPolicyBlocked: + return WebCore::WebGLBlockCreation; + case kWKWebGLLoadPolicyPending: + return WebCore::WebGLPendingCreation; + } + + ASSERT_NOT_REACHED(); + return WebCore::WebGLAllowCreation; +} + +inline WKWebGLLoadPolicy toAPI(WebCore::WebGLLoadPolicy webGLLoadPolicy) +{ + switch (webGLLoadPolicy) { + case WebCore::WebGLAllowCreation: + return kWKWebGLLoadPolicyLoadNormally; + case WebCore::WebGLBlockCreation: + return kWKWebGLLoadPolicyBlocked; + case WebCore::WebGLPendingCreation: + return kWKWebGLLoadPolicyPending; + } + + ASSERT_NOT_REACHED(); + return kWKWebGLLoadPolicyLoadNormally; } inline ProxyingRefPtr<WebGrammarDetail> toAPI(const WebCore::GrammarDetail& grammarDetail) diff --git a/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.cpp b/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.cpp index 2d95c6721..72b3fa5c8 100644 --- a/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.cpp @@ -26,27 +26,43 @@ #include "config.h" #include "WKApplicationCacheManager.h" +#include "APIWebsiteDataStore.h" #include "WKAPICast.h" -#include "WebApplicationCacheManagerProxy.h" +#include "WebsiteDataRecord.h" using namespace WebKit; WKTypeID WKApplicationCacheManagerGetTypeID() { - return toAPI(WebApplicationCacheManagerProxy::APIType); + return toAPI(API::WebsiteDataStore::APIType); } -void WKApplicationCacheManagerGetApplicationCacheOrigins(WKApplicationCacheManagerRef applicationCacheManagerRef, void* context, WKApplicationCacheManagerGetApplicationCacheOriginsFunction callback) +void WKApplicationCacheManagerGetApplicationCacheOrigins(WKApplicationCacheManagerRef applicationCacheManager, void* context, WKApplicationCacheManagerGetApplicationCacheOriginsFunction callback) { - toImpl(applicationCacheManagerRef)->getApplicationCacheOrigins(ArrayCallback::create(context, callback)); + auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(applicationCacheManager))->websiteDataStore(); + websiteDataStore.fetchData(WebsiteDataTypes::WebsiteDataTypeOfflineWebApplicationCache, [context, callback](Vector<WebsiteDataRecord> dataRecords) { + Vector<RefPtr<API::Object>> securityOrigins; + for (const auto& dataRecord : dataRecords) { + for (const auto& origin : dataRecord.origins) + securityOrigins.append(API::SecurityOrigin::create(*origin)); + } + + callback(toAPI(API::Array::create(WTFMove(securityOrigins)).ptr()), nullptr, context); + }); } -void WKApplicationCacheManagerDeleteEntriesForOrigin(WKApplicationCacheManagerRef applicationCacheManagerRef, WKSecurityOriginRef originRef) +void WKApplicationCacheManagerDeleteEntriesForOrigin(WKApplicationCacheManagerRef applicationCacheManager, WKSecurityOriginRef origin) { - toImpl(applicationCacheManagerRef)->deleteEntriesForOrigin(toImpl(originRef)); + auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(applicationCacheManager))->websiteDataStore(); + + WebsiteDataRecord dataRecord; + dataRecord.add(WebsiteDataTypes::WebsiteDataTypeOfflineWebApplicationCache, &toImpl(origin)->securityOrigin()); + + websiteDataStore.removeData(WebsiteDataTypes::WebsiteDataTypeOfflineWebApplicationCache, { dataRecord }, [] { }); } -void WKApplicationCacheManagerDeleteAllEntries(WKApplicationCacheManagerRef applicationCacheManagerRef) +void WKApplicationCacheManagerDeleteAllEntries(WKApplicationCacheManagerRef applicationCacheManager) { - toImpl(applicationCacheManagerRef)->deleteAllEntries(); + auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(applicationCacheManager))->websiteDataStore(); + websiteDataStore.removeData(WebsiteDataTypes::WebsiteDataTypeOfflineWebApplicationCache, std::chrono::system_clock::time_point::min(), [] { }); } diff --git a/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.h b/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.h index c40039e37..065a462d4 100644 --- a/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.h +++ b/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.h @@ -26,7 +26,7 @@ #ifndef WKApplicationCacheManager_h #define WKApplicationCacheManager_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp b/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp index c42b85732..17067cc32 100644 --- a/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp @@ -27,10 +27,11 @@ #include "WKAuthenticationChallenge.h" #include "AuthenticationChallengeProxy.h" +#include "AuthenticationDecisionListener.h" +#include "WKAPICast.h" #include "WebCertificateInfo.h" #include "WebCredential.h" #include "WebProtectionSpace.h" -#include "WKAPICast.h" using namespace WebKit; diff --git a/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.h b/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.h index 3802f417f..bc2cf2e7e 100644 --- a/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.h +++ b/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.h @@ -26,7 +26,7 @@ #ifndef WKAuthenticationChallenge_h #define WKAuthenticationChallenge_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp b/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp index bcb175dfd..06ca308b5 100644 --- a/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp @@ -28,6 +28,7 @@ #include "AuthenticationDecisionListener.h" #include "WKAPICast.h" +#include "WebCredential.h" using namespace WebKit; diff --git a/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.h b/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.h index f0724610b..2134de091 100644 --- a/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.h +++ b/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.h @@ -26,7 +26,7 @@ #ifndef WKAuthenticationDecisionListener_h #define WKAuthenticationDecisionListener_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItemRef.cpp index 00dc6da41..fea7fb941 100644 --- a/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItemRef.cpp @@ -24,7 +24,7 @@ */ #include "config.h" -#include "WKBackForwardListItem.h" +#include "WKBackForwardListItemRef.h" #include "WKAPICast.h" #include "WebBackForwardListItem.h" diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.h b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItemRef.h index 3810d1523..f63ba5f45 100644 --- a/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.h +++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItemRef.h @@ -23,10 +23,10 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKBackForwardListItem_h -#define WKBackForwardListItem_h +#ifndef WKBackForwardListItemRef_h +#define WKBackForwardListItemRef_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { @@ -42,4 +42,4 @@ WK_EXPORT WKURLRef WKBackForwardListItemCopyOriginalURL(WKBackForwardListItemRef } #endif -#endif /* WKBackForwardListItem_h */ +#endif /* WKBackForwardListItemRef_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp b/Source/WebKit2/UIProcess/API/C/WKBackForwardListRef.cpp index f7129b866..4be7fc369 100644 --- a/Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardListRef.cpp @@ -24,8 +24,9 @@ */ #include "config.h" -#include "WKBackForwardList.h" +#include "WKBackForwardListRef.h" +#include "APIArray.h" #include "WebBackForwardList.h" #include "WKAPICast.h" @@ -56,6 +57,11 @@ WKBackForwardListItemRef WKBackForwardListGetItemAtIndex(WKBackForwardListRef li return toAPI(toImpl(listRef)->itemAtIndex(index)); } +void WKBackForwardListClear(WKBackForwardListRef listRef) +{ + toImpl(listRef)->clear(); +} + unsigned WKBackForwardListGetBackListCount(WKBackForwardListRef listRef) { return toImpl(listRef)->backListCount(); @@ -68,10 +74,10 @@ unsigned WKBackForwardListGetForwardListCount(WKBackForwardListRef listRef) WKArrayRef WKBackForwardListCopyBackListWithLimit(WKBackForwardListRef listRef, unsigned limit) { - return toAPI(toImpl(listRef)->backListAsImmutableArrayWithLimit(limit).leakRef()); + return toAPI(&toImpl(listRef)->backListAsAPIArrayWithLimit(limit).leakRef()); } WKArrayRef WKBackForwardListCopyForwardListWithLimit(WKBackForwardListRef listRef, unsigned limit) { - return toAPI(toImpl(listRef)->forwardListAsImmutableArrayWithLimit(limit).leakRef()); + return toAPI(&toImpl(listRef)->forwardListAsAPIArrayWithLimit(limit).leakRef()); } diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardList.h b/Source/WebKit2/UIProcess/API/C/WKBackForwardListRef.h index 214a6bc81..97b2209d2 100644 --- a/Source/WebKit2/UIProcess/API/C/WKBackForwardList.h +++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardListRef.h @@ -23,10 +23,10 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKBackForwardList_h -#define WKBackForwardList_h +#ifndef WKBackForwardListRef_h +#define WKBackForwardListRef_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { @@ -39,6 +39,8 @@ WK_EXPORT WKBackForwardListItemRef WKBackForwardListGetBackItem(WKBackForwardLis WK_EXPORT WKBackForwardListItemRef WKBackForwardListGetForwardItem(WKBackForwardListRef list); WK_EXPORT WKBackForwardListItemRef WKBackForwardListGetItemAtIndex(WKBackForwardListRef list, int index); +WK_EXPORT void WKBackForwardListClear(WKBackForwardListRef list); + WK_EXPORT unsigned WKBackForwardListGetBackListCount(WKBackForwardListRef list); WK_EXPORT unsigned WKBackForwardListGetForwardListCount(WKBackForwardListRef list); @@ -49,4 +51,4 @@ WK_EXPORT WKArrayRef WKBackForwardListCopyForwardListWithLimit(WKBackForwardList } #endif -#endif // WKBackForwardList_h +#endif // WKBackForwardListRef_h diff --git a/Source/WebKit2/UIProcess/API/C/WKBatteryManager.cpp b/Source/WebKit2/UIProcess/API/C/WKBatteryManager.cpp index 950336d56..7a87d5d85 100644 --- a/Source/WebKit2/UIProcess/API/C/WKBatteryManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKBatteryManager.cpp @@ -31,6 +31,7 @@ #if ENABLE(BATTERY_STATUS) #include "WebBatteryManagerProxy.h" +#include "WebBatteryStatus.h" #endif using namespace WebKit; @@ -44,10 +45,13 @@ WKTypeID WKBatteryManagerGetTypeID() #endif } -void WKBatteryManagerSetProvider(WKBatteryManagerRef batteryManager, const WKBatteryProvider* provider) +void WKBatteryManagerSetProvider(WKBatteryManagerRef batteryManager, const WKBatteryProviderBase* provider) { #if ENABLE(BATTERY_STATUS) toImpl(batteryManager)->initializeProvider(provider); +#else + UNUSED_PARAM(batteryManager); + UNUSED_PARAM(provider); #endif } @@ -55,6 +59,10 @@ void WKBatteryManagerProviderDidChangeBatteryStatus(WKBatteryManagerRef batteryM { #if ENABLE(BATTERY_STATUS) toImpl(batteryManager)->providerDidChangeBatteryStatus(AtomicString(toImpl(eventType)->string()), toImpl(status)); +#else + UNUSED_PARAM(batteryManager); + UNUSED_PARAM(eventType); + UNUSED_PARAM(status); #endif } @@ -62,5 +70,8 @@ void WKBatteryManagerProviderUpdateBatteryStatus(WKBatteryManagerRef batteryMana { #if ENABLE(BATTERY_STATUS) toImpl(batteryManager)->providerUpdateBatteryStatus(toImpl(status)); +#else + UNUSED_PARAM(batteryManager); + UNUSED_PARAM(status); #endif } diff --git a/Source/WebKit2/UIProcess/API/C/WKBatteryManager.h b/Source/WebKit2/UIProcess/API/C/WKBatteryManager.h index 712cbfb4c..5c2ce7585 100644 --- a/Source/WebKit2/UIProcess/API/C/WKBatteryManager.h +++ b/Source/WebKit2/UIProcess/API/C/WKBatteryManager.h @@ -26,7 +26,7 @@ #ifndef WKBatteryManager_h #define WKBatteryManager_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { @@ -36,19 +36,21 @@ extern "C" { typedef void (*WKBatteryProviderStartUpdatingCallback)(WKBatteryManagerRef batteryManager, const void* clientInfo); typedef void (*WKBatteryProviderStopUpdatingCallback)(WKBatteryManagerRef batteryManager, const void* clientInfo); -struct WKBatteryProvider { +typedef struct WKBatteryProviderBase { int version; const void * clientInfo; +} WKBatteryProviderBase; + +typedef struct WKBatteryProviderV0 { + WKBatteryProviderBase base; + WKBatteryProviderStartUpdatingCallback startUpdating; WKBatteryProviderStopUpdatingCallback stopUpdating; -}; -typedef struct WKBatteryProvider WKBatteryProvider; - -enum { kWKBatteryProviderCurrentVersion = 0 }; +} WKBatteryProviderV0; WK_EXPORT WKTypeID WKBatteryManagerGetTypeID(); -WK_EXPORT void WKBatteryManagerSetProvider(WKBatteryManagerRef batteryManager, const WKBatteryProvider* provider); +WK_EXPORT void WKBatteryManagerSetProvider(WKBatteryManagerRef batteryManager, const WKBatteryProviderBase* provider); WK_EXPORT void WKBatteryManagerProviderDidChangeBatteryStatus(WKBatteryManagerRef batteryManager, WKStringRef eventType, WKBatteryStatusRef status); WK_EXPORT void WKBatteryManagerProviderUpdateBatteryStatus(WKBatteryManagerRef batteryManager, WKBatteryStatusRef status); diff --git a/Source/WebKit2/UIProcess/API/C/WKBatteryStatus.cpp b/Source/WebKit2/UIProcess/API/C/WKBatteryStatus.cpp index 0069a6f95..953850d8b 100644 --- a/Source/WebKit2/UIProcess/API/C/WKBatteryStatus.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKBatteryStatus.cpp @@ -49,6 +49,10 @@ WKBatteryStatusRef WKBatteryStatusCreate(bool isCharging, double chargingTime, d RefPtr<WebBatteryStatus> status = WebBatteryStatus::create(isCharging, chargingTime, dischargingTime, level); return toAPI(status.release().leakRef()); #else + UNUSED_PARAM(isCharging); + UNUSED_PARAM(chargingTime); + UNUSED_PARAM(dischargingTime); + UNUSED_PARAM(level); return 0; #endif } diff --git a/Source/WebKit2/UIProcess/API/C/WKBatteryStatus.h b/Source/WebKit2/UIProcess/API/C/WKBatteryStatus.h index afa1dd931..b32b99fd7 100644 --- a/Source/WebKit2/UIProcess/API/C/WKBatteryStatus.h +++ b/Source/WebKit2/UIProcess/API/C/WKBatteryStatus.h @@ -26,7 +26,7 @@ #ifndef WKBatteryStatus_h #define WKBatteryStatus_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKColorPickerResultListener.h b/Source/WebKit2/UIProcess/API/C/WKColorPickerResultListener.h deleted file mode 100644 index bfd4732c9..000000000 --- a/Source/WebKit2/UIProcess/API/C/WKColorPickerResultListener.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2012 Samsung Electronics. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WKColorPickerResultListener_h -#define WKColorPickerResultListener_h - -#include <WebKit2/WKBase.h> - -#ifdef __cplusplus -extern "C" { -#endif - -WK_EXPORT WKTypeID WKColorPickerResultListenerGetTypeID(); - -WK_EXPORT void WKColorPickerResultListenerSetColor(WKColorPickerResultListenerRef listenerRef, const WKStringRef color); - -#ifdef __cplusplus -} -#endif - -#endif /* WKColorPickerResultListener_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.cpp b/Source/WebKit2/UIProcess/API/C/WKContext.cpp index 1629a5627..98555a2d6 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKContext.cpp @@ -24,91 +24,266 @@ */ #include "config.h" -#include "WKContext.h" #include "WKContextPrivate.h" +#include "APIClient.h" +#include "APIDownloadClient.h" +#include "APILegacyContextHistoryClient.h" +#include "APINavigationData.h" +#include "APIProcessPoolConfiguration.h" +#include "APIURLRequest.h" +#include "AuthenticationChallengeProxy.h" +#include "DownloadProxy.h" #include "WKAPICast.h" -#include "WebContext.h" -#include "WebURLRequest.h" +#include "WKContextConfigurationRef.h" +#include "WKRetainPtr.h" +#include "WebCertificateInfo.h" +#include "WebIconDatabase.h" +#include "WebProcessPool.h" #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/text/WTFString.h> // Supplements -#include "WebApplicationCacheManagerProxy.h" #include "WebCookieManagerProxy.h" #include "WebGeolocationManagerProxy.h" -#include "WebKeyValueStorageManager.h" -#include "WebMediaCacheManagerProxy.h" #include "WebNotificationManagerProxy.h" -#include "WebResourceCacheManagerProxy.h" -#if ENABLE(SQL_DATABASE) -#include "WebDatabaseManagerProxy.h" -#endif #if ENABLE(BATTERY_STATUS) #include "WebBatteryManagerProxy.h" #endif -#if ENABLE(NETWORK_INFO) -#include "WebNetworkInfoManagerProxy.h" -#endif - -using namespace WebKit; -extern "C" { -// For binary compatibility with Safari 5.1. Should be removed eventually. -WK_EXPORT void _WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKStringRef pluginsDirectory); -WK_EXPORT void _WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef context, WKStringRef urlScheme); -WK_EXPORT void _WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef context, bool alwaysUseComplexTextCodePath); -WK_EXPORT void _WKContextSetHTTPPipeliningEnabled(WKContextRef context, bool enabled); +namespace API { +template<> struct ClientTraits<WKContextDownloadClientBase> { + typedef std::tuple<WKContextDownloadClientV0> Versions; +}; +template<> struct ClientTraits<WKContextHistoryClientBase> { + typedef std::tuple<WKContextHistoryClientV0> Versions; +}; } +using namespace WebCore; +using namespace WebKit; + WKTypeID WKContextGetTypeID() { - return toAPI(WebContext::APIType); + return toAPI(WebProcessPool::APIType); } WKContextRef WKContextCreate() { - RefPtr<WebContext> context = WebContext::create(String()); - return toAPI(context.release().leakRef()); + auto configuration = API::ProcessPoolConfiguration::createWithLegacyOptions(); + return toAPI(&WebProcessPool::create(configuration).leakRef()); } WKContextRef WKContextCreateWithInjectedBundlePath(WKStringRef pathRef) { - RefPtr<WebContext> context = WebContext::create(toImpl(pathRef)->string()); - return toAPI(context.release().leakRef()); + auto configuration = API::ProcessPoolConfiguration::createWithLegacyOptions(); + configuration->setInjectedBundlePath(toWTFString(pathRef)); + + return toAPI(&WebProcessPool::create(configuration).leakRef()); } -void WKContextSetClient(WKContextRef contextRef, const WKContextClient* wkClient) +WKContextRef WKContextCreateWithConfiguration(WKContextConfigurationRef configuration) { - toImpl(contextRef)->initializeClient(wkClient); + return toAPI(&WebProcessPool::create(*toImpl(configuration)).leakRef()); } -void WKContextSetInjectedBundleClient(WKContextRef contextRef, const WKContextInjectedBundleClient* wkClient) +void WKContextSetClient(WKContextRef contextRef, const WKContextClientBase* wkClient) { - toImpl(contextRef)->initializeInjectedBundleClient(wkClient); + toImpl(contextRef)->initializeClient(wkClient); } -void WKContextSetHistoryClient(WKContextRef contextRef, const WKContextHistoryClient* wkClient) +void WKContextSetInjectedBundleClient(WKContextRef contextRef, const WKContextInjectedBundleClientBase* wkClient) { - toImpl(contextRef)->initializeHistoryClient(wkClient); + toImpl(contextRef)->initializeInjectedBundleClient(wkClient); } -void WKContextSetDownloadClient(WKContextRef contextRef, const WKContextDownloadClient* wkClient) +void WKContextSetHistoryClient(WKContextRef contextRef, const WKContextHistoryClientBase* wkClient) { - toImpl(contextRef)->initializeDownloadClient(wkClient); -} + class HistoryClient final : public API::Client<WKContextHistoryClientBase>, public API::LegacyContextHistoryClient { + public: + explicit HistoryClient(const WKContextHistoryClientBase* client) + { + initialize(client); + } -void WKContextSetConnectionClient(WKContextRef contextRef, const WKContextConnectionClient* wkClient) + private: + virtual void didNavigateWithNavigationData(WebProcessPool& processPool, WebPageProxy& page, const WebNavigationDataStore& navigationDataStore, WebFrameProxy& frame) override + { + if (!m_client.didNavigateWithNavigationData) + return; + + RefPtr<API::NavigationData> navigationData = API::NavigationData::create(navigationDataStore); + m_client.didNavigateWithNavigationData(toAPI(&processPool), toAPI(&page), toAPI(navigationData.get()), toAPI(&frame), m_client.base.clientInfo); + } + + virtual void didPerformClientRedirect(WebProcessPool& processPool, WebPageProxy& page, const String& sourceURL, const String& destinationURL, WebFrameProxy& frame) override + { + if (!m_client.didPerformClientRedirect) + return; + + m_client.didPerformClientRedirect(toAPI(&processPool), toAPI(&page), toURLRef(sourceURL.impl()), toURLRef(destinationURL.impl()), toAPI(&frame), m_client.base.clientInfo); + } + + virtual void didPerformServerRedirect(WebProcessPool& processPool, WebPageProxy& page, const String& sourceURL, const String& destinationURL, WebFrameProxy& frame) override + { + if (!m_client.didPerformServerRedirect) + return; + + m_client.didPerformServerRedirect(toAPI(&processPool), toAPI(&page), toURLRef(sourceURL.impl()), toURLRef(destinationURL.impl()), toAPI(&frame), m_client.base.clientInfo); + } + + virtual void didUpdateHistoryTitle(WebProcessPool& processPool, WebPageProxy& page, const String& title, const String& url, WebFrameProxy& frame) override + { + if (!m_client.didUpdateHistoryTitle) + return; + + m_client.didUpdateHistoryTitle(toAPI(&processPool), toAPI(&page), toAPI(title.impl()), toURLRef(url.impl()), toAPI(&frame), m_client.base.clientInfo); + } + + virtual void populateVisitedLinks(WebProcessPool& processPool) override + { + if (!m_client.populateVisitedLinks) + return; + + m_client.populateVisitedLinks(toAPI(&processPool), m_client.base.clientInfo); + } + + virtual bool addsVisitedLinks() const override + { + return m_client.populateVisitedLinks; + } + }; + + WebProcessPool& processPool = *toImpl(contextRef); + processPool.setHistoryClient(std::make_unique<HistoryClient>(wkClient)); + + bool addsVisitedLinks = processPool.historyClient().addsVisitedLinks(); + + for (auto& process : processPool.processes()) { + for (auto& page : process->pages()) + page->setAddsVisitedLinks(addsVisitedLinks); + } +} + +void WKContextSetDownloadClient(WKContextRef contextRef, const WKContextDownloadClientBase* wkClient) +{ + class DownloadClient final : public API::Client<WKContextDownloadClientBase>, public API::DownloadClient { + public: + explicit DownloadClient(const WKContextDownloadClientBase* client) + { + initialize(client); + } + private: + virtual void didStart(WebProcessPool* processPool, DownloadProxy* downloadProxy) override + { + if (!m_client.didStart) + return; + + m_client.didStart(toAPI(processPool), toAPI(downloadProxy), m_client.base.clientInfo); + } + + virtual void didReceiveAuthenticationChallenge(WebProcessPool* processPool, DownloadProxy* downloadProxy, AuthenticationChallengeProxy* authenticationChallengeProxy) override + { + if (!m_client.didReceiveAuthenticationChallenge) + return; + + m_client.didReceiveAuthenticationChallenge(toAPI(processPool), toAPI(downloadProxy), toAPI(authenticationChallengeProxy), m_client.base.clientInfo); + } + + virtual void didReceiveResponse(WebProcessPool* processPool, DownloadProxy* downloadProxy, const ResourceResponse& response) override + { + if (!m_client.didReceiveResponse) + return; + + m_client.didReceiveResponse(toAPI(processPool), toAPI(downloadProxy), toAPI(API::URLResponse::create(response).ptr()), m_client.base.clientInfo); + } + + virtual void didReceiveData(WebProcessPool* processPool, DownloadProxy* downloadProxy, uint64_t length) override + { + if (!m_client.didReceiveData) + return; + + m_client.didReceiveData(toAPI(processPool), toAPI(downloadProxy), length, m_client.base.clientInfo); + } + + virtual bool shouldDecodeSourceDataOfMIMEType(WebProcessPool* processPool, DownloadProxy* downloadProxy, const String& mimeType) override + { + if (!m_client.shouldDecodeSourceDataOfMIMEType) + return true; + + return m_client.shouldDecodeSourceDataOfMIMEType(toAPI(processPool), toAPI(downloadProxy), toAPI(mimeType.impl()), m_client.base.clientInfo); + } + + virtual String decideDestinationWithSuggestedFilename(WebProcessPool* processPool, DownloadProxy* downloadProxy, const String& filename, bool& allowOverwrite) override + { + if (!m_client.decideDestinationWithSuggestedFilename) + return String(); + + WKRetainPtr<WKStringRef> destination(AdoptWK, m_client.decideDestinationWithSuggestedFilename(toAPI(processPool), toAPI(downloadProxy), toAPI(filename.impl()), &allowOverwrite, m_client.base.clientInfo)); + return toWTFString(destination.get()); + } + + virtual void didCreateDestination(WebProcessPool* processPool, DownloadProxy* downloadProxy, const String& path) override + { + if (!m_client.didCreateDestination) + return; + + m_client.didCreateDestination(toAPI(processPool), toAPI(downloadProxy), toAPI(path.impl()), m_client.base.clientInfo); + } + + virtual void didFinish(WebProcessPool* processPool, DownloadProxy* downloadProxy) override + { + if (!m_client.didFinish) + return; + + m_client.didFinish(toAPI(processPool), toAPI(downloadProxy), m_client.base.clientInfo); + } + + virtual void didFail(WebProcessPool* processPool, DownloadProxy* downloadProxy, const ResourceError& error) override + { + if (!m_client.didFail) + return; + + m_client.didFail(toAPI(processPool), toAPI(downloadProxy), toAPI(error), m_client.base.clientInfo); + } + + virtual void didCancel(WebProcessPool* processPool, DownloadProxy* downloadProxy) override + { + if (!m_client.didCancel) + return; + + m_client.didCancel(toAPI(processPool), toAPI(downloadProxy), m_client.base.clientInfo); + } + + virtual void processDidCrash(WebProcessPool* processPool, DownloadProxy* downloadProxy) override + { + if (!m_client.processDidCrash) + return; + + m_client.processDidCrash(toAPI(processPool), toAPI(downloadProxy), m_client.base.clientInfo); + } + + }; + + toImpl(contextRef)->setDownloadClient(std::make_unique<DownloadClient>(wkClient)); +} + +void WKContextSetConnectionClient(WKContextRef contextRef, const WKContextConnectionClientBase* wkClient) { toImpl(contextRef)->initializeConnectionClient(wkClient); } -WKDownloadRef WKContextDownloadURLRequest(WKContextRef contextRef, const WKURLRequestRef requestRef) +WKDownloadRef WKContextDownloadURLRequest(WKContextRef contextRef, WKURLRequestRef requestRef) { return toAPI(toImpl(contextRef)->download(0, toImpl(requestRef)->resourceRequest())); } +WKDownloadRef WKContextResumeDownload(WKContextRef contextRef, WKDataRef resumeData, WKStringRef path) +{ + return toAPI(toImpl(contextRef)->resumeDownload(toImpl(resumeData), toWTFString(path))); +} + void WKContextSetInitializationUserDataForInjectedBundle(WKContextRef contextRef, WKTypeRef userDataRef) { toImpl(contextRef)->setInjectedBundleInitializationUserData(toImpl(userDataRef)); @@ -121,7 +296,7 @@ void WKContextPostMessageToInjectedBundle(WKContextRef contextRef, WKStringRef m void WKContextGetGlobalStatistics(WKContextStatistics* statistics) { - const WebContext::Statistics& webContextStatistics = WebContext::statistics(); + const WebProcessPool::Statistics& webContextStatistics = WebProcessPool::statistics(); statistics->wkViewCount = webContextStatistics.wkViewCount; statistics->wkPageCount = webContextStatistics.wkPageCount; @@ -130,27 +305,26 @@ void WKContextGetGlobalStatistics(WKContextStatistics* statistics) void WKContextAddVisitedLink(WKContextRef contextRef, WKStringRef visitedURL) { - toImpl(contextRef)->addVisitedLink(toImpl(visitedURL)->string()); -} + String visitedURLString = toImpl(visitedURL)->string(); + if (visitedURLString.isEmpty()) + return; -void WKContextSetCacheModel(WKContextRef contextRef, WKCacheModel cacheModel) -{ - toImpl(contextRef)->setCacheModel(toCacheModel(cacheModel)); + toImpl(contextRef)->visitedLinkStore().addVisitedLinkHash(visitedLinkHash(visitedURLString)); } -WKCacheModel WKContextGetCacheModel(WKContextRef contextRef) +void WKContextClearVisitedLinks(WKContextRef contextRef) { - return toAPI(toImpl(contextRef)->cacheModel()); + toImpl(contextRef)->visitedLinkStore().removeAll(); } -void WKContextSetProcessModel(WKContextRef contextRef, WKProcessModel processModel) +void WKContextSetCacheModel(WKContextRef contextRef, WKCacheModel cacheModel) { - toImpl(contextRef)->setProcessModel(toProcessModel(processModel)); + toImpl(contextRef)->setCacheModel(toCacheModel(cacheModel)); } -WKProcessModel WKContextGetProcessModel(WKContextRef contextRef) +WKCacheModel WKContextGetCacheModel(WKContextRef contextRef) { - return toAPI(toImpl(contextRef)->processModel()); + return toAPI(toImpl(contextRef)->cacheModel()); } void WKContextSetMaximumNumberOfProcesses(WKContextRef contextRef, unsigned numberOfProcesses) @@ -193,35 +367,52 @@ void WKContextRegisterURLSchemeAsSecure(WKContextRef contextRef, WKStringRef url toImpl(contextRef)->registerURLSchemeAsSecure(toImpl(urlScheme)->string()); } +void WKContextRegisterURLSchemeAsBypassingContentSecurityPolicy(WKContextRef contextRef, WKStringRef urlScheme) +{ + toImpl(contextRef)->registerURLSchemeAsBypassingContentSecurityPolicy(toImpl(urlScheme)->string()); +} + +void WKContextRegisterURLSchemeAsCachePartitioned(WKContextRef contextRef, WKStringRef urlScheme) +{ +#if ENABLE(CACHE_PARTITIONING) + toImpl(contextRef)->registerURLSchemeAsCachePartitioned(toImpl(urlScheme)->string()); +#else + UNUSED_PARAM(contextRef); + UNUSED_PARAM(urlScheme); +#endif +} + void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef contextRef, WKStringRef urlScheme) { toImpl(contextRef)->setDomainRelaxationForbiddenForURLScheme(toImpl(urlScheme)->string()); } +void WKContextSetCanHandleHTTPSServerTrustEvaluation(WKContextRef contextRef, bool value) +{ + toImpl(contextRef)->setCanHandleHTTPSServerTrustEvaluation(value); +} + WKCookieManagerRef WKContextGetCookieManager(WKContextRef contextRef) { return toAPI(toImpl(contextRef)->supplement<WebCookieManagerProxy>()); } -WKApplicationCacheManagerRef WKContextGetApplicationCacheManager(WKContextRef contextRef) +WKWebsiteDataStoreRef WKContextGetWebsiteDataStore(WKContextRef context) { - return toAPI(toImpl(contextRef)->supplement<WebApplicationCacheManagerProxy>()); + return toAPI(toImpl(context)->websiteDataStore()); } -WKBatteryManagerRef WKContextGetBatteryManager(WKContextRef contextRef) +WKApplicationCacheManagerRef WKContextGetApplicationCacheManager(WKContextRef context) { -#if ENABLE(BATTERY_STATUS) - return toAPI(toImpl(contextRef)->supplement<WebBatteryManagerProxy>()); -#else - return 0; -#endif + return reinterpret_cast<WKApplicationCacheManagerRef>(WKContextGetWebsiteDataStore(context)); } -WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef contextRef) +WKBatteryManagerRef WKContextGetBatteryManager(WKContextRef contextRef) { -#if ENABLE(SQL_DATABASE) - return toAPI(toImpl(contextRef)->supplement<WebDatabaseManagerProxy>()); +#if ENABLE(BATTERY_STATUS) + return toAPI(toImpl(contextRef)->supplement<WebBatteryManagerProxy>()); #else + UNUSED_PARAM(contextRef); return 0; #endif } @@ -231,28 +422,24 @@ WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef contextRef) return toAPI(toImpl(contextRef)->supplement<WebGeolocationManagerProxy>()); } -WKNetworkInfoManagerRef WKContextGetNetworkInfoManager(WKContextRef contextRef) -{ -#if ENABLE(NETWORK_INFO) - return toAPI(toImpl(contextRef)->supplement<WebNetworkInfoManagerProxy>()); -#else - return 0; -#endif -} - WKIconDatabaseRef WKContextGetIconDatabase(WKContextRef contextRef) { return toAPI(toImpl(contextRef)->iconDatabase()); } -WKKeyValueStorageManagerRef WKContextGetKeyValueStorageManager(WKContextRef contextRef) +WKKeyValueStorageManagerRef WKContextGetKeyValueStorageManager(WKContextRef context) { - return toAPI(toImpl(contextRef)->supplement<WebKeyValueStorageManager>()); + return reinterpret_cast<WKKeyValueStorageManagerRef>(WKContextGetWebsiteDataStore(context)); } -WKMediaCacheManagerRef WKContextGetMediaCacheManager(WKContextRef contextRef) +WKMediaSessionFocusManagerRef WKContextGetMediaSessionFocusManager(WKContextRef context) { - return toAPI(toImpl(contextRef)->supplement<WebMediaCacheManagerProxy>()); +#if ENABLE(MEDIA_SESSION) + return toAPI(toImpl(context)->supplement<WebMediaSessionFocusManager>()); +#else + UNUSED_PARAM(context); + return nullptr; +#endif } WKNotificationManagerRef WKContextGetNotificationManager(WKContextRef contextRef) @@ -260,18 +447,19 @@ WKNotificationManagerRef WKContextGetNotificationManager(WKContextRef contextRef return toAPI(toImpl(contextRef)->supplement<WebNotificationManagerProxy>()); } -WKPluginSiteDataManagerRef WKContextGetPluginSiteDataManager(WKContextRef contextRef) +WKPluginSiteDataManagerRef WKContextGetPluginSiteDataManager(WKContextRef context) { #if ENABLE(NETSCAPE_PLUGIN_API) - return toAPI(toImpl(contextRef)->pluginSiteDataManager()); + return reinterpret_cast<WKPluginSiteDataManagerRef>(WKContextGetWebsiteDataStore(context)); #else - return 0; + UNUSED_PARAM(context); + return nullptr; #endif } -WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRef contextRef) +WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRef context) { - return toAPI(toImpl(contextRef)->supplement<WebResourceCacheManagerProxy>()); + return reinterpret_cast<WKResourceCacheManagerRef>(WKContextGetWebsiteDataStore(context)); } void WKContextStartMemorySampler(WKContextRef contextRef, WKDoubleRef interval) @@ -294,26 +482,6 @@ void WKContextAllowSpecificHTTPSCertificateForHost(WKContextRef contextRef, WKCe toImpl(contextRef)->allowSpecificHTTPSCertificateForHost(toImpl(certificateRef), toImpl(hostRef)->string()); } -WK_EXPORT void WKContextSetApplicationCacheDirectory(WKContextRef contextRef, WKStringRef applicationCacheDirectory) -{ - toImpl(contextRef)->setApplicationCacheDirectory(toImpl(applicationCacheDirectory)->string()); -} - -void WKContextSetDatabaseDirectory(WKContextRef contextRef, WKStringRef databaseDirectory) -{ - toImpl(contextRef)->setDatabaseDirectory(toImpl(databaseDirectory)->string()); -} - -void WKContextSetLocalStorageDirectory(WKContextRef contextRef, WKStringRef localStorageDirectory) -{ - toImpl(contextRef)->setLocalStorageDirectory(toImpl(localStorageDirectory)->string()); -} - -WK_EXPORT void WKContextSetDiskCacheDirectory(WKContextRef contextRef, WKStringRef diskCacheDirectory) -{ - toImpl(contextRef)->setDiskCacheDirectory(toImpl(diskCacheDirectory)->string()); -} - WK_EXPORT void WKContextSetCookieStorageDirectory(WKContextRef contextRef, WKStringRef cookieStorageDirectory) { toImpl(contextRef)->setCookieStorageDirectory(toImpl(cookieStorageDirectory)->string()); @@ -341,12 +509,12 @@ void WKContextWarmInitialProcess(WKContextRef contextRef) void WKContextGetStatistics(WKContextRef contextRef, void* context, WKContextGetStatisticsFunction callback) { - toImpl(contextRef)->getStatistics(0xFFFFFFFF, DictionaryCallback::create(context, callback)); + toImpl(contextRef)->getStatistics(0xFFFFFFFF, toGenericCallbackFunction(context, callback)); } void WKContextGetStatisticsWithOptions(WKContextRef contextRef, WKStatisticsOptions optionsMask, void* context, WKContextGetStatisticsFunction callback) { - toImpl(contextRef)->getStatistics(optionsMask, DictionaryCallback::create(context, callback)); + toImpl(contextRef)->getStatistics(optionsMask, toGenericCallbackFunction(context, callback)); } void WKContextGarbageCollectJavaScriptObjects(WKContextRef contextRef) @@ -359,9 +527,14 @@ void WKContextSetJavaScriptGarbageCollectorTimerEnabled(WKContextRef contextRef, toImpl(contextRef)->setJavaScriptGarbageCollectorTimerEnabled(enable); } -void WKContextSetUsesNetworkProcess(WKContextRef contextRef, bool usesNetworkProcess) +void WKContextUseTestingNetworkSession(WKContextRef context) +{ + toImpl(context)->useTestingNetworkSession(); +} + +void WKContextClearCachedCredentials(WKContextRef context) { - toImpl(contextRef)->setUsesNetworkProcess(usesNetworkProcess); + toImpl(context)->clearCachedCredentials(); } WKDictionaryRef WKContextCopyPlugInAutoStartOriginHashes(WKContextRef contextRef) @@ -376,6 +549,13 @@ void WKContextSetPlugInAutoStartOriginHashes(WKContextRef contextRef, WKDictiona toImpl(contextRef)->setPlugInAutoStartOriginHashes(*toImpl(dictionaryRef)); } +void WKContextSetPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime(WKContextRef contextRef, WKDictionaryRef dictionaryRef, double time) +{ + if (!dictionaryRef) + return; + toImpl(contextRef)->setPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime(*toImpl(dictionaryRef), time); +} + void WKContextSetPlugInAutoStartOrigins(WKContextRef contextRef, WKArrayRef arrayRef) { if (!arrayRef) @@ -385,26 +565,15 @@ void WKContextSetPlugInAutoStartOrigins(WKContextRef contextRef, WKArrayRef arra void WKContextSetInvalidMessageFunction(WKContextInvalidMessageFunction invalidMessageFunction) { - WebContext::setInvalidMessageCallback(invalidMessageFunction); -} - -// Deprecated functions. -void _WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKStringRef pluginsDirectory) -{ - WKContextSetAdditionalPluginsDirectory(context, pluginsDirectory); -} - -void _WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef context, WKStringRef urlScheme) -{ - WKContextRegisterURLSchemeAsEmptyDocument(context, urlScheme); + WebProcessPool::setInvalidMessageCallback(invalidMessageFunction); } -void _WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef context, bool alwaysUseComplexTextCodePath) +void WKContextSetMemoryCacheDisabled(WKContextRef contextRef, bool disabled) { - WKContextSetAlwaysUsesComplexTextCodePath(context, alwaysUseComplexTextCodePath); + toImpl(contextRef)->setMemoryCacheDisabled(disabled); } -void _WKContextSetHTTPPipeliningEnabled(WKContextRef context, bool enabled) +void WKContextSetFontWhitelist(WKContextRef contextRef, WKArrayRef arrayRef) { - WKContextSetHTTPPipeliningEnabled(context, enabled); + toImpl(contextRef)->setFontWhitelist(toImpl(arrayRef)); } diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.h b/Source/WebKit2/UIProcess/API/C/WKContext.h index 3ce731e78..279096991 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.h +++ b/Source/WebKit2/UIProcess/API/C/WKContext.h @@ -26,7 +26,11 @@ #ifndef WKContext_h #define WKContext_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKContextConnectionClient.h> +#include <WebKit/WKContextDownloadClient.h> +#include <WebKit/WKContextHistoryClient.h> +#include <WebKit/WKContextInjectedBundleClient.h> #ifdef __cplusplus extern "C" { @@ -43,104 +47,35 @@ typedef uint32_t WKCacheModel; typedef void (*WKContextPlugInAutoStartOriginHashesChangedCallback)(WKContextRef context, const void *clientInfo); typedef void (*WKContextNetworkProcessDidCrashCallback)(WKContextRef context, const void *clientInfo); typedef void (*WKContextPlugInInformationBecameAvailableCallback)(WKContextRef context, WKArrayRef plugIn, const void *clientInfo); +typedef WKDataRef (*WKContextCopyWebCryptoMasterKeyCallback)(WKContextRef context, const void *clientInfo); -struct WKContextClient { +typedef struct WKContextClientBase { int version; const void * clientInfo; +} WKContextClientBase; + +typedef struct WKContextClientV0 { + WKContextClientBase base; // Version 0. WKContextPlugInAutoStartOriginHashesChangedCallback plugInAutoStartOriginHashesChanged; WKContextNetworkProcessDidCrashCallback networkProcessDidCrash; WKContextPlugInInformationBecameAvailableCallback plugInInformationBecameAvailable; -}; -typedef struct WKContextClient WKContextClient; +} WKContextClientV0; -enum { kWKContextClientCurrentVersion = 0 }; - -// Injected Bundle Client -typedef void (*WKContextDidReceiveMessageFromInjectedBundleCallback)(WKContextRef page, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo); -typedef void (*WKContextDidReceiveSynchronousMessageFromInjectedBundleCallback)(WKContextRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData, const void *clientInfo); -typedef WKTypeRef (*WKContextGetInjectedBundleInitializationUserDataCallback)(WKContextRef context, const void *clientInfo); - -struct WKContextInjectedBundleClient { - int version; - const void * clientInfo; +typedef struct WKContextClientV1 { + WKContextClientBase base; // Version 0. - WKContextDidReceiveMessageFromInjectedBundleCallback didReceiveMessageFromInjectedBundle; - WKContextDidReceiveSynchronousMessageFromInjectedBundleCallback didReceiveSynchronousMessageFromInjectedBundle; + WKContextPlugInAutoStartOriginHashesChangedCallback plugInAutoStartOriginHashesChanged; + WKContextNetworkProcessDidCrashCallback networkProcessDidCrash; + WKContextPlugInInformationBecameAvailableCallback plugInInformationBecameAvailable; // Version 1. - WKContextGetInjectedBundleInitializationUserDataCallback getInjectedBundleInitializationUserData; -}; -typedef struct WKContextInjectedBundleClient WKContextInjectedBundleClient; - -enum { kWKContextInjectedBundleClientCurrentVersion = 1 }; - -// History Client -typedef void (*WKContextDidNavigateWithNavigationDataCallback)(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo); -typedef void (*WKContextDidPerformClientRedirectCallback)(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo); -typedef void (*WKContextDidPerformServerRedirectCallback)(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo); -typedef void (*WKContextDidUpdateHistoryTitleCallback)(WKContextRef context, WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void *clientInfo); -typedef void (*WKContextPopulateVisitedLinksCallback)(WKContextRef context, const void *clientInfo); - -struct WKContextHistoryClient { - int version; - const void * clientInfo; - WKContextDidNavigateWithNavigationDataCallback didNavigateWithNavigationData; - WKContextDidPerformClientRedirectCallback didPerformClientRedirect; - WKContextDidPerformServerRedirectCallback didPerformServerRedirect; - WKContextDidUpdateHistoryTitleCallback didUpdateHistoryTitle; - WKContextPopulateVisitedLinksCallback populateVisitedLinks; -}; -typedef struct WKContextHistoryClient WKContextHistoryClient; - -enum { kWKContextHistoryClientCurrentVersion = 0 }; - -// Download Client -typedef void (*WKContextDownloadDidStartCallback)(WKContextRef context, WKDownloadRef download, const void *clientInfo); -typedef void (*WKContextDownloadDidReceiveAuthenticationChallengeCallback)(WKContextRef context, WKDownloadRef download, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo); -typedef void (*WKContextDownloadDidReceiveResponseCallback)(WKContextRef context, WKDownloadRef download, WKURLResponseRef response, const void *clientInfo); -typedef void (*WKContextDownloadDidReceiveDataCallback)(WKContextRef context, WKDownloadRef download, uint64_t length, const void *clientInfo); -typedef bool (*WKContextDownloadShouldDecodeSourceDataOfMIMETypeCallback)(WKContextRef context, WKDownloadRef download, WKStringRef mimeType, const void *clientInfo); -typedef WKStringRef (*WKContextDownloadDecideDestinationWithSuggestedFilenameCallback)(WKContextRef context, WKDownloadRef download, WKStringRef filename, bool* allowOverwrite, const void *clientInfo); -typedef void (*WKContextDownloadDidCreateDestinationCallback)(WKContextRef context, WKDownloadRef download, WKStringRef path, const void *clientInfo); -typedef void (*WKContextDownloadDidFinishCallback)(WKContextRef context, WKDownloadRef download, const void *clientInfo); -typedef void (*WKContextDownloadDidFailCallback)(WKContextRef context, WKDownloadRef download, WKErrorRef error, const void *clientInfo); -typedef void (*WKContextDownloadDidCancel)(WKContextRef context, WKDownloadRef download, const void *clientInfo); -typedef void (*WKContextDownloadProcessDidCrashCallback)(WKContextRef context, WKDownloadRef download, const void *clientInfo); - -struct WKContextDownloadClient { - int version; - const void * clientInfo; - WKContextDownloadDidStartCallback didStart; - WKContextDownloadDidReceiveAuthenticationChallengeCallback didReceiveAuthenticationChallenge; - WKContextDownloadDidReceiveResponseCallback didReceiveResponse; - WKContextDownloadDidReceiveDataCallback didReceiveData; - WKContextDownloadShouldDecodeSourceDataOfMIMETypeCallback shouldDecodeSourceDataOfMIMEType; - WKContextDownloadDecideDestinationWithSuggestedFilenameCallback decideDestinationWithSuggestedFilename; - WKContextDownloadDidCreateDestinationCallback didCreateDestination; - WKContextDownloadDidFinishCallback didFinish; - WKContextDownloadDidFailCallback didFail; - WKContextDownloadDidCancel didCancel; - WKContextDownloadProcessDidCrashCallback processDidCrash; -}; -typedef struct WKContextDownloadClient WKContextDownloadClient; - -enum { kWKContextDownloadClientCurrentVersion = 0 }; - -// Connection Client -typedef void (*WKContextDidCreateConnection)(WKContextRef context, WKConnectionRef connection, const void* clientInfo); - -struct WKContextConnectionClient { - int version; - const void * clientInfo; - WKContextDidCreateConnection didCreateConnection; -}; -typedef struct WKContextConnectionClient WKContextConnectionClient; - -enum { kWKContextConnectionClientCurrentVersion = 0 }; + WKContextCopyWebCryptoMasterKeyCallback copyWebCryptoMasterKey; +} WKContextClientV1; +// FIXME: Remove these once support for Mavericks has been dropped. enum { kWKProcessModelSharedSecondaryProcess = 0, kWKProcessModelMultipleSecondaryProcesses = 1 @@ -157,25 +92,29 @@ WK_EXPORT WKTypeID WKContextGetTypeID(); WK_EXPORT WKContextRef WKContextCreate(); WK_EXPORT WKContextRef WKContextCreateWithInjectedBundlePath(WKStringRef path); +WK_EXPORT WKContextRef WKContextCreateWithConfiguration(WKContextConfigurationRef configuration); -WK_EXPORT void WKContextSetClient(WKContextRef context, const WKContextClient* client); -WK_EXPORT void WKContextSetInjectedBundleClient(WKContextRef context, const WKContextInjectedBundleClient* client); -WK_EXPORT void WKContextSetHistoryClient(WKContextRef context, const WKContextHistoryClient* client); -WK_EXPORT void WKContextSetDownloadClient(WKContextRef context, const WKContextDownloadClient* client); -WK_EXPORT void WKContextSetConnectionClient(WKContextRef context, const WKContextConnectionClient* client); +WK_EXPORT void WKContextSetClient(WKContextRef context, const WKContextClientBase* client); +WK_EXPORT void WKContextSetInjectedBundleClient(WKContextRef context, const WKContextInjectedBundleClientBase* client); +WK_EXPORT void WKContextSetHistoryClient(WKContextRef context, const WKContextHistoryClientBase* client); +WK_EXPORT void WKContextSetDownloadClient(WKContextRef context, const WKContextDownloadClientBase* client); +WK_EXPORT void WKContextSetConnectionClient(WKContextRef context, const WKContextConnectionClientBase* client); -WK_EXPORT WKDownloadRef WKContextDownloadURLRequest(WKContextRef context, const WKURLRequestRef request); +WK_EXPORT WKDownloadRef WKContextDownloadURLRequest(WKContextRef context, WKURLRequestRef request); +WK_EXPORT WKDownloadRef WKContextResumeDownload(WKContextRef context, WKDataRef resumeData, WKStringRef path); WK_EXPORT void WKContextSetInitializationUserDataForInjectedBundle(WKContextRef context, WKTypeRef userData); WK_EXPORT void WKContextPostMessageToInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody); WK_EXPORT void WKContextAddVisitedLink(WKContextRef context, WKStringRef visitedURL); +WK_EXPORT void WKContextClearVisitedLinks(WKContextRef contextRef); WK_EXPORT void WKContextSetCacheModel(WKContextRef context, WKCacheModel cacheModel); WK_EXPORT WKCacheModel WKContextGetCacheModel(WKContextRef context); -WK_EXPORT void WKContextSetProcessModel(WKContextRef context, WKProcessModel processModel); -WK_EXPORT WKProcessModel WKContextGetProcessModel(WKContextRef context); +// FIXME: Move these to WKDeprecatedFunctions.cpp once support for Mavericks has been dropped. +WK_EXPORT void WKContextSetProcessModel(WKContextRef, WKProcessModel); +WK_EXPORT WKProcessModel WKContextGetProcessModel(WKContextRef); WK_EXPORT void WKContextSetMaximumNumberOfProcesses(WKContextRef context, unsigned numberOfProcesses); WK_EXPORT unsigned WKContextGetMaximumNumberOfProcesses(WKContextRef context); @@ -183,19 +122,19 @@ WK_EXPORT unsigned WKContextGetMaximumNumberOfProcesses(WKContextRef context); WK_EXPORT void WKContextStartMemorySampler(WKContextRef context, WKDoubleRef interval); WK_EXPORT void WKContextStopMemorySampler(WKContextRef context); +WK_EXPORT WKWebsiteDataStoreRef WKContextGetWebsiteDataStore(WKContextRef context); + WK_EXPORT WKApplicationCacheManagerRef WKContextGetApplicationCacheManager(WKContextRef context); WK_EXPORT WKBatteryManagerRef WKContextGetBatteryManager(WKContextRef context); WK_EXPORT WKCookieManagerRef WKContextGetCookieManager(WKContextRef context); -WK_EXPORT WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef context); WK_EXPORT WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef context); WK_EXPORT WKIconDatabaseRef WKContextGetIconDatabase(WKContextRef context); WK_EXPORT WKKeyValueStorageManagerRef WKContextGetKeyValueStorageManager(WKContextRef context); -WK_EXPORT WKMediaCacheManagerRef WKContextGetMediaCacheManager(WKContextRef context); -WK_EXPORT WKNetworkInfoManagerRef WKContextGetNetworkInfoManager(WKContextRef context); +WK_EXPORT WKMediaSessionFocusManagerRef WKContextGetMediaSessionFocusManager(WKContextRef context); WK_EXPORT WKNotificationManagerRef WKContextGetNotificationManager(WKContextRef context); WK_EXPORT WKPluginSiteDataManagerRef WKContextGetPluginSiteDataManager(WKContextRef context); WK_EXPORT WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRef context); - + typedef void (*WKContextGetStatisticsFunction)(WKDictionaryRef statistics, WKErrorRef error, void* functionContext); WK_EXPORT void WKContextGetStatistics(WKContextRef context, void* functionContext, WKContextGetStatisticsFunction function); WK_EXPORT void WKContextGetStatisticsWithOptions(WKContextRef context, WKStatisticsOptions statisticsMask, void* functionContext, WKContextGetStatisticsFunction function); @@ -206,6 +145,7 @@ WK_EXPORT void WKContextSetJavaScriptGarbageCollectorTimerEnabled(WKContextRef c WK_EXPORT WKDictionaryRef WKContextCopyPlugInAutoStartOriginHashes(WKContextRef context); WK_EXPORT void WKContextSetPlugInAutoStartOriginHashes(WKContextRef context, WKDictionaryRef dictionary); WK_EXPORT void WKContextSetPlugInAutoStartOrigins(WKContextRef contextRef, WKArrayRef arrayRef); +WK_EXPORT void WKContextSetPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime(WKContextRef contextRef, WKDictionaryRef dictionaryRef, double time); #ifdef __cplusplus } diff --git a/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.cpp b/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.cpp new file mode 100644 index 000000000..fe4f9139a --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.cpp @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2014 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKContextConfigurationRef.h" + +#include "APIProcessPoolConfiguration.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKContextConfigurationRef WKContextConfigurationCreate() +{ + auto configuration = API::ProcessPoolConfiguration::create(); + + // FIXME: A context created like this shouldn't have a data store, + // instead there should be a WKPageConfigurationRef object that specifies the data store. + configuration->setShouldHaveLegacyDataStore(true); + + return toAPI(&configuration.leakRef()); +} + +WKStringRef WKContextConfigurationCopyDiskCacheDirectory(WKContextConfigurationRef configuration) +{ + return toCopiedAPI(toImpl(configuration)->diskCacheDirectory()); +} + +void WKContextConfigurationSetDiskCacheDirectory(WKContextConfigurationRef configuration, WKStringRef diskCacheDirectory) +{ + toImpl(configuration)->setDiskCacheDirectory(toImpl(diskCacheDirectory)->string()); +} + +WKStringRef WKContextConfigurationCopyApplicationCacheDirectory(WKContextConfigurationRef configuration) +{ + return toCopiedAPI(toImpl(configuration)->applicationCacheDirectory()); +} + +void WKContextConfigurationSetApplicationCacheDirectory(WKContextConfigurationRef configuration, WKStringRef applicationCacheDirectory) +{ + toImpl(configuration)->setApplicationCacheDirectory(toImpl(applicationCacheDirectory)->string()); +} + +WKStringRef WKContextConfigurationCopyIndexedDBDatabaseDirectory(WKContextConfigurationRef configuration) +{ + return toCopiedAPI(toImpl(configuration)->indexedDBDatabaseDirectory()); +} + +void WKContextConfigurationSetIndexedDBDatabaseDirectory(WKContextConfigurationRef configuration, WKStringRef indexedDBDatabaseDirectory) +{ + toImpl(configuration)->setIndexedDBDatabaseDirectory(toImpl(indexedDBDatabaseDirectory)->string()); +} + +WKStringRef WKContextConfigurationCopyInjectedBundlePath(WKContextConfigurationRef configuration) +{ + return toCopiedAPI(toImpl(configuration)->injectedBundlePath()); +} + +void WKContextConfigurationSetInjectedBundlePath(WKContextConfigurationRef configuration, WKStringRef injectedBundlePath) +{ + toImpl(configuration)->setInjectedBundlePath(toImpl(injectedBundlePath)->string()); +} + +WKStringRef WKContextConfigurationCopyLocalStorageDirectory(WKContextConfigurationRef configuration) +{ + return toCopiedAPI(toImpl(configuration)->localStorageDirectory()); +} + +void WKContextConfigurationSetLocalStorageDirectory(WKContextConfigurationRef configuration, WKStringRef localStorageDirectory) +{ + toImpl(configuration)->setLocalStorageDirectory(toImpl(localStorageDirectory)->string()); +} + +WKStringRef WKContextConfigurationCopyWebSQLDatabaseDirectory(WKContextConfigurationRef configuration) +{ + return toCopiedAPI(toImpl(configuration)->webSQLDatabaseDirectory()); +} + +void WKContextConfigurationSetWebSQLDatabaseDirectory(WKContextConfigurationRef configuration, WKStringRef webSQLDatabaseDirectory) +{ + toImpl(configuration)->setWebSQLDatabaseDirectory(toImpl(webSQLDatabaseDirectory)->string()); +} + +WKStringRef WKContextConfigurationCopyMediaKeysStorageDirectory(WKContextConfigurationRef configuration) +{ + return toCopiedAPI(toImpl(configuration)->mediaKeysStorageDirectory()); +} + +void WKContextConfigurationSetMediaKeysStorageDirectory(WKContextConfigurationRef configuration, WKStringRef mediaKeysStorageDirectory) +{ + toImpl(configuration)->setMediaKeysStorageDirectory(toImpl(mediaKeysStorageDirectory)->string()); +} + +bool WKContextConfigurationFullySynchronousModeIsAllowedForTesting(WKContextConfigurationRef configuration) +{ + return toImpl(configuration)->fullySynchronousModeIsAllowedForTesting(); +} + +void WKContextConfigurationSetFullySynchronousModeIsAllowedForTesting(WKContextConfigurationRef configuration, bool allowed) +{ + toImpl(configuration)->setFullySynchronousModeIsAllowedForTesting(allowed); +} + +WKArrayRef WKContextConfigurationCopyOverrideLanguages(WKContextConfigurationRef configuration) +{ + return toAPI(&API::Array::createStringArray(toImpl(configuration)->overrideLanguages()).leakRef()); +} + +void WKContextConfigurationSetOverrideLanguages(WKContextConfigurationRef configuration, WKArrayRef overrideLanguages) +{ + toImpl(configuration)->setOverrideLanguages(toImpl(overrideLanguages)->toStringVector()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.h b/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.h new file mode 100644 index 000000000..1ee343a47 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2014 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKContextConfigurationRef_h +#define WKContextConfigurationRef_h + +#include <WebKit/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKContextConfigurationRef WKContextConfigurationCreate(); + +WK_EXPORT WKStringRef WKContextConfigurationCopyApplicationCacheDirectory(WKContextConfigurationRef configuration); +WK_EXPORT void WKContextConfigurationSetApplicationCacheDirectory(WKContextConfigurationRef configuration, WKStringRef applicationCacheDirectory); + +WK_EXPORT WKStringRef WKContextConfigurationCopyDiskCacheDirectory(WKContextConfigurationRef configuration); +WK_EXPORT void WKContextConfigurationSetDiskCacheDirectory(WKContextConfigurationRef configuration, WKStringRef diskCacheDirectory); + +WK_EXPORT WKStringRef WKContextConfigurationCopyIndexedDBDatabaseDirectory(WKContextConfigurationRef configuration); +WK_EXPORT void WKContextConfigurationSetIndexedDBDatabaseDirectory(WKContextConfigurationRef configuration, WKStringRef indexedDBDatabaseDirectory); + +WK_EXPORT WKStringRef WKContextConfigurationCopyInjectedBundlePath(WKContextConfigurationRef configuration); +WK_EXPORT void WKContextConfigurationSetInjectedBundlePath(WKContextConfigurationRef configuration, WKStringRef injectedBundlePath); + +WK_EXPORT WKStringRef WKContextConfigurationCopyLocalStorageDirectory(WKContextConfigurationRef configuration); +WK_EXPORT void WKContextConfigurationSetLocalStorageDirectory(WKContextConfigurationRef configuration, WKStringRef localStorageDirectory); + +WK_EXPORT WKStringRef WKContextConfigurationCopyWebSQLDatabaseDirectory(WKContextConfigurationRef configuration); +WK_EXPORT void WKContextConfigurationSetWebSQLDatabaseDirectory(WKContextConfigurationRef configuration, WKStringRef webSQLDatabaseDirectory); + +WK_EXPORT WKStringRef WKContextConfigurationCopyMediaKeysStorageDirectory(WKContextConfigurationRef configuration); +WK_EXPORT void WKContextConfigurationSetMediaKeysStorageDirectory(WKContextConfigurationRef configuration, WKStringRef mediaKeysStorageDirectory); + +WK_EXPORT bool WKContextConfigurationFullySynchronousModeIsAllowedForTesting(WKContextConfigurationRef configuration); +WK_EXPORT void WKContextConfigurationSetFullySynchronousModeIsAllowedForTesting(WKContextConfigurationRef configuration, bool allowed); + +WK_EXPORT WKArrayRef WKContextConfigurationCopyOverrideLanguages(WKContextConfigurationRef configuration); +WK_EXPORT void WKContextConfigurationSetOverrideLanguages(WKContextConfigurationRef configuration, WKArrayRef overrideLanguages); + +#ifdef __cplusplus +} +#endif + + +#endif // WKContextConfigurationRef_h diff --git a/Source/WebKit2/UIProcess/API/C/WKContextConnectionClient.h b/Source/WebKit2/UIProcess/API/C/WKContextConnectionClient.h new file mode 100644 index 000000000..e7c576310 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKContextConnectionClient.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2013 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKContextConnectionClient_h +#define WKContextConnectionClient_h + +#include <WebKit/WKBase.h> + +typedef void (*WKContextDidCreateConnection)(WKContextRef context, WKConnectionRef connection, const void* clientInfo); + +typedef struct WKContextConnectionClientBase { + int version; + const void * clientInfo; +} WKContextConnectionClientBase; + +typedef struct WKContextConnectionClientV0 { + WKContextConnectionClientBase base; + + // Version 0. + WKContextDidCreateConnection didCreateConnection; +} WKContextConnectionClientV0; + +#endif // WKContextConnectionClient_h diff --git a/Source/WebKit2/UIProcess/API/C/WKContextDownloadClient.h b/Source/WebKit2/UIProcess/API/C/WKContextDownloadClient.h new file mode 100644 index 000000000..5bb8d83a8 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKContextDownloadClient.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2013 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKContextDownloadClient_h +#define WKContextDownloadClient_h + +#include <WebKit/WKBase.h> + +typedef void (*WKContextDownloadDidStartCallback)(WKContextRef context, WKDownloadRef download, const void *clientInfo); +typedef void (*WKContextDownloadDidReceiveAuthenticationChallengeCallback)(WKContextRef context, WKDownloadRef download, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo); +typedef void (*WKContextDownloadDidReceiveResponseCallback)(WKContextRef context, WKDownloadRef download, WKURLResponseRef response, const void *clientInfo); +typedef void (*WKContextDownloadDidReceiveDataCallback)(WKContextRef context, WKDownloadRef download, uint64_t length, const void *clientInfo); +typedef bool (*WKContextDownloadShouldDecodeSourceDataOfMIMETypeCallback)(WKContextRef context, WKDownloadRef download, WKStringRef mimeType, const void *clientInfo); +typedef WKStringRef (*WKContextDownloadDecideDestinationWithSuggestedFilenameCallback)(WKContextRef context, WKDownloadRef download, WKStringRef filename, bool* allowOverwrite, const void *clientInfo); +typedef void (*WKContextDownloadDidCreateDestinationCallback)(WKContextRef context, WKDownloadRef download, WKStringRef path, const void *clientInfo); +typedef void (*WKContextDownloadDidFinishCallback)(WKContextRef context, WKDownloadRef download, const void *clientInfo); +typedef void (*WKContextDownloadDidFailCallback)(WKContextRef context, WKDownloadRef download, WKErrorRef error, const void *clientInfo); +typedef void (*WKContextDownloadDidCancel)(WKContextRef context, WKDownloadRef download, const void *clientInfo); +typedef void (*WKContextDownloadProcessDidCrashCallback)(WKContextRef context, WKDownloadRef download, const void *clientInfo); + +typedef struct WKContextDownloadClientBase { + int version; + const void * clientInfo; +} WKContextDownloadClientBase; + +typedef struct WKContextDownloadClientV0 { + WKContextDownloadClientBase base; + + // Version 0. + WKContextDownloadDidStartCallback didStart; + WKContextDownloadDidReceiveAuthenticationChallengeCallback didReceiveAuthenticationChallenge; + WKContextDownloadDidReceiveResponseCallback didReceiveResponse; + WKContextDownloadDidReceiveDataCallback didReceiveData; + WKContextDownloadShouldDecodeSourceDataOfMIMETypeCallback shouldDecodeSourceDataOfMIMEType; + WKContextDownloadDecideDestinationWithSuggestedFilenameCallback decideDestinationWithSuggestedFilename; + WKContextDownloadDidCreateDestinationCallback didCreateDestination; + WKContextDownloadDidFinishCallback didFinish; + WKContextDownloadDidFailCallback didFail; + WKContextDownloadDidCancel didCancel; + WKContextDownloadProcessDidCrashCallback processDidCrash; +} WKContextDownloadClientV0; + +#endif // WKContextDownloadClient_h diff --git a/Source/WebKit2/UIProcess/API/C/WKContextHistoryClient.h b/Source/WebKit2/UIProcess/API/C/WKContextHistoryClient.h new file mode 100644 index 000000000..0558efdba --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKContextHistoryClient.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2013 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKContextHistoryClient_h +#define WKContextHistoryClient_h + +#include <WebKit/WKBase.h> + +typedef void (*WKContextDidNavigateWithNavigationDataCallback)(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo); +typedef void (*WKContextDidPerformClientRedirectCallback)(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo); +typedef void (*WKContextDidPerformServerRedirectCallback)(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo); +typedef void (*WKContextDidUpdateHistoryTitleCallback)(WKContextRef context, WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void *clientInfo); +typedef void (*WKContextPopulateVisitedLinksCallback)(WKContextRef context, const void *clientInfo); + +typedef struct WKContextHistoryClientBase { + int version; + const void * clientInfo; +} WKContextHistoryClientBase; + +typedef struct WKContextHistoryClientV0 { + WKContextHistoryClientBase base; + + // Version 0. + WKContextDidNavigateWithNavigationDataCallback didNavigateWithNavigationData; + WKContextDidPerformClientRedirectCallback didPerformClientRedirect; + WKContextDidPerformServerRedirectCallback didPerformServerRedirect; + WKContextDidUpdateHistoryTitleCallback didUpdateHistoryTitle; + WKContextPopulateVisitedLinksCallback populateVisitedLinks; +} WKContextHistoryClientV0; + +#endif // WKContextHistoryClient_h diff --git a/Source/WebKit2/UIProcess/API/C/WKContextInjectedBundleClient.h b/Source/WebKit2/UIProcess/API/C/WKContextInjectedBundleClient.h new file mode 100644 index 000000000..d3456aa68 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKContextInjectedBundleClient.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2013 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKContextInjectedBundleClient_h +#define WKContextInjectedBundleClient_h + +#include <WebKit/WKBase.h> + +// Injected Bundle Client +typedef void (*WKContextDidReceiveMessageFromInjectedBundleCallback)(WKContextRef page, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo); +typedef void (*WKContextDidReceiveSynchronousMessageFromInjectedBundleCallback)(WKContextRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData, const void *clientInfo); +typedef WKTypeRef (*WKContextGetInjectedBundleInitializationUserDataCallback)(WKContextRef context, const void *clientInfo); + +typedef struct WKContextInjectedBundleClientBase { + int version; + const void * clientInfo; +} WKContextInjectedBundleClientBase; + +typedef struct WKContextInjectedBundleClientV0 { + WKContextInjectedBundleClientBase base; + + // Version 0. + WKContextDidReceiveMessageFromInjectedBundleCallback didReceiveMessageFromInjectedBundle; + WKContextDidReceiveSynchronousMessageFromInjectedBundleCallback didReceiveSynchronousMessageFromInjectedBundle; +} WKContextInjectedBundleClientV0; + +typedef struct WKContextInjectedBundleClientV1 { + WKContextInjectedBundleClientBase base; + + // Version 0. + WKContextDidReceiveMessageFromInjectedBundleCallback didReceiveMessageFromInjectedBundle; + WKContextDidReceiveSynchronousMessageFromInjectedBundleCallback didReceiveSynchronousMessageFromInjectedBundle; + + // Version 1. + WKContextGetInjectedBundleInitializationUserDataCallback getInjectedBundleInitializationUserData; +} WKContextInjectedBundleClientV1; + +#endif // WKContextInjectedBundleClient_h diff --git a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h index 79e7f7f25..05d27fd10 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h @@ -26,8 +26,8 @@ #ifndef WKContextPrivate_h #define WKContextPrivate_h -#include <WebKit2/WKBase.h> -#include <WebKit2/WKContext.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKContext.h> #ifdef __cplusplus extern "C" { @@ -52,18 +52,18 @@ WK_EXPORT void WKContextSetShouldUseFontSmoothing(WKContextRef context, bool use WK_EXPORT void WKContextRegisterURLSchemeAsSecure(WKContextRef context, WKStringRef urlScheme); +WK_EXPORT void WKContextRegisterURLSchemeAsBypassingContentSecurityPolicy(WKContextRef context, WKStringRef urlScheme); + +WK_EXPORT void WKContextRegisterURLSchemeAsCachePartitioned(WKContextRef context, WKStringRef urlScheme); + WK_EXPORT void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef context, WKStringRef urlScheme); +WK_EXPORT void WKContextSetCanHandleHTTPSServerTrustEvaluation(WKContextRef context, bool value); + WK_EXPORT void WKContextSetIconDatabasePath(WKContextRef context, WKStringRef iconDatabasePath); WK_EXPORT void WKContextAllowSpecificHTTPSCertificateForHost(WKContextRef context, WKCertificateInfoRef certificate, WKStringRef host); -// FIXME: These functions are only effective if called before the Web process is launched. But -// we should really change these settings to be on WebPreferences and changeable at runtime. -WK_EXPORT void WKContextSetApplicationCacheDirectory(WKContextRef context, WKStringRef applicationCacheDirectory); -WK_EXPORT void WKContextSetDatabaseDirectory(WKContextRef context, WKStringRef databaseDirectory); -WK_EXPORT void WKContextSetLocalStorageDirectory(WKContextRef context, WKStringRef localStorageDirectory); -WK_EXPORT void WKContextSetDiskCacheDirectory(WKContextRef context, WKStringRef diskCacheDirectory); WK_EXPORT void WKContextSetCookieStorageDirectory(WKContextRef context, WKStringRef cookieStorageDirectory); // FIXME: This is a workaround for testing purposes only and should be removed once a better @@ -77,10 +77,20 @@ WK_EXPORT void WKContextWarmInitialProcess(WKContextRef context); // FIXME: This function is temporary and useful during the development of the NetworkProcess feature. // At some point it should be removed. -WK_EXPORT void WKContextSetUsesNetworkProcess(WKContextRef context, bool usesNetworkProcess); +WK_EXPORT void WKContextSetUsesNetworkProcess(WKContextRef, bool); + +// Test only. Should be called before any secondary processes are started. +WK_EXPORT void WKContextUseTestingNetworkSession(WKContextRef context); + +// Test only. Should be called before running a test. +WK_EXPORT void WKContextClearCachedCredentials(WKContextRef context); typedef void (*WKContextInvalidMessageFunction)(WKStringRef messageName); WK_EXPORT void WKContextSetInvalidMessageFunction(WKContextInvalidMessageFunction invalidMessageFunction); + +WK_EXPORT void WKContextSetMemoryCacheDisabled(WKContextRef, bool disabled); + +WK_EXPORT void WKContextSetFontWhitelist(WKContextRef, WKArrayRef); #ifdef __cplusplus } diff --git a/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp b/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp index 49ce6ac0c..e4a30611a 100644 --- a/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp @@ -36,14 +36,14 @@ WKTypeID WKCookieManagerGetTypeID() return toAPI(WebCookieManagerProxy::APIType); } -void WKCookieManagerSetClient(WKCookieManagerRef cookieManagerRef, const WKCookieManagerClient* wkClient) +void WKCookieManagerSetClient(WKCookieManagerRef cookieManagerRef, const WKCookieManagerClientBase* wkClient) { toImpl(cookieManagerRef)->initializeClient(wkClient); } void WKCookieManagerGetHostnamesWithCookies(WKCookieManagerRef cookieManagerRef, void* context, WKCookieManagerGetCookieHostnamesFunction callback) { - toImpl(cookieManagerRef)->getHostnamesWithCookies(ArrayCallback::create(context, callback)); + toImpl(cookieManagerRef)->getHostnamesWithCookies(toGenericCallbackFunction(context, callback)); } void WKCookieManagerDeleteCookiesForHostname(WKCookieManagerRef cookieManagerRef, WKStringRef hostname) @@ -56,6 +56,14 @@ void WKCookieManagerDeleteAllCookies(WKCookieManagerRef cookieManagerRef) toImpl(cookieManagerRef)->deleteAllCookies(); } +void WKCookieManagerDeleteAllCookiesModifiedAfterDate(WKCookieManagerRef cookieManagerRef, double date) +{ + using namespace std::chrono; + + auto time = system_clock::time_point(duration_cast<system_clock::duration>(duration<double>(date))); + toImpl(cookieManagerRef)->deleteAllCookiesModifiedSince(time); +} + void WKCookieManagerSetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, WKHTTPCookieAcceptPolicy policy) { toImpl(cookieManager)->setHTTPCookieAcceptPolicy(toHTTPCookieAcceptPolicy(policy)); @@ -63,7 +71,7 @@ void WKCookieManagerSetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, void WKCookieManagerGetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, void* context, WKCookieManagerGetHTTPCookieAcceptPolicyFunction callback) { - toImpl(cookieManager)->getHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicyCallback::create(context, callback)); + toImpl(cookieManager)->getHTTPCookieAcceptPolicy(toGenericCallbackFunction<WKHTTPCookieAcceptPolicy, HTTPCookieAcceptPolicy>(context, callback)); } void WKCookieManagerStartObservingCookieChanges(WKCookieManagerRef cookieManager) diff --git a/Source/WebKit2/UIProcess/API/C/WKCookieManager.h b/Source/WebKit2/UIProcess/API/C/WKCookieManager.h index 88f56dc37..8f4111c3f 100644 --- a/Source/WebKit2/UIProcess/API/C/WKCookieManager.h +++ b/Source/WebKit2/UIProcess/API/C/WKCookieManager.h @@ -26,7 +26,7 @@ #ifndef WKCookieManager_h #define WKCookieManager_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { @@ -35,25 +35,29 @@ extern "C" { enum { kWKHTTPCookieAcceptPolicyAlways = 0, kWKHTTPCookieAcceptPolicyNever = 1, - kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain = 2 + kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain = 2, + kWKHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain = 3 }; typedef uint32_t WKHTTPCookieAcceptPolicy; // Cookie Manager Client typedef void (*WKCookieManagerCookiesDidChangeCallback)(WKCookieManagerRef cookieManager, const void *clientInfo); -struct WKCookieManagerClient { +typedef struct WKCookieManagerClientBase { int version; const void * clientInfo; - WKCookieManagerCookiesDidChangeCallback cookiesDidChange; -}; -typedef struct WKCookieManagerClient WKCookieManagerClient; +} WKCookieManagerClientBase; -enum { kWKCookieManagerClientCurrentVersion = 0 }; +typedef struct WKCookieManagerClientV0 { + WKCookieManagerClientBase base; + + // Version 0. + WKCookieManagerCookiesDidChangeCallback cookiesDidChange; +} WKCookieManagerClientV0; WK_EXPORT WKTypeID WKCookieManagerGetTypeID(); -WK_EXPORT void WKCookieManagerSetClient(WKCookieManagerRef cookieManager, const WKCookieManagerClient* client); +WK_EXPORT void WKCookieManagerSetClient(WKCookieManagerRef cookieManager, const WKCookieManagerClientBase* client); typedef void (*WKCookieManagerGetCookieHostnamesFunction)(WKArrayRef, WKErrorRef, void*); WK_EXPORT void WKCookieManagerGetHostnamesWithCookies(WKCookieManagerRef cookieManager, void* context, WKCookieManagerGetCookieHostnamesFunction function); @@ -61,6 +65,9 @@ WK_EXPORT void WKCookieManagerGetHostnamesWithCookies(WKCookieManagerRef cookieM WK_EXPORT void WKCookieManagerDeleteCookiesForHostname(WKCookieManagerRef cookieManager, WKStringRef hostname); WK_EXPORT void WKCookieManagerDeleteAllCookies(WKCookieManagerRef cookieManager); +// The time here is relative to the Unix epoch. +WK_EXPORT void WKCookieManagerDeleteAllCookiesModifiedAfterDate(WKCookieManagerRef cookieManager, double); + WK_EXPORT void WKCookieManagerSetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, WKHTTPCookieAcceptPolicy policy); typedef void (*WKCookieManagerGetHTTPCookieAcceptPolicyFunction)(WKHTTPCookieAcceptPolicy, WKErrorRef, void*); WK_EXPORT void WKCookieManagerGetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, void* context, WKCookieManagerGetHTTPCookieAcceptPolicyFunction callback); diff --git a/Source/WebKit2/UIProcess/API/C/WKCredential.cpp b/Source/WebKit2/UIProcess/API/C/WKCredential.cpp index 8b4c33ba1..35ecb203b 100644 --- a/Source/WebKit2/UIProcess/API/C/WKCredential.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKCredential.cpp @@ -26,9 +26,9 @@ #include "config.h" #include "WKCredential.h" +#include "APIString.h" #include "WebCertificateInfo.h" #include "WebCredential.h" -#include "WebString.h" #include "WKAPICast.h" using namespace WebKit; @@ -40,18 +40,16 @@ WKTypeID WKCredentialGetTypeID() WKCredentialRef WKCredentialCreate(WKStringRef username, WKStringRef password, WKCredentialPersistence persistence) { - RefPtr<WebCredential> credential = WebCredential::create(toImpl(username), toImpl(password), toCredentialPersistence(persistence)); - return toAPI(credential.release().leakRef()); + return toAPI(&WebCredential::create(WebCore::Credential(toImpl(username)->string(), toImpl(password)->string(), toCredentialPersistence(persistence))).leakRef()); } WKCredentialRef WKCredentialCreateWithCertificateInfo(WKCertificateInfoRef certificateInfo) { - RefPtr<WebCredential> credential = WebCredential::create(toImpl(certificateInfo)); - return toAPI(credential.release().leakRef()); + return toAPI(&WebCredential::create(toImpl(certificateInfo)).leakRef()); } WKStringRef WKCredentialCopyUser(WKCredentialRef credentialRef) { - return toCopiedAPI(toImpl(credentialRef)->user()); + return toCopiedAPI(toImpl(credentialRef)->credential().user()); } diff --git a/Source/WebKit2/UIProcess/API/C/WKCredential.h b/Source/WebKit2/UIProcess/API/C/WKCredential.h index 560fc419a..57842fbda 100644 --- a/Source/WebKit2/UIProcess/API/C/WKCredential.h +++ b/Source/WebKit2/UIProcess/API/C/WKCredential.h @@ -26,8 +26,8 @@ #ifndef WKCredential_h #define WKCredential_h -#include <WebKit2/WKBase.h> -#include <WebKit2/WKCredentialTypes.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKCredentialTypes.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKCredentialTypes.h b/Source/WebKit2/UIProcess/API/C/WKCredentialTypes.h index bba31ac58..71ea8e9ee 100644 --- a/Source/WebKit2/UIProcess/API/C/WKCredentialTypes.h +++ b/Source/WebKit2/UIProcess/API/C/WKCredentialTypes.h @@ -26,6 +26,8 @@ #ifndef WKCredentialTypes_h #define WKCredentialTypes_h +#include <stdint.h> + #ifdef __cplusplus extern "C" { #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp b/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp deleted file mode 100644 index 4f9496878..000000000 --- a/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WKDatabaseManager.h" - -#include "WebDatabaseManagerProxy.h" -#include "WKAPICast.h" - -#ifdef __BLOCKS__ -#include <Block.h> -#endif - -using namespace WebKit; - -WKTypeID WKDatabaseManagerGetTypeID() -{ -#if ENABLE(SQL_DATABASE) - return toAPI(WebDatabaseManagerProxy::APIType); -#else - return 0; -#endif -} - -WKStringRef WKDatabaseManagerGetOriginKey() -{ -#if ENABLE(SQL_DATABASE) - static WebString* key = WebString::create(WebDatabaseManagerProxy::originKey()).leakRef(); - return toAPI(key); -#else - return 0; -#endif -} - -WKStringRef WKDatabaseManagerGetOriginQuotaKey() -{ -#if ENABLE(SQL_DATABASE) - static WebString* key = WebString::create(WebDatabaseManagerProxy::originQuotaKey()).leakRef(); - return toAPI(key); -#else - return 0; -#endif -} - -WKStringRef WKDatabaseManagerGetOriginUsageKey() -{ -#if ENABLE(SQL_DATABASE) - static WebString* key = WebString::create(WebDatabaseManagerProxy::originUsageKey()).leakRef(); - return toAPI(key); -#else - return 0; -#endif -} - -WKStringRef WKDatabaseManagerGetDatabaseDetailsKey() -{ -#if ENABLE(SQL_DATABASE) - static WebString* key = WebString::create(WebDatabaseManagerProxy::databaseDetailsKey()).leakRef(); - return toAPI(key); -#else - return 0; -#endif -} - -WKStringRef WKDatabaseManagerGetDatabaseDetailsNameKey() -{ -#if ENABLE(SQL_DATABASE) - static WebString* key = WebString::create(WebDatabaseManagerProxy::databaseDetailsNameKey()).leakRef(); - return toAPI(key); -#else - return 0; -#endif -} - -WKStringRef WKDatabaseManagerGetDatabaseDetailsDisplayNameKey() -{ -#if ENABLE(SQL_DATABASE) - static WebString* key = WebString::create(WebDatabaseManagerProxy::databaseDetailsDisplayNameKey()).leakRef(); - return toAPI(key); -#else - return 0; -#endif -} - -WKStringRef WKDatabaseManagerGetDatabaseDetailsExpectedUsageKey() -{ -#if ENABLE(SQL_DATABASE) - static WebString* key = WebString::create(WebDatabaseManagerProxy::databaseDetailsExpectedUsageKey()).leakRef(); - return toAPI(key); -#else - return 0; -#endif -} - -WKStringRef WKDatabaseManagerGetDatabaseDetailsCurrentUsageKey() -{ -#if ENABLE(SQL_DATABASE) - static WebString* key = WebString::create(WebDatabaseManagerProxy::databaseDetailsCurrentUsageKey()).leakRef(); - return toAPI(key); -#else - return 0; -#endif -} - -void WKDatabaseManagerSetClient(WKDatabaseManagerRef databaseManagerRef, const WKDatabaseManagerClient* wkClient) -{ -#if ENABLE(SQL_DATABASE) - if (wkClient && wkClient->version) - return; - toImpl(databaseManagerRef)->initializeClient(wkClient); -#endif -} - -void WKDatabaseManagerGetDatabasesByOrigin(WKDatabaseManagerRef databaseManagerRef, void* context, WKDatabaseManagerGetDatabasesByOriginFunction callback) -{ -#if ENABLE(SQL_DATABASE) - toImpl(databaseManagerRef)->getDatabasesByOrigin(ArrayCallback::create(context, callback)); -#endif -} - -#ifdef __BLOCKS__ -static void callGetDatabasesByOriginBlockAndDispose(WKArrayRef resultValue, WKErrorRef errorRef, void* context) -{ -#if ENABLE(SQL_DATABASE) - WKDatabaseManagerGetDatabasesByOriginBlock block = (WKDatabaseManagerGetDatabasesByOriginBlock)context; - block(resultValue, errorRef); - Block_release(block); -#endif -} - -void WKDatabaseManagerGetDatabasesByOrigin_b(WKDatabaseManagerRef databaseManagerRef, WKDatabaseManagerGetDatabasesByOriginBlock block) -{ -#if ENABLE(SQL_DATABASE) - WKDatabaseManagerGetDatabasesByOrigin(databaseManagerRef, Block_copy(block), callGetDatabasesByOriginBlockAndDispose); -#endif -} -#endif // __BLOCKS__ - -void WKDatabaseManagerGetDatabaseOrigins(WKDatabaseManagerRef databaseManagerRef, void* context, WKDatabaseManagerGetDatabaseOriginsFunction callback) -{ -#if ENABLE(SQL_DATABASE) - toImpl(databaseManagerRef)->getDatabaseOrigins(ArrayCallback::create(context, callback)); -#endif -} - -#ifdef __BLOCKS__ -static void callGetDatabaseOriginsBlockBlockAndDispose(WKArrayRef resultValue, WKErrorRef errorRef, void* context) -{ -#if ENABLE(SQL_DATABASE) - WKDatabaseManagerGetDatabaseOriginsBlock block = (WKDatabaseManagerGetDatabaseOriginsBlock)context; - block(resultValue, errorRef); - Block_release(block); -#endif -} - -void WKDatabaseManagerGetDatabaseOrigins_b(WKDatabaseManagerRef databaseManagerRef, WKDatabaseManagerGetDatabaseOriginsBlock block) -{ -#if ENABLE(SQL_DATABASE) - WKDatabaseManagerGetDatabaseOrigins(databaseManagerRef, Block_copy(block), callGetDatabaseOriginsBlockBlockAndDispose); -#endif -} -#endif // __BLOCKS__ - -void WKDatabaseManagerDeleteDatabasesWithNameForOrigin(WKDatabaseManagerRef databaseManagerRef, WKStringRef databaseNameRef, WKSecurityOriginRef originRef) -{ -#if ENABLE(SQL_DATABASE) - toImpl(databaseManagerRef)->deleteDatabaseWithNameForOrigin(toWTFString(databaseNameRef), toImpl(originRef)); -#endif -} - -void WKDatabaseManagerDeleteDatabasesForOrigin(WKDatabaseManagerRef databaseManagerRef, WKSecurityOriginRef originRef) -{ -#if ENABLE(SQL_DATABASE) - toImpl(databaseManagerRef)->deleteDatabasesForOrigin(toImpl(originRef)); -#endif -} - -void WKDatabaseManagerDeleteAllDatabases(WKDatabaseManagerRef databaseManagerRef) -{ -#if ENABLE(SQL_DATABASE) - toImpl(databaseManagerRef)->deleteAllDatabases(); -#endif -} - -void WKDatabaseManagerSetQuotaForOrigin(WKDatabaseManagerRef databaseManagerRef, WKSecurityOriginRef originRef, uint64_t quota) -{ -#if ENABLE(SQL_DATABASE) - toImpl(databaseManagerRef)->setQuotaForOrigin(toImpl(originRef), quota); -#endif -} diff --git a/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.h b/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.h deleted file mode 100644 index 820f0f870..000000000 --- a/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WKDatabaseManager_h -#define WKDatabaseManager_h - -#include <WebKit2/WKBase.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* Value type: WKSecurityOriginRef */ -WK_EXPORT WKStringRef WKDatabaseManagerGetOriginKey(); - -/* Value type: WKUInt64Ref */ -WK_EXPORT WKStringRef WKDatabaseManagerGetOriginQuotaKey(); - -/* Value type: WKUInt64Ref */ -WK_EXPORT WKStringRef WKDatabaseManagerGetOriginUsageKey(); - -/* Value type: WKArrayRef (array of WKDictionaryRef's with keys that include: - - WKDatabaseManagerGetDatabaseNameKey() - - WKDatabaseManagerGetDatabaseDisplayNameKey() - - WKDatabaseManagerGetDatabaseExpectedUsageKey() - - WKDatabaseManagerGetDatabaseCurrentUsageKey() - */ -WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsKey(); - -/* Value type: WKStringRef */ -WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsNameKey(); - -/* Value type: WKStringRef */ -WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsDisplayNameKey(); - -/* Value type: WKUInt64Ref */ -WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsExpectedUsageKey(); - -/* Value type: WKUInt64Ref */ -WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsCurrentUsageKey(); - - -// Database Manager Client -typedef void (*WKDatabaseManagerDidModifyOriginCallback)(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin, const void *clientInfo); -typedef void (*WKDatabaseManagerDidModifyDatabaseCallback)(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin, WKStringRef databaseIdentifier, const void *clientInfo); - -struct WKDatabaseManagerClient { - int version; - const void * clientInfo; - WKDatabaseManagerDidModifyOriginCallback didModifyOrigin; - WKDatabaseManagerDidModifyDatabaseCallback didModifyDatabase; -}; -typedef struct WKDatabaseManagerClient WKDatabaseManagerClient; - -enum { kWKDatabaseManagerClientCurrentVersion = 0 }; - - -WK_EXPORT WKTypeID WKDatabaseManagerGetTypeID(); - -WK_EXPORT void WKDatabaseManagerSetClient(WKDatabaseManagerRef databaseManager, const WKDatabaseManagerClient* client); - -typedef void (*WKDatabaseManagerGetDatabasesByOriginFunction)(WKArrayRef, WKErrorRef, void*); -WK_EXPORT void WKDatabaseManagerGetDatabasesByOrigin(WKDatabaseManagerRef databaseManager, void* context, WKDatabaseManagerGetDatabasesByOriginFunction function); -#ifdef __BLOCKS__ -typedef void (^WKDatabaseManagerGetDatabasesByOriginBlock)(WKArrayRef, WKErrorRef); -WK_EXPORT void WKDatabaseManagerGetDatabasesByOrigin_b(WKDatabaseManagerRef databaseManager, WKDatabaseManagerGetDatabasesByOriginBlock block); -#endif - -typedef void (*WKDatabaseManagerGetDatabaseOriginsFunction)(WKArrayRef, WKErrorRef, void*); -WK_EXPORT void WKDatabaseManagerGetDatabaseOrigins(WKDatabaseManagerRef contextRef, void* context, WKDatabaseManagerGetDatabaseOriginsFunction function); -#ifdef __BLOCKS__ -typedef void (^WKDatabaseManagerGetDatabaseOriginsBlock)(WKArrayRef, WKErrorRef); -WK_EXPORT void WKDatabaseManagerGetDatabaseOrigins_b(WKDatabaseManagerRef databaseManager, WKDatabaseManagerGetDatabaseOriginsBlock block); -#endif - -WK_EXPORT void WKDatabaseManagerDeleteDatabasesWithNameForOrigin(WKDatabaseManagerRef databaseManager, WKStringRef databaseName, WKSecurityOriginRef origin); -WK_EXPORT void WKDatabaseManagerDeleteDatabasesForOrigin(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin); -WK_EXPORT void WKDatabaseManagerDeleteAllDatabases(WKDatabaseManagerRef databaseManager); - -WK_EXPORT void WKDatabaseManagerSetQuotaForOrigin(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin, uint64_t quota); - -#ifdef __cplusplus -} -#endif - -#endif // WKDatabaseManager_h diff --git a/Source/WebKit2/UIProcess/API/C/WKDownload.cpp b/Source/WebKit2/UIProcess/API/C/WKDownload.cpp index 3588fd563..abf93f12f 100644 --- a/Source/WebKit2/UIProcess/API/C/WKDownload.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKDownload.cpp @@ -26,9 +26,10 @@ #include "config.h" #include "WKDownload.h" +#include "APIData.h" +#include "APIURLRequest.h" #include "DownloadProxy.h" #include "WKAPICast.h" -#include "WebURLRequest.h" using namespace WebKit; @@ -39,12 +40,12 @@ WKTypeID WKDownloadGetTypeID() uint64_t WKDownloadGetID(WKDownloadRef download) { - return toImpl(download)->downloadID(); + return toImpl(download)->downloadID().downloadID(); } WKURLRequestRef WKDownloadCopyRequest(WKDownloadRef download) { - return toAPI(WebURLRequest::create(toImpl(download)->request()).leakRef()); + return toAPI(&API::URLRequest::create(toImpl(download)->request()).leakRef()); } WKDataRef WKDownloadGetResumeData(WKDownloadRef download) diff --git a/Source/WebKit2/UIProcess/API/C/WKDownload.h b/Source/WebKit2/UIProcess/API/C/WKDownload.h index 8acc9106d..5dbea7e44 100644 --- a/Source/WebKit2/UIProcess/API/C/WKDownload.h +++ b/Source/WebKit2/UIProcess/API/C/WKDownload.h @@ -26,7 +26,7 @@ #ifndef WKDownload_h #define WKDownload_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifndef __cplusplus #include <stdbool.h> diff --git a/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.h b/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.h index 4b9b79acb..c320b68d4 100644 --- a/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.h +++ b/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.h @@ -26,7 +26,7 @@ #ifndef WKFormSubmissionListener_h #define WKFormSubmissionListener_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKFrame.cpp b/Source/WebKit2/UIProcess/API/C/WKFrame.cpp index 3bb375f7d..f54e70d8a 100644 --- a/Source/WebKit2/UIProcess/API/C/WKFrame.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKFrame.cpp @@ -26,12 +26,12 @@ #include "config.h" #include "WKFrame.h" +#include "APIData.h" +#include "APIFrameInfo.h" #include "WKAPICast.h" +#include "WebCertificateInfo.h" #include "WebFrameProxy.h" - -#ifdef __BLOCKS__ -#include <Block.h> -#endif +#include "WebPageProxy.h" using namespace WebKit; @@ -48,13 +48,13 @@ bool WKFrameIsMainFrame(WKFrameRef frameRef) WKFrameLoadState WKFrameGetFrameLoadState(WKFrameRef frameRef) { WebFrameProxy* frame = toImpl(frameRef); - switch (frame->loadState()) { - case WebFrameProxy::LoadStateProvisional: - return kWKFrameLoadStateProvisional; - case WebFrameProxy::LoadStateCommitted: - return kWKFrameLoadStateCommitted; - case WebFrameProxy::LoadStateFinished: - return kWKFrameLoadStateFinished; + switch (frame->frameLoadState().state()) { + case FrameLoadState::State::Provisional: + return kWKFrameLoadStateProvisional; + case FrameLoadState::State::Committed: + return kWKFrameLoadStateCommitted; + case FrameLoadState::State::Finished: + return kWKFrameLoadStateFinished; } ASSERT_NOT_REACHED(); @@ -126,63 +126,22 @@ bool WKFrameIsFrameSet(WKFrameRef frameRef) return toImpl(frameRef)->isFrameSet(); } -void WKFrameGetMainResourceData(WKFrameRef frameRef, WKFrameGetResourceDataFunction callback, void* context) +WKFrameInfoRef WKFrameCreateFrameInfo(WKFrameRef frameRef) { - toImpl(frameRef)->getMainResourceData(DataCallback::create(context, callback)); + return toAPI(&API::FrameInfo::create(*toImpl(frameRef), WebCore::SecurityOrigin::createFromString(toImpl(frameRef)->url())).leakRef()); } -void WKFrameGetResourceData(WKFrameRef frameRef, WKURLRef resourceURL, WKFrameGetResourceDataFunction callback, void* context) -{ - toImpl(frameRef)->getResourceData(toImpl(resourceURL), DataCallback::create(context, callback)); -} - -#ifdef __BLOCKS__ -static void callGetResourceDataBlockAndDispose(WKDataRef data, WKErrorRef error, void* context) -{ - WKFrameGetResourceDataBlock block = (WKFrameGetResourceDataBlock)context; - block(data, error); - Block_release(block); -} - -void WKFrameGetMainResourceData_b(WKFrameRef frameRef, WKFrameGetResourceDataBlock block) +void WKFrameGetMainResourceData(WKFrameRef frameRef, WKFrameGetResourceDataFunction callback, void* context) { - WKFrameGetMainResourceData(frameRef, callGetResourceDataBlockAndDispose, Block_copy(block)); + toImpl(frameRef)->getMainResourceData(toGenericCallbackFunction(context, callback)); } -void WKFrameGetResourceData_b(WKFrameRef frameRef, WKURLRef resourceURL, WKFrameGetResourceDataBlock block) +void WKFrameGetResourceData(WKFrameRef frameRef, WKURLRef resourceURL, WKFrameGetResourceDataFunction callback, void* context) { - WKFrameGetResourceData(frameRef, resourceURL, callGetResourceDataBlockAndDispose, Block_copy(block)); + toImpl(frameRef)->getResourceData(toImpl(resourceURL), toGenericCallbackFunction(context, callback)); } -#endif void WKFrameGetWebArchive(WKFrameRef frameRef, WKFrameGetWebArchiveFunction callback, void* context) { - toImpl(frameRef)->getWebArchive(DataCallback::create(context, callback)); -} - -#ifdef __BLOCKS__ -static void callGetWebArchiveBlockAndDispose(WKDataRef archiveData, WKErrorRef error, void* context) -{ - WKFrameGetWebArchiveBlock block = (WKFrameGetWebArchiveBlock)context; - block(archiveData, error); - Block_release(block); -} - -void WKFrameGetWebArchive_b(WKFrameRef frameRef, WKFrameGetWebArchiveBlock block) -{ - WKFrameGetWebArchive(frameRef, callGetWebArchiveBlockAndDispose, Block_copy(block)); -} -#endif - - -// NOTE: These are deprecated and should be removed. They currently do nothing. - -WKArrayRef WKFrameCopyChildFrames(WKFrameRef) -{ - return 0; -} - -WKFrameRef WKFrameGetParentFrame(WKFrameRef) -{ - return 0; + toImpl(frameRef)->getWebArchive(toGenericCallbackFunction(context, callback)); } diff --git a/Source/WebKit2/UIProcess/API/C/WKFrame.h b/Source/WebKit2/UIProcess/API/C/WKFrame.h index d8221cc0c..4fd29a608 100644 --- a/Source/WebKit2/UIProcess/API/C/WKFrame.h +++ b/Source/WebKit2/UIProcess/API/C/WKFrame.h @@ -26,7 +26,7 @@ #ifndef WKFrame_h #define WKFrame_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifndef __cplusplus #include <stdbool.h> @@ -68,27 +68,14 @@ WK_EXPORT bool WKFrameIsDisplayingMarkupDocument(WKFrameRef frame); WK_EXPORT bool WKFrameIsFrameSet(WKFrameRef frame); +WK_EXPORT WKFrameInfoRef WKFrameCreateFrameInfo(WKFrameRef frame); + typedef void (*WKFrameGetResourceDataFunction)(WKDataRef data, WKErrorRef error, void* functionContext); WK_EXPORT void WKFrameGetMainResourceData(WKFrameRef frame, WKFrameGetResourceDataFunction function, void* functionContext); WK_EXPORT void WKFrameGetResourceData(WKFrameRef frame, WKURLRef resourceURL, WKFrameGetResourceDataFunction function, void* functionContext); -#ifdef __BLOCKS__ -typedef void (^WKFrameGetResourceDataBlock)(WKDataRef data, WKErrorRef error); -WK_EXPORT void WKFrameGetMainResourceData_b(WKFrameRef frame, WKFrameGetResourceDataBlock block); -WK_EXPORT void WKFrameGetResourceData_b(WKFrameRef frame, WKURLRef resourceURL, WKFrameGetResourceDataBlock block); -#endif typedef void (*WKFrameGetWebArchiveFunction)(WKDataRef archiveData, WKErrorRef error, void* functionContext); WK_EXPORT void WKFrameGetWebArchive(WKFrameRef frame, WKFrameGetWebArchiveFunction function, void* functionContext); -#ifdef __BLOCKS__ -typedef void (^WKFrameGetWebArchiveBlock)(WKDataRef archiveData, WKErrorRef error); -WK_EXPORT void WKFrameGetWebArchive_b(WKFrameRef frame, WKFrameGetWebArchiveBlock block); -#endif - - -// NOTE: These are deprecated and should be removed. They currently do nothing. - -WK_EXPORT WKArrayRef WKFrameCopyChildFrames(WKFrameRef frame); -WK_EXPORT WKFrameRef WKFrameGetParentFrame(WKFrameRef frame); #ifdef __cplusplus } diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKInspectorClientGtk.cpp b/Source/WebKit2/UIProcess/API/C/WKFrameInfoRef.cpp index c9d777c4d..dbdd10113 100644 --- a/Source/WebKit2/UIProcess/API/C/gtk/WKInspectorClientGtk.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKFrameInfoRef.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Igalia S.L. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,14 +24,14 @@ */ #include "config.h" -#include "WKInspectorClientGtk.h" +#include "WKFrameInfoRef.h" +#include "APIFrameInfo.h" #include "WKAPICast.h" -#include "WebInspectorProxy.h" using namespace WebKit; -void WKInspectorSetInspectorClientGtk(WKInspectorRef inspectorRef, const WKInspectorClientGtk* wkClient) +WKTypeID WKFrameInfoGetTypeID() { - toImpl(inspectorRef)->initializeInspectorClientGtk(wkClient); + return toAPI(API::FrameInfo::APIType); } diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKViewPrivate.h b/Source/WebKit2/UIProcess/API/C/WKFrameInfoRef.h index 2c1b2d1f0..f7ddadd92 100644 --- a/Source/WebKit2/UIProcess/API/C/gtk/WKViewPrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKFrameInfoRef.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Igalia S.L. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,19 +23,19 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKViewPrivate_h -#define WKViewPrivate_h +#ifndef WKFrameInfoRef_h +#define WKFrameInfoRef_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { #endif -WK_EXPORT void WKViewSetFocus(WKViewRef viewRef, bool focused); +WK_EXPORT WKTypeID WKFrameInfoGetTypeID(); #ifdef __cplusplus } #endif -#endif /* WKViewPrivate_h */ +#endif // WKFrameInfoRef_h diff --git a/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.h b/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.h index 99b013d54..046c68131 100644 --- a/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.h +++ b/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.h @@ -26,7 +26,7 @@ #ifndef WKFramePolicyListener_h #define WKFramePolicyListener_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp index 384e05156..18b1a09bc 100644 --- a/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp @@ -28,6 +28,7 @@ #include "WKAPICast.h" #include "WebGeolocationManagerProxy.h" +#include "WebGeolocationPosition.h" using namespace WebKit; @@ -36,7 +37,7 @@ WKTypeID WKGeolocationManagerGetTypeID() return toAPI(WebGeolocationManagerProxy::APIType); } -void WKGeolocationManagerSetProvider(WKGeolocationManagerRef geolocationManagerRef, const WKGeolocationProvider* wkProvider) +void WKGeolocationManagerSetProvider(WKGeolocationManagerRef geolocationManagerRef, const WKGeolocationProviderBase* wkProvider) { toImpl(geolocationManagerRef)->initializeProvider(wkProvider); } diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h index 7f9cb6891..581ae0472 100644 --- a/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,7 +26,7 @@ #ifndef WKGeolocationManager_h #define WKGeolocationManager_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { @@ -35,20 +35,36 @@ extern "C" { // Provider. typedef void (*WKGeolocationProviderStartUpdatingCallback)(WKGeolocationManagerRef geolocationManager, const void* clientInfo); typedef void (*WKGeolocationProviderStopUpdatingCallback)(WKGeolocationManagerRef geolocationManager, const void* clientInfo); +typedef void (*WKGeolocationProviderSetEnableHighAccuracyCallback)(WKGeolocationManagerRef geolocationManager, bool enabled, const void* clientInfo); -struct WKGeolocationProvider { +typedef struct WKGeolocationProviderBase { int version; const void * clientInfo; +} WKGeolocationProviderBase; + +typedef struct WKGeolocationProviderV0 { + WKGeolocationProviderBase base; + + // Version 0. WKGeolocationProviderStartUpdatingCallback startUpdating; WKGeolocationProviderStopUpdatingCallback stopUpdating; -}; -typedef struct WKGeolocationProvider WKGeolocationProvider; +} WKGeolocationProviderV0; + +typedef struct WKGeolocationProviderV1 { + WKGeolocationProviderBase base; + + // Version 0. + WKGeolocationProviderStartUpdatingCallback startUpdating; + WKGeolocationProviderStopUpdatingCallback stopUpdating; + + // Version 1. + WKGeolocationProviderSetEnableHighAccuracyCallback setEnableHighAccuracy; +} WKGeolocationProviderV1; -enum { kWKGeolocationProviderCurrentVersion = 0 }; WK_EXPORT WKTypeID WKGeolocationManagerGetTypeID(); -WK_EXPORT void WKGeolocationManagerSetProvider(WKGeolocationManagerRef geolocationManager, const WKGeolocationProvider* provider); +WK_EXPORT void WKGeolocationManagerSetProvider(WKGeolocationManagerRef geolocationManager, const WKGeolocationProviderBase* provider); WK_EXPORT void WKGeolocationManagerProviderDidChangePosition(WKGeolocationManagerRef geolocationManager, WKGeolocationPositionRef position); WK_EXPORT void WKGeolocationManagerProviderDidFailToDeterminePosition(WKGeolocationManagerRef geolocationManager); diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.h b/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.h index ee27b66ec..b1391813a 100644 --- a/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.h +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.h @@ -26,7 +26,7 @@ #ifndef WKGeolocationPermissionRequest_h #define WKGeolocationPermissionRequest_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.h b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.h index 4727e9763..6d67f1d1e 100644 --- a/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.h +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.h @@ -26,7 +26,7 @@ #ifndef WKGeolocationPosition_h #define WKGeolocationPosition_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKGrammarDetail.cpp b/Source/WebKit2/UIProcess/API/C/WKGrammarDetail.cpp index 9bf8315b3..065f99ba7 100644 --- a/Source/WebKit2/UIProcess/API/C/WKGrammarDetail.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKGrammarDetail.cpp @@ -26,8 +26,8 @@ #include "config.h" #include "WKGrammarDetail.h" +#include "APIArray.h" #include "APIObject.h" -#include "ImmutableArray.h" #include "WKAPICast.h" #include "WebGrammarDetail.h" @@ -35,7 +35,7 @@ using namespace WebKit; WKTypeID WKGrammarDetailGetTypeID() { - return toAPI(APIObject::TypeGrammarDetail); + return toAPI(API::Object::Type::GrammarDetail); } WKGrammarDetailRef WKGrammarDetailCreate(int location, int length, WKArrayRef guesses, WKStringRef userDescription) @@ -56,7 +56,7 @@ int WKGrammarDetailGetLength(WKGrammarDetailRef grammarDetailRef) WKArrayRef WKGrammarDetailCopyGuesses(WKGrammarDetailRef grammarDetailRef) { - return toAPI(toImpl(grammarDetailRef)->guesses().leakRef()); + return toAPI(&toImpl(grammarDetailRef)->guesses().leakRef()); } WKStringRef WKGrammarDetailCopyUserDescription(WKGrammarDetailRef grammarDetailRef) diff --git a/Source/WebKit2/UIProcess/API/C/WKGrammarDetail.h b/Source/WebKit2/UIProcess/API/C/WKGrammarDetail.h index c187ce6ad..2493c44d4 100644 --- a/Source/WebKit2/UIProcess/API/C/WKGrammarDetail.h +++ b/Source/WebKit2/UIProcess/API/C/WKGrammarDetail.h @@ -26,7 +26,7 @@ #ifndef WKGrammarDetail_h #define WKGrammarDetail_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKHitTestResult.cpp b/Source/WebKit2/UIProcess/API/C/WKHitTestResult.cpp index 5949091bb..4082002b0 100644 --- a/Source/WebKit2/UIProcess/API/C/WKHitTestResult.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKHitTestResult.cpp @@ -27,14 +27,14 @@ #include "config.h" #include "WKHitTestResult.h" +#include "APIHitTestResult.h" #include "WKAPICast.h" -#include "WebHitTestResult.h" using namespace WebKit; WKTypeID WKHitTestResultGetTypeID() { - return toAPI(WebHitTestResult::APIType); + return toAPI(API::HitTestResult::APIType); } WKURLRef WKHitTestResultCopyAbsoluteImageURL(WKHitTestResultRef hitTestResultRef) @@ -67,7 +67,17 @@ WKStringRef WKHitTestResultCopyLinkTitle(WKHitTestResultRef hitTestResultRef) return toCopiedAPI(toImpl(hitTestResultRef)->linkTitle()); } +WKStringRef WKHitTestResultCopyLookupText(WKHitTestResultRef hitTestResult) +{ + return toCopiedAPI(toImpl(hitTestResult)->lookupText()); +} + bool WKHitTestResultIsContentEditable(WKHitTestResultRef hitTestResultRef) { return toImpl(hitTestResultRef)->isContentEditable(); } + +WKRect WKHitTestResultGetElementBoundingBox(WKHitTestResultRef hitTestResultRef) +{ + return toAPI(toImpl(hitTestResultRef)->elementBoundingBox()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKHitTestResult.h b/Source/WebKit2/UIProcess/API/C/WKHitTestResult.h index 55fd13768..3c7081362 100644 --- a/Source/WebKit2/UIProcess/API/C/WKHitTestResult.h +++ b/Source/WebKit2/UIProcess/API/C/WKHitTestResult.h @@ -27,7 +27,8 @@ #ifndef WKHitTestResult_h #define WKHitTestResult_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKGeometry.h> #ifdef __cplusplus extern "C" { @@ -42,9 +43,12 @@ WK_EXPORT WKURLRef WKHitTestResultCopyAbsoluteMediaURL(WKHitTestResultRef hitTes WK_EXPORT WKStringRef WKHitTestResultCopyLinkLabel(WKHitTestResultRef hitTestResult); WK_EXPORT WKStringRef WKHitTestResultCopyLinkTitle(WKHitTestResultRef hitTestResult); +WK_EXPORT WKStringRef WKHitTestResultCopyLookupText(WKHitTestResultRef hitTestResult); WK_EXPORT bool WKHitTestResultIsContentEditable(WKHitTestResultRef hitTestResult); +WK_EXPORT WKRect WKHitTestResultGetElementBoundingBox(WKHitTestResultRef hitTestResultRef); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp index d667bb752..39006631f 100644 --- a/Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "WKIconDatabase.h" +#include "APIData.h" #include "WKAPICast.h" #include "WebIconDatabase.h" @@ -36,7 +37,7 @@ WKTypeID WKIconDatabaseGetTypeID() return toAPI(WebIconDatabase::APIType); } -void WKIconDatabaseSetIconDatabaseClient(WKIconDatabaseRef iconDatabaseRef, const WKIconDatabaseClient* wkClient) +void WKIconDatabaseSetIconDatabaseClient(WKIconDatabaseRef iconDatabaseRef, const WKIconDatabaseClientBase* wkClient) { toImpl(iconDatabaseRef)->initializeIconDatabaseClient(wkClient); } @@ -51,6 +52,28 @@ void WKIconDatabaseReleaseIconForURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef toImpl(iconDatabaseRef)->releaseIconForPageURL(toWTFString(pageURLRef)); } +void WKIconDatabaseSetIconDataForIconURL(WKIconDatabaseRef iconDatabaseRef, WKDataRef iconDataRef, WKURLRef iconURLRef) +{ + toImpl(iconDatabaseRef)->setIconDataForIconURL(toImpl(iconDataRef)->dataReference(), toWTFString(iconURLRef)); +} + +void WKIconDatabaseSetIconURLForPageURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef iconURLRef, WKURLRef pageURLRef) +{ + toImpl(iconDatabaseRef)->setIconURLForPageURL(toWTFString(iconURLRef), toWTFString(pageURLRef)); +} + +WKURLRef WKIconDatabaseCopyIconURLForPageURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef pageURLRef) +{ + String iconURLString; + toImpl(iconDatabaseRef)->synchronousIconURLForPageURL(toWTFString(pageURLRef), iconURLString); + return toCopiedURLAPI(iconURLString); +} + +WKDataRef WKIconDatabaseCopyIconDataForPageURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef pageURL) +{ + return toAPI(toImpl(iconDatabaseRef)->iconDataForPageURL(toWTFString(pageURL)).leakRef()); +} + void WKIconDatabaseEnableDatabaseCleanup(WKIconDatabaseRef iconDatabaseRef) { toImpl(iconDatabaseRef)->enableDatabaseCleanup(); diff --git a/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h index eec4ab3af..847414179 100644 --- a/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h +++ b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h @@ -26,7 +26,7 @@ #ifndef WKIconDatabase_h #define WKIconDatabase_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { @@ -37,27 +37,41 @@ typedef void (*WKIconDatabaseDidChangeIconForPageURLCallback)(WKIconDatabaseRef typedef void (*WKIconDatabaseDidRemoveAllIconsCallback)(WKIconDatabaseRef iconDatabase, const void* clientInfo); typedef void (*WKIconDatabaseIconDataReadyForPageURLCallback)(WKIconDatabaseRef iconDatabase, WKURLRef pageURL, const void* clientInfo); -struct WKIconDatabaseClient { +typedef struct WKIconDatabaseClientBase { int version; const void * clientInfo; +} WKIconDatabaseClientBase; - // Version 0 +typedef struct WKIconDatabaseClientV0 { + WKIconDatabaseClientBase base; + + // Version 0. WKIconDatabaseDidChangeIconForPageURLCallback didChangeIconForPageURL; WKIconDatabaseDidRemoveAllIconsCallback didRemoveAllIcons; +} WKIconDatabaseClientV0; - // Version 1 - WKIconDatabaseIconDataReadyForPageURLCallback iconDataReadyForPageURL; -}; -typedef struct WKIconDatabaseClient WKIconDatabaseClient; +typedef struct WKIconDatabaseClientV1 { + WKIconDatabaseClientBase base; -enum { kWKIconDatabaseClientCurrentVersion = 1 }; + // Version 0. + WKIconDatabaseDidChangeIconForPageURLCallback didChangeIconForPageURL; + WKIconDatabaseDidRemoveAllIconsCallback didRemoveAllIcons; + + // Version 1. + WKIconDatabaseIconDataReadyForPageURLCallback iconDataReadyForPageURL; +} WKIconDatabaseClientV1; WK_EXPORT WKTypeID WKIconDatabaseGetTypeID(); -WK_EXPORT void WKIconDatabaseSetIconDatabaseClient(WKIconDatabaseRef iconDatabase, const WKIconDatabaseClient* client); +WK_EXPORT void WKIconDatabaseSetIconDatabaseClient(WKIconDatabaseRef iconDatabase, const WKIconDatabaseClientBase* client); WK_EXPORT void WKIconDatabaseRetainIconForURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL); WK_EXPORT void WKIconDatabaseReleaseIconForURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL); +WK_EXPORT void WKIconDatabaseSetIconDataForIconURL(WKIconDatabaseRef iconDatabase, WKDataRef iconData, WKURLRef iconURL); +WK_EXPORT void WKIconDatabaseSetIconURLForPageURL(WKIconDatabaseRef iconDatabase, WKURLRef iconURL, WKURLRef pageURL); +WK_EXPORT WKURLRef WKIconDatabaseCopyIconURLForPageURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL); +WK_EXPORT WKDataRef WKIconDatabaseCopyIconDataForPageURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL); + WK_EXPORT void WKIconDatabaseEnableDatabaseCleanup(WKIconDatabaseRef iconDatabase); WK_EXPORT void WKIconDatabaseRemoveAllIcons(WKIconDatabaseRef iconDatabase); diff --git a/Source/WebKit2/UIProcess/API/C/WKInspector.cpp b/Source/WebKit2/UIProcess/API/C/WKInspector.cpp index e638609bb..92c641dbb 100644 --- a/Source/WebKit2/UIProcess/API/C/WKInspector.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKInspector.cpp @@ -26,205 +26,98 @@ #include "config.h" #include "WKInspector.h" +#if !PLATFORM(IOS) + #include "WKAPICast.h" #include "WebInspectorProxy.h" +#include "WebPageProxy.h" using namespace WebKit; WKTypeID WKInspectorGetTypeID() { -#if ENABLE(INSPECTOR) return toAPI(WebInspectorProxy::APIType); -#else - return 0; -#endif } WKPageRef WKInspectorGetPage(WKInspectorRef inspectorRef) { -#if ENABLE(INSPECTOR) - return toAPI(toImpl(inspectorRef)->page()); -#else - UNUSED_PARAM(inspectorRef); - return 0; -#endif + return toAPI(toImpl(inspectorRef)->inspectedPage()); } bool WKInspectorIsConnected(WKInspectorRef inspectorRef) { -#if ENABLE(INSPECTOR) return toImpl(inspectorRef)->isConnected(); -#else - UNUSED_PARAM(inspectorRef); - return false; -#endif } bool WKInspectorIsVisible(WKInspectorRef inspectorRef) { -#if ENABLE(INSPECTOR) return toImpl(inspectorRef)->isVisible(); -#else - UNUSED_PARAM(inspectorRef); - return false; -#endif } bool WKInspectorIsFront(WKInspectorRef inspectorRef) { -#if ENABLE(INSPECTOR) return toImpl(inspectorRef)->isFront(); -#else - UNUSED_PARAM(inspectorRef); - return false; -#endif } void WKInspectorConnect(WKInspectorRef inspectorRef) { -#if ENABLE(INSPECTOR) toImpl(inspectorRef)->connect(); -#else - UNUSED_PARAM(inspectorRef); -#endif } void WKInspectorShow(WKInspectorRef inspectorRef) { -#if ENABLE(INSPECTOR) toImpl(inspectorRef)->show(); -#else - UNUSED_PARAM(inspectorRef); -#endif } void WKInspectorHide(WKInspectorRef inspectorRef) { -#if ENABLE(INSPECTOR) toImpl(inspectorRef)->hide(); -#else - UNUSED_PARAM(inspectorRef); -#endif } void WKInspectorClose(WKInspectorRef inspectorRef) { -#if ENABLE(INSPECTOR) toImpl(inspectorRef)->close(); -#else - UNUSED_PARAM(inspectorRef); -#endif } void WKInspectorShowConsole(WKInspectorRef inspectorRef) { -#if ENABLE(INSPECTOR) toImpl(inspectorRef)->showConsole(); -#else - UNUSED_PARAM(inspectorRef); -#endif } void WKInspectorShowResources(WKInspectorRef inspectorRef) { -#if ENABLE(INSPECTOR) toImpl(inspectorRef)->showResources(); -#else - UNUSED_PARAM(inspectorRef); -#endif } void WKInspectorShowMainResourceForFrame(WKInspectorRef inspectorRef, WKFrameRef frameRef) { -#if ENABLE(INSPECTOR) toImpl(inspectorRef)->showMainResourceForFrame(toImpl(frameRef)); -#else - UNUSED_PARAM(inspectorRef); - UNUSED_PARAM(frameRef); -#endif } bool WKInspectorIsAttached(WKInspectorRef inspectorRef) { -#if ENABLE(INSPECTOR) return toImpl(inspectorRef)->isAttached(); -#else - UNUSED_PARAM(inspectorRef); - return false; -#endif } void WKInspectorAttach(WKInspectorRef inspectorRef) { -#if ENABLE(INSPECTOR) - toImpl(inspectorRef)->attach(); -#else - UNUSED_PARAM(inspectorRef); -#endif + auto inspector = toImpl(inspectorRef); + inspector->attach(inspector->attachmentSide()); } void WKInspectorDetach(WKInspectorRef inspectorRef) { -#if ENABLE(INSPECTOR) toImpl(inspectorRef)->detach(); -#else - UNUSED_PARAM(inspectorRef); -#endif -} - -bool WKInspectorIsDebuggingJavaScript(WKInspectorRef inspectorRef) -{ -#if ENABLE(INSPECTOR) - return toImpl(inspectorRef)->isDebuggingJavaScript(); -#else - UNUSED_PARAM(inspectorRef); - return false; -#endif -} - -void WKInspectorToggleJavaScriptDebugging(WKInspectorRef inspectorRef) -{ -#if ENABLE(INSPECTOR) - toImpl(inspectorRef)->toggleJavaScriptDebugging(); -#else - UNUSED_PARAM(inspectorRef); -#endif -} - -bool WKInspectorIsProfilingJavaScript(WKInspectorRef inspectorRef) -{ -#if ENABLE(INSPECTOR) - return toImpl(inspectorRef)->isProfilingJavaScript(); -#else - UNUSED_PARAM(inspectorRef); - return false; -#endif -} - -void WKInspectorToggleJavaScriptProfiling(WKInspectorRef inspectorRef) -{ -#if ENABLE(INSPECTOR) - toImpl(inspectorRef)->toggleJavaScriptProfiling(); -#else - UNUSED_PARAM(inspectorRef); -#endif } bool WKInspectorIsProfilingPage(WKInspectorRef inspectorRef) { -#if ENABLE(INSPECTOR) return toImpl(inspectorRef)->isProfilingPage(); -#else - UNUSED_PARAM(inspectorRef); - return false; -#endif } void WKInspectorTogglePageProfiling(WKInspectorRef inspectorRef) { -#if ENABLE(INSPECTOR) toImpl(inspectorRef)->togglePageProfiling(); -#else - UNUSED_PARAM(inspectorRef); -#endif } + +#endif // !PLATFORM(IOS) diff --git a/Source/WebKit2/UIProcess/API/C/WKInspector.h b/Source/WebKit2/UIProcess/API/C/WKInspector.h index 203e1b3cf..14654fcd4 100644 --- a/Source/WebKit2/UIProcess/API/C/WKInspector.h +++ b/Source/WebKit2/UIProcess/API/C/WKInspector.h @@ -26,7 +26,7 @@ #ifndef WKInspector_h #define WKInspector_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifndef __cplusplus #include <stdbool.h> @@ -58,12 +58,6 @@ WK_EXPORT bool WKInspectorIsAttached(WKInspectorRef inspector); WK_EXPORT void WKInspectorAttach(WKInspectorRef inspector); WK_EXPORT void WKInspectorDetach(WKInspectorRef inspector); -WK_EXPORT bool WKInspectorIsDebuggingJavaScript(WKInspectorRef inspector); -WK_EXPORT void WKInspectorToggleJavaScriptDebugging(WKInspectorRef inspector); - -WK_EXPORT bool WKInspectorIsProfilingJavaScript(WKInspectorRef inspector); -WK_EXPORT void WKInspectorToggleJavaScriptProfiling(WKInspectorRef inspector); - WK_EXPORT bool WKInspectorIsProfilingPage(WKInspectorRef inspector); WK_EXPORT void WKInspectorTogglePageProfiling(WKInspectorRef inspector); diff --git a/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.cpp b/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.cpp index d33c056bf..e412511f6 100644 --- a/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.cpp @@ -26,27 +26,106 @@ #include "config.h" #include "WKKeyValueStorageManager.h" +#include "APIDictionary.h" +#include "APIWebsiteDataStore.h" +#include "StorageManager.h" #include "WKAPICast.h" -#include "WebKeyValueStorageManager.h" +#include "WebsiteDataStore.h" +#include <wtf/RunLoop.h> using namespace WebKit; WKTypeID WKKeyValueStorageManagerGetTypeID() { - return toAPI(WebKeyValueStorageManager::APIType); + return toAPI(API::WebsiteDataStore::APIType); } -void WKKeyValueStorageManagerGetKeyValueStorageOrigins(WKKeyValueStorageManagerRef keyValueStorageManagerRef, void* context, WKKeyValueStorageManagerGetKeyValueStorageOriginsFunction callback) +WKStringRef WKKeyValueStorageManagerGetOriginKey() { - toImpl(keyValueStorageManagerRef)->getKeyValueStorageOrigins(ArrayCallback::create(context, callback)); + static API::String& key = API::String::create("WebKeyValueStorageManagerStorageDetailsOriginKey").leakRef(); + return toAPI(&key); } -void WKKeyValueStorageManagerDeleteEntriesForOrigin(WKKeyValueStorageManagerRef keyValueStorageManagerRef, WKSecurityOriginRef originRef) +WKStringRef WKKeyValueStorageManagerGetCreationTimeKey() { - toImpl(keyValueStorageManagerRef)->deleteEntriesForOrigin(toImpl(originRef)); + static API::String& key = API::String::create("WebKeyValueStorageManagerStorageDetailsCreationTimeKey").leakRef(); + return toAPI(&key); } -void WKKeyValueStorageManagerDeleteAllEntries(WKKeyValueStorageManagerRef keyValueStorageManagerRef) +WKStringRef WKKeyValueStorageManagerGetModificationTimeKey() { - toImpl(keyValueStorageManagerRef)->deleteAllEntries(); + static API::String& key = API::String::create("WebKeyValueStorageManagerStorageDetailsModificationTimeKey").leakRef(); + return toAPI(&key); +} + +void WKKeyValueStorageManagerGetKeyValueStorageOrigins(WKKeyValueStorageManagerRef keyValueStorageManager, void* context, WKKeyValueStorageManagerGetKeyValueStorageOriginsFunction callback) + +{ + StorageManager* storageManager = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(keyValueStorageManager))->websiteDataStore().storageManager(); + if (!storageManager) { + RunLoop::main().dispatch([context, callback] { + callback(toAPI(API::Array::create().ptr()), nullptr, context); + }); + return; + } + + storageManager->getLocalStorageOrigins([context, callback](HashSet<RefPtr<WebCore::SecurityOrigin>>&& securityOrigins) { + Vector<RefPtr<API::Object>> webSecurityOrigins; + webSecurityOrigins.reserveInitialCapacity(securityOrigins.size()); + for (auto& origin : securityOrigins) + webSecurityOrigins.uncheckedAppend(API::SecurityOrigin::create(*origin)); + + callback(toAPI(API::Array::create(WTFMove(webSecurityOrigins)).ptr()), nullptr, context); + }); +} + +void WKKeyValueStorageManagerGetStorageDetailsByOrigin(WKKeyValueStorageManagerRef keyValueStorageManager, void* context, WKKeyValueStorageManagerGetStorageDetailsByOriginFunction callback) +{ + StorageManager* storageManager = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(keyValueStorageManager))->websiteDataStore().storageManager(); + if (!storageManager) { + RunLoop::main().dispatch([context, callback] { + callback(toAPI(API::Array::create().ptr()), nullptr, context); + }); + return; + } + + storageManager->getLocalStorageOriginDetails([context, callback](Vector<LocalStorageDatabaseTracker::OriginDetails> storageDetails) { + HashMap<String, RefPtr<API::Object>> detailsMap; + Vector<RefPtr<API::Object>> result; + result.reserveInitialCapacity(storageDetails.size()); + + for (const auto& originDetails : storageDetails) { + HashMap<String, RefPtr<API::Object>> detailsMap; + + RefPtr<API::Object> origin = API::SecurityOrigin::create(WebCore::SecurityOrigin::createFromDatabaseIdentifier(originDetails.originIdentifier)); + + detailsMap.set(toImpl(WKKeyValueStorageManagerGetOriginKey())->string(), origin); + if (originDetails.creationTime) + detailsMap.set(toImpl(WKKeyValueStorageManagerGetCreationTimeKey())->string(), API::Double::create(originDetails.creationTime.valueOr(0))); + if (originDetails.modificationTime) + detailsMap.set(toImpl(WKKeyValueStorageManagerGetModificationTimeKey())->string(), API::Double::create(originDetails.modificationTime.valueOr(0))); + + result.uncheckedAppend(API::Dictionary::create(WTFMove(detailsMap))); + } + + callback(toAPI(API::Array::create(WTFMove(result)).ptr()), nullptr, context); + }); +} + +void WKKeyValueStorageManagerDeleteEntriesForOrigin(WKKeyValueStorageManagerRef keyValueStorageManager, WKSecurityOriginRef origin) +{ + StorageManager* storageManager = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(keyValueStorageManager))->websiteDataStore().storageManager(); + if (!storageManager) + return; + + storageManager->deleteLocalStorageEntriesForOrigin(toImpl(origin)->securityOrigin()); +} + +void WKKeyValueStorageManagerDeleteAllEntries(WKKeyValueStorageManagerRef keyValueStorageManager) +{ + StorageManager* storageManager = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(keyValueStorageManager))->websiteDataStore().storageManager(); + if (!storageManager) + return; + + storageManager->deleteLocalStorageOriginsModifiedSince(std::chrono::system_clock::time_point::min(), [] { }); } diff --git a/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.h b/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.h index a0ee27825..d92adadad 100644 --- a/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.h +++ b/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.h @@ -26,7 +26,7 @@ #ifndef WKKeyValueStorageManager_h #define WKKeyValueStorageManager_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { @@ -34,9 +34,21 @@ extern "C" { WK_EXPORT WKTypeID WKKeyValueStorageManagerGetTypeID(); +/* Value type: WKSecurityOriginRef */ +WK_EXPORT WKStringRef WKKeyValueStorageManagerGetOriginKey(); + +/* Value type: WKDoubleRef, seconds since January 1st, 1970 UTC */ +WK_EXPORT WKStringRef WKKeyValueStorageManagerGetCreationTimeKey(); + +/* Value type: WKDoubleRef, seconds since January 1st, 1970 UTC */ +WK_EXPORT WKStringRef WKKeyValueStorageManagerGetModificationTimeKey(); + typedef void (*WKKeyValueStorageManagerGetKeyValueStorageOriginsFunction)(WKArrayRef, WKErrorRef, void*); WK_EXPORT void WKKeyValueStorageManagerGetKeyValueStorageOrigins(WKKeyValueStorageManagerRef keyValueStorageManager, void* context, WKKeyValueStorageManagerGetKeyValueStorageOriginsFunction function); +typedef void (*WKKeyValueStorageManagerGetStorageDetailsByOriginFunction)(WKArrayRef, WKErrorRef, void*); +WK_EXPORT void WKKeyValueStorageManagerGetStorageDetailsByOrigin(WKKeyValueStorageManagerRef keyValueStorageManager, void* context, WKKeyValueStorageManagerGetStorageDetailsByOriginFunction function); + WK_EXPORT void WKKeyValueStorageManagerDeleteEntriesForOrigin(WKKeyValueStorageManagerRef keyValueStorageManager, WKSecurityOriginRef origin); WK_EXPORT void WKKeyValueStorageManagerDeleteAllEntries(WKKeyValueStorageManagerRef keyValueStorageManager); diff --git a/Source/WebKit2/UIProcess/API/C/WKLayoutMode.h b/Source/WebKit2/UIProcess/API/C/WKLayoutMode.h new file mode 100644 index 000000000..bb75f17f9 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKLayoutMode.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKLayoutMode_h +#define WKLayoutMode_h + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKLayoutModeViewSize = 0, + kWKLayoutModeFixedSize = 1, + kWKLayoutModeDynamicSizeComputedFromViewScale = 2, + kWKLayoutModeDynamicSizeComputedFromMinimumDocumentSize = 4 +}; +typedef uint32_t WKLayoutMode; + +#ifdef __cplusplus +} +#endif + +#endif /* WKLayoutMode_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKMediaSessionFocusManager.cpp b/Source/WebKit2/UIProcess/API/C/WKMediaSessionFocusManager.cpp new file mode 100644 index 000000000..9603bf072 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKMediaSessionFocusManager.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKMediaSessionFocusManager.h" + +#include "WKAPICast.h" +#include "WebMediaSessionFocusManager.h" + +using namespace WebKit; + +WKTypeID WKMediaSessionFocusManagerGetTypeID() +{ +#if ENABLE(MEDIA_SESSION) + return toAPI(WebMediaSessionFocusManager::APIType); +#else + return toAPI(API::Object::Type::Null); +#endif +} + +void WKMediaSessionFocusManagerSetClient(WKMediaSessionFocusManagerRef manager, const WKMediaSessionFocusManagerClientBase* client) +{ +#if ENABLE(MEDIA_SESSION) + toImpl(manager)->initializeClient(client); +#else + UNUSED_PARAM(manager); + UNUSED_PARAM(client); +#endif +} + +bool WKMediaSessionFocusManagerValueForPlaybackAttribute(WKMediaSessionFocusManagerRef manager, WKMediaSessionFocusManagerPlaybackAttribute attribute) +{ +#if ENABLE(MEDIA_SESSION) + return toImpl(manager)->valueForPlaybackAttribute(attribute); +#else + UNUSED_PARAM(manager); + UNUSED_PARAM(attribute); + return false; +#endif +} + +void WKMediaSessionFocusManagerSetVolumeOfFocusedMediaElement(WKMediaSessionFocusManagerRef manager, double volume) +{ +#if ENABLE(MEDIA_SESSION) + toImpl(manager)->setVolumeOfFocusedMediaElement(volume); +#else + UNUSED_PARAM(manager); + UNUSED_PARAM(volume); +#endif +} diff --git a/Source/WebKit2/UIProcess/API/C/WKMediaSessionFocusManager.h b/Source/WebKit2/UIProcess/API/C/WKMediaSessionFocusManager.h new file mode 100644 index 000000000..ed39e705a --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKMediaSessionFocusManager.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKMediaSessionFocusManager_h +#define WKMediaSessionFocusManager_h + +#include <WebKit/WKBase.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +enum WKMediaSessionFocusManagerPlaybackAttribute { + IsPlaying = 1 << 0, + IsPreviousTrackControlEnabled = 1 << 1, + IsNextTrackControlEnabled = 1 << 2, +}; +typedef uint32_t WKMediaSessionFocusManagerPlaybackAttributes; + +// Media Session Focus Manager Client +typedef void (*WKMediaSessionFocusManagerDidChangePlaybackAttribute)(WKMediaSessionFocusManagerRef manager, WKMediaSessionFocusManagerPlaybackAttribute playbackAttribute, bool value, const void *clientInfo); + +typedef struct WKMediaSessionFocusManagerClientBase { + int version; + const void * clientInfo; +} WKMediaSessionFocusManagerClientBase; + +typedef struct WKMediaSessionFocusManagerClientV0 { + WKMediaSessionFocusManagerClientBase base; + + // Version 0. + WKMediaSessionFocusManagerDidChangePlaybackAttribute didChangePlaybackAttribute; +} WKMediaSessionFocusManagerClientV0; + +WK_EXPORT WKTypeID WKMediaSessionFocusManagerGetTypeID(); + +WK_EXPORT void WKMediaSessionFocusManagerSetClient(WKMediaSessionFocusManagerRef manager, const WKMediaSessionFocusManagerClientBase* client); + +WK_EXPORT bool WKMediaSessionFocusManagerValueForPlaybackAttribute(WKMediaSessionFocusManagerRef, WKMediaSessionFocusManagerPlaybackAttribute); +WK_EXPORT void WKMediaSessionFocusManagerSetVolumeOfFocusedMediaElement(WKMediaSessionFocusManagerRef, double); + +#ifdef __cplusplus +} +#endif + +#endif /* WKMediaSessionFocusManager_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKMediaSessionMetadata.cpp b/Source/WebKit2/UIProcess/API/C/WKMediaSessionMetadata.cpp new file mode 100644 index 000000000..330ca53aa --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKMediaSessionMetadata.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKMediaSessionMetadata.h" + +#include "WKAPICast.h" +#include "WebMediaSessionMetadata.h" + +using namespace WebKit; + +WKTypeID WKMediaSessionMetadataGetTypeID() +{ +#if ENABLE(MEDIA_SESSION) + return toAPI(WebMediaSessionMetadata::APIType); +#else + return toAPI(API::Object::Type::Null); +#endif +} + +WKStringRef WKMediaSessionMetadataCopyTitle(WKMediaSessionMetadataRef metadata) +{ +#if ENABLE(MEDIA_SESSION) + return toCopiedAPI(toImpl(metadata)->title()); +#else + UNUSED_PARAM(metadata); + return nullptr; +#endif +} + +WKStringRef WKMediaSessionMetadataCopyArtist(WKMediaSessionMetadataRef metadata) +{ +#if ENABLE(MEDIA_SESSION) + return toCopiedAPI(toImpl(metadata)->artist()); +#else + UNUSED_PARAM(metadata); + return nullptr; +#endif +} + +WKStringRef WKMediaSessionMetadataCopyAlbum(WKMediaSessionMetadataRef metadata) +{ +#if ENABLE(MEDIA_SESSION) + return toCopiedAPI(toImpl(metadata)->album()); +#else + UNUSED_PARAM(metadata); + return nullptr; +#endif +} + +WKURLRef WKMediaSessionMetadataCopyArtworkURL(WKMediaSessionMetadataRef metadata) +{ +#if ENABLE(MEDIA_SESSION) + return toCopiedURLAPI(toImpl(metadata)->artworkURL()); +#else + UNUSED_PARAM(metadata); + return nullptr; +#endif +} diff --git a/Source/WebKit2/UIProcess/API/C/WKMediaSessionMetadata.h b/Source/WebKit2/UIProcess/API/C/WKMediaSessionMetadata.h new file mode 100644 index 000000000..b9430f7e4 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKMediaSessionMetadata.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKMediaSessionMetadata_h +#define WKMediaSessionMetadata_h + +#include <WebKit/WKBase.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKMediaSessionMetadataGetTypeID(); + +WK_EXPORT WKStringRef WKMediaSessionMetadataCopyTitle(WKMediaSessionMetadataRef metadata); +WK_EXPORT WKStringRef WKMediaSessionMetadataCopyArtist(WKMediaSessionMetadataRef metadata); +WK_EXPORT WKStringRef WKMediaSessionMetadataCopyAlbum(WKMediaSessionMetadataRef metadata); +WK_EXPORT WKURLRef WKMediaSessionMetadataCopyArtworkURL(WKMediaSessionMetadataRef metadata); + +#ifdef __cplusplus +} +#endif + +#endif /* WKMediaSessionMetadata_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKNativeEvent.h b/Source/WebKit2/UIProcess/API/C/WKNativeEvent.h index f0d39fb5a..10bed36ea 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNativeEvent.h +++ b/Source/WebKit2/UIProcess/API/C/WKNativeEvent.h @@ -26,11 +26,15 @@ #ifndef WKNativeEvent_h #define WKNativeEvent_h +#ifdef __APPLE__ +#include <TargetConditionals.h> +#endif + #ifdef __cplusplus extern "C" { #endif -#ifdef __APPLE__ +#if defined(__APPLE__) && !TARGET_OS_IPHONE && !defined(BUILDING_GTK__) #ifdef __OBJC__ @class NSEvent; #elif __cplusplus diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKFullScreenClientGtk.cpp b/Source/WebKit2/UIProcess/API/C/WKNavigationActionRef.cpp index 2b29a2b76..14a235157 100644 --- a/Source/WebKit2/UIProcess/API/C/gtk/WKFullScreenClientGtk.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKNavigationActionRef.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Igalia S.L. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,14 +24,14 @@ */ #include "config.h" -#include "WKFullScreenClientGtk.h" +#include "WKNavigationActionRef.h" +#include "APINavigationAction.h" #include "WKAPICast.h" -#include "WebKitWebViewBasePrivate.h" using namespace WebKit; -void WKViewSetFullScreenClientGtk(WKViewRef viewRef, const WKFullScreenClientGtk* wkClient) +WKTypeID WKNavigationActionGetTypeID() { - webkitWebViewBaseInitializeFullScreenClient(toImpl(viewRef), wkClient); + return toAPI(API::NavigationAction::APIType); } diff --git a/Source/WebKit2/UIProcess/API/C/cairo/WKIconDatabaseCairo.h b/Source/WebKit2/UIProcess/API/C/WKNavigationActionRef.h index ea6231148..5691eabcd 100644 --- a/Source/WebKit2/UIProcess/API/C/cairo/WKIconDatabaseCairo.h +++ b/Source/WebKit2/UIProcess/API/C/WKNavigationActionRef.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Intel Corporation. All rights reserved. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,16 +23,19 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include <WebKit2/WKBase.h> +#ifndef WKNavigationActionRef_h +#define WKNavigationActionRef_h -typedef struct _cairo_surface cairo_surface_t; +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { #endif -WK_EXPORT cairo_surface_t* WKIconDatabaseTryGetCairoSurfaceForURL(WKIconDatabaseRef iconDatabase, WKURLRef url); +WK_EXPORT WKTypeID WKNavigationActionGetTypeID(); #ifdef __cplusplus } #endif + +#endif // WKNavigationActionRef_h diff --git a/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp b/Source/WebKit2/UIProcess/API/C/WKNavigationDataRef.cpp index e0100bed8..0a815bb82 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKNavigationDataRef.cpp @@ -24,17 +24,17 @@ */ #include "config.h" -#include "WKNavigationData.h" +#include "WKNavigationDataRef.h" +#include "APINavigationData.h" +#include "APIURLRequest.h" #include "WKAPICast.h" -#include "WebNavigationData.h" -#include "WebURLRequest.h" using namespace WebKit; WKTypeID WKNavigationDataGetTypeID() { - return toAPI(WebNavigationData::APIType); + return toAPI(API::NavigationData::APIType); } WKStringRef WKNavigationDataCopyTitle(WKNavigationDataRef navigationDataRef) @@ -55,5 +55,5 @@ WKURLRef WKNavigationDataCopyNavigationDestinationURL(WKNavigationDataRef naviga WKURLRequestRef WKNavigationDataCopyOriginalRequest(WKNavigationDataRef navigationData) { - return toAPI(WebURLRequest::create(toImpl(navigationData)->originalRequest()).leakRef()); + return toAPI(&API::URLRequest::create(toImpl(navigationData)->originalRequest()).leakRef()); } diff --git a/Source/WebKit2/UIProcess/API/C/WKNavigationData.h b/Source/WebKit2/UIProcess/API/C/WKNavigationDataRef.h index e5d3a15f8..b2c5f5b2b 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNavigationData.h +++ b/Source/WebKit2/UIProcess/API/C/WKNavigationDataRef.h @@ -23,10 +23,10 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKNavigationData_h -#define WKNavigationData_h +#ifndef WKNavigationDataRef_h +#define WKNavigationDataRef_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { @@ -45,4 +45,4 @@ WK_EXPORT WKURLRef WKNavigationDataCopyURL(WKNavigationDataRef navigationData); } #endif -#endif /* WKNavigationData_h */ +#endif /* WKNavigationDataRef_h */ diff --git a/Source/WebKit2/UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp b/Source/WebKit2/UIProcess/API/C/WKNavigationRef.cpp index 118c4d8cb..591c14660 100644 --- a/Source/WebKit2/UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKNavigationRef.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Intel Corporation. All rights reserved. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,15 +24,14 @@ */ #include "config.h" -#include "WKIconDatabaseCairo.h" +#include "WKNavigationRef.h" +#include "APINavigation.h" #include "WKAPICast.h" -#include "WebIconDatabase.h" -using namespace WebCore; using namespace WebKit; -cairo_surface_t* WKIconDatabaseTryGetCairoSurfaceForURL(WKIconDatabaseRef iconDatabase, WKURLRef url) +WKTypeID WKNavigationGetTypeID() { - return toImpl(iconDatabase)->nativeImageForPageURL(toWTFString(url)).get(); + return toAPI(API::Navigation::APIType); } diff --git a/Source/WebKit2/UIProcess/API/C/soup/WKContextSoup.h b/Source/WebKit2/UIProcess/API/C/WKNavigationRef.h index 36954ffe3..ae9a19074 100644 --- a/Source/WebKit2/UIProcess/API/C/soup/WKContextSoup.h +++ b/Source/WebKit2/UIProcess/API/C/WKNavigationRef.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Igalia S.L. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,20 +23,19 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKContextSoup_h -#define WKContextSoup_h +#ifndef WKNavigationRef_h +#define WKNavigationRef_h -#include <WebKit2/WKBase.h> -#include <WebKit2/WKSoupRequestManager.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { #endif -WK_EXPORT WKSoupRequestManagerRef WKContextGetSoupRequestManager(WKContextRef context); +WK_EXPORT WKTypeID WKNavigationGetTypeID(); #ifdef __cplusplus } #endif -#endif /* WKContextSoup_h */ +#endif // WKNavigationRef_h diff --git a/Source/WebKit2/UIProcess/API/C/WKNavigationResponseRef.cpp b/Source/WebKit2/UIProcess/API/C/WKNavigationResponseRef.cpp new file mode 100644 index 000000000..ed6f21b0f --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKNavigationResponseRef.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKNavigationResponseRef.h" + +#include "APINavigationResponse.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKNavigationResponseGetTypeID() +{ + return toAPI(API::NavigationResponse::APIType); +} + +bool WKNavigationResponseCanShowMIMEType(WKNavigationResponseRef response) +{ + return toImpl(response)->canShowMIMEType(); +} diff --git a/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.h b/Source/WebKit2/UIProcess/API/C/WKNavigationResponseRef.h index 8357ba56a..c82b14dc3 100644 --- a/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.h +++ b/Source/WebKit2/UIProcess/API/C/WKNavigationResponseRef.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,20 +23,21 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKPagePrivateMac_h -#define WKPagePrivateMac_h +#ifndef WKNavigationResponseRef_h +#define WKNavigationResponseRef_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { #endif -WK_EXPORT pid_t WKPageGetProcessIdentifier(WKPageRef page); -WK_EXPORT bool WKPageIsURLKnownHSTSHost(WKPageRef page, WKURLRef url); +WK_EXPORT WKTypeID WKNavigationResponseGetTypeID(); + +WK_EXPORT bool WKNavigationResponseCanShowMIMEType(WKNavigationResponseRef); #ifdef __cplusplus } #endif -#endif /* WKPagePrivateMac_h */ +#endif // WKNavigationResponseRef_h diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h b/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h deleted file mode 100644 index dd92eb868..000000000 --- a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2012 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WKNetworkInfoManager_h -#define WKNetworkInfoManager_h - -#include <WebKit2/WKBase.h> - -#ifdef __cplusplus -extern "C" { -#endif - -// Provider. -typedef void (*WKNetworkInfoProviderStartUpdatingCallback)(WKNetworkInfoManagerRef networkInfoManager, const void* clientInfo); -typedef void (*WKNetworkInfoProviderStopUpdatingCallback)(WKNetworkInfoManagerRef networkInfoManager, const void* clientInfo); -typedef double (*WKNetworkInfoProviderGetBandwidthCallback)(WKNetworkInfoManagerRef networkInfoManager, const void* clientInfo); -typedef bool (*WKNetworkInfoProviderIsMeteredCallback)(WKNetworkInfoManagerRef networkInfoManager, const void* clientInfo); - -struct WKNetworkInfoProvider { - int version; - const void * clientInfo; - WKNetworkInfoProviderStartUpdatingCallback startUpdating; - WKNetworkInfoProviderStopUpdatingCallback stopUpdating; - WKNetworkInfoProviderGetBandwidthCallback bandwidth; - WKNetworkInfoProviderIsMeteredCallback isMetered; -}; -typedef struct WKNetworkInfoProvider WKNetworkInfoProvider; - -enum { kWKNetworkInfoProviderCurrentVersion = 0 }; - -WK_EXPORT WKTypeID WKNetworkInfoManagerGetTypeID(); - -WK_EXPORT void WKNetworkInfoManagerSetProvider(WKNetworkInfoManagerRef networkInfoManager, const WKNetworkInfoProvider* provider); - -WK_EXPORT void WKNetworkInfoManagerProviderDidChangeNetworkInformation(WKNetworkInfoManagerRef networkInfoManager, WKStringRef eventType, WKNetworkInfoRef networkInfo); - -#ifdef __cplusplus -} -#endif - -#endif // WKNetworkInfoManager_h diff --git a/Source/WebKit2/UIProcess/API/C/WKNotification.cpp b/Source/WebKit2/UIProcess/API/C/WKNotification.cpp index 78b09e09e..3d1805730 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNotification.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKNotification.cpp @@ -26,9 +26,9 @@ #include "config.h" #include "WKNotification.h" +#include "APISecurityOrigin.h" #include "WKAPICast.h" #include "WebNotification.h" -#include "WebSecurityOrigin.h" using namespace WebKit; diff --git a/Source/WebKit2/UIProcess/API/C/WKNotification.h b/Source/WebKit2/UIProcess/API/C/WKNotification.h index 7035ef3f8..d3ae98bf7 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNotification.h +++ b/Source/WebKit2/UIProcess/API/C/WKNotification.h @@ -26,7 +26,7 @@ #ifndef WKNotification_h #define WKNotification_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKNotificationManager.cpp b/Source/WebKit2/UIProcess/API/C/WKNotificationManager.cpp index 60671a7e1..1e050a6e6 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNotificationManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKNotificationManager.cpp @@ -36,7 +36,7 @@ WKTypeID WKNotificationManagerGetTypeID() return toAPI(WebNotificationManagerProxy::APIType); } -void WKNotificationManagerSetProvider(WKNotificationManagerRef managerRef, const WKNotificationProvider* wkProvider) +void WKNotificationManagerSetProvider(WKNotificationManagerRef managerRef, const WKNotificationProviderBase* wkProvider) { toImpl(managerRef)->initializeProvider(wkProvider); } diff --git a/Source/WebKit2/UIProcess/API/C/WKNotificationManager.h b/Source/WebKit2/UIProcess/API/C/WKNotificationManager.h index 7074a2186..cb88036bc 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNotificationManager.h +++ b/Source/WebKit2/UIProcess/API/C/WKNotificationManager.h @@ -27,14 +27,14 @@ #define WKNotificationManager_h #include "WKNotificationProvider.h" -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { #endif WK_EXPORT WKTypeID WKNotificationManagerGetTypeID(); -WK_EXPORT void WKNotificationManagerSetProvider(WKNotificationManagerRef managerRef, const WKNotificationProvider* wkProvider); +WK_EXPORT void WKNotificationManagerSetProvider(WKNotificationManagerRef managerRef, const WKNotificationProviderBase* wkProvider); WK_EXPORT void WKNotificationManagerProviderDidShowNotification(WKNotificationManagerRef managerRef, uint64_t notificationID); WK_EXPORT void WKNotificationManagerProviderDidClickNotification(WKNotificationManagerRef managerRef, uint64_t notificationID); diff --git a/Source/WebKit2/UIProcess/API/C/WKNotificationPermissionRequest.h b/Source/WebKit2/UIProcess/API/C/WKNotificationPermissionRequest.h index 1947a06aa..02be0e63c 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNotificationPermissionRequest.h +++ b/Source/WebKit2/UIProcess/API/C/WKNotificationPermissionRequest.h @@ -26,7 +26,7 @@ #ifndef WKNotificationPermissionRequest_h #define WKNotificationPermissionRequest_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKNotificationProvider.h b/Source/WebKit2/UIProcess/API/C/WKNotificationProvider.h index bc99ec9b0..8a416c57c 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNotificationProvider.h +++ b/Source/WebKit2/UIProcess/API/C/WKNotificationProvider.h @@ -26,7 +26,7 @@ #ifndef WKNotificationProvider_h #define WKNotificationProvider_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { @@ -40,9 +40,15 @@ typedef void (*WKNotificationProviderRemoveNotificationManagerCallback)(WKNotifi typedef WKDictionaryRef (*WKNotificationProviderNotificationPermissionsCallback)(const void* clientInfo); typedef void (*WKNotificationProviderClearNotificationsCallback)(WKArrayRef notificationIDs, const void* clientInfo); -struct WKNotificationProvider { +typedef struct WKNotificationProviderBase { int version; const void* clientInfo; +} WKNotificationProviderBase; + +typedef struct WKNotificationProviderV0 { + WKNotificationProviderBase base; + + // Version 0. WKNotificationProviderShowCallback show; WKNotificationProviderCancelCallback cancel; WKNotificationProviderDidDestroyNotificationCallback didDestroyNotification; @@ -50,10 +56,7 @@ struct WKNotificationProvider { WKNotificationProviderRemoveNotificationManagerCallback removeNotificationManager; WKNotificationProviderNotificationPermissionsCallback notificationPermissions; WKNotificationProviderClearNotificationsCallback clearNotifications; -}; -typedef struct WKNotificationProvider WKNotificationProvider; - -enum { kWKNotificationProviderCurrentVersion = 0 }; +} WKNotificationProviderV0; #ifdef __cplusplus } diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp index 29ecf543b..8370a6ffd 100644 --- a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp @@ -27,7 +27,7 @@ #include "config.h" #include "WKOpenPanelParameters.h" -#include "ImmutableArray.h" +#include "APIArray.h" #include "WKAPICast.h" #include "WebOpenPanelParameters.h" @@ -45,19 +45,26 @@ bool WKOpenPanelParametersGetAllowsMultipleFiles(WKOpenPanelParametersRef parame WKArrayRef WKOpenPanelParametersCopyAcceptedMIMETypes(WKOpenPanelParametersRef parametersRef) { - return toAPI(toImpl(parametersRef)->acceptMIMETypes().leakRef()); + return toAPI(&toImpl(parametersRef)->acceptMIMETypes().leakRef()); } -WKStringRef WKOpenPanelParametersCopyCapture(WKOpenPanelParametersRef parametersRef) +// Deprecated. +WKStringRef WKOpenPanelParametersCopyCapture(WKOpenPanelParametersRef) +{ + return 0; +} + +bool WKOpenPanelParametersGetCaptureEnabled(WKOpenPanelParametersRef parametersRef) { #if ENABLE(MEDIA_CAPTURE) - return toCopiedAPI(toImpl(parametersRef)->capture()); + return toImpl(parametersRef)->capture(); #else - return 0; + UNUSED_PARAM(parametersRef); + return false; #endif } WKArrayRef WKOpenPanelParametersCopySelectedFileNames(WKOpenPanelParametersRef parametersRef) { - return toAPI(toImpl(parametersRef)->selectedFileNames().leakRef()); + return toAPI(&toImpl(parametersRef)->selectedFileNames().leakRef()); } diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h index 3801c2f7b..803bff8b4 100644 --- a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h +++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h @@ -27,7 +27,7 @@ #ifndef WKOpenPanelParameters_h #define WKOpenPanelParameters_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifndef __cplusplus #include <stdbool.h> @@ -43,8 +43,11 @@ WK_EXPORT bool WKOpenPanelParametersGetAllowsMultipleFiles(WKOpenPanelParameters WK_EXPORT WKArrayRef WKOpenPanelParametersCopyAcceptedMIMETypes(WKOpenPanelParametersRef parameters); +/* DEPRECATED - Please use WKOpenPanelParametersGetCaptureEnabled() instead. */ WK_EXPORT WKStringRef WKOpenPanelParametersCopyCapture(WKOpenPanelParametersRef parameters); +WK_EXPORT bool WKOpenPanelParametersGetCaptureEnabled(WKOpenPanelParametersRef parametersRef); + WK_EXPORT WKArrayRef WKOpenPanelParametersCopySelectedFileNames(WKOpenPanelParametersRef parametersRef); #ifdef __cplusplus diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.h b/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.h index d581738a5..21c92ee24 100644 --- a/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.h +++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.h @@ -26,7 +26,7 @@ #ifndef WKOpenPanelResultListener_h #define WKOpenPanelResultListener_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.cpp b/Source/WebKit2/UIProcess/API/C/WKPage.cpp index 2d9ae5e51..701a4c83b 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,14 +27,51 @@ #include "WKPage.h" #include "WKPagePrivate.h" +#include "APIArray.h" +#include "APIContextMenuClient.h" +#include "APIData.h" +#include "APIDictionary.h" +#include "APIFindClient.h" +#include "APIFindMatchesClient.h" +#include "APIFrameInfo.h" +#include "APIGeometry.h" +#include "APIHitTestResult.h" +#include "APILoaderClient.h" +#include "APINavigationAction.h" +#include "APINavigationClient.h" +#include "APINavigationResponse.h" +#include "APIPageConfiguration.h" +#include "APIPolicyClient.h" +#include "APISessionState.h" +#include "APIUIClient.h" +#include "APIWindowFeatures.h" +#include "AuthenticationChallengeProxy.h" +#include "LegacySessionStateCoding.h" +#include "Logging.h" +#include "NativeWebKeyboardEvent.h" +#include "NativeWebWheelEvent.h" +#include "NavigationActionData.h" +#include "PluginInformation.h" #include "PrintInfo.h" #include "WKAPICast.h" +#include "WKPagePolicyClientInternal.h" +#include "WKPageRenderingProgressEventsInternal.h" #include "WKPluginInformation.h" #include "WebBackForwardList.h" -#include "WebData.h" +#include "WebFormClient.h" +#include "WebImage.h" +#include "WebInspectorProxy.h" +#include "WebOpenPanelParameters.h" +#include "WebOpenPanelResultListenerProxy.h" +#include "WebPageGroup.h" +#include "WebPageMessages.h" #include "WebPageProxy.h" +#include "WebProcessPool.h" #include "WebProcessProxy.h" +#include "WebProtectionSpace.h" #include <WebCore/Page.h> +#include <WebCore/SecurityOriginData.h> +#include <WebCore/WindowFeatures.h> #ifdef __BLOCKS__ #include <Block.h> @@ -44,9 +81,51 @@ #include "WebContextMenuItem.h" #endif +#if ENABLE(VIBRATION) +#include "WebVibrationProxy.h" +#endif + +#if ENABLE(MEDIA_SESSION) +#include "WebMediaSessionMetadata.h" +#include <WebCore/MediaSessionEvents.h> +#endif + using namespace WebCore; using namespace WebKit; +namespace API { +template<> struct ClientTraits<WKPageLoaderClientBase> { + typedef std::tuple<WKPageLoaderClientV0, WKPageLoaderClientV1, WKPageLoaderClientV2, WKPageLoaderClientV3, WKPageLoaderClientV4, WKPageLoaderClientV5, WKPageLoaderClientV6> Versions; +}; + +template<> struct ClientTraits<WKPageNavigationClientBase> { + typedef std::tuple<WKPageNavigationClientV0> Versions; +}; + +template<> struct ClientTraits<WKPagePolicyClientBase> { + typedef std::tuple<WKPagePolicyClientV0, WKPagePolicyClientV1, WKPagePolicyClientInternal> Versions; +}; + +template<> struct ClientTraits<WKPageUIClientBase> { + typedef std::tuple<WKPageUIClientV0, WKPageUIClientV1, WKPageUIClientV2, WKPageUIClientV3, WKPageUIClientV4, WKPageUIClientV5, WKPageUIClientV6, WKPageUIClientV7> Versions; +}; + +#if ENABLE(CONTEXT_MENUS) +template<> struct ClientTraits<WKPageContextMenuClientBase> { + typedef std::tuple<WKPageContextMenuClientV0, WKPageContextMenuClientV1, WKPageContextMenuClientV2, WKPageContextMenuClientV3> Versions; +}; +#endif + +template<> struct ClientTraits<WKPageFindClientBase> { + typedef std::tuple<WKPageFindClientV0> Versions; +}; + +template<> struct ClientTraits<WKPageFindMatchesClientBase> { + typedef std::tuple<WKPageFindMatchesClientV0> Versions; +}; + +} + WKTypeID WKPageGetTypeID() { return toAPI(WebPageProxy::APIType); @@ -54,32 +133,43 @@ WKTypeID WKPageGetTypeID() WKContextRef WKPageGetContext(WKPageRef pageRef) { - return toAPI(toImpl(pageRef)->process()->context()); + return toAPI(&toImpl(pageRef)->process().processPool()); } WKPageGroupRef WKPageGetPageGroup(WKPageRef pageRef) { - return toAPI(toImpl(pageRef)->pageGroup()); + return toAPI(&toImpl(pageRef)->pageGroup()); +} + +WKPageConfigurationRef WKPageCopyPageConfiguration(WKPageRef pageRef) +{ + return toAPI(&toImpl(pageRef)->configuration().copy().leakRef()); } void WKPageLoadURL(WKPageRef pageRef, WKURLRef URLRef) { - toImpl(pageRef)->loadURL(toWTFString(URLRef)); + toImpl(pageRef)->loadRequest(URL(URL(), toWTFString(URLRef))); +} + +void WKPageLoadURLWithShouldOpenExternalURLsPolicy(WKPageRef pageRef, WKURLRef URLRef, bool shouldOpenExternalURLs) +{ + ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy = shouldOpenExternalURLs ? ShouldOpenExternalURLsPolicy::ShouldAllow : ShouldOpenExternalURLsPolicy::ShouldNotAllow; + toImpl(pageRef)->loadRequest(URL(URL(), toWTFString(URLRef)), shouldOpenExternalURLsPolicy); } void WKPageLoadURLWithUserData(WKPageRef pageRef, WKURLRef URLRef, WKTypeRef userDataRef) { - toImpl(pageRef)->loadURL(toWTFString(URLRef), toImpl(userDataRef)); + toImpl(pageRef)->loadRequest(URL(URL(), toWTFString(URLRef)), ShouldOpenExternalURLsPolicy::ShouldNotAllow, toImpl(userDataRef)); } void WKPageLoadURLRequest(WKPageRef pageRef, WKURLRequestRef urlRequestRef) { - toImpl(pageRef)->loadURLRequest(toImpl(urlRequestRef)); + toImpl(pageRef)->loadRequest(toImpl(urlRequestRef)->resourceRequest()); } void WKPageLoadURLRequestWithUserData(WKPageRef pageRef, WKURLRequestRef urlRequestRef, WKTypeRef userDataRef) { - toImpl(pageRef)->loadURLRequest(toImpl(urlRequestRef), toImpl(userDataRef)); + toImpl(pageRef)->loadRequest(toImpl(urlRequestRef)->resourceRequest(), ShouldOpenExternalURLsPolicy::ShouldNotAllow, toImpl(userDataRef)); } void WKPageLoadFile(WKPageRef pageRef, WKURLRef fileURL, WKURLRef resourceDirectoryURL) @@ -149,12 +239,23 @@ void WKPageStopLoading(WKPageRef pageRef) void WKPageReload(WKPageRef pageRef) { - toImpl(pageRef)->reload(false); + const bool reloadFromOrigin = false; + const bool contentBlockersEnabled = true; + toImpl(pageRef)->reload(reloadFromOrigin, contentBlockersEnabled); +} + +void WKPageReloadWithoutContentBlockers(WKPageRef pageRef) +{ + const bool reloadFromOrigin = false; + const bool contentBlockersEnabled = false; + toImpl(pageRef)->reload(reloadFromOrigin, contentBlockersEnabled); } void WKPageReloadFromOrigin(WKPageRef pageRef) { - toImpl(pageRef)->reload(true); + const bool reloadFromOrigin = true; + const bool contentBlockersEnabled = true; + toImpl(pageRef)->reload(reloadFromOrigin, contentBlockersEnabled); } bool WKPageTryClose(WKPageRef pageRef) @@ -179,7 +280,7 @@ void WKPageGoForward(WKPageRef pageRef) bool WKPageCanGoForward(WKPageRef pageRef) { - return toImpl(pageRef)->canGoForward(); + return toImpl(pageRef)->backForwardList().forwardItem(); } void WKPageGoBack(WKPageRef pageRef) @@ -189,7 +290,7 @@ void WKPageGoBack(WKPageRef pageRef) bool WKPageCanGoBack(WKPageRef pageRef) { - return toImpl(pageRef)->canGoBack(); + return toImpl(pageRef)->backForwardList().backItem(); } void WKPageGoToBackForwardListItem(WKPageRef pageRef, WKBackForwardListItemRef itemRef) @@ -204,7 +305,7 @@ void WKPageTryRestoreScrollPosition(WKPageRef pageRef) WKBackForwardListRef WKPageGetBackForwardList(WKPageRef pageRef) { - return toAPI(toImpl(pageRef)->backForwardList()); + return toAPI(&toImpl(pageRef)->backForwardList()); } bool WKPageWillHandleHorizontalScrollEvents(WKPageRef pageRef) @@ -214,7 +315,7 @@ bool WKPageWillHandleHorizontalScrollEvents(WKPageRef pageRef) WKStringRef WKPageCopyTitle(WKPageRef pageRef) { - return toCopiedAPI(toImpl(pageRef)->pageTitle()); + return toCopiedAPI(toImpl(pageRef)->pageLoadState().title()); } WKFrameRef WKPageGetMainFrame(WKPageRef pageRef) @@ -239,12 +340,7 @@ uint64_t WKPageGetRenderTreeSize(WKPageRef page) WKInspectorRef WKPageGetInspector(WKPageRef pageRef) { -#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR return toAPI(toImpl(pageRef)->inspector()); -#else - UNUSED_PARAM(pageRef); - return 0; -#endif } WKVibrationRef WKPageGetVibration(WKPageRef page) @@ -262,11 +358,6 @@ double WKPageGetEstimatedProgress(WKPageRef pageRef) return toImpl(pageRef)->estimatedProgress(); } -void WKPageSetMemoryCacheClientCallsEnabled(WKPageRef pageRef, bool memoryCacheClientCallsEnabled) -{ - toImpl(pageRef)->setMemoryCacheClientCallsEnabled(memoryCacheClientCallsEnabled); -} - WKStringRef WKPageCopyUserAgent(WKPageRef pageRef) { return toCopiedAPI(toImpl(pageRef)->userAgent()); @@ -292,6 +383,11 @@ void WKPageSetCustomUserAgent(WKPageRef pageRef, WKStringRef userAgentRef) toImpl(pageRef)->setCustomUserAgent(toWTFString(userAgentRef)); } +void WKPageSetUserContentExtensionsEnabled(WKPageRef pageRef, bool enabled) +{ + // FIXME: Remove this function once it is no longer used. +} + bool WKPageSupportsTextEncoding(WKPageRef pageRef) { return toImpl(pageRef)->supportsTextEncoding(); @@ -314,24 +410,55 @@ void WKPageTerminate(WKPageRef pageRef) WKStringRef WKPageGetSessionHistoryURLValueType() { - static WebString* sessionHistoryURLValueType = WebString::create("SessionHistoryURL").leakRef(); - return toAPI(sessionHistoryURLValueType); + static API::String& sessionHistoryURLValueType = API::String::create("SessionHistoryURL").leakRef(); + return toAPI(&sessionHistoryURLValueType); } WKStringRef WKPageGetSessionBackForwardListItemValueType() { - static WebString* sessionBackForwardListValueType = WebString::create("SessionBackForwardListItem").leakRef(); - return toAPI(sessionBackForwardListValueType); + static API::String& sessionBackForwardListValueType = API::String::create("SessionBackForwardListItem").leakRef(); + return toAPI(&sessionBackForwardListValueType); } -WKDataRef WKPageCopySessionState(WKPageRef pageRef, void *context, WKPageSessionStateFilterCallback filter) +WKTypeRef WKPageCopySessionState(WKPageRef pageRef, void* context, WKPageSessionStateFilterCallback filter) { - return toAPI(toImpl(pageRef)->sessionStateData(filter, context).leakRef()); + // FIXME: This is a hack to make sure we return a WKDataRef to maintain compatibility with older versions of Safari. + bool shouldReturnData = !(reinterpret_cast<uintptr_t>(context) & 1); + context = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(context) & ~1); + + auto sessionState = toImpl(pageRef)->sessionState([pageRef, context, filter](WebBackForwardListItem& item) { + if (filter) { + if (!filter(pageRef, WKPageGetSessionBackForwardListItemValueType(), toAPI(&item), context)) + return false; + + if (!filter(pageRef, WKPageGetSessionHistoryURLValueType(), toURLRef(item.originalURL().impl()), context)) + return false; + } + + return true; + }); + + if (shouldReturnData) + return toAPI(encodeLegacySessionState(sessionState).release().leakRef()); + + return toAPI(&API::SessionState::create(WTFMove(sessionState)).leakRef()); } -void WKPageRestoreFromSessionState(WKPageRef pageRef, WKDataRef sessionStateData) +void WKPageRestoreFromSessionState(WKPageRef pageRef, WKTypeRef sessionStateRef) { - toImpl(pageRef)->restoreFromSessionStateData(toImpl(sessionStateData)); + SessionState sessionState; + + // FIXME: This is for backwards compatibility with Safari. Remove it once Safari no longer depends on it. + if (toImpl(sessionStateRef)->type() == API::Object::Type::Data) { + if (!decodeLegacySessionState(toImpl(static_cast<WKDataRef>(sessionStateRef))->bytes(), toImpl(static_cast<WKDataRef>(sessionStateRef))->size(), sessionState)) + return; + } else { + ASSERT(toImpl(sessionStateRef)->type() == API::Object::Type::SessionState); + + sessionState = toImpl(static_cast<WKSessionStateRef>(sessionStateRef))->sessionState(); + } + + toImpl(pageRef)->restoreFromSessionState(WTFMove(sessionState), true); } double WKPageGetTextZoomFactor(WKPageRef pageRef) @@ -409,11 +536,6 @@ void WKPageListenForLayoutMilestones(WKPageRef pageRef, WKLayoutMilestones miles toImpl(pageRef)->listenForLayoutMilestones(toLayoutMilestones(milestones)); } -void WKPageSetVisibilityState(WKPageRef pageRef, WKPageVisibilityState state, bool isInitialState) -{ - toImpl(pageRef)->setVisibilityState(toPageVisibilityState(state), isInitialState); -} - bool WKPageHasHorizontalScrollbar(WKPageRef pageRef) { return toImpl(pageRef)->hasHorizontalScrollbar(); @@ -454,15 +576,24 @@ bool WKPageIsPinnedToBottomSide(WKPageRef pageRef) return toImpl(pageRef)->isPinnedToBottomSide(); } +bool WKPageRubberBandsAtLeft(WKPageRef pageRef) +{ + return toImpl(pageRef)->rubberBandsAtLeft(); +} -bool WKPageRubberBandsAtBottom(WKPageRef pageRef) +void WKPageSetRubberBandsAtLeft(WKPageRef pageRef, bool rubberBandsAtLeft) { - return toImpl(pageRef)->rubberBandsAtBottom(); + toImpl(pageRef)->setRubberBandsAtLeft(rubberBandsAtLeft); } -void WKPageSetRubberBandsAtBottom(WKPageRef pageRef, bool rubberBandsAtBottom) +bool WKPageRubberBandsAtRight(WKPageRef pageRef) { - toImpl(pageRef)->setRubberBandsAtBottom(rubberBandsAtBottom); + return toImpl(pageRef)->rubberBandsAtRight(); +} + +void WKPageSetRubberBandsAtRight(WKPageRef pageRef, bool rubberBandsAtRight) +{ + toImpl(pageRef)->setRubberBandsAtRight(rubberBandsAtRight); } bool WKPageRubberBandsAtTop(WKPageRef pageRef) @@ -475,6 +606,46 @@ void WKPageSetRubberBandsAtTop(WKPageRef pageRef, bool rubberBandsAtTop) toImpl(pageRef)->setRubberBandsAtTop(rubberBandsAtTop); } +bool WKPageRubberBandsAtBottom(WKPageRef pageRef) +{ + return toImpl(pageRef)->rubberBandsAtBottom(); +} + +void WKPageSetRubberBandsAtBottom(WKPageRef pageRef, bool rubberBandsAtBottom) +{ + toImpl(pageRef)->setRubberBandsAtBottom(rubberBandsAtBottom); +} + +bool WKPageVerticalRubberBandingIsEnabled(WKPageRef pageRef) +{ + return toImpl(pageRef)->verticalRubberBandingIsEnabled(); +} + +void WKPageSetEnableVerticalRubberBanding(WKPageRef pageRef, bool enableVerticalRubberBanding) +{ + toImpl(pageRef)->setEnableVerticalRubberBanding(enableVerticalRubberBanding); +} + +bool WKPageHorizontalRubberBandingIsEnabled(WKPageRef pageRef) +{ + return toImpl(pageRef)->horizontalRubberBandingIsEnabled(); +} + +void WKPageSetEnableHorizontalRubberBanding(WKPageRef pageRef, bool enableHorizontalRubberBanding) +{ + toImpl(pageRef)->setEnableHorizontalRubberBanding(enableHorizontalRubberBanding); +} + +void WKPageSetBackgroundExtendsBeyondPage(WKPageRef pageRef, bool backgroundExtendsBeyondPage) +{ + toImpl(pageRef)->setBackgroundExtendsBeyondPage(backgroundExtendsBeyondPage); +} + +bool WKPageBackgroundExtendsBeyondPage(WKPageRef pageRef) +{ + return toImpl(pageRef)->backgroundExtendsBeyondPage(); +} + void WKPageSetPaginationMode(WKPageRef pageRef, WKPaginationMode paginationMode) { Pagination::Mode mode; @@ -549,6 +720,16 @@ double WKPageGetGapBetweenPages(WKPageRef pageRef) return toImpl(pageRef)->gapBetweenPages(); } +void WKPageSetPaginationLineGridEnabled(WKPageRef pageRef, bool lineGridEnabled) +{ + toImpl(pageRef)->setPaginationLineGridEnabled(lineGridEnabled); +} + +bool WKPageGetPaginationLineGridEnabled(WKPageRef pageRef) +{ + return toImpl(pageRef)->paginationLineGridEnabled(); +} + unsigned WKPageGetPageCount(WKPageRef pageRef) { return toImpl(pageRef)->pageCount(); @@ -609,131 +790,1652 @@ void WKPageCountStringMatches(WKPageRef pageRef, WKStringRef string, WKFindOptio toImpl(pageRef)->countStringMatches(toImpl(string)->string(), toFindOptions(options), maxMatchCount); } -void WKPageSetPageContextMenuClient(WKPageRef pageRef, const WKPageContextMenuClient* wkClient) +void WKPageSetPageContextMenuClient(WKPageRef pageRef, const WKPageContextMenuClientBase* wkClient) { #if ENABLE(CONTEXT_MENUS) - toImpl(pageRef)->initializeContextMenuClient(wkClient); + class ContextMenuClient final : public API::Client<WKPageContextMenuClientBase>, public API::ContextMenuClient { + public: + explicit ContextMenuClient(const WKPageContextMenuClientBase* client) + { + initialize(client); + } + + private: + virtual bool getContextMenuFromProposedMenu(WebPageProxy& page, const Vector<RefPtr<WebKit::WebContextMenuItem>>& proposedMenuVector, Vector<RefPtr<WebKit::WebContextMenuItem>>& customMenu, const WebHitTestResultData& hitTestResultData, API::Object* userData) override + { + if (!m_client.getContextMenuFromProposedMenu && !m_client.getContextMenuFromProposedMenu_deprecatedForUseWithV0) + return false; + + if (m_client.base.version >= 2 && !m_client.getContextMenuFromProposedMenu) + return false; + + Vector<RefPtr<API::Object>> proposedMenuItems; + proposedMenuItems.reserveInitialCapacity(proposedMenuVector.size()); + + for (const auto& menuItem : proposedMenuVector) + proposedMenuItems.uncheckedAppend(menuItem); + + WKArrayRef newMenu = nullptr; + if (m_client.base.version >= 2) { + RefPtr<API::HitTestResult> webHitTestResult = API::HitTestResult::create(hitTestResultData); + m_client.getContextMenuFromProposedMenu(toAPI(&page), toAPI(API::Array::create(WTFMove(proposedMenuItems)).ptr()), &newMenu, toAPI(webHitTestResult.get()), toAPI(userData), m_client.base.clientInfo); + } else + m_client.getContextMenuFromProposedMenu_deprecatedForUseWithV0(toAPI(&page), toAPI(API::Array::create(WTFMove(proposedMenuItems)).ptr()), &newMenu, toAPI(userData), m_client.base.clientInfo); + + RefPtr<API::Array> array = adoptRef(toImpl(newMenu)); + + customMenu.clear(); + + size_t newSize = array ? array->size() : 0; + for (size_t i = 0; i < newSize; ++i) { + WebContextMenuItem* item = array->at<WebContextMenuItem>(i); + if (!item) { + LOG(ContextMenu, "New menu entry at index %i is not a WebContextMenuItem", (int)i); + continue; + } + + customMenu.append(item); + } + + return true; + } + + virtual void customContextMenuItemSelected(WebPageProxy& page, const WebContextMenuItemData& itemData) override + { + if (!m_client.customContextMenuItemSelected) + return; + + m_client.customContextMenuItemSelected(toAPI(&page), toAPI(WebContextMenuItem::create(itemData).ptr()), m_client.base.clientInfo); + } + + virtual bool showContextMenu(WebPageProxy& page, const WebCore::IntPoint& menuLocation, const Vector<RefPtr<WebContextMenuItem>>& menuItemsVector) override + { + if (!m_client.showContextMenu) + return false; + + Vector<RefPtr<API::Object>> menuItems; + menuItems.reserveInitialCapacity(menuItemsVector.size()); + + for (const auto& menuItem : menuItemsVector) + menuItems.uncheckedAppend(menuItem); + + m_client.showContextMenu(toAPI(&page), toAPI(menuLocation), toAPI(API::Array::create(WTFMove(menuItems)).ptr()), m_client.base.clientInfo); + + return true; + } + + virtual bool hideContextMenu(WebPageProxy& page) override + { + if (!m_client.hideContextMenu) + return false; + + m_client.hideContextMenu(toAPI(&page), m_client.base.clientInfo); + + return true; + } + }; + + toImpl(pageRef)->setContextMenuClient(std::make_unique<ContextMenuClient>(wkClient)); +#else + UNUSED_PARAM(pageRef); + UNUSED_PARAM(wkClient); #endif } -void WKPageSetPageFindClient(WKPageRef pageRef, const WKPageFindClient* wkClient) +void WKPageSetPageDiagnosticLoggingClient(WKPageRef pageRef, const WKPageDiagnosticLoggingClientBase* wkClient) { - toImpl(pageRef)->initializeFindClient(wkClient); + toImpl(pageRef)->setDiagnosticLoggingClient(std::make_unique<WebPageDiagnosticLoggingClient>(wkClient)); } -void WKPageSetPageFindMatchesClient(WKPageRef pageRef, const WKPageFindMatchesClient* wkClient) +void WKPageSetPageFindClient(WKPageRef pageRef, const WKPageFindClientBase* wkClient) { - toImpl(pageRef)->initializeFindMatchesClient(wkClient); + class FindClient : public API::Client<WKPageFindClientBase>, public API::FindClient { + public: + explicit FindClient(const WKPageFindClientBase* client) + { + initialize(client); + } + + private: + virtual void didFindString(WebPageProxy* page, const String& string, const Vector<WebCore::IntRect>&, uint32_t matchCount, int32_t) override + { + if (!m_client.didFindString) + return; + + m_client.didFindString(toAPI(page), toAPI(string.impl()), matchCount, m_client.base.clientInfo); + } + + virtual void didFailToFindString(WebPageProxy* page, const String& string) override + { + if (!m_client.didFailToFindString) + return; + + m_client.didFailToFindString(toAPI(page), toAPI(string.impl()), m_client.base.clientInfo); + } + + virtual void didCountStringMatches(WebPageProxy* page, const String& string, uint32_t matchCount) override + { + if (!m_client.didCountStringMatches) + return; + + m_client.didCountStringMatches(toAPI(page), toAPI(string.impl()), matchCount, m_client.base.clientInfo); + } + }; + + toImpl(pageRef)->setFindClient(std::make_unique<FindClient>(wkClient)); } -void WKPageSetPageFormClient(WKPageRef pageRef, const WKPageFormClient* wkClient) +void WKPageSetPageFindMatchesClient(WKPageRef pageRef, const WKPageFindMatchesClientBase* wkClient) { - toImpl(pageRef)->initializeFormClient(wkClient); + class FindMatchesClient : public API::Client<WKPageFindMatchesClientBase>, public API::FindMatchesClient { + public: + explicit FindMatchesClient(const WKPageFindMatchesClientBase* client) + { + initialize(client); + } + + private: + virtual void didFindStringMatches(WebPageProxy* page, const String& string, const Vector<Vector<WebCore::IntRect>>& matchRects, int32_t index) override + { + if (!m_client.didFindStringMatches) + return; + + Vector<RefPtr<API::Object>> matches; + matches.reserveInitialCapacity(matchRects.size()); + + for (const auto& rects : matchRects) { + Vector<RefPtr<API::Object>> apiRects; + apiRects.reserveInitialCapacity(rects.size()); + + for (const auto& rect : rects) + apiRects.uncheckedAppend(API::Rect::create(toAPI(rect))); + + matches.uncheckedAppend(API::Array::create(WTFMove(apiRects))); + } + + m_client.didFindStringMatches(toAPI(page), toAPI(string.impl()), toAPI(API::Array::create(WTFMove(matches)).ptr()), index, m_client.base.clientInfo); + } + + virtual void didGetImageForMatchResult(WebPageProxy* page, WebImage* image, int32_t index) override + { + if (!m_client.didGetImageForMatchResult) + return; + + m_client.didGetImageForMatchResult(toAPI(page), toAPI(image), index, m_client.base.clientInfo); + } + }; + + toImpl(pageRef)->setFindMatchesClient(std::make_unique<FindMatchesClient>(wkClient)); } -void WKPageSetPageLoaderClient(WKPageRef pageRef, const WKPageLoaderClient* wkClient) +void WKPageSetPageInjectedBundleClient(WKPageRef pageRef, const WKPageInjectedBundleClientBase* wkClient) { - toImpl(pageRef)->initializeLoaderClient(wkClient); + toImpl(pageRef)->setInjectedBundleClient(wkClient); } -void WKPageSetPagePolicyClient(WKPageRef pageRef, const WKPagePolicyClient* wkClient) +void WKPageSetPageFormClient(WKPageRef pageRef, const WKPageFormClientBase* wkClient) { - toImpl(pageRef)->initializePolicyClient(wkClient); + toImpl(pageRef)->setFormClient(std::make_unique<WebFormClient>(wkClient)); } -void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClient* wkClient) +void WKPageSetPageLoaderClient(WKPageRef pageRef, const WKPageLoaderClientBase* wkClient) { - toImpl(pageRef)->initializeUIClient(wkClient); + class LoaderClient : public API::Client<WKPageLoaderClientBase>, public API::LoaderClient { + public: + explicit LoaderClient(const WKPageLoaderClientBase* client) + { + initialize(client); + } + + private: + virtual void didStartProvisionalLoadForFrame(WebPageProxy& page, WebFrameProxy& frame, API::Navigation*, API::Object* userData) override + { + if (!m_client.didStartProvisionalLoadForFrame) + return; + + m_client.didStartProvisionalLoadForFrame(toAPI(&page), toAPI(&frame), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didReceiveServerRedirectForProvisionalLoadForFrame(WebPageProxy& page, WebFrameProxy& frame, API::Navigation*, API::Object* userData) override + { + if (!m_client.didReceiveServerRedirectForProvisionalLoadForFrame) + return; + + m_client.didReceiveServerRedirectForProvisionalLoadForFrame(toAPI(&page), toAPI(&frame), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didFailProvisionalLoadWithErrorForFrame(WebPageProxy& page, WebFrameProxy& frame, API::Navigation*, const ResourceError& error, API::Object* userData) override + { + if (!m_client.didFailProvisionalLoadWithErrorForFrame) + return; + + m_client.didFailProvisionalLoadWithErrorForFrame(toAPI(&page), toAPI(&frame), toAPI(error), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didCommitLoadForFrame(WebPageProxy& page, WebFrameProxy& frame, API::Navigation*, API::Object* userData) override + { + if (!m_client.didCommitLoadForFrame) + return; + + m_client.didCommitLoadForFrame(toAPI(&page), toAPI(&frame), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didFinishDocumentLoadForFrame(WebPageProxy& page, WebFrameProxy& frame, API::Navigation*, API::Object* userData) override + { + if (!m_client.didFinishDocumentLoadForFrame) + return; + + m_client.didFinishDocumentLoadForFrame(toAPI(&page), toAPI(&frame), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didFinishLoadForFrame(WebPageProxy& page, WebFrameProxy& frame, API::Navigation*, API::Object* userData) override + { + if (!m_client.didFinishLoadForFrame) + return; + + m_client.didFinishLoadForFrame(toAPI(&page), toAPI(&frame), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didFailLoadWithErrorForFrame(WebPageProxy& page, WebFrameProxy& frame, API::Navigation*, const ResourceError& error, API::Object* userData) override + { + if (!m_client.didFailLoadWithErrorForFrame) + return; + + m_client.didFailLoadWithErrorForFrame(toAPI(&page), toAPI(&frame), toAPI(error), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didSameDocumentNavigationForFrame(WebPageProxy& page, WebFrameProxy& frame, API::Navigation*, SameDocumentNavigationType type, API::Object* userData) override + { + if (!m_client.didSameDocumentNavigationForFrame) + return; + + m_client.didSameDocumentNavigationForFrame(toAPI(&page), toAPI(&frame), toAPI(type), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didReceiveTitleForFrame(WebPageProxy& page, const String& title, WebFrameProxy& frame, API::Object* userData) override + { + if (!m_client.didReceiveTitleForFrame) + return; + + m_client.didReceiveTitleForFrame(toAPI(&page), toAPI(title.impl()), toAPI(&frame), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didFirstLayoutForFrame(WebPageProxy& page, WebFrameProxy& frame, API::Object* userData) override + { + if (!m_client.didFirstLayoutForFrame) + return; + + m_client.didFirstLayoutForFrame(toAPI(&page), toAPI(&frame), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didFirstVisuallyNonEmptyLayoutForFrame(WebPageProxy& page, WebFrameProxy& frame, API::Object* userData) override + { + if (!m_client.didFirstVisuallyNonEmptyLayoutForFrame) + return; + + m_client.didFirstVisuallyNonEmptyLayoutForFrame(toAPI(&page), toAPI(&frame), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didLayout(WebPageProxy& page, LayoutMilestones milestones) override + { + if (!m_client.didLayout) + return; + + m_client.didLayout(toAPI(&page), toWKLayoutMilestones(milestones), nullptr, m_client.base.clientInfo); + } + + virtual void didDisplayInsecureContentForFrame(WebPageProxy& page, WebFrameProxy& frame, API::Object* userData) override + { + if (!m_client.didDisplayInsecureContentForFrame) + return; + + m_client.didDisplayInsecureContentForFrame(toAPI(&page), toAPI(&frame), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didRunInsecureContentForFrame(WebPageProxy& page, WebFrameProxy& frame, API::Object* userData) override + { + if (!m_client.didRunInsecureContentForFrame) + return; + + m_client.didRunInsecureContentForFrame(toAPI(&page), toAPI(&frame), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didDetectXSSForFrame(WebPageProxy& page, WebFrameProxy& frame, API::Object* userData) override + { + if (!m_client.didDetectXSSForFrame) + return; + + m_client.didDetectXSSForFrame(toAPI(&page), toAPI(&frame), toAPI(userData), m_client.base.clientInfo); + } + + virtual bool canAuthenticateAgainstProtectionSpaceInFrame(WebPageProxy& page, WebFrameProxy& frame, WebProtectionSpace* protectionSpace) override + { + if (!m_client.canAuthenticateAgainstProtectionSpaceInFrame) + return false; + + return m_client.canAuthenticateAgainstProtectionSpaceInFrame(toAPI(&page), toAPI(&frame), toAPI(protectionSpace), m_client.base.clientInfo); + } + + virtual void didReceiveAuthenticationChallengeInFrame(WebPageProxy& page, WebFrameProxy& frame, AuthenticationChallengeProxy* authenticationChallenge) override + { + if (!m_client.didReceiveAuthenticationChallengeInFrame) + return; + + m_client.didReceiveAuthenticationChallengeInFrame(toAPI(&page), toAPI(&frame), toAPI(authenticationChallenge), m_client.base.clientInfo); + } + + virtual void didStartProgress(WebPageProxy& page) override + { + if (!m_client.didStartProgress) + return; + + m_client.didStartProgress(toAPI(&page), m_client.base.clientInfo); + } + + virtual void didChangeProgress(WebPageProxy& page) override + { + if (!m_client.didChangeProgress) + return; + + m_client.didChangeProgress(toAPI(&page), m_client.base.clientInfo); + } + + virtual void didFinishProgress(WebPageProxy& page) override + { + if (!m_client.didFinishProgress) + return; + + m_client.didFinishProgress(toAPI(&page), m_client.base.clientInfo); + } + + virtual void processDidBecomeUnresponsive(WebPageProxy& page) override + { + if (!m_client.processDidBecomeUnresponsive) + return; + + m_client.processDidBecomeUnresponsive(toAPI(&page), m_client.base.clientInfo); + } + + virtual void processDidBecomeResponsive(WebPageProxy& page) override + { + if (!m_client.processDidBecomeResponsive) + return; + + m_client.processDidBecomeResponsive(toAPI(&page), m_client.base.clientInfo); + } + + virtual void processDidCrash(WebPageProxy& page) override + { + if (!m_client.processDidCrash) + return; + + m_client.processDidCrash(toAPI(&page), m_client.base.clientInfo); + } + + virtual void didChangeBackForwardList(WebPageProxy& page, WebBackForwardListItem* addedItem, Vector<RefPtr<WebBackForwardListItem>> removedItems) override + { + if (!m_client.didChangeBackForwardList) + return; + + RefPtr<API::Array> removedItemsArray; + if (!removedItems.isEmpty()) { + Vector<RefPtr<API::Object>> removedItemsVector; + removedItemsVector.reserveInitialCapacity(removedItems.size()); + for (auto& removedItem : removedItems) + removedItemsVector.append(WTFMove(removedItem)); + + removedItemsArray = API::Array::create(WTFMove(removedItemsVector)); + } + + m_client.didChangeBackForwardList(toAPI(&page), toAPI(addedItem), toAPI(removedItemsArray.get()), m_client.base.clientInfo); + } + + virtual bool shouldKeepCurrentBackForwardListItemInList(WebKit::WebPageProxy& page, WebKit::WebBackForwardListItem* item) override + { + if (!m_client.shouldKeepCurrentBackForwardListItemInList) + return true; + + return m_client.shouldKeepCurrentBackForwardListItemInList(toAPI(&page), toAPI(item), m_client.base.clientInfo); + } + + virtual void willGoToBackForwardListItem(WebPageProxy& page, WebBackForwardListItem* item, API::Object* userData) override + { + if (m_client.willGoToBackForwardListItem) + m_client.willGoToBackForwardListItem(toAPI(&page), toAPI(item), toAPI(userData), m_client.base.clientInfo); + } + + virtual RefPtr<API::Data> webCryptoMasterKey(WebPageProxy& page) override + { + return page.process().processPool().client().copyWebCryptoMasterKey(&page.process().processPool()); + } + + virtual void navigationGestureDidBegin(WebPageProxy& page) override + { + if (m_client.navigationGestureDidBegin) + m_client.navigationGestureDidBegin(toAPI(&page), m_client.base.clientInfo); + } + + virtual void navigationGestureWillEnd(WebPageProxy& page, bool willNavigate, WebBackForwardListItem& item) override + { + if (m_client.navigationGestureWillEnd) + m_client.navigationGestureWillEnd(toAPI(&page), willNavigate, toAPI(&item), m_client.base.clientInfo); + } + + virtual void navigationGestureDidEnd(WebPageProxy& page, bool willNavigate, WebBackForwardListItem& item) override + { + if (m_client.navigationGestureDidEnd) + m_client.navigationGestureDidEnd(toAPI(&page), willNavigate, toAPI(&item), m_client.base.clientInfo); + } + +#if ENABLE(NETSCAPE_PLUGIN_API) + virtual void didFailToInitializePlugin(WebPageProxy& page, API::Dictionary* pluginInformation) override + { + if (m_client.didFailToInitializePlugin_deprecatedForUseWithV0) + m_client.didFailToInitializePlugin_deprecatedForUseWithV0(toAPI(&page), toAPI(pluginInformation->get<API::String>(pluginInformationMIMETypeKey())), m_client.base.clientInfo); + + if (m_client.pluginDidFail_deprecatedForUseWithV1) + m_client.pluginDidFail_deprecatedForUseWithV1(toAPI(&page), kWKErrorCodeCannotLoadPlugIn, toAPI(pluginInformation->get<API::String>(pluginInformationMIMETypeKey())), 0, 0, m_client.base.clientInfo); + + if (m_client.pluginDidFail) + m_client.pluginDidFail(toAPI(&page), kWKErrorCodeCannotLoadPlugIn, toAPI(pluginInformation), m_client.base.clientInfo); + } + + virtual void didBlockInsecurePluginVersion(WebPageProxy& page, API::Dictionary* pluginInformation) override + { + if (m_client.pluginDidFail_deprecatedForUseWithV1) + m_client.pluginDidFail_deprecatedForUseWithV1(toAPI(&page), kWKErrorCodeInsecurePlugInVersion, toAPI(pluginInformation->get<API::String>(pluginInformationMIMETypeKey())), toAPI(pluginInformation->get<API::String>(pluginInformationBundleIdentifierKey())), toAPI(pluginInformation->get<API::String>(pluginInformationBundleVersionKey())), m_client.base.clientInfo); + + if (m_client.pluginDidFail) + m_client.pluginDidFail(toAPI(&page), kWKErrorCodeInsecurePlugInVersion, toAPI(pluginInformation), m_client.base.clientInfo); + } + + virtual PluginModuleLoadPolicy pluginLoadPolicy(WebPageProxy& page, PluginModuleLoadPolicy currentPluginLoadPolicy, API::Dictionary* pluginInformation, String& unavailabilityDescription) override + { + WKStringRef unavailabilityDescriptionOut = 0; + PluginModuleLoadPolicy loadPolicy = currentPluginLoadPolicy; + + if (m_client.pluginLoadPolicy_deprecatedForUseWithV2) + loadPolicy = toPluginModuleLoadPolicy(m_client.pluginLoadPolicy_deprecatedForUseWithV2(toAPI(&page), toWKPluginLoadPolicy(currentPluginLoadPolicy), toAPI(pluginInformation), m_client.base.clientInfo)); + else if (m_client.pluginLoadPolicy) + loadPolicy = toPluginModuleLoadPolicy(m_client.pluginLoadPolicy(toAPI(&page), toWKPluginLoadPolicy(currentPluginLoadPolicy), toAPI(pluginInformation), &unavailabilityDescriptionOut, m_client.base.clientInfo)); + + if (unavailabilityDescriptionOut) { + RefPtr<API::String> webUnavailabilityDescription = adoptRef(toImpl(unavailabilityDescriptionOut)); + unavailabilityDescription = webUnavailabilityDescription->string(); + } + + return loadPolicy; + } +#endif // ENABLE(NETSCAPE_PLUGIN_API) + +#if ENABLE(WEBGL) + virtual WebCore::WebGLLoadPolicy webGLLoadPolicy(WebPageProxy& page, const String& url) const override + { + WebCore::WebGLLoadPolicy loadPolicy = WebGLAllowCreation; + + if (m_client.webGLLoadPolicy) + loadPolicy = toWebGLLoadPolicy(m_client.webGLLoadPolicy(toAPI(&page), toAPI(url.impl()), m_client.base.clientInfo)); + + return loadPolicy; + } + + virtual WebCore::WebGLLoadPolicy resolveWebGLLoadPolicy(WebPageProxy& page, const String& url) const override + { + WebCore::WebGLLoadPolicy loadPolicy = WebGLAllowCreation; + + if (m_client.resolveWebGLLoadPolicy) + loadPolicy = toWebGLLoadPolicy(m_client.resolveWebGLLoadPolicy(toAPI(&page), toAPI(url.impl()), m_client.base.clientInfo)); + + return loadPolicy; + } + +#endif // ENABLE(WEBGL) + }; + + WebPageProxy* webPageProxy = toImpl(pageRef); + + auto loaderClient = std::make_unique<LoaderClient>(wkClient); + + // It would be nice to get rid of this code and transition all clients to using didLayout instead of + // didFirstLayoutInFrame and didFirstVisuallyNonEmptyLayoutInFrame. In the meantime, this is required + // for backwards compatibility. + WebCore::LayoutMilestones milestones = 0; + if (loaderClient->client().didFirstLayoutForFrame) + milestones |= WebCore::DidFirstLayout; + if (loaderClient->client().didFirstVisuallyNonEmptyLayoutForFrame) + milestones |= WebCore::DidFirstVisuallyNonEmptyLayout; + + if (milestones) + webPageProxy->process().send(Messages::WebPage::ListenForLayoutMilestones(milestones), webPageProxy->pageID()); + + webPageProxy->setLoaderClient(WTFMove(loaderClient)); +} + +void WKPageSetPagePolicyClient(WKPageRef pageRef, const WKPagePolicyClientBase* wkClient) +{ + class PolicyClient : public API::Client<WKPagePolicyClientBase>, public API::PolicyClient { + public: + explicit PolicyClient(const WKPagePolicyClientBase* client) + { + initialize(client); + } + + private: + virtual void decidePolicyForNavigationAction(WebPageProxy& page, WebFrameProxy* frame, const NavigationActionData& navigationActionData, WebFrameProxy* originatingFrame, const WebCore::ResourceRequest& originalResourceRequest, const WebCore::ResourceRequest& resourceRequest, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userData) override + { + if (!m_client.decidePolicyForNavigationAction_deprecatedForUseWithV0 && !m_client.decidePolicyForNavigationAction_deprecatedForUseWithV1 && !m_client.decidePolicyForNavigationAction) { + listener->use(); + return; + } + + Ref<API::URLRequest> originalRequest = API::URLRequest::create(originalResourceRequest); + Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest); + + if (m_client.decidePolicyForNavigationAction_deprecatedForUseWithV0) + m_client.decidePolicyForNavigationAction_deprecatedForUseWithV0(toAPI(&page), toAPI(frame), toAPI(navigationActionData.navigationType), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), toAPI(request.ptr()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo); + else if (m_client.decidePolicyForNavigationAction_deprecatedForUseWithV1) + m_client.decidePolicyForNavigationAction_deprecatedForUseWithV1(toAPI(&page), toAPI(frame), toAPI(navigationActionData.navigationType), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), toAPI(originatingFrame), toAPI(request.ptr()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo); + else + m_client.decidePolicyForNavigationAction(toAPI(&page), toAPI(frame), toAPI(navigationActionData.navigationType), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), toAPI(originatingFrame), toAPI(originalRequest.ptr()), toAPI(request.ptr()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo); + } + + virtual void decidePolicyForNewWindowAction(WebPageProxy& page, WebFrameProxy& frame, const NavigationActionData& navigationActionData, const ResourceRequest& resourceRequest, const String& frameName, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userData) override + { + if (!m_client.decidePolicyForNewWindowAction) { + listener->use(); + return; + } + + Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest); + + m_client.decidePolicyForNewWindowAction(toAPI(&page), toAPI(&frame), toAPI(navigationActionData.navigationType), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), toAPI(request.ptr()), toAPI(frameName.impl()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo); + } + + virtual void decidePolicyForResponse(WebPageProxy& page, WebFrameProxy& frame, const ResourceResponse& resourceResponse, const ResourceRequest& resourceRequest, bool canShowMIMEType, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userData) override + { + if (!m_client.decidePolicyForResponse_deprecatedForUseWithV0 && !m_client.decidePolicyForResponse) { + listener->use(); + return; + } + + Ref<API::URLResponse> response = API::URLResponse::create(resourceResponse); + Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest); + + if (m_client.decidePolicyForResponse_deprecatedForUseWithV0) + m_client.decidePolicyForResponse_deprecatedForUseWithV0(toAPI(&page), toAPI(&frame), toAPI(response.ptr()), toAPI(request.ptr()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo); + else + m_client.decidePolicyForResponse(toAPI(&page), toAPI(&frame), toAPI(response.ptr()), toAPI(request.ptr()), canShowMIMEType, toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo); + } + + virtual void unableToImplementPolicy(WebPageProxy& page, WebFrameProxy& frame, const ResourceError& error, API::Object* userData) override + { + if (!m_client.unableToImplementPolicy) + return; + + m_client.unableToImplementPolicy(toAPI(&page), toAPI(&frame), toAPI(error), toAPI(userData), m_client.base.clientInfo); + } + }; + + toImpl(pageRef)->setPolicyClient(std::make_unique<PolicyClient>(wkClient)); +} + +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000 +static void fixUpBotchedPageUIClient(WKPageRef pageRef, const WKPageUIClientBase& wkClient) +{ + struct BotchedWKPageUIClientV4 { + WKPageUIClientBase base; + + // Version 0. + WKPageCreateNewPageCallback_deprecatedForUseWithV0 createNewPage_deprecatedForUseWithV0; + WKPageUIClientCallback showPage; + WKPageUIClientCallback close; + WKPageTakeFocusCallback takeFocus; + WKPageFocusCallback focus; + WKPageUnfocusCallback unfocus; + WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert_deprecatedForUseWithV0; + WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm_deprecatedForUseWithV0; + WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt_deprecatedForUseWithV0; + WKPageSetStatusTextCallback setStatusText; + WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; + WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0 missingPluginButtonClicked_deprecatedForUseWithV0; + WKPageDidNotHandleKeyEventCallback didNotHandleKeyEvent; + WKPageDidNotHandleWheelEventCallback didNotHandleWheelEvent; + WKPageGetToolbarsAreVisibleCallback toolbarsAreVisible; + WKPageSetToolbarsAreVisibleCallback setToolbarsAreVisible; + WKPageGetMenuBarIsVisibleCallback menuBarIsVisible; + WKPageSetMenuBarIsVisibleCallback setMenuBarIsVisible; + WKPageGetStatusBarIsVisibleCallback statusBarIsVisible; + WKPageSetStatusBarIsVisibleCallback setStatusBarIsVisible; + WKPageGetIsResizableCallback isResizable; + WKPageSetIsResizableCallback setIsResizable; + WKPageGetWindowFrameCallback getWindowFrame; + WKPageSetWindowFrameCallback setWindowFrame; + WKPageRunBeforeUnloadConfirmPanelCallback_deprecatedForUseWithV6 runBeforeUnloadConfirmPanel; + WKPageUIClientCallback didDraw; + WKPageUIClientCallback pageDidScroll; + WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota; + WKPageRunOpenPanelCallback runOpenPanel; + WKPageDecidePolicyForGeolocationPermissionRequestCallback decidePolicyForGeolocationPermissionRequest; + WKPageHeaderHeightCallback headerHeight; + WKPageFooterHeightCallback footerHeight; + WKPageDrawHeaderCallback drawHeader; + WKPageDrawFooterCallback drawFooter; + WKPagePrintFrameCallback printFrame; + WKPageUIClientCallback runModal; + void* unused1; // Used to be didCompleteRubberBandForMainFrame + WKPageSaveDataToFileInDownloadsFolderCallback saveDataToFileInDownloadsFolder; + void* shouldInterruptJavaScript_unavailable; + + // Version 1. + WKPageCreateNewPageCallback_deprecatedForUseWithV1 createNewPage; + WKPageMouseDidMoveOverElementCallback mouseDidMoveOverElement; + WKPageDecidePolicyForNotificationPermissionRequestCallback decidePolicyForNotificationPermissionRequest; + WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1 unavailablePluginButtonClicked_deprecatedForUseWithV1; + + // Version 2. + WKPageShowColorPickerCallback showColorPicker; + WKPageHideColorPickerCallback hideColorPicker; + WKPageUnavailablePluginButtonClickedCallback unavailablePluginButtonClicked; + + // Version 3. + WKPagePinnedStateDidChangeCallback pinnedStateDidChange; + + // Version 4. + WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV5 runJavaScriptAlert; + WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV5 runJavaScriptConfirm; + WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV5 runJavaScriptPrompt; + }; + + const auto& botchedPageUIClient = reinterpret_cast<const BotchedWKPageUIClientV4&>(wkClient); + + WKPageUIClientV5 fixedPageUIClient = { + { 5, botchedPageUIClient.base.clientInfo }, + botchedPageUIClient.createNewPage_deprecatedForUseWithV0, + botchedPageUIClient.showPage, + botchedPageUIClient.close, + botchedPageUIClient.takeFocus, + botchedPageUIClient.focus, + botchedPageUIClient.unfocus, + botchedPageUIClient.runJavaScriptAlert_deprecatedForUseWithV0, + botchedPageUIClient.runJavaScriptConfirm_deprecatedForUseWithV0, + botchedPageUIClient.runJavaScriptPrompt_deprecatedForUseWithV0, + botchedPageUIClient.setStatusText, + botchedPageUIClient.mouseDidMoveOverElement_deprecatedForUseWithV0, + botchedPageUIClient.missingPluginButtonClicked_deprecatedForUseWithV0, + botchedPageUIClient.didNotHandleKeyEvent, + botchedPageUIClient.didNotHandleWheelEvent, + botchedPageUIClient.toolbarsAreVisible, + botchedPageUIClient.setToolbarsAreVisible, + botchedPageUIClient.menuBarIsVisible, + botchedPageUIClient.setMenuBarIsVisible, + botchedPageUIClient.statusBarIsVisible, + botchedPageUIClient.setStatusBarIsVisible, + botchedPageUIClient.isResizable, + botchedPageUIClient.setIsResizable, + botchedPageUIClient.getWindowFrame, + botchedPageUIClient.setWindowFrame, + botchedPageUIClient.runBeforeUnloadConfirmPanel, + botchedPageUIClient.didDraw, + botchedPageUIClient.pageDidScroll, + botchedPageUIClient.exceededDatabaseQuota, + botchedPageUIClient.runOpenPanel, + botchedPageUIClient.decidePolicyForGeolocationPermissionRequest, + botchedPageUIClient.headerHeight, + botchedPageUIClient.footerHeight, + botchedPageUIClient.drawHeader, + botchedPageUIClient.drawFooter, + botchedPageUIClient.printFrame, + botchedPageUIClient.runModal, + botchedPageUIClient.unused1, + botchedPageUIClient.saveDataToFileInDownloadsFolder, + botchedPageUIClient.shouldInterruptJavaScript_unavailable, + botchedPageUIClient.createNewPage, + botchedPageUIClient.mouseDidMoveOverElement, + botchedPageUIClient.decidePolicyForNotificationPermissionRequest, + botchedPageUIClient.unavailablePluginButtonClicked_deprecatedForUseWithV1, + botchedPageUIClient.showColorPicker, + botchedPageUIClient.hideColorPicker, + botchedPageUIClient.unavailablePluginButtonClicked, + botchedPageUIClient.pinnedStateDidChange, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + botchedPageUIClient.runJavaScriptAlert, + botchedPageUIClient.runJavaScriptConfirm, + botchedPageUIClient.runJavaScriptPrompt, + nullptr, + }; + + WKPageSetPageUIClient(pageRef, &fixedPageUIClient.base); } +#endif -void WKPageRunJavaScriptInMainFrame(WKPageRef pageRef, WKStringRef scriptRef, void* context, WKPageRunJavaScriptFunction callback) +namespace WebKit { + +class RunBeforeUnloadConfirmPanelResultListener : public API::ObjectImpl<API::Object::Type::RunBeforeUnloadConfirmPanelResultListener> { +public: + static PassRefPtr<RunBeforeUnloadConfirmPanelResultListener> create(std::function<void (bool)>&& completionHandler) + { + return adoptRef(new RunBeforeUnloadConfirmPanelResultListener(WTFMove(completionHandler))); + } + + virtual ~RunBeforeUnloadConfirmPanelResultListener() + { + } + + void call(bool result) + { + m_completionHandler(result); + } + +private: + explicit RunBeforeUnloadConfirmPanelResultListener(std::function<void (bool)>&& completionHandler) + : m_completionHandler(WTFMove(completionHandler)) + { + } + + std::function<void (bool)> m_completionHandler; +}; + +class RunJavaScriptAlertResultListener : public API::ObjectImpl<API::Object::Type::RunJavaScriptAlertResultListener> { +public: + static PassRefPtr<RunJavaScriptAlertResultListener> create(std::function<void ()>&& completionHandler) + { + return adoptRef(new RunJavaScriptAlertResultListener(WTFMove(completionHandler))); + } + + virtual ~RunJavaScriptAlertResultListener() + { + } + + void call() + { + m_completionHandler(); + } + +private: + explicit RunJavaScriptAlertResultListener(std::function<void ()>&& completionHandler) + : m_completionHandler(WTFMove(completionHandler)) + { + } + + std::function<void ()> m_completionHandler; +}; + +class RunJavaScriptConfirmResultListener : public API::ObjectImpl<API::Object::Type::RunJavaScriptConfirmResultListener> { +public: + static PassRefPtr<RunJavaScriptConfirmResultListener> create(std::function<void (bool)>&& completionHandler) + { + return adoptRef(new RunJavaScriptConfirmResultListener(WTFMove(completionHandler))); + } + + virtual ~RunJavaScriptConfirmResultListener() + { + } + + void call(bool result) + { + m_completionHandler(result); + } + +private: + explicit RunJavaScriptConfirmResultListener(std::function<void (bool)>&& completionHandler) + : m_completionHandler(WTFMove(completionHandler)) + { + } + + std::function<void (bool)> m_completionHandler; +}; + +class RunJavaScriptPromptResultListener : public API::ObjectImpl<API::Object::Type::RunJavaScriptPromptResultListener> { +public: + static PassRefPtr<RunJavaScriptPromptResultListener> create(std::function<void (const String&)>&& completionHandler) + { + return adoptRef(new RunJavaScriptPromptResultListener(WTFMove(completionHandler))); + } + + virtual ~RunJavaScriptPromptResultListener() + { + } + + void call(const String& result) + { + m_completionHandler(result); + } + +private: + explicit RunJavaScriptPromptResultListener(std::function<void (const String&)>&& completionHandler) + : m_completionHandler(WTFMove(completionHandler)) + { + } + + std::function<void (const String&)> m_completionHandler; +}; + +WK_ADD_API_MAPPING(WKPageRunBeforeUnloadConfirmPanelResultListenerRef, RunBeforeUnloadConfirmPanelResultListener) +WK_ADD_API_MAPPING(WKPageRunJavaScriptAlertResultListenerRef, RunJavaScriptAlertResultListener) +WK_ADD_API_MAPPING(WKPageRunJavaScriptConfirmResultListenerRef, RunJavaScriptConfirmResultListener) +WK_ADD_API_MAPPING(WKPageRunJavaScriptPromptResultListenerRef, RunJavaScriptPromptResultListener) + +} + +WKTypeID WKPageRunBeforeUnloadConfirmPanelResultListenerGetTypeID() { - toImpl(pageRef)->runJavaScriptInMainFrame(toImpl(scriptRef)->string(), ScriptValueCallback::create(context, callback)); + return toAPI(RunBeforeUnloadConfirmPanelResultListener::APIType); } -#ifdef __BLOCKS__ -static void callRunJavaScriptBlockAndRelease(WKSerializedScriptValueRef resultValue, WKErrorRef error, void* context) +void WKPageRunBeforeUnloadConfirmPanelResultListenerCall(WKPageRunBeforeUnloadConfirmPanelResultListenerRef listener, bool result) { - WKPageRunJavaScriptBlock block = (WKPageRunJavaScriptBlock)context; - block(resultValue, error); - Block_release(block); + toImpl(listener)->call(result); } -void WKPageRunJavaScriptInMainFrame_b(WKPageRef pageRef, WKStringRef scriptRef, WKPageRunJavaScriptBlock block) +WKTypeID WKPageRunJavaScriptAlertResultListenerGetTypeID() { - WKPageRunJavaScriptInMainFrame(pageRef, scriptRef, Block_copy(block), callRunJavaScriptBlockAndRelease); + return toAPI(RunJavaScriptAlertResultListener::APIType); } -#endif -void WKPageRenderTreeExternalRepresentation(WKPageRef pageRef, void* context, WKPageRenderTreeExternalRepresentationFunction callback) +void WKPageRunJavaScriptAlertResultListenerCall(WKPageRunJavaScriptAlertResultListenerRef listener) { - toImpl(pageRef)->getRenderTreeExternalRepresentation(StringCallback::create(context, callback)); + toImpl(listener)->call(); } -#ifdef __BLOCKS__ -static void callRenderTreeExternalRepresentationBlockAndDispose(WKStringRef resultValue, WKErrorRef error, void* context) +WKTypeID WKPageRunJavaScriptConfirmResultListenerGetTypeID() { - WKPageRenderTreeExternalRepresentationBlock block = (WKPageRenderTreeExternalRepresentationBlock)context; - block(resultValue, error); - Block_release(block); + return toAPI(RunJavaScriptConfirmResultListener::APIType); +} + +void WKPageRunJavaScriptConfirmResultListenerCall(WKPageRunJavaScriptConfirmResultListenerRef listener, bool result) +{ + toImpl(listener)->call(result); } -void WKPageRenderTreeExternalRepresentation_b(WKPageRef pageRef, WKPageRenderTreeExternalRepresentationBlock block) +WKTypeID WKPageRunJavaScriptPromptResultListenerGetTypeID() { - WKPageRenderTreeExternalRepresentation(pageRef, Block_copy(block), callRenderTreeExternalRepresentationBlockAndDispose); + return toAPI(RunJavaScriptPromptResultListener::APIType); } + +void WKPageRunJavaScriptPromptResultListenerCall(WKPageRunJavaScriptPromptResultListenerRef listener, WKStringRef result) +{ + toImpl(listener)->call(toWTFString(result)); +} + +void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClientBase* wkClient) +{ +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000 + if (wkClient && wkClient->version == 4) { + fixUpBotchedPageUIClient(pageRef, *wkClient); + return; + } #endif -void WKPageGetSourceForFrame(WKPageRef pageRef, WKFrameRef frameRef, void* context, WKPageGetSourceForFrameFunction callback) + class UIClient : public API::Client<WKPageUIClientBase>, public API::UIClient { + public: + explicit UIClient(const WKPageUIClientBase* client) + { + initialize(client); + } + + private: + virtual PassRefPtr<WebPageProxy> createNewPage(WebPageProxy* page, WebFrameProxy* initiatingFrame, const SecurityOriginData& securityOriginData, const ResourceRequest& resourceRequest, const WindowFeatures& windowFeatures, const NavigationActionData& navigationActionData) override + { + if (m_client.createNewPage) { + auto configuration = page->configuration().copy(); + configuration->setRelatedPage(page); + + auto sourceFrameInfo = API::FrameInfo::create(*initiatingFrame, securityOriginData.securityOrigin()); + + bool shouldOpenAppLinks = !hostsAreEqual(WebCore::URL(WebCore::ParsedURLString, initiatingFrame->url()), resourceRequest.url()); + auto apiNavigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.ptr(), nullptr, resourceRequest, WebCore::URL(), shouldOpenAppLinks); + + auto apiWindowFeatures = API::WindowFeatures::create(windowFeatures); + + return adoptRef(toImpl(m_client.createNewPage(toAPI(page), toAPI(configuration.ptr()), toAPI(apiNavigationAction.ptr()), toAPI(apiWindowFeatures.ptr()), m_client.base.clientInfo))); + } + + if (m_client.createNewPage_deprecatedForUseWithV1 || m_client.createNewPage_deprecatedForUseWithV0) { + API::Dictionary::MapType map; + if (windowFeatures.x) + map.set("x", API::Double::create(*windowFeatures.x)); + if (windowFeatures.y) + map.set("y", API::Double::create(*windowFeatures.y)); + if (windowFeatures.width) + map.set("width", API::Double::create(*windowFeatures.width)); + if (windowFeatures.height) + map.set("height", API::Double::create(*windowFeatures.height)); + map.set("menuBarVisible", API::Boolean::create(windowFeatures.menuBarVisible)); + map.set("statusBarVisible", API::Boolean::create(windowFeatures.statusBarVisible)); + map.set("toolBarVisible", API::Boolean::create(windowFeatures.toolBarVisible)); + map.set("locationBarVisible", API::Boolean::create(windowFeatures.locationBarVisible)); + map.set("scrollbarsVisible", API::Boolean::create(windowFeatures.scrollbarsVisible)); + map.set("resizable", API::Boolean::create(windowFeatures.resizable)); + map.set("fullscreen", API::Boolean::create(windowFeatures.fullscreen)); + map.set("dialog", API::Boolean::create(windowFeatures.dialog)); + Ref<API::Dictionary> featuresMap = API::Dictionary::create(WTFMove(map)); + + if (m_client.createNewPage_deprecatedForUseWithV1) { + Ref<API::URLRequest> request = API::URLRequest::create(resourceRequest); + return adoptRef(toImpl(m_client.createNewPage_deprecatedForUseWithV1(toAPI(page), toAPI(request.ptr()), toAPI(featuresMap.ptr()), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), m_client.base.clientInfo))); + } + + ASSERT(m_client.createNewPage_deprecatedForUseWithV0); + return adoptRef(toImpl(m_client.createNewPage_deprecatedForUseWithV0(toAPI(page), toAPI(featuresMap.ptr()), toAPI(navigationActionData.modifiers), toAPI(navigationActionData.mouseButton), m_client.base.clientInfo))); + } + + return nullptr; + } + + virtual void showPage(WebPageProxy* page) override + { + if (!m_client.showPage) + return; + + m_client.showPage(toAPI(page), m_client.base.clientInfo); + } + + virtual void close(WebPageProxy* page) override + { + if (!m_client.close) + return; + + m_client.close(toAPI(page), m_client.base.clientInfo); + } + + virtual void takeFocus(WebPageProxy* page, WKFocusDirection direction) override + { + if (!m_client.takeFocus) + return; + + m_client.takeFocus(toAPI(page), direction, m_client.base.clientInfo); + } + + virtual void focus(WebPageProxy* page) override + { + if (!m_client.focus) + return; + + m_client.focus(toAPI(page), m_client.base.clientInfo); + } + + virtual void unfocus(WebPageProxy* page) override + { + if (!m_client.unfocus) + return; + + m_client.unfocus(toAPI(page), m_client.base.clientInfo); + } + + virtual void runJavaScriptAlert(WebPageProxy* page, const String& message, WebFrameProxy* frame, const SecurityOriginData& securityOriginData, std::function<void ()> completionHandler) override + { + if (m_client.runJavaScriptAlert) { + RefPtr<RunJavaScriptAlertResultListener> listener = RunJavaScriptAlertResultListener::create(WTFMove(completionHandler)); + RefPtr<API::SecurityOrigin> securityOrigin = API::SecurityOrigin::create(securityOriginData.protocol, securityOriginData.host, securityOriginData.port); + m_client.runJavaScriptAlert(toAPI(page), toAPI(message.impl()), toAPI(frame), toAPI(securityOrigin.get()), toAPI(listener.get()), m_client.base.clientInfo); + return; + } + + if (m_client.runJavaScriptAlert_deprecatedForUseWithV5) { + RefPtr<API::SecurityOrigin> securityOrigin = API::SecurityOrigin::create(securityOriginData.protocol, securityOriginData.host, securityOriginData.port); + m_client.runJavaScriptAlert_deprecatedForUseWithV5(toAPI(page), toAPI(message.impl()), toAPI(frame), toAPI(securityOrigin.get()), m_client.base.clientInfo); + completionHandler(); + return; + } + + if (m_client.runJavaScriptAlert_deprecatedForUseWithV0) { + m_client.runJavaScriptAlert_deprecatedForUseWithV0(toAPI(page), toAPI(message.impl()), toAPI(frame), m_client.base.clientInfo); + completionHandler(); + return; + } + + + completionHandler(); + } + + virtual void runJavaScriptConfirm(WebPageProxy* page, const String& message, WebFrameProxy* frame, const SecurityOriginData& securityOriginData, std::function<void (bool)> completionHandler) override + { + if (m_client.runJavaScriptConfirm) { + RefPtr<RunJavaScriptConfirmResultListener> listener = RunJavaScriptConfirmResultListener::create(WTFMove(completionHandler)); + RefPtr<API::SecurityOrigin> securityOrigin = API::SecurityOrigin::create(securityOriginData.protocol, securityOriginData.host, securityOriginData.port); + m_client.runJavaScriptConfirm(toAPI(page), toAPI(message.impl()), toAPI(frame), toAPI(securityOrigin.get()), toAPI(listener.get()), m_client.base.clientInfo); + return; + } + + if (m_client.runJavaScriptConfirm_deprecatedForUseWithV5) { + RefPtr<API::SecurityOrigin> securityOrigin = API::SecurityOrigin::create(securityOriginData.protocol, securityOriginData.host, securityOriginData.port); + bool result = m_client.runJavaScriptConfirm_deprecatedForUseWithV5(toAPI(page), toAPI(message.impl()), toAPI(frame), toAPI(securityOrigin.get()), m_client.base.clientInfo); + + completionHandler(result); + return; + } + + if (m_client.runJavaScriptConfirm_deprecatedForUseWithV0) { + bool result = m_client.runJavaScriptConfirm_deprecatedForUseWithV0(toAPI(page), toAPI(message.impl()), toAPI(frame), m_client.base.clientInfo); + + completionHandler(result); + return; + } + + completionHandler(false); + } + + virtual void runJavaScriptPrompt(WebPageProxy* page, const String& message, const String& defaultValue, WebFrameProxy* frame, const SecurityOriginData& securityOriginData, std::function<void (const String&)> completionHandler) override + { + if (m_client.runJavaScriptPrompt) { + RefPtr<RunJavaScriptPromptResultListener> listener = RunJavaScriptPromptResultListener::create(WTFMove(completionHandler)); + RefPtr<API::SecurityOrigin> securityOrigin = API::SecurityOrigin::create(securityOriginData.protocol, securityOriginData.host, securityOriginData.port); + m_client.runJavaScriptPrompt(toAPI(page), toAPI(message.impl()), toAPI(defaultValue.impl()), toAPI(frame), toAPI(securityOrigin.get()), toAPI(listener.get()), m_client.base.clientInfo); + return; + } + + if (m_client.runJavaScriptPrompt_deprecatedForUseWithV5) { + RefPtr<API::SecurityOrigin> securityOrigin = API::SecurityOrigin::create(securityOriginData.protocol, securityOriginData.host, securityOriginData.port); + RefPtr<API::String> string = adoptRef(toImpl(m_client.runJavaScriptPrompt_deprecatedForUseWithV5(toAPI(page), toAPI(message.impl()), toAPI(defaultValue.impl()), toAPI(frame), toAPI(securityOrigin.get()), m_client.base.clientInfo))); + + if (string) + completionHandler(string->string()); + else + completionHandler(String()); + return; + } + + if (m_client.runJavaScriptPrompt_deprecatedForUseWithV0) { + RefPtr<API::String> string = adoptRef(toImpl(m_client.runJavaScriptPrompt_deprecatedForUseWithV0(toAPI(page), toAPI(message.impl()), toAPI(defaultValue.impl()), toAPI(frame), m_client.base.clientInfo))); + + if (string) + completionHandler(string->string()); + else + completionHandler(String()); + return; + } + + completionHandler(String()); + } + + virtual void setStatusText(WebPageProxy* page, const String& text) override + { + if (!m_client.setStatusText) + return; + + m_client.setStatusText(toAPI(page), toAPI(text.impl()), m_client.base.clientInfo); + } + + virtual void mouseDidMoveOverElement(WebPageProxy* page, const WebHitTestResultData& data, WebEvent::Modifiers modifiers, API::Object* userData) override + { + if (!m_client.mouseDidMoveOverElement && !m_client.mouseDidMoveOverElement_deprecatedForUseWithV0) + return; + + if (m_client.base.version > 0 && !m_client.mouseDidMoveOverElement) + return; + + if (!m_client.base.version) { + m_client.mouseDidMoveOverElement_deprecatedForUseWithV0(toAPI(page), toAPI(modifiers), toAPI(userData), m_client.base.clientInfo); + return; + } + + RefPtr<API::HitTestResult> webHitTestResult = API::HitTestResult::create(data); + m_client.mouseDidMoveOverElement(toAPI(page), toAPI(webHitTestResult.get()), toAPI(modifiers), toAPI(userData), m_client.base.clientInfo); + } + +#if ENABLE(NETSCAPE_PLUGIN_API) + virtual void unavailablePluginButtonClicked(WebPageProxy* page, WKPluginUnavailabilityReason pluginUnavailabilityReason, API::Dictionary* pluginInformation) override + { + if (pluginUnavailabilityReason == kWKPluginUnavailabilityReasonPluginMissing) { + if (m_client.missingPluginButtonClicked_deprecatedForUseWithV0) + m_client.missingPluginButtonClicked_deprecatedForUseWithV0( + toAPI(page), + toAPI(pluginInformation->get<API::String>(pluginInformationMIMETypeKey())), + toAPI(pluginInformation->get<API::String>(pluginInformationPluginURLKey())), + toAPI(pluginInformation->get<API::String>(pluginInformationPluginspageAttributeURLKey())), + m_client.base.clientInfo); + } + + if (m_client.unavailablePluginButtonClicked_deprecatedForUseWithV1) + m_client.unavailablePluginButtonClicked_deprecatedForUseWithV1( + toAPI(page), + pluginUnavailabilityReason, + toAPI(pluginInformation->get<API::String>(pluginInformationMIMETypeKey())), + toAPI(pluginInformation->get<API::String>(pluginInformationPluginURLKey())), + toAPI(pluginInformation->get<API::String>(pluginInformationPluginspageAttributeURLKey())), + m_client.base.clientInfo); + + if (m_client.unavailablePluginButtonClicked) + m_client.unavailablePluginButtonClicked( + toAPI(page), + pluginUnavailabilityReason, + toAPI(pluginInformation), + m_client.base.clientInfo); + } +#endif // ENABLE(NETSCAPE_PLUGIN_API) + + virtual bool implementsDidNotHandleKeyEvent() const override + { + return m_client.didNotHandleKeyEvent; + } + + virtual void didNotHandleKeyEvent(WebPageProxy* page, const NativeWebKeyboardEvent& event) override + { + if (!m_client.didNotHandleKeyEvent) + return; + m_client.didNotHandleKeyEvent(toAPI(page), event.nativeEvent(), m_client.base.clientInfo); + } + + virtual bool implementsDidNotHandleWheelEvent() const override + { + return m_client.didNotHandleWheelEvent; + } + + virtual void didNotHandleWheelEvent(WebPageProxy* page, const NativeWebWheelEvent& event) override + { + if (!m_client.didNotHandleWheelEvent) + return; + m_client.didNotHandleWheelEvent(toAPI(page), event.nativeEvent(), m_client.base.clientInfo); + } + + virtual bool toolbarsAreVisible(WebPageProxy* page) override + { + if (!m_client.toolbarsAreVisible) + return true; + return m_client.toolbarsAreVisible(toAPI(page), m_client.base.clientInfo); + } + + virtual void setToolbarsAreVisible(WebPageProxy* page, bool visible) override + { + if (!m_client.setToolbarsAreVisible) + return; + m_client.setToolbarsAreVisible(toAPI(page), visible, m_client.base.clientInfo); + } + + virtual bool menuBarIsVisible(WebPageProxy* page) override + { + if (!m_client.menuBarIsVisible) + return true; + return m_client.menuBarIsVisible(toAPI(page), m_client.base.clientInfo); + } + + virtual void setMenuBarIsVisible(WebPageProxy* page, bool visible) override + { + if (!m_client.setMenuBarIsVisible) + return; + m_client.setMenuBarIsVisible(toAPI(page), visible, m_client.base.clientInfo); + } + + virtual bool statusBarIsVisible(WebPageProxy* page) override + { + if (!m_client.statusBarIsVisible) + return true; + return m_client.statusBarIsVisible(toAPI(page), m_client.base.clientInfo); + } + + virtual void setStatusBarIsVisible(WebPageProxy* page, bool visible) override + { + if (!m_client.setStatusBarIsVisible) + return; + m_client.setStatusBarIsVisible(toAPI(page), visible, m_client.base.clientInfo); + } + + virtual bool isResizable(WebPageProxy* page) override + { + if (!m_client.isResizable) + return true; + return m_client.isResizable(toAPI(page), m_client.base.clientInfo); + } + + virtual void setIsResizable(WebPageProxy* page, bool resizable) override + { + if (!m_client.setIsResizable) + return; + m_client.setIsResizable(toAPI(page), resizable, m_client.base.clientInfo); + } + + virtual void setWindowFrame(WebPageProxy* page, const FloatRect& frame) override + { + if (!m_client.setWindowFrame) + return; + + m_client.setWindowFrame(toAPI(page), toAPI(frame), m_client.base.clientInfo); + } + + virtual FloatRect windowFrame(WebPageProxy* page) override + { + if (!m_client.getWindowFrame) + return FloatRect(); + + return toFloatRect(m_client.getWindowFrame(toAPI(page), m_client.base.clientInfo)); + } + + virtual bool canRunBeforeUnloadConfirmPanel() const override + { + return m_client.runBeforeUnloadConfirmPanel_deprecatedForUseWithV6 || m_client.runBeforeUnloadConfirmPanel; + } + + virtual void runBeforeUnloadConfirmPanel(WebKit::WebPageProxy* page, const WTF::String& message, WebKit::WebFrameProxy* frame, std::function<void (bool)> completionHandler) override + { + if (m_client.runBeforeUnloadConfirmPanel) { + RefPtr<RunBeforeUnloadConfirmPanelResultListener> listener = RunBeforeUnloadConfirmPanelResultListener::create(WTFMove(completionHandler)); + m_client.runBeforeUnloadConfirmPanel(toAPI(page), toAPI(message.impl()), toAPI(frame), toAPI(listener.get()), m_client.base.clientInfo); + return; + } + + if (m_client.runBeforeUnloadConfirmPanel_deprecatedForUseWithV6) { + bool result = m_client.runBeforeUnloadConfirmPanel_deprecatedForUseWithV6(toAPI(page), toAPI(message.impl()), toAPI(frame), m_client.base.clientInfo); + completionHandler(result); + return; + } + + completionHandler(true); + } + + virtual void pageDidScroll(WebPageProxy* page) override + { + if (!m_client.pageDidScroll) + return; + + m_client.pageDidScroll(toAPI(page), m_client.base.clientInfo); + } + + virtual void exceededDatabaseQuota(WebPageProxy* page, WebFrameProxy* frame, API::SecurityOrigin* origin, const String& databaseName, const String& databaseDisplayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage, std::function<void (unsigned long long)> completionHandler) override + { + if (!m_client.exceededDatabaseQuota) { + completionHandler(currentQuota); + return; + } + + completionHandler(m_client.exceededDatabaseQuota(toAPI(page), toAPI(frame), toAPI(origin), toAPI(databaseName.impl()), toAPI(databaseDisplayName.impl()), currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage, m_client.base.clientInfo)); + } + + virtual bool runOpenPanel(WebPageProxy* page, WebFrameProxy* frame, WebOpenPanelParameters* parameters, WebOpenPanelResultListenerProxy* listener) override + { + if (!m_client.runOpenPanel) + return false; + + m_client.runOpenPanel(toAPI(page), toAPI(frame), toAPI(parameters), toAPI(listener), m_client.base.clientInfo); + return true; + } + + virtual bool decidePolicyForGeolocationPermissionRequest(WebPageProxy* page, WebFrameProxy* frame, API::SecurityOrigin* origin, GeolocationPermissionRequestProxy* permissionRequest) override + { + if (!m_client.decidePolicyForGeolocationPermissionRequest) + return false; + + m_client.decidePolicyForGeolocationPermissionRequest(toAPI(page), toAPI(frame), toAPI(origin), toAPI(permissionRequest), m_client.base.clientInfo); + return true; + } + + virtual bool decidePolicyForUserMediaPermissionRequest(WebPageProxy& page, WebFrameProxy& frame, API::SecurityOrigin& origin, UserMediaPermissionRequestProxy& permissionRequest) override + { + if (!m_client.decidePolicyForUserMediaPermissionRequest) + return false; + + m_client.decidePolicyForUserMediaPermissionRequest(toAPI(&page), toAPI(&frame), toAPI(&origin), toAPI(&permissionRequest), m_client.base.clientInfo); + return true; + } + + virtual bool checkUserMediaPermissionForOrigin(WebPageProxy& page, WebFrameProxy& frame, API::SecurityOrigin& origin, UserMediaPermissionCheckProxy& request) override + { + if (!m_client.checkUserMediaPermissionForOrigin) + return false; + + m_client.checkUserMediaPermissionForOrigin(toAPI(&page), toAPI(&frame), toAPI(&origin), toAPI(&request), m_client.base.clientInfo); + return true; + } + + virtual bool decidePolicyForNotificationPermissionRequest(WebPageProxy* page, API::SecurityOrigin* origin, NotificationPermissionRequest* permissionRequest) override + { + if (!m_client.decidePolicyForNotificationPermissionRequest) + return false; + + m_client.decidePolicyForNotificationPermissionRequest(toAPI(page), toAPI(origin), toAPI(permissionRequest), m_client.base.clientInfo); + return true; + } + + // Printing. + virtual float headerHeight(WebPageProxy* page, WebFrameProxy* frame) override + { + if (!m_client.headerHeight) + return 0; + + return m_client.headerHeight(toAPI(page), toAPI(frame), m_client.base.clientInfo); + } + + virtual float footerHeight(WebPageProxy* page, WebFrameProxy* frame) override + { + if (!m_client.footerHeight) + return 0; + + return m_client.footerHeight(toAPI(page), toAPI(frame), m_client.base.clientInfo); + } + + virtual void drawHeader(WebPageProxy* page, WebFrameProxy* frame, const WebCore::FloatRect& rect) override + { + if (!m_client.drawHeader) + return; + + m_client.drawHeader(toAPI(page), toAPI(frame), toAPI(rect), m_client.base.clientInfo); + } + + virtual void drawFooter(WebPageProxy* page, WebFrameProxy* frame, const WebCore::FloatRect& rect) override + { + if (!m_client.drawFooter) + return; + + m_client.drawFooter(toAPI(page), toAPI(frame), toAPI(rect), m_client.base.clientInfo); + } + + virtual void printFrame(WebPageProxy* page, WebFrameProxy* frame) override + { + if (!m_client.printFrame) + return; + + m_client.printFrame(toAPI(page), toAPI(frame), m_client.base.clientInfo); + } + + virtual bool canRunModal() const override + { + return m_client.runModal; + } + + virtual void runModal(WebPageProxy* page) override + { + if (!m_client.runModal) + return; + + m_client.runModal(toAPI(page), m_client.base.clientInfo); + } + + virtual void saveDataToFileInDownloadsFolder(WebPageProxy* page, const String& suggestedFilename, const String& mimeType, const String& originatingURLString, API::Data* data) override + { + if (!m_client.saveDataToFileInDownloadsFolder) + return; + + m_client.saveDataToFileInDownloadsFolder(toAPI(page), toAPI(suggestedFilename.impl()), toAPI(mimeType.impl()), toURLRef(originatingURLString.impl()), toAPI(data), m_client.base.clientInfo); + } + + virtual void pinnedStateDidChange(WebPageProxy& page) override + { + if (!m_client.pinnedStateDidChange) + return; + + m_client.pinnedStateDidChange(toAPI(&page), m_client.base.clientInfo); + } + + virtual void isPlayingAudioDidChange(WebPageProxy& page) override + { + if (!m_client.isPlayingAudioDidChange) + return; + + m_client.isPlayingAudioDidChange(toAPI(&page), m_client.base.clientInfo); + } + + virtual void didClickAutoFillButton(WebPageProxy& page, API::Object* userInfo) override + { + if (!m_client.didClickAutoFillButton) + return; + + m_client.didClickAutoFillButton(toAPI(&page), toAPI(userInfo), m_client.base.clientInfo); + } + +#if ENABLE(MEDIA_SESSION) + virtual void mediaSessionMetadataDidChange(WebPageProxy& page, WebMediaSessionMetadata* metadata) override + { + if (!m_client.mediaSessionMetadataDidChange) + return; + + m_client.mediaSessionMetadataDidChange(toAPI(&page), toAPI(metadata), m_client.base.clientInfo); + } +#endif + }; + + toImpl(pageRef)->setUIClient(std::make_unique<UIClient>(wkClient)); +} + +void WKPageSetPageNavigationClient(WKPageRef pageRef, const WKPageNavigationClientBase* wkClient) +{ + class NavigationClient : public API::Client<WKPageNavigationClientBase>, public API::NavigationClient { + public: + explicit NavigationClient(const WKPageNavigationClientBase* client) + { + initialize(client); + } + + private: + virtual void decidePolicyForNavigationAction(WebPageProxy& page, API::NavigationAction& navigationAction, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, API::Object* userData) override + { + if (!m_client.decidePolicyForNavigationAction) + return; + m_client.decidePolicyForNavigationAction(toAPI(&page), toAPI(&navigationAction), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo); + } + + virtual void decidePolicyForNavigationResponse(WebPageProxy& page, API::NavigationResponse& navigationResponse, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, API::Object* userData) override + { + if (!m_client.decidePolicyForNavigationResponse) + return; + m_client.decidePolicyForNavigationResponse(toAPI(&page), toAPI(&navigationResponse), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didStartProvisionalNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object* userData) override + { + if (!m_client.didStartProvisionalNavigation) + return; + m_client.didStartProvisionalNavigation(toAPI(&page), toAPI(navigation), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didReceiveServerRedirectForProvisionalNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object* userData) override + { + if (!m_client.didReceiveServerRedirectForProvisionalNavigation) + return; + m_client.didReceiveServerRedirectForProvisionalNavigation(toAPI(&page), toAPI(navigation), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didFailProvisionalNavigationWithError(WebPageProxy& page, WebFrameProxy&, API::Navigation* navigation, const WebCore::ResourceError& error, API::Object* userData) override + { + if (!m_client.didFailProvisionalNavigation) + return; + m_client.didFailProvisionalNavigation(toAPI(&page), toAPI(navigation), toAPI(error), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didCommitNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object* userData) override + { + if (!m_client.didCommitNavigation) + return; + m_client.didCommitNavigation(toAPI(&page), toAPI(navigation), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didFinishNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object* userData) override + { + if (!m_client.didFinishNavigation) + return; + m_client.didFinishNavigation(toAPI(&page), toAPI(navigation), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didFailNavigationWithError(WebPageProxy& page, WebFrameProxy&, API::Navigation* navigation, const WebCore::ResourceError& error, API::Object* userData) override + { + if (!m_client.didFailNavigation) + return; + m_client.didFailNavigation(toAPI(&page), toAPI(navigation), toAPI(error), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didFailProvisionalLoadInSubframeWithError(WebPageProxy& page, WebFrameProxy& subframe, const WebCore::SecurityOriginData& securityOriginData, API::Navigation* navigation, const WebCore::ResourceError& error, API::Object* userData) override + { + if (!m_client.didFailProvisionalLoadInSubframe) + return; + m_client.didFailProvisionalLoadInSubframe(toAPI(&page), toAPI(navigation), toAPI(API::FrameInfo::create(subframe, securityOriginData.securityOrigin()).ptr()), toAPI(error), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didFinishDocumentLoad(WebPageProxy& page, API::Navigation* navigation, API::Object* userData) override + { + if (!m_client.didFinishDocumentLoad) + return; + m_client.didFinishDocumentLoad(toAPI(&page), toAPI(navigation), toAPI(userData), m_client.base.clientInfo); + } + + virtual void didSameDocumentNavigation(WebPageProxy& page, API::Navigation* navigation, WebKit::SameDocumentNavigationType navigationType, API::Object* userData) override + { + if (!m_client.didSameDocumentNavigation) + return; + m_client.didSameDocumentNavigation(toAPI(&page), toAPI(navigation), toAPI(navigationType), toAPI(userData), m_client.base.clientInfo); + } + + virtual void renderingProgressDidChange(WebPageProxy& page, WebCore::LayoutMilestones milestones) override + { + if (!m_client.renderingProgressDidChange) + return; + m_client.renderingProgressDidChange(toAPI(&page), pageRenderingProgressEvents(milestones), nullptr, m_client.base.clientInfo); + } + + virtual bool canAuthenticateAgainstProtectionSpace(WebPageProxy& page, WebProtectionSpace* protectionSpace) override + { + if (!m_client.canAuthenticateAgainstProtectionSpace) + return false; + return m_client.canAuthenticateAgainstProtectionSpace(toAPI(&page), toAPI(protectionSpace), m_client.base.clientInfo); + } + + virtual void didReceiveAuthenticationChallenge(WebPageProxy& page, AuthenticationChallengeProxy* authenticationChallenge) override + { + if (!m_client.didReceiveAuthenticationChallenge) + return; + m_client.didReceiveAuthenticationChallenge(toAPI(&page), toAPI(authenticationChallenge), m_client.base.clientInfo); + } + + virtual void processDidCrash(WebPageProxy& page) override + { + if (!m_client.webProcessDidCrash) + return; + m_client.webProcessDidCrash(toAPI(&page), m_client.base.clientInfo); + } + + virtual RefPtr<API::Data> webCryptoMasterKey(WebPageProxy& page) override + { + if (!m_client.copyWebCryptoMasterKey) + return nullptr; + return adoptRef(toImpl(m_client.copyWebCryptoMasterKey(toAPI(&page), m_client.base.clientInfo))); + } + + virtual void didBeginNavigationGesture(WebPageProxy& page) override + { + if (!m_client.didBeginNavigationGesture) + return; + m_client.didBeginNavigationGesture(toAPI(&page), m_client.base.clientInfo); + } + + virtual void didEndNavigationGesture(WebPageProxy& page, bool willNavigate, WebKit::WebBackForwardListItem& item) override + { + if (!m_client.didEndNavigationGesture) + return; + m_client.didEndNavigationGesture(toAPI(&page), willNavigate ? toAPI(&item) : nullptr, m_client.base.clientInfo); + } + + virtual void willEndNavigationGesture(WebPageProxy& page, bool willNavigate, WebKit::WebBackForwardListItem& item) override + { + if (!m_client.willEndNavigationGesture) + return; + m_client.willEndNavigationGesture(toAPI(&page), willNavigate ? toAPI(&item) : nullptr, m_client.base.clientInfo); + } + + virtual void didRemoveNavigationGestureSnapshot(WebPageProxy& page) override + { + if (!m_client.didRemoveNavigationGestureSnapshot) + return; + m_client.didRemoveNavigationGestureSnapshot(toAPI(&page), m_client.base.clientInfo); + } + +#if ENABLE(NETSCAPE_PLUGIN_API) + virtual PluginModuleLoadPolicy decidePolicyForPluginLoad(WebPageProxy& page, PluginModuleLoadPolicy currentPluginLoadPolicy, API::Dictionary* pluginInformation, String& unavailabilityDescription) override + { + WKStringRef unavailabilityDescriptionOut = 0; + PluginModuleLoadPolicy loadPolicy = currentPluginLoadPolicy; + + if (m_client.decidePolicyForPluginLoad) + loadPolicy = toPluginModuleLoadPolicy(m_client.decidePolicyForPluginLoad(toAPI(&page), toWKPluginLoadPolicy(currentPluginLoadPolicy), toAPI(pluginInformation), &unavailabilityDescriptionOut, m_client.base.clientInfo)); + + if (unavailabilityDescriptionOut) { + RefPtr<API::String> webUnavailabilityDescription = adoptRef(toImpl(unavailabilityDescriptionOut)); + unavailabilityDescription = webUnavailabilityDescription->string(); + } + + return loadPolicy; + } +#endif + }; + + WebPageProxy* webPageProxy = toImpl(pageRef); + + auto navigationClient = std::make_unique<NavigationClient>(wkClient); + webPageProxy->setNavigationClient(WTFMove(navigationClient)); +} + +void WKPageSetSession(WKPageRef pageRef, WKSessionRef session) +{ + toImpl(pageRef)->setSessionID(toImpl(session)->getID()); +} + +void WKPageRunJavaScriptInMainFrame(WKPageRef pageRef, WKStringRef scriptRef, void* context, WKPageRunJavaScriptFunction callback) { - toImpl(pageRef)->getSourceForFrame(toImpl(frameRef), StringCallback::create(context, callback)); + toImpl(pageRef)->runJavaScriptInMainFrame(toImpl(scriptRef)->string(), [context, callback](API::SerializedScriptValue* returnValue, bool, const WebCore::ExceptionDetails&, CallbackBase::Error error) { + callback(toAPI(returnValue), (error != CallbackBase::Error::None) ? toAPI(API::Error::create().ptr()) : 0, context); + }); } #ifdef __BLOCKS__ -static void callGetSourceForFrameBlockBlockAndDispose(WKStringRef resultValue, WKErrorRef error, void* context) +static void callRunJavaScriptBlockAndRelease(WKSerializedScriptValueRef resultValue, WKErrorRef error, void* context) { - WKPageGetSourceForFrameBlock block = (WKPageGetSourceForFrameBlock)context; + WKPageRunJavaScriptBlock block = (WKPageRunJavaScriptBlock)context; block(resultValue, error); Block_release(block); } -void WKPageGetSourceForFrame_b(WKPageRef pageRef, WKFrameRef frameRef, WKPageGetSourceForFrameBlock block) +void WKPageRunJavaScriptInMainFrame_b(WKPageRef pageRef, WKStringRef scriptRef, WKPageRunJavaScriptBlock block) { - WKPageGetSourceForFrame(pageRef, frameRef, Block_copy(block), callGetSourceForFrameBlockBlockAndDispose); + WKPageRunJavaScriptInMainFrame(pageRef, scriptRef, Block_copy(block), callRunJavaScriptBlockAndRelease); } #endif +static std::function<void (const String&, WebKit::CallbackBase::Error)> toGenericCallbackFunction(void* context, void (*callback)(WKStringRef, WKErrorRef, void*)) +{ + return [context, callback](const String& returnValue, WebKit::CallbackBase::Error error) { + callback(toAPI(API::String::create(returnValue).ptr()), error != WebKit::CallbackBase::Error::None ? toAPI(API::Error::create().ptr()) : 0, context); + }; +} + +void WKPageRenderTreeExternalRepresentation(WKPageRef pageRef, void* context, WKPageRenderTreeExternalRepresentationFunction callback) +{ + toImpl(pageRef)->getRenderTreeExternalRepresentation(toGenericCallbackFunction(context, callback)); +} + +void WKPageGetSourceForFrame(WKPageRef pageRef, WKFrameRef frameRef, void* context, WKPageGetSourceForFrameFunction callback) +{ + toImpl(pageRef)->getSourceForFrame(toImpl(frameRef), toGenericCallbackFunction(context, callback)); +} + void WKPageGetContentsAsString(WKPageRef pageRef, void* context, WKPageGetContentsAsStringFunction callback) { - toImpl(pageRef)->getContentsAsString(StringCallback::create(context, callback)); + toImpl(pageRef)->getContentsAsString(toGenericCallbackFunction(context, callback)); } -#ifdef __BLOCKS__ -static void callContentsAsStringBlockBlockAndDispose(WKStringRef resultValue, WKErrorRef error, void* context) +void WKPageGetBytecodeProfile(WKPageRef pageRef, void* context, WKPageGetBytecodeProfileFunction callback) { - WKPageGetContentsAsStringBlock block = (WKPageGetContentsAsStringBlock)context; - block(resultValue, error); - Block_release(block); + toImpl(pageRef)->getBytecodeProfile(toGenericCallbackFunction(context, callback)); } -void WKPageGetContentsAsString_b(WKPageRef pageRef, WKPageGetSourceForFrameBlock block) +void WKPageIsWebProcessResponsive(WKPageRef pageRef, void* context, WKPageIsWebProcessResponsiveFunction callback) { - WKPageGetContentsAsString(pageRef, Block_copy(block), callContentsAsStringBlockBlockAndDispose); + toImpl(pageRef)->isWebProcessResponsive([context, callback](bool isWebProcessResponsive) { + callback(isWebProcessResponsive, context); + }); } -#endif void WKPageGetSelectionAsWebArchiveData(WKPageRef pageRef, void* context, WKPageGetSelectionAsWebArchiveDataFunction callback) { - toImpl(pageRef)->getSelectionAsWebArchiveData(DataCallback::create(context, callback)); + toImpl(pageRef)->getSelectionAsWebArchiveData(toGenericCallbackFunction(context, callback)); } -void WKPageGetContentsAsMHTMLData(WKPageRef pageRef, bool useBinaryEncoding, void* context, WKPageGetContentsAsMHTMLDataFunction callback) +void WKPageGetContentsAsMHTMLData(WKPageRef pageRef, void* context, WKPageGetContentsAsMHTMLDataFunction callback) { #if ENABLE(MHTML) - toImpl(pageRef)->getContentsAsMHTMLData(DataCallback::create(context, callback), useBinaryEncoding); + toImpl(pageRef)->getContentsAsMHTMLData(toGenericCallbackFunction(context, callback)); #else UNUSED_PARAM(pageRef); - UNUSED_PARAM(useBinaryEncoding); UNUSED_PARAM(context); UNUSED_PARAM(callback); #endif @@ -741,39 +2443,34 @@ void WKPageGetContentsAsMHTMLData(WKPageRef pageRef, bool useBinaryEncoding, voi void WKPageForceRepaint(WKPageRef pageRef, void* context, WKPageForceRepaintFunction callback) { - toImpl(pageRef)->forceRepaint(VoidCallback::create(context, callback)); + toImpl(pageRef)->forceRepaint(VoidCallback::create([context, callback](WebKit::CallbackBase::Error error) { + callback(error == WebKit::CallbackBase::Error::None ? nullptr : toAPI(API::Error::create().ptr()), context); + })); } WK_EXPORT WKURLRef WKPageCopyPendingAPIRequestURL(WKPageRef pageRef) { - if (toImpl(pageRef)->pendingAPIRequestURL().isNull()) - return 0; - return toCopiedURLAPI(toImpl(pageRef)->pendingAPIRequestURL()); + const String& pendingAPIRequestURL = toImpl(pageRef)->pageLoadState().pendingAPIRequestURL(); + + if (pendingAPIRequestURL.isNull()) + return nullptr; + + return toCopiedURLAPI(pendingAPIRequestURL); } WKURLRef WKPageCopyActiveURL(WKPageRef pageRef) { - return toCopiedURLAPI(toImpl(pageRef)->activeURL()); + return toCopiedURLAPI(toImpl(pageRef)->pageLoadState().activeURL()); } WKURLRef WKPageCopyProvisionalURL(WKPageRef pageRef) { - return toCopiedURLAPI(toImpl(pageRef)->provisionalURL()); + return toCopiedURLAPI(toImpl(pageRef)->pageLoadState().provisionalURL()); } WKURLRef WKPageCopyCommittedURL(WKPageRef pageRef) { - return toCopiedURLAPI(toImpl(pageRef)->committedURL()); -} - -void WKPageSetDebugPaintFlags(WKPageDebugPaintFlags flags) -{ - WebPageProxy::setDebugPaintFlags(flags); -} - -WKPageDebugPaintFlags WKPageGetDebugPaintFlags() -{ - return WebPageProxy::debugPaintFlags(); + return toCopiedURLAPI(toImpl(pageRef)->pageLoadState().url()); } WKStringRef WKPageCopyStandardUserAgentWithApplicationName(WKStringRef applicationName) @@ -783,7 +2480,9 @@ WKStringRef WKPageCopyStandardUserAgentWithApplicationName(WKStringRef applicati void WKPageValidateCommand(WKPageRef pageRef, WKStringRef command, void* context, WKPageValidateCommandCallback callback) { - toImpl(pageRef)->validateCommand(toImpl(command)->string(), ValidateCommandCallback::create(context, callback)); + toImpl(pageRef)->validateCommand(toImpl(command)->string(), [context, callback](const String& commandName, bool isEnabled, int32_t state, WebKit::CallbackBase::Error error) { + callback(toAPI(API::String::create(commandName).ptr()), isEnabled, state, error != WebKit::CallbackBase::Error::None ? toAPI(API::Error::create().ptr()) : 0, context); + }); } void WKPageExecuteCommand(WKPageRef pageRef, WKStringRef command) @@ -791,26 +2490,7 @@ void WKPageExecuteCommand(WKPageRef pageRef, WKStringRef command) toImpl(pageRef)->executeEditCommand(toImpl(command)->string()); } -#if PLATFORM(MAC) -struct ComputedPagesContext { - ComputedPagesContext(WKPageComputePagesForPrintingFunction callback, void* context) - : callback(callback) - , context(context) - { - } - WKPageComputePagesForPrintingFunction callback; - void* context; -}; - -static void computedPagesCallback(const Vector<WebCore::IntRect>& rects, double scaleFactor, WKErrorRef error, void* untypedContext) -{ - OwnPtr<ComputedPagesContext> context = adoptPtr(static_cast<ComputedPagesContext*>(untypedContext)); - Vector<WKRect> wkRects(rects.size()); - for (size_t i = 0; i < rects.size(); ++i) - wkRects[i] = toAPI(rects[i]); - context->callback(wkRects.data(), wkRects.size(), scaleFactor, error, context->context); -} - +#if PLATFORM(COCOA) static PrintInfo printInfoFromWKPrintInfo(const WKPrintInfo& printInfo) { PrintInfo result; @@ -822,7 +2502,12 @@ static PrintInfo printInfoFromWKPrintInfo(const WKPrintInfo& printInfo) void WKPageComputePagesForPrinting(WKPageRef page, WKFrameRef frame, WKPrintInfo printInfo, WKPageComputePagesForPrintingFunction callback, void* context) { - toImpl(page)->computePagesForPrinting(toImpl(frame), printInfoFromWKPrintInfo(printInfo), ComputedPagesCallback::create(new ComputedPagesContext(callback, context), computedPagesCallback)); + toImpl(page)->computePagesForPrinting(toImpl(frame), printInfoFromWKPrintInfo(printInfo), ComputedPagesCallback::create([context, callback](const Vector<WebCore::IntRect>& rects, double scaleFactor, WebKit::CallbackBase::Error error) { + Vector<WKRect> wkRects(rects.size()); + for (size_t i = 0; i < rects.size(); ++i) + wkRects[i] = toAPI(rects[i]); + callback(wkRects.data(), wkRects.size(), scaleFactor, error != WebKit::CallbackBase::Error::None ? toAPI(API::Error::create().ptr()) : 0, context); + })); } void WKPageBeginPrinting(WKPageRef page, WKFrameRef frame, WKPrintInfo printInfo) @@ -832,7 +2517,7 @@ void WKPageBeginPrinting(WKPageRef page, WKFrameRef frame, WKPrintInfo printInfo void WKPageDrawPagesToPDF(WKPageRef page, WKFrameRef frame, WKPrintInfo printInfo, uint32_t first, uint32_t count, WKPageDrawToPDFFunction callback, void* context) { - toImpl(page)->drawPagesToPDF(toImpl(frame), printInfoFromWKPrintInfo(printInfo), first, count, DataCallback::create(context, callback)); + toImpl(page)->drawPagesToPDF(toImpl(frame), printInfoFromWKPrintInfo(printInfo), first, count, DataCallback::create(toGenericCallbackFunction(context, callback))); } void WKPageEndPrinting(WKPageRef page) @@ -841,14 +2526,24 @@ void WKPageEndPrinting(WKPageRef page) } #endif -WKImageRef WKPageCreateSnapshotOfVisibleContent(WKPageRef) +bool WKPageGetAllowsRemoteInspection(WKPageRef page) { - return 0; +#if ENABLE(REMOTE_INSPECTOR) + return toImpl(page)->allowsRemoteInspection(); +#else + UNUSED_PARAM(page); + return false; +#endif } -void WKPageSetShouldSendEventsSynchronously(WKPageRef page, bool sync) +void WKPageSetAllowsRemoteInspection(WKPageRef page, bool allow) { - toImpl(page)->setShouldSendEventsSynchronously(sync); +#if ENABLE(REMOTE_INSPECTOR) + toImpl(page)->setAllowsRemoteInspection(allow); +#else + UNUSED_PARAM(page); + UNUSED_PARAM(allow); +#endif } void WKPageSetMediaVolume(WKPageRef page, float volume) @@ -856,6 +2551,48 @@ void WKPageSetMediaVolume(WKPageRef page, float volume) toImpl(page)->setMediaVolume(volume); } +void WKPageSetMuted(WKPageRef page, bool muted) +{ + toImpl(page)->setMuted(muted); +} + +bool WKPageHasMediaSessionWithActiveMediaElements(WKPageRef page) +{ +#if ENABLE(MEDIA_SESSION) + return toImpl(page)->hasMediaSessionWithActiveMediaElements(); +#else + UNUSED_PARAM(page); + return false; +#endif +} + +void WKPageHandleMediaEvent(WKPageRef page, WKMediaEventType wkEventType) +{ +#if ENABLE(MEDIA_SESSION) + MediaEventType eventType; + + switch (wkEventType) { + case kWKMediaEventTypePlayPause: + eventType = MediaEventType::PlayPause; + break; + case kWKMediaEventTypeTrackNext: + eventType = MediaEventType::TrackNext; + break; + case kWKMediaEventTypeTrackPrevious: + eventType = MediaEventType::TrackPrevious; + break; + default: + ASSERT_NOT_REACHED(); + return; + } + + toImpl(page)->handleMediaEvent(eventType); +#else + UNUSED_PARAM(page); + UNUSED_PARAM(wkEventType); +#endif +} + void WKPagePostMessageToInjectedBundle(WKPageRef pageRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef) { toImpl(pageRef)->postMessageToInjectedBundle(toImpl(messageNameRef)->string(), toImpl(messageBodyRef)); @@ -863,7 +2600,14 @@ void WKPagePostMessageToInjectedBundle(WKPageRef pageRef, WKStringRef messageNam WKArrayRef WKPageCopyRelatedPages(WKPageRef pageRef) { - return toAPI(toImpl(pageRef)->relatedPages().leakRef()); + Vector<RefPtr<API::Object>> relatedPages; + + for (auto& page : toImpl(pageRef)->process().pages()) { + if (page != toImpl(pageRef)) + relatedPages.append(page); + } + + return toAPI(&API::Array::create(WTFMove(relatedPages)).leakRef()); } void WKPageSetMayStartMediaWhenInWindow(WKPageRef pageRef, bool mayStartMedia) @@ -875,7 +2619,10 @@ void WKPageSetMayStartMediaWhenInWindow(WKPageRef pageRef, bool mayStartMedia) void WKPageSelectContextMenuItem(WKPageRef page, WKContextMenuItemRef item) { #if ENABLE(CONTEXT_MENUS) - toImpl(page)->contextMenuItemSelected(*(toImpl(item)->data())); + toImpl(page)->contextMenuItemSelected((toImpl(item)->data())); +#else + UNUSED_PARAM(page); + UNUSED_PARAM(item); #endif } @@ -884,11 +2631,11 @@ WKScrollPinningBehavior WKPageGetScrollPinningBehavior(WKPageRef page) ScrollPinningBehavior pinning = toImpl(page)->scrollPinningBehavior(); switch (pinning) { - case DoNotPin: + case WebCore::ScrollPinningBehavior::DoNotPin: return kWKScrollPinningBehaviorDoNotPin; - case PinToTop: + case WebCore::ScrollPinningBehavior::PinToTop: return kWKScrollPinningBehaviorPinToTop; - case PinToBottom: + case WebCore::ScrollPinningBehavior::PinToBottom: return kWKScrollPinningBehaviorPinToBottom; } @@ -898,17 +2645,17 @@ WKScrollPinningBehavior WKPageGetScrollPinningBehavior(WKPageRef page) void WKPageSetScrollPinningBehavior(WKPageRef page, WKScrollPinningBehavior pinning) { - ScrollPinningBehavior corePinning = DoNotPin; + ScrollPinningBehavior corePinning = ScrollPinningBehavior::DoNotPin; switch (pinning) { case kWKScrollPinningBehaviorDoNotPin: - corePinning = DoNotPin; + corePinning = ScrollPinningBehavior::DoNotPin; break; case kWKScrollPinningBehaviorPinToTop: - corePinning = PinToTop; + corePinning = ScrollPinningBehavior::PinToTop; break; case kWKScrollPinningBehaviorPinToBottom: - corePinning = PinToBottom; + corePinning = ScrollPinningBehavior::PinToBottom; break; default: ASSERT_NOT_REACHED(); @@ -917,15 +2664,37 @@ void WKPageSetScrollPinningBehavior(WKPageRef page, WKScrollPinningBehavior pinn toImpl(page)->setScrollPinningBehavior(corePinning); } +bool WKPageGetAddsVisitedLinks(WKPageRef page) +{ + return toImpl(page)->addsVisitedLinks(); +} +void WKPageSetAddsVisitedLinks(WKPageRef page, bool addsVisitedLinks) +{ + toImpl(page)->setAddsVisitedLinks(addsVisitedLinks); +} -// -- DEPRECATED -- +bool WKPageIsPlayingAudio(WKPageRef page) +{ + return toImpl(page)->isPlayingAudio(); +} + +void WKPageClearWheelEventTestTrigger(WKPageRef pageRef) +{ + toImpl(pageRef)->clearWheelEventTestTrigger(); +} -void WKPageSetInvalidMessageFunction(WKPageInvalidMessageFunction) +void WKPageCallAfterNextPresentationUpdate(WKPageRef pageRef, void* context, WKPagePostPresentationUpdateFunction callback) { - // FIXME: Remove this function when doing so won't break WebKit nightlies. + toImpl(pageRef)->callAfterNextPresentationUpdate([context, callback](WebKit::CallbackBase::Error error) { + callback(error != WebKit::CallbackBase::Error::None ? toAPI(API::Error::create().ptr()) : 0, context); + }); } +#if ENABLE(NETSCAPE_PLUGIN_API) + +// -- DEPRECATED -- + WKStringRef WKPageGetPluginInformationBundleIdentifierKey() { return WKPluginInformationBundleIdentifierKey(); @@ -968,3 +2737,4 @@ WKStringRef WKPageGetPluginInformationPluginURLKey() // -- DEPRECATED -- +#endif // ENABLE(NETSCAPE_PLUGIN_API) diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.h b/Source/WebKit2/UIProcess/API/C/WKPage.h index dc57c523d..59709495d 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.h +++ b/Source/WebKit2/UIProcess/API/C/WKPage.h @@ -26,14 +26,25 @@ #ifndef WKPage_h #define WKPage_h -#include <WebKit2/WKBase.h> -#include <WebKit2/WKError.h> -#include <WebKit2/WKEvent.h> -#include <WebKit2/WKFindOptions.h> -#include <WebKit2/WKGeometry.h> -#include <WebKit2/WKNativeEvent.h> -#include <WebKit2/WKPageLoadTypes.h> -#include <WebKit2/WKPageVisibilityTypes.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKErrorRef.h> +#include <WebKit/WKEvent.h> +#include <WebKit/WKFindOptions.h> +#include <WebKit/WKGeometry.h> +#include <WebKit/WKNativeEvent.h> +#include <WebKit/WKPageContextMenuClient.h> +#include <WebKit/WKPageDiagnosticLoggingClient.h> +#include <WebKit/WKPageFindClient.h> +#include <WebKit/WKPageFindMatchesClient.h> +#include <WebKit/WKPageFormClient.h> +#include <WebKit/WKPageInjectedBundleClient.h> +#include <WebKit/WKPageLoadTypes.h> +#include <WebKit/WKPageLoaderClient.h> +#include <WebKit/WKPageNavigationClient.h> +#include <WebKit/WKPagePolicyClient.h> +#include <WebKit/WKPageUIClient.h> +#include <WebKit/WKPageVisibilityTypes.h> +#include <WebKit/WKSessionRef.h> #ifndef __cplusplus #include <stdbool.h> @@ -43,324 +54,13 @@ extern "C" { #endif -enum { - kWKFocusDirectionBackward = 0, - kWKFocusDirectionForward = 1 -}; -typedef uint32_t WKFocusDirection; - -enum { - kWKPluginLoadPolicyLoadNormally = 0, - kWKPluginLoadPolicyBlocked, - kWKPluginLoadPolicyInactive, - kWKPluginLoadPolicyLoadUnsandboxed, -}; -typedef uint32_t WKPluginLoadPolicy; - -typedef void (*WKPageCallback)(WKPageRef page, const void* clientInfo); - -// FrameLoad Client -typedef void (*WKPageDidStartProvisionalLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageDidFailProvisionalLoadWithErrorForFrameCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageDidCommitLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageDidFinishDocumentLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageDidFinishLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageDidFailLoadWithErrorForFrameCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageDidSameDocumentNavigationForFrameCallback)(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageDidReceiveTitleForFrameCallback)(WKPageRef page, WKStringRef title, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageDidFirstLayoutForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageDidRemoveFrameFromHierarchyCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageDidDisplayInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageDidRunInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageDidDetectXSSForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); -typedef bool (*WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback)(WKPageRef page, WKFrameRef frame, WKProtectionSpaceRef protectionSpace, const void *clientInfo); -typedef void (*WKPageDidReceiveAuthenticationChallengeInFrameCallback)(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo); -typedef void (*WKPageDidChangeBackForwardListCallback)(WKPageRef page, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void *clientInfo); -typedef bool (*WKPageShouldGoToBackForwardListItemCallback)(WKPageRef page, WKBackForwardListItemRef item, const void *clientInfo); -typedef void (*WKPageDidNewFirstVisuallyNonEmptyLayoutCallback)(WKPageRef page, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageWillGoToBackForwardListItemCallback)(WKPageRef page, WKBackForwardListItemRef item, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageDidLayoutCallback)(WKPageRef page, WKLayoutMilestones milestones, WKTypeRef userData, const void *clientInfo); -typedef WKPluginLoadPolicy (*WKPagePluginLoadPolicyCallback)(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInfoDictionary, WKStringRef* unavailabilityDescription, const void* clientInfo); -typedef void (*WKPagePluginDidFailCallback)(WKPageRef page, WKErrorCode errorCode, WKDictionaryRef pluginInfoDictionary, const void* clientInfo); - -// Deprecated -typedef void (*WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef mimeType, const void* clientInfo); -typedef void (*WKPagePluginDidFailCallback_deprecatedForUseWithV1)(WKPageRef page, WKErrorCode errorCode, WKStringRef mimeType, WKStringRef pluginIdentifier, WKStringRef pluginVersion, const void* clientInfo); -typedef WKPluginLoadPolicy (*WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2)(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInfoDictionary, const void* clientInfo); - -struct WKPageLoaderClient { - int version; - const void * clientInfo; - WKPageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame; - WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame; - WKPageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame; - WKPageDidCommitLoadForFrameCallback didCommitLoadForFrame; - WKPageDidFinishDocumentLoadForFrameCallback didFinishDocumentLoadForFrame; - WKPageDidFinishLoadForFrameCallback didFinishLoadForFrame; - WKPageDidFailLoadWithErrorForFrameCallback didFailLoadWithErrorForFrame; - WKPageDidSameDocumentNavigationForFrameCallback didSameDocumentNavigationForFrame; - WKPageDidReceiveTitleForFrameCallback didReceiveTitleForFrame; - WKPageDidFirstLayoutForFrameCallback didFirstLayoutForFrame; - WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback didFirstVisuallyNonEmptyLayoutForFrame; - WKPageDidRemoveFrameFromHierarchyCallback didRemoveFrameFromHierarchy; - WKPageDidDisplayInsecureContentForFrameCallback didDisplayInsecureContentForFrame; - WKPageDidRunInsecureContentForFrameCallback didRunInsecureContentForFrame; - WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback canAuthenticateAgainstProtectionSpaceInFrame; - WKPageDidReceiveAuthenticationChallengeInFrameCallback didReceiveAuthenticationChallengeInFrame; - - // FIXME: Move to progress client. - WKPageCallback didStartProgress; - WKPageCallback didChangeProgress; - WKPageCallback didFinishProgress; - - // FIXME: These three functions should not be part of this client. - WKPageCallback processDidBecomeUnresponsive; - WKPageCallback processDidBecomeResponsive; - WKPageCallback processDidCrash; - WKPageDidChangeBackForwardListCallback didChangeBackForwardList; - WKPageShouldGoToBackForwardListItemCallback shouldGoToBackForwardListItem; - WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0 didFailToInitializePlugin_deprecatedForUseWithV0; - - // Version 1 - WKPageDidDetectXSSForFrameCallback didDetectXSSForFrame; - - // FIXME: didNewFirstVisuallyNonEmptyLayout should be removed. We should consider removing didFirstVisuallyNonEmptyLayoutForFrame - // as well. Their functionality is replaced by didLayout. - WKPageDidNewFirstVisuallyNonEmptyLayoutCallback didNewFirstVisuallyNonEmptyLayout; - - WKPageWillGoToBackForwardListItemCallback willGoToBackForwardListItem; - - WKPageCallback interactionOccurredWhileProcessUnresponsive; - WKPagePluginDidFailCallback_deprecatedForUseWithV1 pluginDidFail_deprecatedForUseWithV1; - - // Version 2 - void (*didReceiveIntentForFrame_unavailable)(void); - void (*registerIntentServiceForFrame_unavailable)(void); - - WKPageDidLayoutCallback didLayout; - WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2 pluginLoadPolicy_deprecatedForUseWithV2; - WKPagePluginDidFailCallback pluginDidFail; - - // Version 3 - WKPagePluginLoadPolicyCallback pluginLoadPolicy; -}; -typedef struct WKPageLoaderClient WKPageLoaderClient; - -enum { kWKPageLoaderClientCurrentVersion = 3 }; - -// Policy Client. -typedef void (*WKPageDecidePolicyForNavigationActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); -typedef void (*WKPageDecidePolicyForNewWindowActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); -typedef void (*WKPageDecidePolicyForResponseCallback)(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); -typedef void (*WKPageUnableToImplementPolicyCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void* clientInfo); - -struct WKPagePolicyClient { - int version; - const void * clientInfo; - WKPageDecidePolicyForNavigationActionCallback decidePolicyForNavigationAction; - WKPageDecidePolicyForNewWindowActionCallback decidePolicyForNewWindowAction; - WKPageDecidePolicyForResponseCallback decidePolicyForResponse; - WKPageUnableToImplementPolicyCallback unableToImplementPolicy; -}; -typedef struct WKPagePolicyClient WKPagePolicyClient; - -enum { kWKPagePolicyClientCurrentVersion = 0 }; - -// Form Client. -typedef void (*WKPageWillSubmitFormCallback)(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef userData, WKFormSubmissionListenerRef listener, const void* clientInfo); - -struct WKPageFormClient { - int version; - const void * clientInfo; - WKPageWillSubmitFormCallback willSubmitForm; -}; -typedef struct WKPageFormClient WKPageFormClient; - -enum { kWKPageFormClientCurrentVersion = 0 }; - -enum { - kWKPluginUnavailabilityReasonPluginMissing, - kWKPluginUnavailabilityReasonPluginCrashed, - kWKPluginUnavailabilityReasonInsecurePluginVersion -}; -typedef uint32_t WKPluginUnavailabilityReason; - -// UI Client -typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, WKURLRequestRef urlRequest, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo); -typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void *clientInfo); -typedef bool (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo); -typedef WKStringRef (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void *clientInfo); -typedef void (*WKPageTakeFocusCallback)(WKPageRef page, WKFocusDirection direction, const void *clientInfo); -typedef void (*WKPageFocusCallback)(WKPageRef page, const void *clientInfo); -typedef void (*WKPageUnfocusCallback)(WKPageRef page, const void *clientInfo); -typedef void (*WKPageSetStatusTextCallback)(WKPageRef page, WKStringRef text, const void *clientInfo); -typedef void (*WKPageMouseDidMoveOverElementCallback)(WKPageRef page, WKHitTestResultRef hitTestResult, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageDidNotHandleKeyEventCallback)(WKPageRef page, WKNativeEventPtr event, const void *clientInfo); -typedef void (*WKPageDidNotHandleWheelEventCallback)(WKPageRef page, WKNativeEventPtr event, const void *clientInfo); -typedef bool (*WKPageGetToolbarsAreVisibleCallback)(WKPageRef page, const void *clientInfo); -typedef void (*WKPageSetToolbarsAreVisibleCallback)(WKPageRef page, bool toolbarsVisible, const void *clientInfo); -typedef bool (*WKPageGetMenuBarIsVisibleCallback)(WKPageRef page, const void *clientInfo); -typedef void (*WKPageSetMenuBarIsVisibleCallback)(WKPageRef page, bool menuBarVisible, const void *clientInfo); -typedef bool (*WKPageGetStatusBarIsVisibleCallback)(WKPageRef page, const void *clientInfo); -typedef void (*WKPageSetStatusBarIsVisibleCallback)(WKPageRef page, bool statusBarVisible, const void *clientInfo); -typedef bool (*WKPageGetIsResizableCallback)(WKPageRef page, const void *clientInfo); -typedef void (*WKPageSetIsResizableCallback)(WKPageRef page, bool resizable, const void *clientInfo); -typedef WKRect (*WKPageGetWindowFrameCallback)(WKPageRef page, const void *clientInfo); -typedef void (*WKPageSetWindowFrameCallback)(WKPageRef page, WKRect frame, const void *clientInfo); -typedef bool (*WKPageRunBeforeUnloadConfirmPanelCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo); -typedef unsigned long long (*WKPageExceededDatabaseQuotaCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage, const void *clientInfo); -typedef void (*WKPageRunOpenPanelCallback)(WKPageRef page, WKFrameRef frame, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener, const void *clientInfo); -typedef void (*WKPageDecidePolicyForGeolocationPermissionRequestCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKGeolocationPermissionRequestRef permissionRequest, const void* clientInfo); -typedef float (*WKPageHeaderHeightCallback)(WKPageRef page, WKFrameRef frame, const void* clientInfo); -typedef float (*WKPageFooterHeightCallback)(WKPageRef page, WKFrameRef frame, const void* clientInfo); -typedef void (*WKPageDrawHeaderCallback)(WKPageRef page, WKFrameRef frame, WKRect rect, const void* clientInfo); -typedef void (*WKPageDrawFooterCallback)(WKPageRef page, WKFrameRef frame, WKRect rect, const void* clientInfo); -typedef void (*WKPagePrintFrameCallback)(WKPageRef page, WKFrameRef frame, const void* clientInfo); -typedef void (*WKPageSaveDataToFileInDownloadsFolderCallback)(WKPageRef page, WKStringRef suggestedFilename, WKStringRef mimeType, WKURLRef originatingURL, WKDataRef data, const void* clientInfo); -typedef bool (*WKPageShouldInterruptJavaScriptCallback)(WKPageRef page, const void *clientInfo); -typedef void (*WKPageDecidePolicyForNotificationPermissionRequestCallback)(WKPageRef page, WKSecurityOriginRef origin, WKNotificationPermissionRequestRef permissionRequest, const void *clientInfo); -typedef void (*WKPageShowColorPickerCallback)(WKPageRef page, WKStringRef initialColor, WKColorPickerResultListenerRef listener, const void* clientInfo); -typedef void (*WKPageHideColorPickerCallback)(WKPageRef page, const void* clientInfo); -typedef void (*WKPageUnavailablePluginButtonClickedCallback)(WKPageRef page, WKPluginUnavailabilityReason pluginUnavailabilityReason, WKDictionaryRef pluginInfoDictionary, const void* clientInfo); - -// Deprecated -typedef WKPageRef (*WKPageCreateNewPageCallback_deprecatedForUseWithV0)(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo); -typedef void (*WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0)(WKPageRef page, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef mimeType, WKStringRef url, WKStringRef pluginsPageURL, const void* clientInfo); -typedef void (*WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1)(WKPageRef page, WKPluginUnavailabilityReason pluginUnavailabilityReason, WKStringRef mimeType, WKStringRef url, WKStringRef pluginsPageURL, const void* clientInfo); - -struct WKPageUIClient { - int version; - const void * clientInfo; - - // Version 0 - WKPageCreateNewPageCallback_deprecatedForUseWithV0 createNewPage_deprecatedForUseWithV0; - WKPageCallback showPage; - WKPageCallback close; - WKPageTakeFocusCallback takeFocus; - WKPageFocusCallback focus; - WKPageUnfocusCallback unfocus; - WKPageRunJavaScriptAlertCallback runJavaScriptAlert; - WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm; - WKPageRunJavaScriptPromptCallback runJavaScriptPrompt; - WKPageSetStatusTextCallback setStatusText; - WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; - WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0 missingPluginButtonClicked_deprecatedForUseWithV0; - WKPageDidNotHandleKeyEventCallback didNotHandleKeyEvent; - WKPageDidNotHandleWheelEventCallback didNotHandleWheelEvent; - WKPageGetToolbarsAreVisibleCallback toolbarsAreVisible; - WKPageSetToolbarsAreVisibleCallback setToolbarsAreVisible; - WKPageGetMenuBarIsVisibleCallback menuBarIsVisible; - WKPageSetMenuBarIsVisibleCallback setMenuBarIsVisible; - WKPageGetStatusBarIsVisibleCallback statusBarIsVisible; - WKPageSetStatusBarIsVisibleCallback setStatusBarIsVisible; - WKPageGetIsResizableCallback isResizable; - WKPageSetIsResizableCallback setIsResizable; - WKPageGetWindowFrameCallback getWindowFrame; - WKPageSetWindowFrameCallback setWindowFrame; - WKPageRunBeforeUnloadConfirmPanelCallback runBeforeUnloadConfirmPanel; - WKPageCallback didDraw; - WKPageCallback pageDidScroll; - WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota; - WKPageRunOpenPanelCallback runOpenPanel; - WKPageDecidePolicyForGeolocationPermissionRequestCallback decidePolicyForGeolocationPermissionRequest; - WKPageHeaderHeightCallback headerHeight; - WKPageFooterHeightCallback footerHeight; - WKPageDrawHeaderCallback drawHeader; - WKPageDrawFooterCallback drawFooter; - WKPagePrintFrameCallback printFrame; - WKPageCallback runModal; - void* unused1; // Used to be didCompleteRubberBandForMainFrame - WKPageSaveDataToFileInDownloadsFolderCallback saveDataToFileInDownloadsFolder; - WKPageShouldInterruptJavaScriptCallback shouldInterruptJavaScript; - - // Version 1 - WKPageCreateNewPageCallback createNewPage; - WKPageMouseDidMoveOverElementCallback mouseDidMoveOverElement; - WKPageDecidePolicyForNotificationPermissionRequestCallback decidePolicyForNotificationPermissionRequest; - WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1 unavailablePluginButtonClicked_deprecatedForUseWithV1; - - // Version 2 - WKPageShowColorPickerCallback showColorPicker; - WKPageHideColorPickerCallback hideColorPicker; - WKPageUnavailablePluginButtonClickedCallback unavailablePluginButtonClicked; -}; -typedef struct WKPageUIClient WKPageUIClient; - -enum { kWKPageUIClientCurrentVersion = 2 }; - -// Find client. -typedef void (*WKPageDidFindStringCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo); -typedef void (*WKPageDidFailToFindStringCallback)(WKPageRef page, WKStringRef string, const void* clientInfo); -typedef void (*WKPageDidCountStringMatchesCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo); - -struct WKPageFindClient { - int version; - const void * clientInfo; - WKPageDidFindStringCallback didFindString; - WKPageDidFailToFindStringCallback didFailToFindString; - WKPageDidCountStringMatchesCallback didCountStringMatches; -}; -typedef struct WKPageFindClient WKPageFindClient; - -enum { kWKPageFindClientCurrentVersion = 0 }; - -enum { - kWKMoreThanMaximumMatchCount = -1 -}; - -// Find match client. -typedef void (*WKPageDidFindStringMatchesCallback)(WKPageRef page, WKStringRef string, WKArrayRef matches, int firstIndex, const void* clientInfo); -typedef void (*WKPageDidGetImageForMatchResultCallback)(WKPageRef page, WKImageRef image, uint32_t index, const void* clientInfo); - -struct WKPageFindMatchesClient { - int version; - const void * clientInfo; - WKPageDidFindStringMatchesCallback didFindStringMatches; - WKPageDidGetImageForMatchResultCallback didGetImageForMatchResult; -}; -typedef struct WKPageFindMatchesClient WKPageFindMatchesClient; - -enum { kWKPageFindMatchesClientCurrentVersion = 0 }; - -// ContextMenu client -typedef void (*WKPageGetContextMenuFromProposedContextMenuCallback)(WKPageRef page, WKArrayRef proposedMenu, WKArrayRef* newMenu, WKHitTestResultRef hitTestResult, WKTypeRef userData, const void* clientInfo); -typedef void (*WKPageCustomContextMenuItemSelectedCallback)(WKPageRef page, WKContextMenuItemRef contextMenuItem, const void* clientInfo); -typedef void (*WKPageContextMenuDismissedCallback)(WKPageRef page, const void* clientInfo); -typedef void (*WKPageShowContextMenuCallback)(WKPageRef page, WKPoint menuLocation, WKArrayRef menuItems, const void* clientInfo); -typedef void (*WKPageHideContextMenuCallback)(WKPageRef page, const void* clientInfo); - -// Deprecated -typedef void (*WKPageGetContextMenuFromProposedContextMenuCallback_deprecatedForUseWithV0)(WKPageRef page, WKArrayRef proposedMenu, WKArrayRef* newMenu, WKTypeRef userData, const void* clientInfo); -struct WKPageContextMenuClient { - int version; - const void * clientInfo; - - // Version 0 - WKPageGetContextMenuFromProposedContextMenuCallback_deprecatedForUseWithV0 getContextMenuFromProposedMenu_deprecatedForUseWithV0; - WKPageCustomContextMenuItemSelectedCallback customContextMenuItemSelected; - - // Version 1 - WKPageContextMenuDismissedCallback contextMenuDismissed; - - // Version 2 - WKPageGetContextMenuFromProposedContextMenuCallback getContextMenuFromProposedMenu; - - // Version 3 - WKPageShowContextMenuCallback showContextMenu; - WKPageHideContextMenuCallback hideContextMenu; -}; -typedef struct WKPageContextMenuClient WKPageContextMenuClient; - -enum { kWKPageContextMenuClientCurrentVersion = 3 }; - WK_EXPORT WKTypeID WKPageGetTypeID(); WK_EXPORT WKContextRef WKPageGetContext(WKPageRef page); WK_EXPORT WKPageGroupRef WKPageGetPageGroup(WKPageRef page); +WK_EXPORT WKPageConfigurationRef WKPageCopyPageConfiguration(WKPageRef page); + // URL Requests WK_EXPORT void WKPageLoadURL(WKPageRef page, WKURLRef url); WK_EXPORT void WKPageLoadURLWithUserData(WKPageRef page, WKURLRef url, WKTypeRef userData); @@ -383,6 +83,7 @@ WK_EXPORT void WKPageLoadWebArchiveDataWithUserData(WKPageRef page, WKDataRef we WK_EXPORT void WKPageStopLoading(WKPageRef page); WK_EXPORT void WKPageReload(WKPageRef page); +WK_EXPORT void WKPageReloadWithoutContentBlockers(WKPageRef page); WK_EXPORT void WKPageReloadFromOrigin(WKPageRef page); WK_EXPORT bool WKPageTryClose(WKPageRef page); @@ -413,8 +114,6 @@ WK_EXPORT double WKPageGetEstimatedProgress(WKPageRef page); WK_EXPORT uint64_t WKPageGetRenderTreeSize(WKPageRef page); -WK_EXPORT void WKPageSetMemoryCacheClientCallsEnabled(WKPageRef page, bool memoryCacheClientCallsEnabled); - WK_EXPORT WKInspectorRef WKPageGetInspector(WKPageRef page); WK_EXPORT WKVibrationRef WKPageGetVibration(WKPageRef page); @@ -427,6 +126,8 @@ WK_EXPORT void WKPageSetApplicationNameForUserAgent(WKPageRef page, WKStringRef WK_EXPORT WKStringRef WKPageCopyCustomUserAgent(WKPageRef page); WK_EXPORT void WKPageSetCustomUserAgent(WKPageRef page, WKStringRef userAgent); +WK_EXPORT void WKPageSetUserContentExtensionsEnabled(WKPageRef, bool); + WK_EXPORT bool WKPageSupportsTextEncoding(WKPageRef page); WK_EXPORT WKStringRef WKPageCopyCustomTextEncodingName(WKPageRef page); WK_EXPORT void WKPageSetCustomTextEncodingName(WKPageRef page, WKStringRef encodingName); @@ -437,11 +138,18 @@ WK_EXPORT WKStringRef WKPageGetSessionHistoryURLValueType(void); WK_EXPORT WKStringRef WKPageGetSessionBackForwardListItemValueType(void); typedef bool (*WKPageSessionStateFilterCallback)(WKPageRef page, WKStringRef valueType, WKTypeRef value, void* context); -WK_EXPORT WKDataRef WKPageCopySessionState(WKPageRef page, void* context, WKPageSessionStateFilterCallback urlAllowedCallback); -WK_EXPORT void WKPageRestoreFromSessionState(WKPageRef page, WKDataRef sessionStateData); + +// FIXME: This should return a WKSessionStateRef object, not a WKTypeRef. +// It currently returns a WKTypeRef for backwards compatibility with Safari. +WK_EXPORT WKTypeRef WKPageCopySessionState(WKPageRef page, void* context, WKPageSessionStateFilterCallback urlAllowedCallback); + +// FIXME: This should take a WKSessionStateRef object, not a WKTypeRef. +// It currently takes a WKTypeRef for backwards compatibility with Safari. +WK_EXPORT void WKPageRestoreFromSessionState(WKPageRef page, WKTypeRef sessionState); WK_EXPORT double WKPageGetBackingScaleFactor(WKPageRef page); WK_EXPORT void WKPageSetCustomBackingScaleFactor(WKPageRef page, double customScaleFactor); +WK_EXPORT void WKPageClearWheelEventTestTrigger(WKPageRef page); WK_EXPORT bool WKPageSupportsTextZoom(WKPageRef page); WK_EXPORT double WKPageGetTextZoomFactor(WKPageRef page); @@ -460,8 +168,6 @@ WK_EXPORT WKSize WKPageFixedLayoutSize(WKPageRef page); WK_EXPORT void WKPageListenForLayoutMilestones(WKPageRef page, WKLayoutMilestones milestones); -WK_EXPORT void WKPageSetVisibilityState(WKPageRef page, WKPageVisibilityState state, bool isInitialState); - WK_EXPORT bool WKPageHasHorizontalScrollbar(WKPageRef page); WK_EXPORT bool WKPageHasVerticalScrollbar(WKPageRef page); @@ -472,11 +178,28 @@ WK_EXPORT bool WKPageIsPinnedToLeftSide(WKPageRef page); WK_EXPORT bool WKPageIsPinnedToRightSide(WKPageRef page); WK_EXPORT bool WKPageIsPinnedToTopSide(WKPageRef page); WK_EXPORT bool WKPageIsPinnedToBottomSide(WKPageRef page); - -WK_EXPORT bool WKPageRubberBandsAtBottom(WKPageRef); -WK_EXPORT void WKPageSetRubberBandsAtBottom(WKPageRef, bool rubberBandsAtBottom); + +// This API is poorly named. Even when these values are set to false, rubber-banding will +// still be allowed to occur at the end of a momentum scroll. These values are used along +// with pin state to determine if wheel events should be handled in the web process or if +// they should be passed up to the client. +WK_EXPORT bool WKPageRubberBandsAtLeft(WKPageRef); +WK_EXPORT void WKPageSetRubberBandsAtLeft(WKPageRef, bool rubberBandsAtLeft); +WK_EXPORT bool WKPageRubberBandsAtRight(WKPageRef); +WK_EXPORT void WKPageSetRubberBandsAtRight(WKPageRef, bool rubberBandsAtRight); WK_EXPORT bool WKPageRubberBandsAtTop(WKPageRef); WK_EXPORT void WKPageSetRubberBandsAtTop(WKPageRef, bool rubberBandsAtTop); +WK_EXPORT bool WKPageRubberBandsAtBottom(WKPageRef); +WK_EXPORT void WKPageSetRubberBandsAtBottom(WKPageRef, bool rubberBandsAtBottom); + +// Rubber-banding is enabled by default. +WK_EXPORT bool WKPageVerticalRubberBandingIsEnabled(WKPageRef); +WK_EXPORT void WKPageSetEnableVerticalRubberBanding(WKPageRef, bool enableVerticalRubberBanding); +WK_EXPORT bool WKPageHorizontalRubberBandingIsEnabled(WKPageRef); +WK_EXPORT void WKPageSetEnableHorizontalRubberBanding(WKPageRef, bool enableHorizontalRubberBanding); + +WK_EXPORT void WKPageSetBackgroundExtendsBeyondPage(WKPageRef, bool backgroundExtendsBeyondPage); +WK_EXPORT bool WKPageBackgroundExtendsBeyondPage(WKPageRef); WK_EXPORT bool WKPageCanDelete(WKPageRef page); WK_EXPORT bool WKPageHasSelectedRange(WKPageRef page); @@ -492,13 +215,20 @@ WK_EXPORT void WKPageFindStringMatches(WKPageRef page, WKStringRef string, WKFin WK_EXPORT void WKPageGetImageForFindMatch(WKPageRef page, int32_t matchIndex); WK_EXPORT void WKPageSelectFindMatch(WKPageRef page, int32_t matchIndex); -WK_EXPORT void WKPageSetPageContextMenuClient(WKPageRef page, const WKPageContextMenuClient* client); -WK_EXPORT void WKPageSetPageFindClient(WKPageRef page, const WKPageFindClient* client); -WK_EXPORT void WKPageSetPageFindMatchesClient(WKPageRef page, const WKPageFindMatchesClient* client); -WK_EXPORT void WKPageSetPageFormClient(WKPageRef page, const WKPageFormClient* client); -WK_EXPORT void WKPageSetPageLoaderClient(WKPageRef page, const WKPageLoaderClient* client); -WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, const WKPagePolicyClient* client); -WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, const WKPageUIClient* client); +WK_EXPORT void WKPageSetPageContextMenuClient(WKPageRef page, const WKPageContextMenuClientBase* client); +WK_EXPORT void WKPageSetPageDiagnosticLoggingClient(WKPageRef page, const WKPageDiagnosticLoggingClientBase* client); +WK_EXPORT void WKPageSetPageFindClient(WKPageRef page, const WKPageFindClientBase* client); +WK_EXPORT void WKPageSetPageFindMatchesClient(WKPageRef page, const WKPageFindMatchesClientBase* client); +WK_EXPORT void WKPageSetPageFormClient(WKPageRef page, const WKPageFormClientBase* client); +WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, const WKPageUIClientBase* client); +WK_EXPORT void WKPageSetPageInjectedBundleClient(WKPageRef page, const WKPageInjectedBundleClientBase* client); + +// A client can implement either a navigation client or loader and policy clients, but never both. +WK_EXPORT void WKPageSetPageLoaderClient(WKPageRef page, const WKPageLoaderClientBase* client); +WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, const WKPagePolicyClientBase* client); +WK_EXPORT void WKPageSetPageNavigationClient(WKPageRef page, const WKPageNavigationClientBase* client); + +WK_EXPORT void WKPageSetSession(WKPageRef page, WKSessionRef session); typedef void (*WKPageRunJavaScriptFunction)(WKSerializedScriptValueRef, WKErrorRef, void*); WK_EXPORT void WKPageRunJavaScriptInMainFrame(WKPageRef page, WKStringRef script, void* context, WKPageRunJavaScriptFunction function); @@ -509,20 +239,12 @@ WK_EXPORT void WKPageRunJavaScriptInMainFrame_b(WKPageRef page, WKStringRef scri typedef void (*WKPageGetSourceForFrameFunction)(WKStringRef, WKErrorRef, void*); WK_EXPORT void WKPageGetSourceForFrame(WKPageRef page, WKFrameRef frame, void* context, WKPageGetSourceForFrameFunction function); -#ifdef __BLOCKS__ -typedef void (^WKPageGetSourceForFrameBlock)(WKStringRef, WKErrorRef); -WK_EXPORT void WKPageGetSourceForFrame_b(WKPageRef page, WKFrameRef frame, WKPageGetSourceForFrameBlock block); -#endif typedef void (*WKPageGetContentsAsStringFunction)(WKStringRef, WKErrorRef, void*); WK_EXPORT void WKPageGetContentsAsString(WKPageRef page, void* context, WKPageGetContentsAsStringFunction function); -#ifdef __BLOCKS__ -typedef void (^WKPageGetContentsAsStringBlock)(WKStringRef, WKErrorRef); -WK_EXPORT void WKPageGetContentsAsString_b(WKPageRef page, WKPageGetContentsAsStringBlock block); -#endif typedef void (*WKPageGetContentsAsMHTMLDataFunction)(WKDataRef, WKErrorRef, void*); -WK_EXPORT void WKPageGetContentsAsMHTMLData(WKPageRef page, bool useBinaryEncoding, void* context, WKPageGetContentsAsMHTMLDataFunction function); +WK_EXPORT void WKPageGetContentsAsMHTMLData(WKPageRef page, void* context, WKPageGetContentsAsMHTMLDataFunction function); typedef void (*WKPageGetSelectionAsWebArchiveDataFunction)(WKDataRef, WKErrorRef, void*); WK_EXPORT void WKPageGetSelectionAsWebArchiveData(WKPageRef page, void* context, WKPageGetSelectionAsWebArchiveDataFunction function); diff --git a/Source/WebKit2/UIProcess/API/C/WKPageConfigurationRef.cpp b/Source/WebKit2/UIProcess/API/C/WKPageConfigurationRef.cpp new file mode 100644 index 000000000..ccdd66dca --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPageConfigurationRef.cpp @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKPageConfigurationRef.h" + +#include "APIPageConfiguration.h" +#include "WKAPICast.h" +#include "WebPageGroup.h" +#include "WebProcessPool.h" +#include "WebUserContentControllerProxy.h" + +using namespace WebKit; + +WKTypeID WKPageConfigurationGetTypeID() +{ + return toAPI(API::PageConfiguration::APIType); +} + +WKPageConfigurationRef WKPageConfigurationCreate() +{ + return toAPI(&API::PageConfiguration::create().leakRef()); +} + +WKContextRef WKPageConfigurationGetContext(WKPageConfigurationRef configuration) +{ + return toAPI(toImpl(configuration)->processPool()); +} + +void WKPageConfigurationSetContext(WKPageConfigurationRef configuration, WKContextRef context) +{ + toImpl(configuration)->setProcessPool(toImpl(context)); +} + +WKPageGroupRef WKPageConfigurationGetPageGroup(WKPageConfigurationRef configuration) +{ + return toAPI(toImpl(configuration)->pageGroup()); +} + +void WKPageConfigurationSetPageGroup(WKPageConfigurationRef configuration, WKPageGroupRef pageGroup) +{ + toImpl(configuration)->setPageGroup(toImpl(pageGroup)); +} + +WKUserContentControllerRef WKPageConfigurationGetUserContentController(WKPageConfigurationRef configuration) +{ + return toAPI(toImpl(configuration)->userContentController()); +} + +void WKPageConfigurationSetUserContentController(WKPageConfigurationRef configuration, WKUserContentControllerRef userContentController) +{ + toImpl(configuration)->setUserContentController(toImpl(userContentController)); +} + +WKPreferencesRef WKPageConfigurationGetPreferences(WKPageConfigurationRef configuration) +{ + return toAPI(toImpl(configuration)->preferences()); +} + +void WKPageConfigurationSetPreferences(WKPageConfigurationRef configuration, WKPreferencesRef preferences) +{ + toImpl(configuration)->setPreferences(toImpl(preferences)); +} + +WKPageRef WKPageConfigurationGetRelatedPage(WKPageConfigurationRef configuration) +{ + return toAPI(toImpl(configuration)->relatedPage()); +} + +void WKPageConfigurationSetRelatedPage(WKPageConfigurationRef configuration, WKPageRef relatedPage) +{ + toImpl(configuration)->setRelatedPage(toImpl(relatedPage)); +} + +WKWebsiteDataStoreRef WKPageConfigurationGetWebsiteDataStore(WKPageConfigurationRef configuration) +{ + return toAPI(toImpl(configuration)->websiteDataStore()); +} + +void WKPageConfigurationSetWebsiteDataStore(WKPageConfigurationRef configuration, WKWebsiteDataStoreRef websiteDataStore) +{ + toImpl(configuration)->setWebsiteDataStore(toImpl(websiteDataStore)); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKPageConfigurationRef.h b/Source/WebKit2/UIProcess/API/C/WKPageConfigurationRef.h new file mode 100644 index 000000000..e61c70fbc --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPageConfigurationRef.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKPageConfigurationRef_h +#define WKPageConfigurationRef_h + +#include <WebKit/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKPageConfigurationGetTypeID(); + +WK_EXPORT WKPageConfigurationRef WKPageConfigurationCreate(); + +WK_EXPORT WKContextRef WKPageConfigurationGetContext(WKPageConfigurationRef configuration); +WK_EXPORT void WKPageConfigurationSetContext(WKPageConfigurationRef configuration, WKContextRef context); + +WK_EXPORT WKPageGroupRef WKPageConfigurationGetPageGroup(WKPageConfigurationRef configuration); +WK_EXPORT void WKPageConfigurationSetPageGroup(WKPageConfigurationRef configuration, WKPageGroupRef pageGroup); + +WK_EXPORT WKUserContentControllerRef WKPageConfigurationGetUserContentController(WKPageConfigurationRef configuration); +WK_EXPORT void WKPageConfigurationSetUserContentController(WKPageConfigurationRef configuration, WKUserContentControllerRef userContentController); + +WK_EXPORT WKPreferencesRef WKPageConfigurationGetPreferences(WKPageConfigurationRef configuration); +WK_EXPORT void WKPageConfigurationSetPreferences(WKPageConfigurationRef configuration, WKPreferencesRef preferences); + +WK_EXPORT WKPageRef WKPageConfigurationGetRelatedPage(WKPageConfigurationRef configuration); +WK_EXPORT void WKPageConfigurationSetRelatedPage(WKPageConfigurationRef configuration, WKPageRef relatedPage); + +WK_EXPORT WKWebsiteDataStoreRef WKPageConfigurationGetWebsiteDataStore(WKPageConfigurationRef configuration); +WK_EXPORT void WKPageConfigurationSetWebsiteDataStore(WKPageConfigurationRef configuration, WKWebsiteDataStoreRef websiteDataStore); + +#ifdef __cplusplus +} +#endif + +#endif // WKPageConfigurationRef_h diff --git a/Source/WebKit2/UIProcess/API/C/WKPageContextMenuClient.h b/Source/WebKit2/UIProcess/API/C/WKPageContextMenuClient.h new file mode 100644 index 000000000..ce2e4b07f --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPageContextMenuClient.h @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2013 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKPageContextMenuClient_h +#define WKPageContextMenuClient_h + +#include <WebKit/WKBase.h> +#include <WebKit/WKGeometry.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*WKPageGetContextMenuFromProposedContextMenuCallback)(WKPageRef page, WKArrayRef proposedMenu, WKArrayRef* newMenu, WKHitTestResultRef hitTestResult, WKTypeRef userData, const void* clientInfo); +typedef void (*WKPageCustomContextMenuItemSelectedCallback)(WKPageRef page, WKContextMenuItemRef contextMenuItem, const void* clientInfo); +typedef void (*WKPageContextMenuDismissedCallback)(WKPageRef page, const void* clientInfo); +typedef void (*WKPageShowContextMenuCallback)(WKPageRef page, WKPoint menuLocation, WKArrayRef menuItems, const void* clientInfo); +typedef void (*WKPageHideContextMenuCallback)(WKPageRef page, const void* clientInfo); + +// Deprecated +typedef void (*WKPageGetContextMenuFromProposedContextMenuCallback_deprecatedForUseWithV0)(WKPageRef page, WKArrayRef proposedMenu, WKArrayRef* newMenu, WKTypeRef userData, const void* clientInfo); + +typedef struct WKPageContextMenuClientBase { + int version; + const void * clientInfo; +} WKPageContextMenuClientBase; + +typedef struct WKPageContextMenuClientV0 { + WKPageContextMenuClientBase base; + + // Version 0. + WKPageGetContextMenuFromProposedContextMenuCallback_deprecatedForUseWithV0 getContextMenuFromProposedMenu_deprecatedForUseWithV0; + WKPageCustomContextMenuItemSelectedCallback customContextMenuItemSelected; +} WKPageContextMenuClientV0; + +typedef struct WKPageContextMenuClientV1 { + WKPageContextMenuClientBase base; + + // Version 0. + WKPageGetContextMenuFromProposedContextMenuCallback_deprecatedForUseWithV0 getContextMenuFromProposedMenu_deprecatedForUseWithV0; + WKPageCustomContextMenuItemSelectedCallback customContextMenuItemSelected; + + // Version 1. + WKPageContextMenuDismissedCallback contextMenuDismissed; +} WKPageContextMenuClientV1; + +typedef struct WKPageContextMenuClientV2 { + WKPageContextMenuClientBase base; + + // Version 0. + WKPageGetContextMenuFromProposedContextMenuCallback_deprecatedForUseWithV0 getContextMenuFromProposedMenu_deprecatedForUseWithV0; + WKPageCustomContextMenuItemSelectedCallback customContextMenuItemSelected; + + // Version 1. + WKPageContextMenuDismissedCallback contextMenuDismissed; + + // Version 2. + WKPageGetContextMenuFromProposedContextMenuCallback getContextMenuFromProposedMenu; +} WKPageContextMenuClientV2; + +typedef struct WKPageContextMenuClientV3 { + WKPageContextMenuClientBase base; + + // Version 0. + WKPageGetContextMenuFromProposedContextMenuCallback_deprecatedForUseWithV0 getContextMenuFromProposedMenu_deprecatedForUseWithV0; + WKPageCustomContextMenuItemSelectedCallback customContextMenuItemSelected; + + // Version 1. + WKPageContextMenuDismissedCallback contextMenuDismissed; + + // Version 2. + WKPageGetContextMenuFromProposedContextMenuCallback getContextMenuFromProposedMenu; + + // Version 3. + WKPageShowContextMenuCallback showContextMenu; + WKPageHideContextMenuCallback hideContextMenu; +} WKPageContextMenuClientV3; + +#ifdef __cplusplus +} +#endif + + +#endif // WKPageContextMenuClient_h diff --git a/Source/WebKit2/UIProcess/API/C/WKPageDiagnosticLoggingClient.h b/Source/WebKit2/UIProcess/API/C/WKPageDiagnosticLoggingClient.h new file mode 100644 index 000000000..9bb0b36e9 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPageDiagnosticLoggingClient.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKPageDiagnosticLoggingClient_h +#define WKPageDiagnosticLoggingClient_h + +#include <WebKit/WKBase.h> +#include <WebKit/WKDiagnosticLoggingResultType.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*WKPageLogDiagnosticMessageCallback)(WKPageRef page, WKStringRef message, WKStringRef description, const void* clientInfo); +typedef void (*WKPageLogDiagnosticMessageWithResultCallback)(WKPageRef page, WKStringRef message, WKStringRef description, WKDiagnosticLoggingResultType result, const void* clientInfo); +typedef void (*WKPageLogDiagnosticMessageWithValueCallback)(WKPageRef page, WKStringRef message, WKStringRef description, WKStringRef value, const void* clientInfo); + +typedef struct WKPageDiagnosticLoggingClientBase { + int version; + const void * clientInfo; +} WKPageDiagnosticLoggingClientBase; + +typedef struct WKPageDiagnosticLoggingClientV0 { + WKPageDiagnosticLoggingClientBase base; + + // Version 0. + WKPageLogDiagnosticMessageCallback logDiagnosticMessage; + WKPageLogDiagnosticMessageWithResultCallback logDiagnosticMessageWithResult; + WKPageLogDiagnosticMessageWithValueCallback logDiagnosticMessageWithValue; +} WKPageDiagnosticLoggingClientV0; + +#ifdef __cplusplus +} +#endif + +#endif // WKPageDiagnosticLoggingClient_h diff --git a/Source/WebKit2/UIProcess/API/C/WKPageFindClient.h b/Source/WebKit2/UIProcess/API/C/WKPageFindClient.h new file mode 100644 index 000000000..6c7b1f22c --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPageFindClient.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2013 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKPageFindClient_h +#define WKPageFindClient_h + +#include <WebKit/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*WKPageDidFindStringCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo); +typedef void (*WKPageDidFailToFindStringCallback)(WKPageRef page, WKStringRef string, const void* clientInfo); +typedef void (*WKPageDidCountStringMatchesCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo); + +typedef struct WKPageFindClientBase { + int version; + const void * clientInfo; +} WKPageFindClientBase; + +typedef struct WKPageFindClientV0 { + WKPageFindClientBase base; + + // Version 0. + WKPageDidFindStringCallback didFindString; + WKPageDidFailToFindStringCallback didFailToFindString; + WKPageDidCountStringMatchesCallback didCountStringMatches; +} WKPageFindClientV0; + +#ifdef __cplusplus +} +#endif + + +#endif // WKPageFindClient_h diff --git a/Source/WebKit2/UIProcess/API/C/WKPageFindMatchesClient.h b/Source/WebKit2/UIProcess/API/C/WKPageFindMatchesClient.h new file mode 100644 index 000000000..395588c7e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPageFindMatchesClient.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2013 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKPageFindMatchesClient_h +#define WKPageFindMatchesClient_h + +#include <WebKit/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKMoreThanMaximumMatchCount = -1 +}; + +// Find match client. +typedef void (*WKPageDidFindStringMatchesCallback)(WKPageRef page, WKStringRef string, WKArrayRef matches, int firstIndex, const void* clientInfo); +typedef void (*WKPageDidGetImageForMatchResultCallback)(WKPageRef page, WKImageRef image, uint32_t index, const void* clientInfo); + +typedef struct WKPageFindMatchesClientBase { + int version; + const void * clientInfo; +} WKPageFindMatchesClientBase; + +typedef struct WKPageFindMatchesClientV0 { + WKPageFindMatchesClientBase base; + + // Version 0. + WKPageDidFindStringMatchesCallback didFindStringMatches; + WKPageDidGetImageForMatchResultCallback didGetImageForMatchResult; +} WKPageFindMatchesClientV0; + +#ifdef __cplusplus +} +#endif + + +#endif // WKPageFindMatchesClient_h diff --git a/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.h b/Source/WebKit2/UIProcess/API/C/WKPageFormClient.h index eee1b9291..2e6b7aeb1 100644 --- a/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.h +++ b/Source/WebKit2/UIProcess/API/C/WKPageFormClient.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,25 +23,32 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKMediaCacheManager_h -#define WKMediaCacheManager_h +#ifndef WKPageFormClient_h +#define WKPageFormClient_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { #endif -WK_EXPORT WKTypeID WKMediaCacheManagerGetTypeID(); +// Form Client. +typedef void (*WKPageWillSubmitFormCallback)(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef userData, WKFormSubmissionListenerRef listener, const void* clientInfo); -typedef void (*WKMediaCacheManagerGetHostnamesWithMediaCacheFunction)(WKArrayRef, WKErrorRef, void*); -WK_EXPORT void WKMediaCacheManagerGetHostnamesWithMediaCache(WKMediaCacheManagerRef mediaCacheManager, void* context, WKMediaCacheManagerGetHostnamesWithMediaCacheFunction function); +typedef struct WKPageFormClientBase { + int version; + const void * clientInfo; +} WKPageFormClientBase; -WK_EXPORT void WKMediaCacheManagerClearCacheForHostname(WKMediaCacheManagerRef mediaCacheManager, WKStringRef hostname); -WK_EXPORT void WKMediaCacheManagerClearCacheForAllHostnames(WKMediaCacheManagerRef mediaCacheManager); +typedef struct WKPageFormClientV0 { + WKPageFormClientBase base; + + // Version 0. + WKPageWillSubmitFormCallback willSubmitForm; +} WKPageFormClientV0; #ifdef __cplusplus } #endif -#endif // WKMediaCacheManager_h +#endif // WKPageFormClient_h diff --git a/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp b/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp index 51298cd14..f1641dbbe 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "WKPageGroup.h" +#include "APIUserContentExtension.h" #include "WKAPICast.h" #include "WebPageGroup.h" #include "WebPreferences.h" @@ -55,7 +56,7 @@ void WKPageGroupSetPreferences(WKPageGroupRef pageGroupRef, WKPreferencesRef pre WKPreferencesRef WKPageGroupGetPreferences(WKPageGroupRef pageGroupRef) { - return toAPI(toImpl(pageGroupRef)->preferences()); + return toAPI(&toImpl(pageGroupRef)->preferences()); } void WKPageGroupAddUserStyleSheet(WKPageGroupRef pageGroupRef, WKStringRef sourceRef, WKURLRef baseURL, WKArrayRef whitelistedURLPatterns, WKArrayRef blacklistedURLPatterns, WKUserContentInjectedFrames injectedFrames) @@ -68,7 +69,7 @@ void WKPageGroupRemoveAllUserStyleSheets(WKPageGroupRef pageGroupRef) toImpl(pageGroupRef)->removeAllUserStyleSheets(); } -void WKPageGroupAddUserScript(WKPageGroupRef pageGroupRef, WKStringRef sourceRef, WKURLRef baseURL, WKArrayRef whitelistedURLPatterns, WKArrayRef blacklistedURLPatterns, WKUserContentInjectedFrames injectedFrames, WKUserScriptInjectionTime injectionTime) +void WKPageGroupAddUserScript(WKPageGroupRef pageGroupRef, WKStringRef sourceRef, WKURLRef baseURL, WKArrayRef whitelistedURLPatterns, WKArrayRef blacklistedURLPatterns, WKUserContentInjectedFrames injectedFrames, _WKUserScriptInjectionTime injectionTime) { toImpl(pageGroupRef)->addUserScript(toWTFString(sourceRef), toWTFString(baseURL), toImpl(whitelistedURLPatterns), toImpl(blacklistedURLPatterns), toUserContentInjectedFrames(injectedFrames), toUserScriptInjectionTime(injectionTime)); } @@ -77,3 +78,33 @@ void WKPageGroupRemoveAllUserScripts(WKPageGroupRef pageGroupRef) { toImpl(pageGroupRef)->removeAllUserScripts(); } + +void WKPageGroupAddUserContentFilter(WKPageGroupRef pageGroupRef, WKUserContentFilterRef userContentFilterRef) +{ +#if ENABLE(CONTENT_EXTENSIONS) + toImpl(pageGroupRef)->addUserContentExtension(*toImpl(userContentFilterRef)); +#else + UNUSED_PARAM(pageGroupRef); + UNUSED_PARAM(userContentFilterRef); +#endif +} + +void WKPageGroupRemoveUserContentFilter(WKPageGroupRef pageGroupRef, WKStringRef userContentFilterNameRef) +{ +#if ENABLE(CONTENT_EXTENSIONS) + toImpl(pageGroupRef)->removeUserContentExtension(toWTFString(userContentFilterNameRef)); +#else + UNUSED_PARAM(pageGroupRef); + UNUSED_PARAM(userContentFilterNameRef); +#endif +} + + +void WKPageGroupRemoveAllUserContentFilters(WKPageGroupRef pageGroupRef) +{ +#if ENABLE(CONTENT_EXTENSIONS) + toImpl(pageGroupRef)->removeAllUserContentExtensions(); +#else + UNUSED_PARAM(pageGroupRef); +#endif +} diff --git a/Source/WebKit2/UIProcess/API/C/WKPageGroup.h b/Source/WebKit2/UIProcess/API/C/WKPageGroup.h index 01edb51c6..b21455c10 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPageGroup.h +++ b/Source/WebKit2/UIProcess/API/C/WKPageGroup.h @@ -26,7 +26,9 @@ #ifndef WKPageGroup_h #define WKPageGroup_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKUserContentInjectedFrames.h> +#include <WebKit/WKUserScriptInjectionTime.h> #ifdef __cplusplus extern "C" { @@ -44,9 +46,13 @@ WK_EXPORT WKPreferencesRef WKPageGroupGetPreferences(WKPageGroupRef pageGroup); WK_EXPORT void WKPageGroupAddUserStyleSheet(WKPageGroupRef pageGroup, WKStringRef source, WKURLRef baseURL, WKArrayRef whitelistedURLPatterns, WKArrayRef blacklistedURLPatterns, WKUserContentInjectedFrames); WK_EXPORT void WKPageGroupRemoveAllUserStyleSheets(WKPageGroupRef pageGroup); -WK_EXPORT void WKPageGroupAddUserScript(WKPageGroupRef pageGroup, WKStringRef source, WKURLRef baseURL, WKArrayRef whitelistedURLPatterns, WKArrayRef blacklistedURLPatterns, WKUserContentInjectedFrames, WKUserScriptInjectionTime); +WK_EXPORT void WKPageGroupAddUserScript(WKPageGroupRef pageGroup, WKStringRef source, WKURLRef baseURL, WKArrayRef whitelistedURLPatterns, WKArrayRef blacklistedURLPatterns, WKUserContentInjectedFrames, _WKUserScriptInjectionTime); WK_EXPORT void WKPageGroupRemoveAllUserScripts(WKPageGroupRef pageGroup); +WK_EXPORT void WKPageGroupAddUserContentFilter(WKPageGroupRef pageGroup, WKUserContentFilterRef userContentFilter); +WK_EXPORT void WKPageGroupRemoveUserContentFilter(WKPageGroupRef pageGroup, WKStringRef userContentFilterName); +WK_EXPORT void WKPageGroupRemoveAllUserContentFilters(WKPageGroupRef pageGroup); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.cpp b/Source/WebKit2/UIProcess/API/C/WKPageInjectedBundleClient.h index 6e2ecce06..b22c3eb86 100644 --- a/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPageInjectedBundleClient.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,30 +23,26 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#include "WKMediaCacheManager.h" +#ifndef WKPageInjectedBundleClient_h +#define WKPageInjectedBundleClient_h -#include "WKAPICast.h" -#include "WebMediaCacheManagerProxy.h" +#include <WebKit/WKBase.h> -using namespace WebKit; +typedef void (*WKPageDidReceiveMessageFromInjectedBundleCallback)(WKPageRef page, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo); +typedef void (*WKPageDidReceiveSynchronousMessageFromInjectedBundleCallback)(WKPageRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData, const void *clientInfo); +typedef WKTypeRef (*WKPageGetInjectedBundleInitializationUserDataCallback)(WKPageRef page, const void *clientInfo); -WKTypeID WKMediaCacheManagerGetTypeID() -{ - return toAPI(WebMediaCacheManagerProxy::APIType); -} +typedef struct WKPageInjectedBundleClientBase { + int version; + const void * clientInfo; +} WKPageInjectedBundleClientBase; -void WKMediaCacheManagerGetHostnamesWithMediaCache(WKMediaCacheManagerRef mediaCacheManagerRef, void* context, WKMediaCacheManagerGetHostnamesWithMediaCacheFunction callback) -{ - toImpl(mediaCacheManagerRef)->getHostnamesWithMediaCache(ArrayCallback::create(context, callback)); -} +typedef struct WKPageInjectedBundleClientV0 { + WKPageInjectedBundleClientBase base; -void WKMediaCacheManagerClearCacheForHostname(WKMediaCacheManagerRef mediaCacheManagerRef, WKStringRef hostname) -{ - toImpl(mediaCacheManagerRef)->clearCacheForHostname(toWTFString(hostname)); -} + // Version 0. + WKPageDidReceiveMessageFromInjectedBundleCallback didReceiveMessageFromInjectedBundle; + WKPageDidReceiveSynchronousMessageFromInjectedBundleCallback didReceiveSynchronousMessageFromInjectedBundle; +} WKPageInjectedBundleClientV0; -void WKMediaCacheManagerClearCacheForAllHostnames(WKMediaCacheManagerRef mediaCacheManagerRef) -{ - toImpl(mediaCacheManagerRef)->clearCacheForAllHostnames(); -} +#endif // WKPageInjectedBundleClient_h diff --git a/Source/WebKit2/UIProcess/API/C/WKPageLoaderClient.h b/Source/WebKit2/UIProcess/API/C/WKPageLoaderClient.h new file mode 100644 index 000000000..c7c1cb011 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPageLoaderClient.h @@ -0,0 +1,469 @@ +/* + * Copyright (C) 2013 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKPageLoaderClient_h +#define WKPageLoaderClient_h + +#include <WebKit/WKBase.h> +#include <WebKit/WKErrorRef.h> +#include <WebKit/WKPageLoadTypes.h> +#include <WebKit/WKPluginLoadPolicy.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKWebGLLoadPolicyBlocked = 0, + kWKWebGLLoadPolicyLoadNormally, + kWKWebGLLoadPolicyPending +}; +typedef uint32_t WKWebGLLoadPolicy; + +typedef void (*WKPageLoaderClientCallback)(WKPageRef page, const void* clientInfo); +typedef void (*WKPageDidStartProvisionalLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFailProvisionalLoadWithErrorForFrameCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidCommitLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFinishDocumentLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFinishLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFailLoadWithErrorForFrameCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidSameDocumentNavigationForFrameCallback)(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidReceiveTitleForFrameCallback)(WKPageRef page, WKStringRef title, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFirstLayoutForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidRemoveFrameFromHierarchyCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidDisplayInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidRunInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidDetectXSSForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef bool (*WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback)(WKPageRef page, WKFrameRef frame, WKProtectionSpaceRef protectionSpace, const void *clientInfo); +typedef void (*WKPageDidReceiveAuthenticationChallengeInFrameCallback)(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo); +typedef void (*WKPageDidChangeBackForwardListCallback)(WKPageRef page, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void *clientInfo); +typedef bool (*WKPageShouldGoToBackForwardListItemCallback)(WKPageRef page, WKBackForwardListItemRef item, const void *clientInfo); +typedef bool (*WKPageShouldKeepCurrentBackForwardListItemInListCallback)(WKPageRef page, WKBackForwardListItemRef item, const void *clientInfo); +typedef void (*WKPageWillGoToBackForwardListItemCallback)(WKPageRef page, WKBackForwardListItemRef item, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidLayoutCallback)(WKPageRef page, WKLayoutMilestones milestones, WKTypeRef userData, const void *clientInfo); +typedef WKPluginLoadPolicy (*WKPagePluginLoadPolicyCallback)(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInfoDictionary, WKStringRef* unavailabilityDescription, const void* clientInfo); +typedef void (*WKPagePluginDidFailCallback)(WKPageRef page, uint32_t errorCode, WKDictionaryRef pluginInfoDictionary, const void* clientInfo); +typedef WKWebGLLoadPolicy (*WKPageWebGLLoadPolicyCallback)(WKPageRef page, WKStringRef url, const void* clientInfo); +typedef void (*WKPageNavigationGestureDidBeginCallback)(WKPageRef page, const void* clientInfo); +typedef void (*WKPageNavigationGestureWillEndCallback)(WKPageRef page, bool willNavigate, WKBackForwardListItemRef item, const void* clientInfo); +typedef void (*WKPageNavigationGestureDidEndCallback)(WKPageRef page, bool willNavigate, WKBackForwardListItemRef item, const void* clientInfo); + +// Deprecated +typedef void (*WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef mimeType, const void* clientInfo); +typedef void (*WKPagePluginDidFailCallback_deprecatedForUseWithV1)(WKPageRef page, uint32_t errorCode, WKStringRef mimeType, WKStringRef pluginIdentifier, WKStringRef pluginVersion, const void* clientInfo); +typedef WKPluginLoadPolicy (*WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2)(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInfoDictionary, const void* clientInfo); + +typedef struct WKPageLoaderClientBase { + int version; + const void * clientInfo; +} WKPageLoaderClientBase; + +typedef struct WKPageLoaderClientV0 { + WKPageLoaderClientBase base; + + // Version 0. + WKPageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame; + WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame; + WKPageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame; + WKPageDidCommitLoadForFrameCallback didCommitLoadForFrame; + WKPageDidFinishDocumentLoadForFrameCallback didFinishDocumentLoadForFrame; + WKPageDidFinishLoadForFrameCallback didFinishLoadForFrame; + WKPageDidFailLoadWithErrorForFrameCallback didFailLoadWithErrorForFrame; + WKPageDidSameDocumentNavigationForFrameCallback didSameDocumentNavigationForFrame; + WKPageDidReceiveTitleForFrameCallback didReceiveTitleForFrame; + WKPageDidFirstLayoutForFrameCallback didFirstLayoutForFrame; + WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback didFirstVisuallyNonEmptyLayoutForFrame; + WKPageDidRemoveFrameFromHierarchyCallback didRemoveFrameFromHierarchy; + WKPageDidDisplayInsecureContentForFrameCallback didDisplayInsecureContentForFrame; + WKPageDidRunInsecureContentForFrameCallback didRunInsecureContentForFrame; + WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback canAuthenticateAgainstProtectionSpaceInFrame; + WKPageDidReceiveAuthenticationChallengeInFrameCallback didReceiveAuthenticationChallengeInFrame; + + // FIXME: Move to progress client. + WKPageLoaderClientCallback didStartProgress; + WKPageLoaderClientCallback didChangeProgress; + WKPageLoaderClientCallback didFinishProgress; + + // FIXME: These three functions should not be part of this client. + WKPageLoaderClientCallback processDidBecomeUnresponsive; + WKPageLoaderClientCallback processDidBecomeResponsive; + WKPageLoaderClientCallback processDidCrash; + WKPageDidChangeBackForwardListCallback didChangeBackForwardList; + WKPageShouldGoToBackForwardListItemCallback shouldGoToBackForwardListItem; + WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0 didFailToInitializePlugin_deprecatedForUseWithV0; +} WKPageLoaderClientV0; + +typedef struct WKPageLoaderClientV1 { + WKPageLoaderClientBase base; + + // Version -. + WKPageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame; + WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame; + WKPageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame; + WKPageDidCommitLoadForFrameCallback didCommitLoadForFrame; + WKPageDidFinishDocumentLoadForFrameCallback didFinishDocumentLoadForFrame; + WKPageDidFinishLoadForFrameCallback didFinishLoadForFrame; + WKPageDidFailLoadWithErrorForFrameCallback didFailLoadWithErrorForFrame; + WKPageDidSameDocumentNavigationForFrameCallback didSameDocumentNavigationForFrame; + WKPageDidReceiveTitleForFrameCallback didReceiveTitleForFrame; + WKPageDidFirstLayoutForFrameCallback didFirstLayoutForFrame; + WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback didFirstVisuallyNonEmptyLayoutForFrame; + WKPageDidRemoveFrameFromHierarchyCallback didRemoveFrameFromHierarchy; + WKPageDidDisplayInsecureContentForFrameCallback didDisplayInsecureContentForFrame; + WKPageDidRunInsecureContentForFrameCallback didRunInsecureContentForFrame; + WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback canAuthenticateAgainstProtectionSpaceInFrame; + WKPageDidReceiveAuthenticationChallengeInFrameCallback didReceiveAuthenticationChallengeInFrame; + + // FIXME: Move to progress client. + WKPageLoaderClientCallback didStartProgress; + WKPageLoaderClientCallback didChangeProgress; + WKPageLoaderClientCallback didFinishProgress; + + // FIXME: These three functions should not be part of this client. + WKPageLoaderClientCallback processDidBecomeUnresponsive; + WKPageLoaderClientCallback processDidBecomeResponsive; + WKPageLoaderClientCallback processDidCrash; + WKPageDidChangeBackForwardListCallback didChangeBackForwardList; + WKPageShouldGoToBackForwardListItemCallback shouldGoToBackForwardListItem; + WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0 didFailToInitializePlugin_deprecatedForUseWithV0; + + // Version 1. + WKPageDidDetectXSSForFrameCallback didDetectXSSForFrame; + + void* didNewFirstVisuallyNonEmptyLayout_unavailable; + + WKPageWillGoToBackForwardListItemCallback willGoToBackForwardListItem; + + WKPageLoaderClientCallback interactionOccurredWhileProcessUnresponsive; + WKPagePluginDidFailCallback_deprecatedForUseWithV1 pluginDidFail_deprecatedForUseWithV1; +} WKPageLoaderClientV1; + +typedef struct WKPageLoaderClientV2 { + WKPageLoaderClientBase base; + + // Version 0. + WKPageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame; + WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame; + WKPageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame; + WKPageDidCommitLoadForFrameCallback didCommitLoadForFrame; + WKPageDidFinishDocumentLoadForFrameCallback didFinishDocumentLoadForFrame; + WKPageDidFinishLoadForFrameCallback didFinishLoadForFrame; + WKPageDidFailLoadWithErrorForFrameCallback didFailLoadWithErrorForFrame; + WKPageDidSameDocumentNavigationForFrameCallback didSameDocumentNavigationForFrame; + WKPageDidReceiveTitleForFrameCallback didReceiveTitleForFrame; + WKPageDidFirstLayoutForFrameCallback didFirstLayoutForFrame; + WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback didFirstVisuallyNonEmptyLayoutForFrame; + WKPageDidRemoveFrameFromHierarchyCallback didRemoveFrameFromHierarchy; + WKPageDidDisplayInsecureContentForFrameCallback didDisplayInsecureContentForFrame; + WKPageDidRunInsecureContentForFrameCallback didRunInsecureContentForFrame; + WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback canAuthenticateAgainstProtectionSpaceInFrame; + WKPageDidReceiveAuthenticationChallengeInFrameCallback didReceiveAuthenticationChallengeInFrame; + + // FIXME: Move to progress client. + WKPageLoaderClientCallback didStartProgress; + WKPageLoaderClientCallback didChangeProgress; + WKPageLoaderClientCallback didFinishProgress; + + // FIXME: These three functions should not be part of this client. + WKPageLoaderClientCallback processDidBecomeUnresponsive; + WKPageLoaderClientCallback processDidBecomeResponsive; + WKPageLoaderClientCallback processDidCrash; + WKPageDidChangeBackForwardListCallback didChangeBackForwardList; + WKPageShouldGoToBackForwardListItemCallback shouldGoToBackForwardListItem; + WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0 didFailToInitializePlugin_deprecatedForUseWithV0; + + // Version 1. + WKPageDidDetectXSSForFrameCallback didDetectXSSForFrame; + + void* didNewFirstVisuallyNonEmptyLayout_unavailable; + + WKPageWillGoToBackForwardListItemCallback willGoToBackForwardListItem; + + WKPageLoaderClientCallback interactionOccurredWhileProcessUnresponsive; + WKPagePluginDidFailCallback_deprecatedForUseWithV1 pluginDidFail_deprecatedForUseWithV1; + + // Version 2. + void (*didReceiveIntentForFrame_unavailable)(void); + void (*registerIntentServiceForFrame_unavailable)(void); + + WKPageDidLayoutCallback didLayout; + WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2 pluginLoadPolicy_deprecatedForUseWithV2; + WKPagePluginDidFailCallback pluginDidFail; +} WKPageLoaderClientV2; + +typedef struct WKPageLoaderClientV3 { + WKPageLoaderClientBase base; + + // Version 0. + WKPageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame; + WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame; + WKPageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame; + WKPageDidCommitLoadForFrameCallback didCommitLoadForFrame; + WKPageDidFinishDocumentLoadForFrameCallback didFinishDocumentLoadForFrame; + WKPageDidFinishLoadForFrameCallback didFinishLoadForFrame; + WKPageDidFailLoadWithErrorForFrameCallback didFailLoadWithErrorForFrame; + WKPageDidSameDocumentNavigationForFrameCallback didSameDocumentNavigationForFrame; + WKPageDidReceiveTitleForFrameCallback didReceiveTitleForFrame; + WKPageDidFirstLayoutForFrameCallback didFirstLayoutForFrame; + WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback didFirstVisuallyNonEmptyLayoutForFrame; + WKPageDidRemoveFrameFromHierarchyCallback didRemoveFrameFromHierarchy; + WKPageDidDisplayInsecureContentForFrameCallback didDisplayInsecureContentForFrame; + WKPageDidRunInsecureContentForFrameCallback didRunInsecureContentForFrame; + WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback canAuthenticateAgainstProtectionSpaceInFrame; + WKPageDidReceiveAuthenticationChallengeInFrameCallback didReceiveAuthenticationChallengeInFrame; + + // FIXME: Move to progress client. + WKPageLoaderClientCallback didStartProgress; + WKPageLoaderClientCallback didChangeProgress; + WKPageLoaderClientCallback didFinishProgress; + + // FIXME: These three functions should not be part of this client. + WKPageLoaderClientCallback processDidBecomeUnresponsive; + WKPageLoaderClientCallback processDidBecomeResponsive; + WKPageLoaderClientCallback processDidCrash; + WKPageDidChangeBackForwardListCallback didChangeBackForwardList; + WKPageShouldGoToBackForwardListItemCallback shouldGoToBackForwardListItem; + WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0 didFailToInitializePlugin_deprecatedForUseWithV0; + + // Version 1. + WKPageDidDetectXSSForFrameCallback didDetectXSSForFrame; + + void* didNewFirstVisuallyNonEmptyLayout_unavailable; + + WKPageWillGoToBackForwardListItemCallback willGoToBackForwardListItem; + + WKPageLoaderClientCallback interactionOccurredWhileProcessUnresponsive; + WKPagePluginDidFailCallback_deprecatedForUseWithV1 pluginDidFail_deprecatedForUseWithV1; + + // Version 2. + void (*didReceiveIntentForFrame_unavailable)(void); + void (*registerIntentServiceForFrame_unavailable)(void); + + WKPageDidLayoutCallback didLayout; + WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2 pluginLoadPolicy_deprecatedForUseWithV2; + WKPagePluginDidFailCallback pluginDidFail; + + // Version 3. + WKPagePluginLoadPolicyCallback pluginLoadPolicy; +} WKPageLoaderClientV3; + +typedef struct WKPageLoaderClientV4 { + WKPageLoaderClientBase base; + + // Version 0. + WKPageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame; + WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame; + WKPageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame; + WKPageDidCommitLoadForFrameCallback didCommitLoadForFrame; + WKPageDidFinishDocumentLoadForFrameCallback didFinishDocumentLoadForFrame; + WKPageDidFinishLoadForFrameCallback didFinishLoadForFrame; + WKPageDidFailLoadWithErrorForFrameCallback didFailLoadWithErrorForFrame; + WKPageDidSameDocumentNavigationForFrameCallback didSameDocumentNavigationForFrame; + WKPageDidReceiveTitleForFrameCallback didReceiveTitleForFrame; + WKPageDidFirstLayoutForFrameCallback didFirstLayoutForFrame; + WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback didFirstVisuallyNonEmptyLayoutForFrame; + WKPageDidRemoveFrameFromHierarchyCallback didRemoveFrameFromHierarchy; + WKPageDidDisplayInsecureContentForFrameCallback didDisplayInsecureContentForFrame; + WKPageDidRunInsecureContentForFrameCallback didRunInsecureContentForFrame; + WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback canAuthenticateAgainstProtectionSpaceInFrame; + WKPageDidReceiveAuthenticationChallengeInFrameCallback didReceiveAuthenticationChallengeInFrame; + + // FIXME: Move to progress client. + WKPageLoaderClientCallback didStartProgress; + WKPageLoaderClientCallback didChangeProgress; + WKPageLoaderClientCallback didFinishProgress; + + // FIXME: These three functions should not be part of this client. + WKPageLoaderClientCallback processDidBecomeUnresponsive; + WKPageLoaderClientCallback processDidBecomeResponsive; + WKPageLoaderClientCallback processDidCrash; + WKPageDidChangeBackForwardListCallback didChangeBackForwardList; + WKPageShouldGoToBackForwardListItemCallback shouldGoToBackForwardListItem; + WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0 didFailToInitializePlugin_deprecatedForUseWithV0; + + // Version 1. + WKPageDidDetectXSSForFrameCallback didDetectXSSForFrame; + + void* didNewFirstVisuallyNonEmptyLayout_unavailable; + + WKPageWillGoToBackForwardListItemCallback willGoToBackForwardListItem; + + WKPageLoaderClientCallback interactionOccurredWhileProcessUnresponsive; + WKPagePluginDidFailCallback_deprecatedForUseWithV1 pluginDidFail_deprecatedForUseWithV1; + + // Version 2. + void (*didReceiveIntentForFrame_unavailable)(void); + void (*registerIntentServiceForFrame_unavailable)(void); + + WKPageDidLayoutCallback didLayout; + WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2 pluginLoadPolicy_deprecatedForUseWithV2; + WKPagePluginDidFailCallback pluginDidFail; + + // Version 3. + WKPagePluginLoadPolicyCallback pluginLoadPolicy; + + // Version 4 + WKPageWebGLLoadPolicyCallback webGLLoadPolicy; + WKPageWebGLLoadPolicyCallback resolveWebGLLoadPolicy; +} WKPageLoaderClientV4; + +typedef struct WKPageLoaderClientV5 { + WKPageLoaderClientBase base; + + // Version 0. + WKPageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame; + WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame; + WKPageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame; + WKPageDidCommitLoadForFrameCallback didCommitLoadForFrame; + WKPageDidFinishDocumentLoadForFrameCallback didFinishDocumentLoadForFrame; + WKPageDidFinishLoadForFrameCallback didFinishLoadForFrame; + WKPageDidFailLoadWithErrorForFrameCallback didFailLoadWithErrorForFrame; + WKPageDidSameDocumentNavigationForFrameCallback didSameDocumentNavigationForFrame; + WKPageDidReceiveTitleForFrameCallback didReceiveTitleForFrame; + WKPageDidFirstLayoutForFrameCallback didFirstLayoutForFrame; + WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback didFirstVisuallyNonEmptyLayoutForFrame; + WKPageDidRemoveFrameFromHierarchyCallback didRemoveFrameFromHierarchy; + WKPageDidDisplayInsecureContentForFrameCallback didDisplayInsecureContentForFrame; + WKPageDidRunInsecureContentForFrameCallback didRunInsecureContentForFrame; + WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback canAuthenticateAgainstProtectionSpaceInFrame; + WKPageDidReceiveAuthenticationChallengeInFrameCallback didReceiveAuthenticationChallengeInFrame; + + // FIXME: Move to progress client. + WKPageLoaderClientCallback didStartProgress; + WKPageLoaderClientCallback didChangeProgress; + WKPageLoaderClientCallback didFinishProgress; + + // FIXME: These three functions should not be part of this client. + WKPageLoaderClientCallback processDidBecomeUnresponsive; + WKPageLoaderClientCallback processDidBecomeResponsive; + WKPageLoaderClientCallback processDidCrash; + WKPageDidChangeBackForwardListCallback didChangeBackForwardList; + WKPageShouldGoToBackForwardListItemCallback shouldGoToBackForwardListItem; + WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0 didFailToInitializePlugin_deprecatedForUseWithV0; + + // Version 1. + WKPageDidDetectXSSForFrameCallback didDetectXSSForFrame; + + void* didNewFirstVisuallyNonEmptyLayout_unavailable; + + WKPageWillGoToBackForwardListItemCallback willGoToBackForwardListItem; + + WKPageLoaderClientCallback interactionOccurredWhileProcessUnresponsive; + WKPagePluginDidFailCallback_deprecatedForUseWithV1 pluginDidFail_deprecatedForUseWithV1; + + // Version 2. + void (*didReceiveIntentForFrame_unavailable)(void); + void (*registerIntentServiceForFrame_unavailable)(void); + + WKPageDidLayoutCallback didLayout; + WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2 pluginLoadPolicy_deprecatedForUseWithV2; + WKPagePluginDidFailCallback pluginDidFail; + + // Version 3. + WKPagePluginLoadPolicyCallback pluginLoadPolicy; + + // Version 4. + WKPageWebGLLoadPolicyCallback webGLLoadPolicy; + WKPageWebGLLoadPolicyCallback resolveWebGLLoadPolicy; + + // Version 5. + WKPageShouldKeepCurrentBackForwardListItemInListCallback shouldKeepCurrentBackForwardListItemInList; +} WKPageLoaderClientV5; + +typedef struct WKPageLoaderClientV6 { + WKPageLoaderClientBase base; + + // Version 0. + WKPageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame; + WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame; + WKPageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame; + WKPageDidCommitLoadForFrameCallback didCommitLoadForFrame; + WKPageDidFinishDocumentLoadForFrameCallback didFinishDocumentLoadForFrame; + WKPageDidFinishLoadForFrameCallback didFinishLoadForFrame; + WKPageDidFailLoadWithErrorForFrameCallback didFailLoadWithErrorForFrame; + WKPageDidSameDocumentNavigationForFrameCallback didSameDocumentNavigationForFrame; + WKPageDidReceiveTitleForFrameCallback didReceiveTitleForFrame; + WKPageDidFirstLayoutForFrameCallback didFirstLayoutForFrame; + WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback didFirstVisuallyNonEmptyLayoutForFrame; + WKPageDidRemoveFrameFromHierarchyCallback didRemoveFrameFromHierarchy; + WKPageDidDisplayInsecureContentForFrameCallback didDisplayInsecureContentForFrame; + WKPageDidRunInsecureContentForFrameCallback didRunInsecureContentForFrame; + WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback canAuthenticateAgainstProtectionSpaceInFrame; + WKPageDidReceiveAuthenticationChallengeInFrameCallback didReceiveAuthenticationChallengeInFrame; + + // FIXME: Move to progress client. + WKPageLoaderClientCallback didStartProgress; + WKPageLoaderClientCallback didChangeProgress; + WKPageLoaderClientCallback didFinishProgress; + + // FIXME: These three functions should not be part of this client. + WKPageLoaderClientCallback processDidBecomeUnresponsive; + WKPageLoaderClientCallback processDidBecomeResponsive; + WKPageLoaderClientCallback processDidCrash; + WKPageDidChangeBackForwardListCallback didChangeBackForwardList; + WKPageShouldGoToBackForwardListItemCallback shouldGoToBackForwardListItem; + WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0 didFailToInitializePlugin_deprecatedForUseWithV0; + + // Version 1. + WKPageDidDetectXSSForFrameCallback didDetectXSSForFrame; + + void* didNewFirstVisuallyNonEmptyLayout_unavailable; + + WKPageWillGoToBackForwardListItemCallback willGoToBackForwardListItem; + + WKPageLoaderClientCallback interactionOccurredWhileProcessUnresponsive; + WKPagePluginDidFailCallback_deprecatedForUseWithV1 pluginDidFail_deprecatedForUseWithV1; + + // Version 2. + void (*didReceiveIntentForFrame_unavailable)(void); + void (*registerIntentServiceForFrame_unavailable)(void); + + WKPageDidLayoutCallback didLayout; + WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2 pluginLoadPolicy_deprecatedForUseWithV2; + WKPagePluginDidFailCallback pluginDidFail; + + // Version 3. + WKPagePluginLoadPolicyCallback pluginLoadPolicy; + + // Version 4. + WKPageWebGLLoadPolicyCallback webGLLoadPolicy; + WKPageWebGLLoadPolicyCallback resolveWebGLLoadPolicy; + + // Version 5. + WKPageShouldKeepCurrentBackForwardListItemInListCallback shouldKeepCurrentBackForwardListItemInList; + + // Version 6. + WKPageNavigationGestureDidBeginCallback navigationGestureDidBegin; + WKPageNavigationGestureWillEndCallback navigationGestureWillEnd; + WKPageNavigationGestureDidEndCallback navigationGestureDidEnd; +} WKPageLoaderClientV6; + +#ifdef __cplusplus +} +#endif + +#endif // WKPageLoaderClient_h diff --git a/Source/WebKit2/UIProcess/API/C/WKPageNavigationClient.h b/Source/WebKit2/UIProcess/API/C/WKPageNavigationClient.h new file mode 100644 index 000000000..e19cf9741 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPageNavigationClient.h @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKPageNavigationClient_h +#define WKPageNavigationClient_h + +#include <WebKit/WKBase.h> +#include <WebKit/WKPageLoadTypes.h> +#include <WebKit/WKPageRenderingProgressEvents.h> +#include <WebKit/WKPluginLoadPolicy.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*WKPageNavigationDecidePolicyForNavigationActionCallback)(WKPageRef page, WKNavigationActionRef navigationAction, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); + +typedef void (*WKPageNavigationDecidePolicyForNavigationResponseCallback)(WKPageRef page, WKNavigationResponseRef navigationResponse, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); + +typedef void (*WKPageNavigationDidStartProvisionalNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo); + +typedef void (*WKPageNavigationDidReceiveServerRedirectForProvisionalNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo); + +typedef void (*WKPageNavigationDidFailProvisionalNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKErrorRef error, WKTypeRef userData, const void* clientInfo); + +typedef void (*WKPageNavigationDidCommitNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo); + +typedef void (*WKPageNavigationDidFinishNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo); + +typedef void (*WKPageNavigationDidFailNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKErrorRef error, WKTypeRef userData, const void* clientInfo); + +typedef void (*WKPageNavigationDidFailProvisionalLoadInSubframeCallback)(WKPageRef page, WKNavigationRef navigation, WKFrameInfoRef subframe, WKErrorRef error, WKTypeRef userData, const void* clientInfo); + +typedef void (*WKPageNavigationDidFinishDocumentLoadCallback)(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo); + +typedef void (*WKPageNavigationDidSameDocumentNavigationCallback)(WKPageRef page, WKNavigationRef navigation, WKSameDocumentNavigationType navigationType, WKTypeRef userData, const void* clientInfo); + +typedef void (*WKPageNavigationRenderingProgressDidChangeCallback)(WKPageRef page, WKPageRenderingProgressEvents progressEvents, WKTypeRef userData, const void* clientInfo); + +typedef bool (*WKPageNavigationCanAuthenticateAgainstProtectionSpaceCallback)(WKPageRef page, WKProtectionSpaceRef protectionSpace, const void* clientInfo); + +typedef void (*WKPageNavigationDidReceiveAuthenticationChallengeCallback)(WKPageRef page, WKAuthenticationChallengeRef challenge, const void* clientInfo); + +typedef void (*WKPageNavigationWebProcessDidCrashCallback)(WKPageRef page, const void* clientInfo); + +typedef WKDataRef (*WKPageNavigationCopyWebCryptoMasterKeyCallback)(WKPageRef page, const void* clientInfo); + +typedef WKPluginLoadPolicy (*WKPageNavigationDecidePolicyForPluginLoadCallback)(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInfoDictionary, WKStringRef* unavailabilityDescription, const void* clientInfo); + +typedef void (*WKPageNavigationDidBeginNavigationGesture)(WKPageRef page, const void* clientInfo); + +typedef void (*WKPageNavigationWillEndNavigationGesture)(WKPageRef page, WKBackForwardListItemRef backForwardListItem, const void* clientInfo); + +typedef void (*WKPageNavigationDidEndNavigationGesture)(WKPageRef page, WKBackForwardListItemRef backForwardListItem, const void* clientInfo); + +typedef void (*WKPageNavigationDidRemoveNavigationGestureSnapshot)(WKPageRef page, const void* clientInfo); + + +typedef struct WKPageNavigationClientBase { + int version; + const void* clientInfo; +} WKPageNavigationClientBase; + +typedef struct WKPageNavigationClientV0 { + WKPageNavigationClientBase base; + + // Version 0. + WKPageNavigationDecidePolicyForNavigationActionCallback decidePolicyForNavigationAction; + WKPageNavigationDecidePolicyForNavigationResponseCallback decidePolicyForNavigationResponse; + WKPageNavigationDecidePolicyForPluginLoadCallback decidePolicyForPluginLoad; + WKPageNavigationDidStartProvisionalNavigationCallback didStartProvisionalNavigation; + WKPageNavigationDidReceiveServerRedirectForProvisionalNavigationCallback didReceiveServerRedirectForProvisionalNavigation; + WKPageNavigationDidFailProvisionalNavigationCallback didFailProvisionalNavigation; + WKPageNavigationDidCommitNavigationCallback didCommitNavigation; + WKPageNavigationDidFinishNavigationCallback didFinishNavigation; + WKPageNavigationDidFailNavigationCallback didFailNavigation; + WKPageNavigationDidFailProvisionalLoadInSubframeCallback didFailProvisionalLoadInSubframe; + WKPageNavigationDidFinishDocumentLoadCallback didFinishDocumentLoad; + WKPageNavigationDidSameDocumentNavigationCallback didSameDocumentNavigation; + WKPageNavigationRenderingProgressDidChangeCallback renderingProgressDidChange; + WKPageNavigationCanAuthenticateAgainstProtectionSpaceCallback canAuthenticateAgainstProtectionSpace; + WKPageNavigationDidReceiveAuthenticationChallengeCallback didReceiveAuthenticationChallenge; + WKPageNavigationWebProcessDidCrashCallback webProcessDidCrash; + WKPageNavigationCopyWebCryptoMasterKeyCallback copyWebCryptoMasterKey; + + WKPageNavigationDidBeginNavigationGesture didBeginNavigationGesture; + WKPageNavigationWillEndNavigationGesture willEndNavigationGesture; + WKPageNavigationDidEndNavigationGesture didEndNavigationGesture; + WKPageNavigationDidRemoveNavigationGestureSnapshot didRemoveNavigationGestureSnapshot; +} WKPageNavigationClientV0; + +#ifdef __cplusplus +} +#endif + +#endif // WKPageNavigationClient_h diff --git a/Source/WebKit2/UIProcess/API/C/WKPagePolicyClient.h b/Source/WebKit2/UIProcess/API/C/WKPagePolicyClient.h new file mode 100644 index 000000000..121c1018a --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPagePolicyClient.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2013 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKPagePolicyClient_h +#define WKPagePolicyClient_h + +#include <WebKit/WKBase.h> +#include <WebKit/WKEvent.h> +#include <WebKit/WKPageLoadTypes.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*WKPageDecidePolicyForNavigationActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKFrameRef originatingFrame, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); +typedef void (*WKPageDecidePolicyForNewWindowActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); +typedef void (*WKPageDecidePolicyForResponseCallback_deprecatedForUseWithV0)(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); +typedef void (*WKPageUnableToImplementPolicyCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void* clientInfo); + +typedef void (*WKPageDecidePolicyForNavigationActionCallback_deprecatedForUseWithV0)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); +typedef void (*WKPageDecidePolicyForResponseCallback)(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, bool canShowMIMEType, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); + +typedef struct WKPagePolicyClientBase { + int version; + const void * clientInfo; +} WKPagePolicyClientBase; + +typedef struct WKPagePolicyClientV0 { + WKPagePolicyClientBase base; + + // Version 0. + WKPageDecidePolicyForNavigationActionCallback_deprecatedForUseWithV0 decidePolicyForNavigationAction_deprecatedForUseWithV0; + WKPageDecidePolicyForNewWindowActionCallback decidePolicyForNewWindowAction; + WKPageDecidePolicyForResponseCallback_deprecatedForUseWithV0 decidePolicyForResponse_deprecatedForUseWithV0; + WKPageUnableToImplementPolicyCallback unableToImplementPolicy; +} WKPagePolicyClientV0; + +typedef struct WKPagePolicyClientV1 { + WKPagePolicyClientBase base; + + // Version 0. + WKPageDecidePolicyForNavigationActionCallback_deprecatedForUseWithV0 decidePolicyForNavigationAction_deprecatedForUseWithV0; + WKPageDecidePolicyForNewWindowActionCallback decidePolicyForNewWindowAction; + WKPageDecidePolicyForResponseCallback_deprecatedForUseWithV0 decidePolicyForResponse_deprecatedForUseWithV0; + WKPageUnableToImplementPolicyCallback unableToImplementPolicy; + + // Version 1. + WKPageDecidePolicyForNavigationActionCallback decidePolicyForNavigationAction; + WKPageDecidePolicyForResponseCallback decidePolicyForResponse; +} WKPagePolicyClientV1; + +#ifdef __cplusplus +} +#endif + +#endif // WKPagePolicyClient_h diff --git a/Source/WebKit2/UIProcess/API/C/WKPagePolicyClientInternal.h b/Source/WebKit2/UIProcess/API/C/WKPagePolicyClientInternal.h new file mode 100644 index 000000000..a6447a249 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPagePolicyClientInternal.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2013 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKPagePolicyClientInternal_h +#define WKPagePolicyClientInternal_h + +#include "WKPagePolicyClient.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*WKPageDecidePolicyForNavigationActionCallback_internal)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKFrameRef originatingFrame, WKURLRequestRef originalRequest, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); + +typedef struct WKPagePolicyClientInternal { + WKPagePolicyClientBase base; + + // Version 0. + WKPageDecidePolicyForNavigationActionCallback_deprecatedForUseWithV0 decidePolicyForNavigationAction_deprecatedForUseWithV0; + WKPageDecidePolicyForNewWindowActionCallback decidePolicyForNewWindowAction; + WKPageDecidePolicyForResponseCallback_deprecatedForUseWithV0 decidePolicyForResponse_deprecatedForUseWithV0; + WKPageUnableToImplementPolicyCallback unableToImplementPolicy; + + // Version 1. + WKPageDecidePolicyForNavigationActionCallback decidePolicyForNavigationAction_deprecatedForUseWithV1; + WKPageDecidePolicyForResponseCallback decidePolicyForResponse; + + // Internal. + WKPageDecidePolicyForNavigationActionCallback_internal decidePolicyForNavigationAction; +} WKPagePolicyClientInternal; + +#ifdef __cplusplus +} +#endif + +#endif // WKPagePolicyClientInternal_h diff --git a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h index 114990aa3..3c361182e 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h @@ -26,8 +26,8 @@ #ifndef WKPagePrivate_h #define WKPagePrivate_h -#include <WebKit2/WKBase.h> -#include <WebKit2/WKPage.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKPage.h> #ifdef __cplusplus extern "C" { @@ -36,11 +36,6 @@ extern "C" { typedef void (*WKPageRenderTreeExternalRepresentationFunction)(WKStringRef, WKErrorRef, void*); WK_EXPORT void WKPageRenderTreeExternalRepresentation(WKPageRef page, void *context, WKPageRenderTreeExternalRepresentationFunction function); -#ifdef __BLOCKS__ -typedef void (^WKPageRenderTreeExternalRepresentationBlock)(WKStringRef, WKErrorRef); -WK_EXPORT void WKPageRenderTreeExternalRepresentation_b(WKPageRef page, WKPageRenderTreeExternalRepresentationBlock block); -#endif - enum { kWKDebugFlashViewUpdates = 1 << 0, kWKDebugFlashBackingStoreUpdates = 1 << 1 @@ -69,6 +64,8 @@ WK_EXPORT void WKPageSetPageLength(WKPageRef page, double pageLength); WK_EXPORT double WKPageGetPageLength(WKPageRef page); WK_EXPORT void WKPageSetGapBetweenPages(WKPageRef page, double gap); WK_EXPORT double WKPageGetGapBetweenPages(WKPageRef page); +WK_EXPORT void WKPageSetPaginationLineGridEnabled(WKPageRef page, bool lineGridEnabled); +WK_EXPORT bool WKPageGetPaginationLineGridEnabled(WKPageRef page); WK_EXPORT unsigned WKPageGetPageCount(WKPageRef page); @@ -87,18 +84,19 @@ WK_EXPORT void WKPageBeginPrinting(WKPageRef page, WKFrameRef frame, WKPrintInfo WK_EXPORT void WKPageDrawPagesToPDF(WKPageRef page, WKFrameRef frame, WKPrintInfo printInfo, uint32_t first, uint32_t count, WKPageDrawToPDFFunction callback, void* context); WK_EXPORT void WKPageEndPrinting(WKPageRef page); -// FIXME https://bugs.webkit.org/show_bug.cgi?id=66979: Remove this sync call. -WK_EXPORT WKImageRef WKPageCreateSnapshotOfVisibleContent(WKPageRef page); - -WK_EXPORT void WKPageSetShouldSendEventsSynchronously(WKPageRef page, bool sync); +WK_EXPORT bool WKPageGetAllowsRemoteInspection(WKPageRef page); +WK_EXPORT void WKPageSetAllowsRemoteInspection(WKPageRef page, bool allow); WK_EXPORT void WKPageSetMediaVolume(WKPageRef page, float volume); WK_EXPORT void WKPageSetMayStartMediaWhenInWindow(WKPageRef page, bool mayStartMedia); -WK_EXPORT WKArrayRef WKPageCopyRelatedPages(WKPageRef page); +typedef void (*WKPageGetBytecodeProfileFunction)(WKStringRef, WKErrorRef, void*); +WK_EXPORT void WKPageGetBytecodeProfile(WKPageRef page, void* context, WKPageGetBytecodeProfileFunction function); -typedef void (*WKPageInvalidMessageFunction)(uint32_t messageID); -WK_EXPORT void WKPageSetInvalidMessageFunction(WKPageInvalidMessageFunction function); +typedef void (*WKPageIsWebProcessResponsiveFunction)(bool isWebProcessResponsive, void* context); +WK_EXPORT void WKPageIsWebProcessResponsive(WKPageRef page, void* context, WKPageIsWebProcessResponsiveFunction function); + +WK_EXPORT WKArrayRef WKPageCopyRelatedPages(WKPageRef page); enum { kWKScrollPinningBehaviorDoNotPin, @@ -110,6 +108,27 @@ typedef uint32_t WKScrollPinningBehavior; WK_EXPORT WKScrollPinningBehavior WKPageGetScrollPinningBehavior(WKPageRef page); WK_EXPORT void WKPageSetScrollPinningBehavior(WKPageRef page, WKScrollPinningBehavior pinning); +WK_EXPORT bool WKPageGetAddsVisitedLinks(WKPageRef page); +WK_EXPORT void WKPageSetAddsVisitedLinks(WKPageRef page, bool visitedLinks); + +WK_EXPORT bool WKPageIsPlayingAudio(WKPageRef page); +WK_EXPORT void WKPageSetMuted(WKPageRef page, bool muted); + +enum { + kWKMediaEventTypePlayPause, + kWKMediaEventTypeTrackNext, + kWKMediaEventTypeTrackPrevious +}; +typedef uint32_t WKMediaEventType; + +WK_EXPORT bool WKPageHasMediaSessionWithActiveMediaElements(WKPageRef page); +WK_EXPORT void WKPageHandleMediaEvent(WKPageRef page, WKMediaEventType event); + +WK_EXPORT void WKPageLoadURLWithShouldOpenExternalURLsPolicy(WKPageRef page, WKURLRef url, bool shouldOpenExternalURLs); + +typedef void (*WKPagePostPresentationUpdateFunction)(WKErrorRef, void*); +WK_EXPORT void WKPageCallAfterNextPresentationUpdate(WKPageRef page, void* context, WKPagePostPresentationUpdateFunction function); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/soup/WKCookieManagerSoup.h b/Source/WebKit2/UIProcess/API/C/WKPageRenderingProgressEvents.h index 0a7b4ff05..6d258ed15 100644 --- a/Source/WebKit2/UIProcess/API/C/soup/WKCookieManagerSoup.h +++ b/Source/WebKit2/UIProcess/API/C/WKPageRenderingProgressEvents.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Intel Corporation. All rights reserved. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,25 +23,25 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKCookieManagerSoup_h -#define WKCookieManagerSoup_h +#ifndef WKPageRenderingProgressEvents_h +#define WKPageRenderingProgressEvents_h -#include <WebKit2/WKBase.h> +#include <stdint.h> #ifdef __cplusplus extern "C" { #endif enum { - kWKCookieStorageTypeText = 0, - kWKCookieStorageTypeSQLite = 1 + WKPageRenderingProgressEventFirstLayout = 1 << 0, + WKPageRenderingProgressEventFirstVisuallyNonEmptyLayout = 1 << 1, + WKPageRenderingProgressEventFirstPaintWithSignificantArea = 1 << 2, + WKPageRenderingProgressEventReachedSessionRestorationRenderTreeSizeThreshold = 1 << 3 }; -typedef uint32_t WKCookieStorageType; - -WK_EXPORT void WKCookieManagerSetCookiePersistentStorage(WKCookieManagerRef cookieManager, WKStringRef storagePath, WKCookieStorageType storageType); +typedef uint32_t WKPageRenderingProgressEvents; #ifdef __cplusplus } #endif -#endif // WKCookieManagerSoup_h +#endif /* WKPageRenderingProgressEvents_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp b/Source/WebKit2/UIProcess/API/C/WKPageRenderingProgressEventsInternal.h index 85620ad61..ab9274534 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPageRenderingProgressEventsInternal.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Intel Corporation. All rights reserved. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,33 +23,25 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#include "WKNetworkInfoManager.h" +#include "WKPageRenderingProgressEvents.h" -#include "WKAPICast.h" -#include "WebNetworkInfoManagerProxy.h" +#include <WebCore/LayoutMilestones.h> -using namespace WebKit; - -WKTypeID WKNetworkInfoManagerGetTypeID() -{ -#if ENABLE(NETWORK_INFO) - return toAPI(WebNetworkInfoManagerProxy::APIType); -#else - return 0; -#endif -} - -void WKNetworkInfoManagerSetProvider(WKNetworkInfoManagerRef networkInfoManager, const WKNetworkInfoProvider* provider) -{ -#if ENABLE(NETWORK_INFO) - toImpl(networkInfoManager)->initializeProvider(provider); -#endif -} - -void WKNetworkInfoManagerProviderDidChangeNetworkInformation(WKNetworkInfoManagerRef networkInfoManager, WKStringRef eventType, WKNetworkInfoRef networkInfo) +static inline WKPageRenderingProgressEvents pageRenderingProgressEvents(WebCore::LayoutMilestones milestones) { -#if ENABLE(NETWORK_INFO) - toImpl(networkInfoManager)->providerDidChangeNetworkInformation(AtomicString(toImpl(eventType)->string()), toImpl(networkInfo)); -#endif + WKPageRenderingProgressEvents events = 0; + + if (milestones & WebCore::DidFirstLayout) + events |= WKPageRenderingProgressEventFirstLayout; + + if (milestones & WebCore::DidFirstVisuallyNonEmptyLayout) + events |= WKPageRenderingProgressEventFirstVisuallyNonEmptyLayout; + + if (milestones & WebCore::DidHitRelevantRepaintedObjectsAreaThreshold) + events |= WKPageRenderingProgressEventFirstPaintWithSignificantArea; + + if (milestones & WebCore::ReachedSessionRestorationRenderTreeSizeThreshold) + events |= WKPageRenderingProgressEventReachedSessionRestorationRenderTreeSizeThreshold; + + return events; } diff --git a/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h b/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h new file mode 100644 index 000000000..2ab3595bd --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h @@ -0,0 +1,641 @@ +/* + * Copyright (C) 2013 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKPageUIClient_h +#define WKPageUIClient_h + +#include <WebKit/WKBase.h> +#include <WebKit/WKEvent.h> +#include <WebKit/WKGeometry.h> +#include <WebKit/WKNativeEvent.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKFocusDirectionBackward = 0, + kWKFocusDirectionForward = 1 +}; +typedef uint32_t WKFocusDirection; + +enum { + kWKPluginUnavailabilityReasonPluginMissing, + kWKPluginUnavailabilityReasonPluginCrashed, + kWKPluginUnavailabilityReasonInsecurePluginVersion +}; +typedef uint32_t WKPluginUnavailabilityReason; + +WK_EXPORT WKTypeID WKPageRunBeforeUnloadConfirmPanelResultListenerGetTypeID(); +WK_EXPORT void WKPageRunBeforeUnloadConfirmPanelResultListenerCall(WKPageRunBeforeUnloadConfirmPanelResultListenerRef listener, bool result); + +WK_EXPORT WKTypeID WKPageRunJavaScriptAlertResultListenerGetTypeID(); +WK_EXPORT void WKPageRunJavaScriptAlertResultListenerCall(WKPageRunJavaScriptAlertResultListenerRef listener); + +WK_EXPORT WKTypeID WKPageRunJavaScriptConfirmResultListenerGetTypeID(); +WK_EXPORT void WKPageRunJavaScriptConfirmResultListenerCall(WKPageRunJavaScriptConfirmResultListenerRef listener, bool result); + +WK_EXPORT WKTypeID WKPageRunJavaScriptPromptResultListenerGetTypeID(); +WK_EXPORT void WKPageRunJavaScriptPromptResultListenerCall(WKPageRunJavaScriptPromptResultListenerRef listener, WKStringRef result); + +typedef void (*WKPageUIClientCallback)(WKPageRef page, const void* clientInfo); +typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo); +typedef void (*WKPageRunBeforeUnloadConfirmPanelCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, WKPageRunBeforeUnloadConfirmPanelResultListenerRef listener, const void *clientInfo); +typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptAlertResultListenerRef listener, const void *clientInfo); +typedef void (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptConfirmResultListenerRef listener, const void *clientInfo); +typedef void (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptPromptResultListenerRef listener, const void *clientInfo); +typedef void (*WKPageTakeFocusCallback)(WKPageRef page, WKFocusDirection direction, const void *clientInfo); +typedef void (*WKPageFocusCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageUnfocusCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageSetStatusTextCallback)(WKPageRef page, WKStringRef text, const void *clientInfo); +typedef void (*WKPageMouseDidMoveOverElementCallback)(WKPageRef page, WKHitTestResultRef hitTestResult, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidNotHandleKeyEventCallback)(WKPageRef page, WKNativeEventPtr event, const void *clientInfo); +typedef void (*WKPageDidNotHandleWheelEventCallback)(WKPageRef page, WKNativeEventPtr event, const void *clientInfo); +typedef bool (*WKPageGetToolbarsAreVisibleCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageSetToolbarsAreVisibleCallback)(WKPageRef page, bool toolbarsVisible, const void *clientInfo); +typedef bool (*WKPageGetMenuBarIsVisibleCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageSetMenuBarIsVisibleCallback)(WKPageRef page, bool menuBarVisible, const void *clientInfo); +typedef bool (*WKPageGetStatusBarIsVisibleCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageSetStatusBarIsVisibleCallback)(WKPageRef page, bool statusBarVisible, const void *clientInfo); +typedef bool (*WKPageGetIsResizableCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageSetIsResizableCallback)(WKPageRef page, bool resizable, const void *clientInfo); +typedef WKRect (*WKPageGetWindowFrameCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageSetWindowFrameCallback)(WKPageRef page, WKRect frame, const void *clientInfo); +typedef unsigned long long (*WKPageExceededDatabaseQuotaCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage, const void *clientInfo); +typedef void (*WKPageRunOpenPanelCallback)(WKPageRef page, WKFrameRef frame, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener, const void *clientInfo); +typedef void (*WKPageDecidePolicyForGeolocationPermissionRequestCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKGeolocationPermissionRequestRef permissionRequest, const void* clientInfo); +typedef float (*WKPageHeaderHeightCallback)(WKPageRef page, WKFrameRef frame, const void* clientInfo); +typedef float (*WKPageFooterHeightCallback)(WKPageRef page, WKFrameRef frame, const void* clientInfo); +typedef void (*WKPageDrawHeaderCallback)(WKPageRef page, WKFrameRef frame, WKRect rect, const void* clientInfo); +typedef void (*WKPageDrawFooterCallback)(WKPageRef page, WKFrameRef frame, WKRect rect, const void* clientInfo); +typedef void (*WKPagePrintFrameCallback)(WKPageRef page, WKFrameRef frame, const void* clientInfo); +typedef void (*WKPageSaveDataToFileInDownloadsFolderCallback)(WKPageRef page, WKStringRef suggestedFilename, WKStringRef mimeType, WKURLRef originatingURL, WKDataRef data, const void* clientInfo); +typedef void (*WKPageDecidePolicyForNotificationPermissionRequestCallback)(WKPageRef page, WKSecurityOriginRef origin, WKNotificationPermissionRequestRef permissionRequest, const void *clientInfo); +typedef void (*WKPageShowColorPickerCallback)(WKPageRef page, WKStringRef initialColor, WKColorPickerResultListenerRef listener, const void* clientInfo); +typedef void (*WKPageHideColorPickerCallback)(WKPageRef page, const void* clientInfo); +typedef void (*WKPageUnavailablePluginButtonClickedCallback)(WKPageRef page, WKPluginUnavailabilityReason pluginUnavailabilityReason, WKDictionaryRef pluginInfoDictionary, const void* clientInfo); +typedef void (*WKPagePinnedStateDidChangeCallback)(WKPageRef page, const void* clientInfo); +typedef void (*WKPageIsPlayingAudioDidChangeCallback)(WKPageRef page, const void* clientInfo); +typedef void (*WKPageDecidePolicyForUserMediaPermissionRequestCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKUserMediaPermissionRequestRef permissionRequest, const void* clientInfo); +typedef void (*WKCheckUserMediaPermissionCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKUserMediaPermissionCheckRef devicesRequest, const void *clientInfo); +typedef void (*WKPageDidClickAutoFillButtonCallback)(WKPageRef page, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageMediaSessionMetadataDidChangeCallback)(WKPageRef page, WKMediaSessionMetadataRef metadata, const void* clientInfo); + +// Deprecated +typedef WKPageRef (*WKPageCreateNewPageCallback_deprecatedForUseWithV0)(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo); +typedef void (*WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0)(WKPageRef page, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef mimeType, WKStringRef url, WKStringRef pluginsPageURL, const void* clientInfo); +typedef void (*WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1)(WKPageRef page, WKPluginUnavailabilityReason pluginUnavailabilityReason, WKStringRef mimeType, WKStringRef url, WKStringRef pluginsPageURL, const void* clientInfo); +typedef void (*WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void *clientInfo); +typedef bool (*WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo); +typedef WKStringRef (*WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void *clientInfo); +typedef WKPageRef (*WKPageCreateNewPageCallback_deprecatedForUseWithV1)(WKPageRef page, WKURLRequestRef urlRequest, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo); +typedef void (*WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV5)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void *clientInfo); +typedef bool (*WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV5)(WKPageRef page, WKStringRef message, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void *clientInfo); +typedef WKStringRef (*WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV5)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, WKSecurityOriginRef securityOrigin, const void *clientInfo); +typedef bool (*WKPageRunBeforeUnloadConfirmPanelCallback_deprecatedForUseWithV6)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo); + +typedef struct WKPageUIClientBase { + int version; + const void * clientInfo; +} WKPageUIClientBase; + +typedef struct WKPageUIClientV0 { + WKPageUIClientBase base; + + // Version 0. + WKPageCreateNewPageCallback_deprecatedForUseWithV0 createNewPage_deprecatedForUseWithV0; + WKPageUIClientCallback showPage; + WKPageUIClientCallback close; + WKPageTakeFocusCallback takeFocus; + WKPageFocusCallback focus; + WKPageUnfocusCallback unfocus; + WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert; + WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm; + WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt; + WKPageSetStatusTextCallback setStatusText; + WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; + WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0 missingPluginButtonClicked_deprecatedForUseWithV0; + WKPageDidNotHandleKeyEventCallback didNotHandleKeyEvent; + WKPageDidNotHandleWheelEventCallback didNotHandleWheelEvent; + WKPageGetToolbarsAreVisibleCallback toolbarsAreVisible; + WKPageSetToolbarsAreVisibleCallback setToolbarsAreVisible; + WKPageGetMenuBarIsVisibleCallback menuBarIsVisible; + WKPageSetMenuBarIsVisibleCallback setMenuBarIsVisible; + WKPageGetStatusBarIsVisibleCallback statusBarIsVisible; + WKPageSetStatusBarIsVisibleCallback setStatusBarIsVisible; + WKPageGetIsResizableCallback isResizable; + WKPageSetIsResizableCallback setIsResizable; + WKPageGetWindowFrameCallback getWindowFrame; + WKPageSetWindowFrameCallback setWindowFrame; + WKPageRunBeforeUnloadConfirmPanelCallback_deprecatedForUseWithV6 runBeforeUnloadConfirmPanel; + WKPageUIClientCallback didDraw; + WKPageUIClientCallback pageDidScroll; + WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota; + WKPageRunOpenPanelCallback runOpenPanel; + WKPageDecidePolicyForGeolocationPermissionRequestCallback decidePolicyForGeolocationPermissionRequest; + WKPageHeaderHeightCallback headerHeight; + WKPageFooterHeightCallback footerHeight; + WKPageDrawHeaderCallback drawHeader; + WKPageDrawFooterCallback drawFooter; + WKPagePrintFrameCallback printFrame; + WKPageUIClientCallback runModal; + void* unused1; // Used to be didCompleteRubberBandForMainFrame + WKPageSaveDataToFileInDownloadsFolderCallback saveDataToFileInDownloadsFolder; + void* shouldInterruptJavaScript_unavailable; +} WKPageUIClientV0; + +typedef struct WKPageUIClientV1 { + WKPageUIClientBase base; + + // Version 0. + WKPageCreateNewPageCallback_deprecatedForUseWithV0 createNewPage_deprecatedForUseWithV0; + WKPageUIClientCallback showPage; + WKPageUIClientCallback close; + WKPageTakeFocusCallback takeFocus; + WKPageFocusCallback focus; + WKPageUnfocusCallback unfocus; + WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert; + WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm; + WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt; + WKPageSetStatusTextCallback setStatusText; + WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; + WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0 missingPluginButtonClicked_deprecatedForUseWithV0; + WKPageDidNotHandleKeyEventCallback didNotHandleKeyEvent; + WKPageDidNotHandleWheelEventCallback didNotHandleWheelEvent; + WKPageGetToolbarsAreVisibleCallback toolbarsAreVisible; + WKPageSetToolbarsAreVisibleCallback setToolbarsAreVisible; + WKPageGetMenuBarIsVisibleCallback menuBarIsVisible; + WKPageSetMenuBarIsVisibleCallback setMenuBarIsVisible; + WKPageGetStatusBarIsVisibleCallback statusBarIsVisible; + WKPageSetStatusBarIsVisibleCallback setStatusBarIsVisible; + WKPageGetIsResizableCallback isResizable; + WKPageSetIsResizableCallback setIsResizable; + WKPageGetWindowFrameCallback getWindowFrame; + WKPageSetWindowFrameCallback setWindowFrame; + WKPageRunBeforeUnloadConfirmPanelCallback_deprecatedForUseWithV6 runBeforeUnloadConfirmPanel; + WKPageUIClientCallback didDraw; + WKPageUIClientCallback pageDidScroll; + WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota; + WKPageRunOpenPanelCallback runOpenPanel; + WKPageDecidePolicyForGeolocationPermissionRequestCallback decidePolicyForGeolocationPermissionRequest; + WKPageHeaderHeightCallback headerHeight; + WKPageFooterHeightCallback footerHeight; + WKPageDrawHeaderCallback drawHeader; + WKPageDrawFooterCallback drawFooter; + WKPagePrintFrameCallback printFrame; + WKPageUIClientCallback runModal; + void* unused1; // Used to be didCompleteRubberBandForMainFrame + WKPageSaveDataToFileInDownloadsFolderCallback saveDataToFileInDownloadsFolder; + void* shouldInterruptJavaScript_unavailable; + + // Version 1. + WKPageCreateNewPageCallback_deprecatedForUseWithV1 createNewPage; + WKPageMouseDidMoveOverElementCallback mouseDidMoveOverElement; + WKPageDecidePolicyForNotificationPermissionRequestCallback decidePolicyForNotificationPermissionRequest; + WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1 unavailablePluginButtonClicked_deprecatedForUseWithV1; +} WKPageUIClientV1; + +typedef struct WKPageUIClientV2 { + WKPageUIClientBase base; + + // Version 0. + WKPageCreateNewPageCallback_deprecatedForUseWithV0 createNewPage_deprecatedForUseWithV0; + WKPageUIClientCallback showPage; + WKPageUIClientCallback close; + WKPageTakeFocusCallback takeFocus; + WKPageFocusCallback focus; + WKPageUnfocusCallback unfocus; + WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert; + WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm; + WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt; + WKPageSetStatusTextCallback setStatusText; + WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; + WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0 missingPluginButtonClicked_deprecatedForUseWithV0; + WKPageDidNotHandleKeyEventCallback didNotHandleKeyEvent; + WKPageDidNotHandleWheelEventCallback didNotHandleWheelEvent; + WKPageGetToolbarsAreVisibleCallback toolbarsAreVisible; + WKPageSetToolbarsAreVisibleCallback setToolbarsAreVisible; + WKPageGetMenuBarIsVisibleCallback menuBarIsVisible; + WKPageSetMenuBarIsVisibleCallback setMenuBarIsVisible; + WKPageGetStatusBarIsVisibleCallback statusBarIsVisible; + WKPageSetStatusBarIsVisibleCallback setStatusBarIsVisible; + WKPageGetIsResizableCallback isResizable; + WKPageSetIsResizableCallback setIsResizable; + WKPageGetWindowFrameCallback getWindowFrame; + WKPageSetWindowFrameCallback setWindowFrame; + WKPageRunBeforeUnloadConfirmPanelCallback_deprecatedForUseWithV6 runBeforeUnloadConfirmPanel; + WKPageUIClientCallback didDraw; + WKPageUIClientCallback pageDidScroll; + WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota; + WKPageRunOpenPanelCallback runOpenPanel; + WKPageDecidePolicyForGeolocationPermissionRequestCallback decidePolicyForGeolocationPermissionRequest; + WKPageHeaderHeightCallback headerHeight; + WKPageFooterHeightCallback footerHeight; + WKPageDrawHeaderCallback drawHeader; + WKPageDrawFooterCallback drawFooter; + WKPagePrintFrameCallback printFrame; + WKPageUIClientCallback runModal; + void* unused1; // Used to be didCompleteRubberBandForMainFrame + WKPageSaveDataToFileInDownloadsFolderCallback saveDataToFileInDownloadsFolder; + void* shouldInterruptJavaScript_unavailable; + + // Version 1. + WKPageCreateNewPageCallback_deprecatedForUseWithV1 createNewPage; + WKPageMouseDidMoveOverElementCallback mouseDidMoveOverElement; + WKPageDecidePolicyForNotificationPermissionRequestCallback decidePolicyForNotificationPermissionRequest; + WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1 unavailablePluginButtonClicked_deprecatedForUseWithV1; + + // Version 2. + WKPageShowColorPickerCallback showColorPicker; + WKPageHideColorPickerCallback hideColorPicker; + WKPageUnavailablePluginButtonClickedCallback unavailablePluginButtonClicked; +} WKPageUIClientV2; + +typedef struct WKPageUIClientV3 { + WKPageUIClientBase base; + + // Version 0. + WKPageCreateNewPageCallback_deprecatedForUseWithV0 createNewPage_deprecatedForUseWithV0; + WKPageUIClientCallback showPage; + WKPageUIClientCallback close; + WKPageTakeFocusCallback takeFocus; + WKPageFocusCallback focus; + WKPageUnfocusCallback unfocus; + WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert; + WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm; + WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt; + WKPageSetStatusTextCallback setStatusText; + WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; + WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0 missingPluginButtonClicked_deprecatedForUseWithV0; + WKPageDidNotHandleKeyEventCallback didNotHandleKeyEvent; + WKPageDidNotHandleWheelEventCallback didNotHandleWheelEvent; + WKPageGetToolbarsAreVisibleCallback toolbarsAreVisible; + WKPageSetToolbarsAreVisibleCallback setToolbarsAreVisible; + WKPageGetMenuBarIsVisibleCallback menuBarIsVisible; + WKPageSetMenuBarIsVisibleCallback setMenuBarIsVisible; + WKPageGetStatusBarIsVisibleCallback statusBarIsVisible; + WKPageSetStatusBarIsVisibleCallback setStatusBarIsVisible; + WKPageGetIsResizableCallback isResizable; + WKPageSetIsResizableCallback setIsResizable; + WKPageGetWindowFrameCallback getWindowFrame; + WKPageSetWindowFrameCallback setWindowFrame; + WKPageRunBeforeUnloadConfirmPanelCallback_deprecatedForUseWithV6 runBeforeUnloadConfirmPanel; + WKPageUIClientCallback didDraw; + WKPageUIClientCallback pageDidScroll; + WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota; + WKPageRunOpenPanelCallback runOpenPanel; + WKPageDecidePolicyForGeolocationPermissionRequestCallback decidePolicyForGeolocationPermissionRequest; + WKPageHeaderHeightCallback headerHeight; + WKPageFooterHeightCallback footerHeight; + WKPageDrawHeaderCallback drawHeader; + WKPageDrawFooterCallback drawFooter; + WKPagePrintFrameCallback printFrame; + WKPageUIClientCallback runModal; + void* unused1; // Used to be didCompleteRubberBandForMainFrame + WKPageSaveDataToFileInDownloadsFolderCallback saveDataToFileInDownloadsFolder; + void* shouldInterruptJavaScript_unavailable; + + // Version 1. + WKPageCreateNewPageCallback_deprecatedForUseWithV1 createNewPage; + WKPageMouseDidMoveOverElementCallback mouseDidMoveOverElement; + WKPageDecidePolicyForNotificationPermissionRequestCallback decidePolicyForNotificationPermissionRequest; + WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1 unavailablePluginButtonClicked_deprecatedForUseWithV1; + + // Version 2. + WKPageShowColorPickerCallback showColorPicker; + WKPageHideColorPickerCallback hideColorPicker; + WKPageUnavailablePluginButtonClickedCallback unavailablePluginButtonClicked; + + // Version 3. + WKPagePinnedStateDidChangeCallback pinnedStateDidChange; +} WKPageUIClientV3; + +typedef struct WKPageUIClientV4 { + WKPageUIClientBase base; + + // Version 0. + WKPageCreateNewPageCallback_deprecatedForUseWithV0 createNewPage_deprecatedForUseWithV0; + WKPageUIClientCallback showPage; + WKPageUIClientCallback close; + WKPageTakeFocusCallback takeFocus; + WKPageFocusCallback focus; + WKPageUnfocusCallback unfocus; + WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert; + WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm; + WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt; + WKPageSetStatusTextCallback setStatusText; + WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; + WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0 missingPluginButtonClicked_deprecatedForUseWithV0; + WKPageDidNotHandleKeyEventCallback didNotHandleKeyEvent; + WKPageDidNotHandleWheelEventCallback didNotHandleWheelEvent; + WKPageGetToolbarsAreVisibleCallback toolbarsAreVisible; + WKPageSetToolbarsAreVisibleCallback setToolbarsAreVisible; + WKPageGetMenuBarIsVisibleCallback menuBarIsVisible; + WKPageSetMenuBarIsVisibleCallback setMenuBarIsVisible; + WKPageGetStatusBarIsVisibleCallback statusBarIsVisible; + WKPageSetStatusBarIsVisibleCallback setStatusBarIsVisible; + WKPageGetIsResizableCallback isResizable; + WKPageSetIsResizableCallback setIsResizable; + WKPageGetWindowFrameCallback getWindowFrame; + WKPageSetWindowFrameCallback setWindowFrame; + WKPageRunBeforeUnloadConfirmPanelCallback_deprecatedForUseWithV6 runBeforeUnloadConfirmPanel; + WKPageUIClientCallback didDraw; + WKPageUIClientCallback pageDidScroll; + WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota; + WKPageRunOpenPanelCallback runOpenPanel; + WKPageDecidePolicyForGeolocationPermissionRequestCallback decidePolicyForGeolocationPermissionRequest; + WKPageHeaderHeightCallback headerHeight; + WKPageFooterHeightCallback footerHeight; + WKPageDrawHeaderCallback drawHeader; + WKPageDrawFooterCallback drawFooter; + WKPagePrintFrameCallback printFrame; + WKPageUIClientCallback runModal; + void* unused1; // Used to be didCompleteRubberBandForMainFrame. + WKPageSaveDataToFileInDownloadsFolderCallback saveDataToFileInDownloadsFolder; + void* shouldInterruptJavaScript_unavailable; + + // Version 1. + WKPageCreateNewPageCallback_deprecatedForUseWithV1 createNewPage; + WKPageMouseDidMoveOverElementCallback mouseDidMoveOverElement; + WKPageDecidePolicyForNotificationPermissionRequestCallback decidePolicyForNotificationPermissionRequest; + WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1 unavailablePluginButtonClicked_deprecatedForUseWithV1; + + // Version 2. + WKPageShowColorPickerCallback showColorPicker; + WKPageHideColorPickerCallback hideColorPicker; + WKPageUnavailablePluginButtonClickedCallback unavailablePluginButtonClicked; + + // Version 3. + WKPagePinnedStateDidChangeCallback pinnedStateDidChange; + + // Version 4. + void* unused2; // Used to be didBeginTrackingPotentialLongMousePress. + void* unused3; // Used to be didRecognizeLongMousePress. + void* unused4; // Used to be didCancelTrackingPotentialLongMousePress. + WKPageIsPlayingAudioDidChangeCallback isPlayingAudioDidChange; +} WKPageUIClientV4; + +typedef struct WKPageUIClientV5 { + WKPageUIClientBase base; + + // Version 0. + WKPageCreateNewPageCallback_deprecatedForUseWithV0 createNewPage_deprecatedForUseWithV0; + WKPageUIClientCallback showPage; + WKPageUIClientCallback close; + WKPageTakeFocusCallback takeFocus; + WKPageFocusCallback focus; + WKPageUnfocusCallback unfocus; + WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert_deprecatedForUseWithV0; + WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm_deprecatedForUseWithV0; + WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt_deprecatedForUseWithV0; + WKPageSetStatusTextCallback setStatusText; + WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; + WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0 missingPluginButtonClicked_deprecatedForUseWithV0; + WKPageDidNotHandleKeyEventCallback didNotHandleKeyEvent; + WKPageDidNotHandleWheelEventCallback didNotHandleWheelEvent; + WKPageGetToolbarsAreVisibleCallback toolbarsAreVisible; + WKPageSetToolbarsAreVisibleCallback setToolbarsAreVisible; + WKPageGetMenuBarIsVisibleCallback menuBarIsVisible; + WKPageSetMenuBarIsVisibleCallback setMenuBarIsVisible; + WKPageGetStatusBarIsVisibleCallback statusBarIsVisible; + WKPageSetStatusBarIsVisibleCallback setStatusBarIsVisible; + WKPageGetIsResizableCallback isResizable; + WKPageSetIsResizableCallback setIsResizable; + WKPageGetWindowFrameCallback getWindowFrame; + WKPageSetWindowFrameCallback setWindowFrame; + WKPageRunBeforeUnloadConfirmPanelCallback_deprecatedForUseWithV6 runBeforeUnloadConfirmPanel; + WKPageUIClientCallback didDraw; + WKPageUIClientCallback pageDidScroll; + WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota; + WKPageRunOpenPanelCallback runOpenPanel; + WKPageDecidePolicyForGeolocationPermissionRequestCallback decidePolicyForGeolocationPermissionRequest; + WKPageHeaderHeightCallback headerHeight; + WKPageFooterHeightCallback footerHeight; + WKPageDrawHeaderCallback drawHeader; + WKPageDrawFooterCallback drawFooter; + WKPagePrintFrameCallback printFrame; + WKPageUIClientCallback runModal; + void* unused1; // Used to be didCompleteRubberBandForMainFrame + WKPageSaveDataToFileInDownloadsFolderCallback saveDataToFileInDownloadsFolder; + void* shouldInterruptJavaScript_unavailable; + + // Version 1. + WKPageCreateNewPageCallback_deprecatedForUseWithV1 createNewPage; + WKPageMouseDidMoveOverElementCallback mouseDidMoveOverElement; + WKPageDecidePolicyForNotificationPermissionRequestCallback decidePolicyForNotificationPermissionRequest; + WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1 unavailablePluginButtonClicked_deprecatedForUseWithV1; + + // Version 2. + WKPageShowColorPickerCallback showColorPicker; + WKPageHideColorPickerCallback hideColorPicker; + WKPageUnavailablePluginButtonClickedCallback unavailablePluginButtonClicked; + + // Version 3. + WKPagePinnedStateDidChangeCallback pinnedStateDidChange; + + // Version 4. + void* unused2; // Used to be didBeginTrackingPotentialLongMousePress. + void* unused3; // Used to be didRecognizeLongMousePress. + void* unused4; // Used to be didCancelTrackingPotentialLongMousePress. + WKPageIsPlayingAudioDidChangeCallback isPlayingAudioDidChange; + + // Version 5. + WKPageDecidePolicyForUserMediaPermissionRequestCallback decidePolicyForUserMediaPermissionRequest; + WKPageDidClickAutoFillButtonCallback didClickAutoFillButton; + WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV5 runJavaScriptAlert; + WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV5 runJavaScriptConfirm; + WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV5 runJavaScriptPrompt; + WKPageMediaSessionMetadataDidChangeCallback mediaSessionMetadataDidChange; +} WKPageUIClientV5; + +typedef struct WKPageUIClientV6 { + WKPageUIClientBase base; + + // Version 0. + WKPageCreateNewPageCallback_deprecatedForUseWithV0 createNewPage_deprecatedForUseWithV0; + WKPageUIClientCallback showPage; + WKPageUIClientCallback close; + WKPageTakeFocusCallback takeFocus; + WKPageFocusCallback focus; + WKPageUnfocusCallback unfocus; + WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert_deprecatedForUseWithV0; + WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm_deprecatedForUseWithV0; + WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt_deprecatedForUseWithV0; + WKPageSetStatusTextCallback setStatusText; + WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; + WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0 missingPluginButtonClicked_deprecatedForUseWithV0; + WKPageDidNotHandleKeyEventCallback didNotHandleKeyEvent; + WKPageDidNotHandleWheelEventCallback didNotHandleWheelEvent; + WKPageGetToolbarsAreVisibleCallback toolbarsAreVisible; + WKPageSetToolbarsAreVisibleCallback setToolbarsAreVisible; + WKPageGetMenuBarIsVisibleCallback menuBarIsVisible; + WKPageSetMenuBarIsVisibleCallback setMenuBarIsVisible; + WKPageGetStatusBarIsVisibleCallback statusBarIsVisible; + WKPageSetStatusBarIsVisibleCallback setStatusBarIsVisible; + WKPageGetIsResizableCallback isResizable; + WKPageSetIsResizableCallback setIsResizable; + WKPageGetWindowFrameCallback getWindowFrame; + WKPageSetWindowFrameCallback setWindowFrame; + WKPageRunBeforeUnloadConfirmPanelCallback_deprecatedForUseWithV6 runBeforeUnloadConfirmPanel; + WKPageUIClientCallback didDraw; + WKPageUIClientCallback pageDidScroll; + WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota; + WKPageRunOpenPanelCallback runOpenPanel; + WKPageDecidePolicyForGeolocationPermissionRequestCallback decidePolicyForGeolocationPermissionRequest; + WKPageHeaderHeightCallback headerHeight; + WKPageFooterHeightCallback footerHeight; + WKPageDrawHeaderCallback drawHeader; + WKPageDrawFooterCallback drawFooter; + WKPagePrintFrameCallback printFrame; + WKPageUIClientCallback runModal; + void* unused1; // Used to be didCompleteRubberBandForMainFrame + WKPageSaveDataToFileInDownloadsFolderCallback saveDataToFileInDownloadsFolder; + void* shouldInterruptJavaScript_unavailable; + + // Version 1. + WKPageCreateNewPageCallback_deprecatedForUseWithV1 createNewPage_deprecatedForUseWithV1; + WKPageMouseDidMoveOverElementCallback mouseDidMoveOverElement; + WKPageDecidePolicyForNotificationPermissionRequestCallback decidePolicyForNotificationPermissionRequest; + WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1 unavailablePluginButtonClicked_deprecatedForUseWithV1; + + // Version 2. + WKPageShowColorPickerCallback showColorPicker; + WKPageHideColorPickerCallback hideColorPicker; + WKPageUnavailablePluginButtonClickedCallback unavailablePluginButtonClicked; + + // Version 3. + WKPagePinnedStateDidChangeCallback pinnedStateDidChange; + + // Version 4. + void* unused2; // Used to be didBeginTrackingPotentialLongMousePress. + void* unused3; // Used to be didRecognizeLongMousePress. + void* unused4; // Used to be didCancelTrackingPotentialLongMousePress. + WKPageIsPlayingAudioDidChangeCallback isPlayingAudioDidChange; + + // Version 5. + WKPageDecidePolicyForUserMediaPermissionRequestCallback decidePolicyForUserMediaPermissionRequest; + WKPageDidClickAutoFillButtonCallback didClickAutoFillButton; + WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV5 runJavaScriptAlert_deprecatedForUseWithV5; + WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV5 runJavaScriptConfirm_deprecatedForUseWithV5; + WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV5 runJavaScriptPrompt_deprecatedForUseWithV5; + WKPageMediaSessionMetadataDidChangeCallback mediaSessionMetadataDidChange; + + // Version 6. + WKPageCreateNewPageCallback createNewPage; + WKPageRunJavaScriptAlertCallback runJavaScriptAlert; + WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm; + WKPageRunJavaScriptPromptCallback runJavaScriptPrompt; + WKCheckUserMediaPermissionCallback checkUserMediaPermissionForOrigin; +} WKPageUIClientV6; + +typedef struct WKPageUIClientV7 { + WKPageUIClientBase base; + + // Version 0. + WKPageCreateNewPageCallback_deprecatedForUseWithV0 createNewPage_deprecatedForUseWithV0; + WKPageUIClientCallback showPage; + WKPageUIClientCallback close; + WKPageTakeFocusCallback takeFocus; + WKPageFocusCallback focus; + WKPageUnfocusCallback unfocus; + WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0 runJavaScriptAlert_deprecatedForUseWithV0; + WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0 runJavaScriptConfirm_deprecatedForUseWithV0; + WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0 runJavaScriptPrompt_deprecatedForUseWithV0; + WKPageSetStatusTextCallback setStatusText; + WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0 mouseDidMoveOverElement_deprecatedForUseWithV0; + WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0 missingPluginButtonClicked_deprecatedForUseWithV0; + WKPageDidNotHandleKeyEventCallback didNotHandleKeyEvent; + WKPageDidNotHandleWheelEventCallback didNotHandleWheelEvent; + WKPageGetToolbarsAreVisibleCallback toolbarsAreVisible; + WKPageSetToolbarsAreVisibleCallback setToolbarsAreVisible; + WKPageGetMenuBarIsVisibleCallback menuBarIsVisible; + WKPageSetMenuBarIsVisibleCallback setMenuBarIsVisible; + WKPageGetStatusBarIsVisibleCallback statusBarIsVisible; + WKPageSetStatusBarIsVisibleCallback setStatusBarIsVisible; + WKPageGetIsResizableCallback isResizable; + WKPageSetIsResizableCallback setIsResizable; + WKPageGetWindowFrameCallback getWindowFrame; + WKPageSetWindowFrameCallback setWindowFrame; + WKPageRunBeforeUnloadConfirmPanelCallback_deprecatedForUseWithV6 runBeforeUnloadConfirmPanel_deprecatedForUseWithV6; + WKPageUIClientCallback didDraw; + WKPageUIClientCallback pageDidScroll; + WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota; + WKPageRunOpenPanelCallback runOpenPanel; + WKPageDecidePolicyForGeolocationPermissionRequestCallback decidePolicyForGeolocationPermissionRequest; + WKPageHeaderHeightCallback headerHeight; + WKPageFooterHeightCallback footerHeight; + WKPageDrawHeaderCallback drawHeader; + WKPageDrawFooterCallback drawFooter; + WKPagePrintFrameCallback printFrame; + WKPageUIClientCallback runModal; + void* unused1; // Used to be didCompleteRubberBandForMainFrame + WKPageSaveDataToFileInDownloadsFolderCallback saveDataToFileInDownloadsFolder; + void* shouldInterruptJavaScript_unavailable; + + // Version 1. + WKPageCreateNewPageCallback_deprecatedForUseWithV1 createNewPage_deprecatedForUseWithV1; + WKPageMouseDidMoveOverElementCallback mouseDidMoveOverElement; + WKPageDecidePolicyForNotificationPermissionRequestCallback decidePolicyForNotificationPermissionRequest; + WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1 unavailablePluginButtonClicked_deprecatedForUseWithV1; + + // Version 2. + WKPageShowColorPickerCallback showColorPicker; + WKPageHideColorPickerCallback hideColorPicker; + WKPageUnavailablePluginButtonClickedCallback unavailablePluginButtonClicked; + + // Version 3. + WKPagePinnedStateDidChangeCallback pinnedStateDidChange; + + // Version 4. + void* unused2; // Used to be didBeginTrackingPotentialLongMousePress. + void* unused3; // Used to be didRecognizeLongMousePress. + void* unused4; // Used to be didCancelTrackingPotentialLongMousePress. + WKPageIsPlayingAudioDidChangeCallback isPlayingAudioDidChange; + + // Version 5. + WKPageDecidePolicyForUserMediaPermissionRequestCallback decidePolicyForUserMediaPermissionRequest; + WKPageDidClickAutoFillButtonCallback didClickAutoFillButton; + WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV5 runJavaScriptAlert_deprecatedForUseWithV5; + WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV5 runJavaScriptConfirm_deprecatedForUseWithV5; + WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV5 runJavaScriptPrompt_deprecatedForUseWithV5; + WKPageMediaSessionMetadataDidChangeCallback mediaSessionMetadataDidChange; + + // Version 6. + WKPageCreateNewPageCallback createNewPage; + WKPageRunJavaScriptAlertCallback runJavaScriptAlert; + WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm; + WKPageRunJavaScriptPromptCallback runJavaScriptPrompt; + WKCheckUserMediaPermissionCallback checkUserMediaPermissionForOrigin; + + // Version 7. + WKPageRunBeforeUnloadConfirmPanelCallback runBeforeUnloadConfirmPanel; +} WKPageUIClientV7; + +#ifdef __cplusplus +} +#endif + +#endif // WKPageUIClient_h diff --git a/Source/WebKit2/UIProcess/API/C/WKPluginLoadPolicy.h b/Source/WebKit2/UIProcess/API/C/WKPluginLoadPolicy.h new file mode 100644 index 000000000..7aaef37ee --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPluginLoadPolicy.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKPluginLoadPolicy_h +#define WKPluginLoadPolicy_h + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKPluginLoadPolicyLoadNormally = 0, + kWKPluginLoadPolicyBlocked, + kWKPluginLoadPolicyInactive, + kWKPluginLoadPolicyLoadUnsandboxed, + kWKPluginLoadPolicyBlockedForCompatibility, +}; +typedef uint32_t WKPluginLoadPolicy; + +enum { + kWKPluginLoadClientPolicyUndefined = 0, + kWKPluginLoadClientPolicyBlock, + kWKPluginLoadClientPolicyAsk, + kWKPluginLoadClientPolicyAllow, + kWKPluginLoadClientPolicyAllowAlways, +}; +typedef uint32_t WKPluginLoadClientPolicy; + +#ifdef __cplusplus +} +#endif + +#endif /* WKPluginLoadPolicy_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.cpp b/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.cpp index 1105ca27a..1015fc4f2 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.cpp @@ -28,68 +28,71 @@ #include "APIObject.h" #include "WKAPICast.h" -#include "WebPluginSiteDataManager.h" - -#if ENABLE(NETSCAPE_PLUGIN_API) -#include <WebCore/npapi.h> -#endif +#include "WebProcessPool.h" +#include "WebsiteDataRecord.h" using namespace WebKit; WKTypeID WKPluginSiteDataManagerGetTypeID() { -#if ENABLE(NETSCAPE_PLUGIN_API) - return toAPI(WebPluginSiteDataManager::APIType); -#else - return APIObject::TypeNull; -#endif + return toAPI(API::WebsiteDataStore::APIType); } -void WKPluginSiteDataManagerGetSitesWithData(WKPluginSiteDataManagerRef managerRef, void* context, WKPluginSiteDataManagerGetSitesWithDataFunction callback) +void WKPluginSiteDataManagerGetSitesWithData(WKPluginSiteDataManagerRef manager, void* context, WKPluginSiteDataManagerGetSitesWithDataFunction callback) { #if ENABLE(NETSCAPE_PLUGIN_API) - toImpl(managerRef)->getSitesWithData(ArrayCallback::create(context, callback)); + auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(manager))->websiteDataStore(); + websiteDataStore.fetchData(WebsiteDataTypes::WebsiteDataTypePlugInData, [context, callback](Vector<WebsiteDataRecord> dataRecords) { + Vector<String> hostNames; + for (const auto& dataRecord : dataRecords) { + for (const auto& hostName : dataRecord.pluginDataHostNames) + hostNames.append(hostName); + } + + callback(toAPI(API::Array::createStringArray(hostNames).ptr()), nullptr, context); + }); #else - UNUSED_PARAM(managerRef); + UNUSED_PARAM(manager); UNUSED_PARAM(context); UNUSED_PARAM(callback); #endif } -#if ENABLE(NETSCAPE_PLUGIN_API) -static uint64_t toNPClearSiteDataFlags(WKClearSiteDataFlags flags) +void WKPluginSiteDataManagerClearSiteData(WKPluginSiteDataManagerRef manager, WKArrayRef sites, WKClearSiteDataFlags flags, uint64_t maxAgeInSeconds, void* context, WKPluginSiteDataManagerClearSiteDataFunction callback) { - if (flags == kWKClearSiteDataFlagsClearAll) - return NP_CLEAR_ALL; + // These are the only parameters supported. + ASSERT_UNUSED(flags, flags == kWKClearSiteDataFlagsClearAll); + ASSERT_UNUSED(maxAgeInSeconds, maxAgeInSeconds == std::numeric_limits<uint64_t>::max()); - uint64_t result = 0; - if (flags & kWKClearSiteDataFlagsClearCache) - result |= NP_CLEAR_CACHE; - return result; -} -#endif - -void WKPluginSiteDataManagerClearSiteData(WKPluginSiteDataManagerRef managerRef, WKArrayRef sitesRef, WKClearSiteDataFlags flags, uint64_t maxAgeInSeconds, void* context, WKPluginSiteDataManagerClearSiteDataFunction function) -{ #if ENABLE(NETSCAPE_PLUGIN_API) - toImpl(managerRef)->clearSiteData(toImpl(sitesRef), toNPClearSiteDataFlags(flags), maxAgeInSeconds, VoidCallback::create(context, function)); + WebsiteDataRecord dataRecord; + for (const auto& string : toImpl(sites)->elementsOfType<API::String>()) + dataRecord.pluginDataHostNames.add(string->string()); + + auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(manager))->websiteDataStore(); + websiteDataStore.removeData(WebsiteDataTypes::WebsiteDataTypePlugInData, { dataRecord }, [context, callback] { + callback(nullptr, context); + }); #else - UNUSED_PARAM(managerRef); - UNUSED_PARAM(sitesRef); + UNUSED_PARAM(manager); + UNUSED_PARAM(sites); UNUSED_PARAM(flags); UNUSED_PARAM(maxAgeInSeconds); UNUSED_PARAM(context); - UNUSED_PARAM(function); + UNUSED_PARAM(callback); #endif } -void WKPluginSiteDataManagerClearAllSiteData(WKPluginSiteDataManagerRef managerRef, void* context, WKPluginSiteDataManagerClearSiteDataFunction function) +void WKPluginSiteDataManagerClearAllSiteData(WKPluginSiteDataManagerRef manager, void* context, WKPluginSiteDataManagerClearSiteDataFunction callback) { #if ENABLE(NETSCAPE_PLUGIN_API) - toImpl(managerRef)->clearSiteData(0, NP_CLEAR_ALL, std::numeric_limits<uint64_t>::max(), VoidCallback::create(context, function)); + auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(manager))->websiteDataStore(); + websiteDataStore.removeData(WebsiteDataTypes::WebsiteDataTypePlugInData, std::chrono::system_clock::time_point::min(), [context, callback] { + callback(nullptr, context); + }); #else - UNUSED_PARAM(managerRef); + UNUSED_PARAM(manager); UNUSED_PARAM(context); - UNUSED_PARAM(function); + UNUSED_PARAM(callback); #endif } diff --git a/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.h b/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.h index 66e76fbcd..9a772b2b5 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.h +++ b/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.h @@ -26,7 +26,7 @@ #ifndef WKPluginSiteDataManager_h #define WKPluginSiteDataManager_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp index b4deaac84..7699c5392 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp @@ -24,11 +24,10 @@ */ #include "config.h" -#include "WKPreferences.h" -#include "WKPreferencesPrivate.h" +#include "WKPreferencesRef.h" +#include "WKPreferencesRefPrivate.h" #include "WKAPICast.h" -#include "WebContext.h" #include "WebPreferences.h" #include <WebCore/Settings.h> #include <wtf/PassRefPtr.h> @@ -43,19 +42,19 @@ WKTypeID WKPreferencesGetTypeID() WKPreferencesRef WKPreferencesCreate() { - RefPtr<WebPreferences> preferences = WebPreferences::create(); + RefPtr<WebPreferences> preferences = WebPreferences::createWithLegacyDefaults(String(), "WebKit2.", "WebKit2."); return toAPI(preferences.release().leakRef()); } WKPreferencesRef WKPreferencesCreateWithIdentifier(WKStringRef identifierRef) { - RefPtr<WebPreferences> preferences = WebPreferences::create(toWTFString(identifierRef)); + RefPtr<WebPreferences> preferences = WebPreferences::createWithLegacyDefaults(toWTFString(identifierRef), "WebKit2.", "WebKit2."); return toAPI(preferences.release().leakRef()); } WKPreferencesRef WKPreferencesCreateCopy(WKPreferencesRef preferencesRef) { - RefPtr<WebPreferences> preferences = WebPreferences::create(*toImpl(preferencesRef)); + RefPtr<WebPreferences> preferences = toImpl(preferencesRef)->copy(); return toAPI(preferences.release().leakRef()); } @@ -299,15 +298,6 @@ uint32_t WKPreferencesGetMinimumFontSize(WKPreferencesRef preferencesRef) return toImpl(preferencesRef)->minimumFontSize(); } -void WKPreferencesSetScreenFontSubstitutionEnabled(WKPreferencesRef preferencesRef, bool enabled) -{ - toImpl(preferencesRef)->setScreenFontSubstitutionEnabled(enabled); -} - -bool WKPreferencesGetScreenFontSubstitutionEnabled(WKPreferencesRef preferencesRef) -{ - return toImpl(preferencesRef)->screenFontSubstitutionEnabled(); -} void WKPreferencesSetCookieEnabled(WKPreferencesRef preferencesRef, bool enabled) { @@ -359,14 +349,14 @@ bool WKPreferencesGetDeveloperExtrasEnabled(WKPreferencesRef preferencesRef) return toImpl(preferencesRef)->developerExtrasEnabled(); } -void WKPreferencesSetJavaScriptExperimentsEnabled(WKPreferencesRef preferencesRef, bool enabled) +void WKPreferencesSetJavaScriptRuntimeFlags(WKPreferencesRef preferencesRef, WKJavaScriptRuntimeFlagSet javaScriptRuntimeFlagSet) { - toImpl(preferencesRef)->setJavaScriptExperimentsEnabled(enabled); + toImpl(preferencesRef)->setJavaScriptRuntimeFlags(javaScriptRuntimeFlagSet); } -bool WKPreferencesGetJavaScriptExperimentsEnabled(WKPreferencesRef preferencesRef) +WKJavaScriptRuntimeFlagSet WKPreferencesGetJavaScriptRuntimeFlags(WKPreferencesRef preferencesRef) { - return toImpl(preferencesRef)->javaScriptExperimentsEnabled(); + return toImpl(preferencesRef)->javaScriptRuntimeFlags(); } void WKPreferencesSetTextAreasAreResizable(WKPreferencesRef preferencesRef, bool resizable) @@ -459,24 +449,24 @@ bool WKPreferencesGetTiledScrollingIndicatorVisible(WKPreferencesRef preferences return toImpl(preferencesRef)->tiledScrollingIndicatorVisible(); } -void WKPreferencesSetCSSCustomFilterEnabled(WKPreferencesRef preferencesRef, bool flag) +void WKPreferencesSetWebGLEnabled(WKPreferencesRef preferencesRef, bool flag) { - toImpl(preferencesRef)->setCSSCustomFilterEnabled(flag); + toImpl(preferencesRef)->setWebGLEnabled(flag); } -bool WKPreferencesGetCSSCustomFilterEnabled(WKPreferencesRef preferencesRef) +bool WKPreferencesGetWebGLEnabled(WKPreferencesRef preferencesRef) { - return toImpl(preferencesRef)->cssCustomFilterEnabled(); + return toImpl(preferencesRef)->webGLEnabled(); } -void WKPreferencesSetWebGLEnabled(WKPreferencesRef preferencesRef, bool flag) +void WKPreferencesSetForceSoftwareWebGLRendering(WKPreferencesRef preferencesRef, bool flag) { - toImpl(preferencesRef)->setWebGLEnabled(flag); + toImpl(preferencesRef)->setForceSoftwareWebGLRendering(flag); } -bool WKPreferencesGetWebGLEnabled(WKPreferencesRef preferencesRef) +bool WKPreferencesGetForceSoftwareWebGLRendering(WKPreferencesRef preferencesRef) { - return toImpl(preferencesRef)->webGLEnabled(); + return toImpl(preferencesRef)->forceSoftwareWebGLRendering(); } void WKPreferencesSetAccelerated2DCanvasEnabled(WKPreferencesRef preferencesRef, bool flag) @@ -489,34 +479,34 @@ bool WKPreferencesGetAccelerated2DCanvasEnabled(WKPreferencesRef preferencesRef) return toImpl(preferencesRef)->accelerated2dCanvasEnabled(); } -void WKPreferencesSetCSSRegionsEnabled(WKPreferencesRef preferencesRef, bool flag) +void WKPreferencesSetCSSAnimationTriggersEnabled(WKPreferencesRef preferencesRef, bool flag) { - toImpl(preferencesRef)->setCSSRegionsEnabled(flag); + toImpl(preferencesRef)->setCSSAnimationTriggersEnabled(flag); } -bool WKPreferencesGetCSSRegionsEnabled(WKPreferencesRef preferencesRef) +bool WKPreferencesGetCSSAnimationTriggersEnabled(WKPreferencesRef preferencesRef) { - return toImpl(preferencesRef)->cssRegionsEnabled(); + return toImpl(preferencesRef)->cssAnimationTriggersEnabled(); } -void WKPreferencesSetCSSGridLayoutEnabled(WKPreferencesRef preferencesRef, bool flag) +void WKPreferencesSetWebAnimationsEnabled(WKPreferencesRef preferencesRef, bool flag) { - toImpl(preferencesRef)->setCSSGridLayoutEnabled(flag); + toImpl(preferencesRef)->setWebAnimationsEnabled(flag); } -bool WKPreferencesGetCSSGridLayoutEnabled(WKPreferencesRef preferencesRef) +bool WKPreferencesGetWebAnimationsEnabled(WKPreferencesRef preferencesRef) { - return toImpl(preferencesRef)->cssGridLayoutEnabled(); + return toImpl(preferencesRef)->webAnimationsEnabled(); } -void WKPreferencesSetRegionBasedColumnsEnabled(WKPreferencesRef preferencesRef, bool flag) +void WKPreferencesSetCSSRegionsEnabled(WKPreferencesRef preferencesRef, bool flag) { - toImpl(preferencesRef)->setRegionBasedColumnsEnabled(flag); + toImpl(preferencesRef)->setCSSRegionsEnabled(flag); } -bool WKPreferencesGetRegionBasedColumnsEnabled(WKPreferencesRef preferencesRef) +bool WKPreferencesGetCSSRegionsEnabled(WKPreferencesRef preferencesRef) { - return toImpl(preferencesRef)->regionBasedColumnsEnabled(); + return toImpl(preferencesRef)->cssRegionsEnabled(); } void WKPreferencesSetNeedsSiteSpecificQuirks(WKPreferencesRef preferencesRef, bool flag) @@ -524,6 +514,16 @@ void WKPreferencesSetNeedsSiteSpecificQuirks(WKPreferencesRef preferencesRef, bo toImpl(preferencesRef)->setNeedsSiteSpecificQuirks(flag); } +bool WKPreferencesUseLegacyTextAlignPositionedElementBehavior(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->useLegacyTextAlignPositionedElementBehavior(); +} + +void WKPreferencesSetUseLegacyTextAlignPositionedElementBehavior(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setUseLegacyTextAlignPositionedElementBehavior(flag); +} + bool WKPreferencesGetNeedsSiteSpecificQuirks(WKPreferencesRef preferencesRef) { return toImpl(preferencesRef)->needsSiteSpecificQuirks(); @@ -589,6 +589,16 @@ bool WKPreferencesGetShouldPrintBackgrounds(WKPreferencesRef preferencesRef) return toImpl(preferencesRef)->shouldPrintBackgrounds(); } +void WKPreferencesSetDOMTimersThrottlingEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setDOMTimersThrottlingEnabled(enabled); +} + +bool WKPreferencesGetDOMTimersThrottlingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->domTimersThrottlingEnabled(); +} + void WKPreferencesSetWebArchiveDebugModeEnabled(WKPreferencesRef preferencesRef, bool enabled) { toImpl(preferencesRef)->setWebArchiveDebugModeEnabled(enabled); @@ -689,6 +699,16 @@ bool WKPreferencesGetAVFoundationEnabled(WKPreferencesRef preferencesRef) return toImpl(preferencesRef)->isAVFoundationEnabled(); } +void WKPreferencesSetAVFoundationNSURLSessionEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setAVFoundationNSURLSessionEnabled(enabled); +} + +bool WKPreferencesGetAVFoundationNSURLSessionEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->isAVFoundationNSURLSessionEnabled(); +} + void WKPreferencesSetWebSecurityEnabled(WKPreferencesRef preferencesRef, bool enabled) { toImpl(preferencesRef)->setWebSecurityEnabled(enabled); @@ -730,22 +750,52 @@ bool WKPreferencesGetHixie76WebSocketProtocolEnabled(WKPreferencesRef) void WKPreferencesSetMediaPlaybackRequiresUserGesture(WKPreferencesRef preferencesRef, bool flag) { - toImpl(preferencesRef)->setMediaPlaybackRequiresUserGesture(flag); + toImpl(preferencesRef)->setRequiresUserGestureForMediaPlayback(flag); } bool WKPreferencesGetMediaPlaybackRequiresUserGesture(WKPreferencesRef preferencesRef) { - return toImpl(preferencesRef)->mediaPlaybackRequiresUserGesture(); + return toImpl(preferencesRef)->requiresUserGestureForMediaPlayback(); +} + +void WKPreferencesSetAudioPlaybackRequiresUserGesture(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setRequiresUserGestureForAudioPlayback(flag); +} + +bool WKPreferencesGetAudioPlaybackRequiresUserGesture(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->requiresUserGestureForAudioPlayback(); } void WKPreferencesSetMediaPlaybackAllowsInline(WKPreferencesRef preferencesRef, bool flag) { - toImpl(preferencesRef)->setMediaPlaybackAllowsInline(flag); + toImpl(preferencesRef)->setAllowsInlineMediaPlayback(flag); } bool WKPreferencesGetMediaPlaybackAllowsInline(WKPreferencesRef preferencesRef) { - return toImpl(preferencesRef)->mediaPlaybackAllowsInline(); + return toImpl(preferencesRef)->allowsInlineMediaPlayback(); +} + +void WKPreferencesSetInlineMediaPlaybackRequiresPlaysInlineAttribute(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setInlineMediaPlaybackRequiresPlaysInlineAttribute(flag); +} + +bool WKPreferencesGetInlineMediaPlaybackRequiresPlaysInlineAttribute(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->inlineMediaPlaybackRequiresPlaysInlineAttribute(); +} + +void WKPreferencesSetMediaControlsScaleWithPageZoom(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setMediaControlsScaleWithPageZoom(flag); +} + +bool WKPreferencesGetMediaControlsScaleWithPageZoom(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->mediaControlsScaleWithPageZoom(); } void WKPreferencesSetShowsToolTipOverTruncatedText(WKPreferencesRef preferencesRef, bool flag) @@ -778,24 +828,26 @@ bool WKPreferencesGetWebAudioEnabled(WKPreferencesRef preferencesRef) return toImpl(preferencesRef)->webAudioEnabled(); } -void WKPreferencesSetApplicationChromeModeEnabled(WKPreferencesRef preferencesRef, bool enabled) +void WKPreferencesSetApplicationChromeModeEnabled(WKPreferencesRef, bool) { - toImpl(preferencesRef)->setApplicationChromeModeEnabled(enabled); + // FIXME: Remove once WebKit nightlies don't need to support Safari 8. } -bool WKPreferencesGetApplicationChromeModeEnabled(WKPreferencesRef preferencesRef) +bool WKPreferencesGetApplicationChromeModeEnabled(WKPreferencesRef) { - return toImpl(preferencesRef)->applicationChromeMode(); + // FIXME: Remove once WebKit nightlies don't need to support Safari 8. + return false; } -void WKPreferencesSetInspectorUsesWebKitUserInterface(WKPreferencesRef preferencesRef, bool enabled) +void WKPreferencesSetInspectorUsesWebKitUserInterface(WKPreferencesRef, bool) { - toImpl(preferencesRef)->setInspectorUsesWebKitUserInterface(enabled); + // FIXME: Remove once WebKit nightlies don't need to support Safari 6 thru 7. } -bool WKPreferencesGetInspectorUsesWebKitUserInterface(WKPreferencesRef preferencesRef) +bool WKPreferencesGetInspectorUsesWebKitUserInterface(WKPreferencesRef) { - return toImpl(preferencesRef)->inspectorUsesWebKitUserInterface(); + // FIXME: Remove once WebKit nightlies don't need to support Safari 6 thru 7. + return false; } void WKPreferencesSetSuppressesIncrementalRendering(WKPreferencesRef preferencesRef, bool enabled) @@ -1145,6 +1197,76 @@ double WKPreferencesGetIncrementalRenderingSuppressionTimeout(WKPreferencesRef p return toAPI(toImpl(preferencesRef)->incrementalRenderingSuppressionTimeout()); } +void WKPreferencesSetThreadedScrollingEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setThreadedScrollingEnabled(enabled); +} + +bool WKPreferencesGetThreadedScrollingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->threadedScrollingEnabled(); +} + +void WKPreferencesSetSimpleLineLayoutEnabled(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setSimpleLineLayoutEnabled(flag); +} + +bool WKPreferencesGetSimpleLineLayoutEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->simpleLineLayoutEnabled(); +} + +void WKPreferencesSetSimpleLineLayoutDebugBordersEnabled(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setSimpleLineLayoutDebugBordersEnabled(flag); +} + +bool WKPreferencesGetSimpleLineLayoutDebugBordersEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->simpleLineLayoutDebugBordersEnabled(); +} + +void WKPreferencesSetNewBlockInsideInlineModelEnabled(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setNewBlockInsideInlineModelEnabled(flag); +} + +bool WKPreferencesGetNewBlockInsideInlineModelEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->newBlockInsideInlineModelEnabled(); +} + +void WKPreferencesSetSubpixelCSSOMElementMetricsEnabled(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setSubpixelCSSOMElementMetricsEnabled(flag); +} + +bool WKPreferencesGetSubpixelCSSOMElementMetricsEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->subpixelCSSOMElementMetricsEnabled(); +} + +void WKPreferencesSetUseGiantTiles(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setUseGiantTiles(flag); +} + +bool WKPreferencesGetUseGiantTiles(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->useGiantTiles(); +} + +void WKPreferencesSetMediaStreamEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setMediaStreamEnabled(enabled); +} + +bool WKPreferencesGetMediaStreamEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->mediaStreamEnabled(); +} + void WKPreferencesSetSpatialNavigationEnabled(WKPreferencesRef preferencesRef, bool enabled) { toImpl(preferencesRef)->setSpatialNavigationEnabled(enabled); @@ -1154,3 +1276,183 @@ bool WKPreferencesGetSpatialNavigationEnabled(WKPreferencesRef preferencesRef) { return toImpl(preferencesRef)->spatialNavigationEnabled(); } + +void WKPreferencesSetMediaSourceEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setMediaSourceEnabled(enabled); +} + +bool WKPreferencesGetMediaSourceEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->mediaSourceEnabled(); +} + +void WKPreferencesSetViewGestureDebuggingEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setViewGestureDebuggingEnabled(enabled); +} + +bool WKPreferencesGetViewGestureDebuggingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->viewGestureDebuggingEnabled(); +} + +void WKPreferencesSetShouldConvertPositionStyleOnCopy(WKPreferencesRef preferencesRef, bool convert) +{ + toImpl(preferencesRef)->setShouldConvertPositionStyleOnCopy(convert); +} + +bool WKPreferencesGetShouldConvertPositionStyleOnCopy(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->shouldConvertPositionStyleOnCopy(); +} + +void WKPreferencesSetTelephoneNumberParsingEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setTelephoneNumberParsingEnabled(enabled); +} + +bool WKPreferencesGetTelephoneNumberParsingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->telephoneNumberParsingEnabled(); +} + +void WKPreferencesSetEnableInheritURIQueryComponent(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setEnableInheritURIQueryComponent(enabled); +} + +bool WKPreferencesGetEnableInheritURIQueryComponent(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->enableInheritURIQueryComponent(); +} + +void WKPreferencesSetServiceControlsEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setServiceControlsEnabled(enabled); +} + +bool WKPreferencesGetServiceControlsEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->serviceControlsEnabled(); +} + +void WKPreferencesSetImageControlsEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setImageControlsEnabled(enabled); +} + +bool WKPreferencesGetImageControlsEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->imageControlsEnabled(); +} + +void WKPreferencesSetGamepadsEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setGamepadsEnabled(enabled); +} + +bool WKPreferencesGetGamepadsEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->gamepadsEnabled(); +} + +// FIXME: Remove these when possible. +void WKPreferencesSetLongMousePressEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ +} + +bool WKPreferencesGetLongMousePressEnabled(WKPreferencesRef preferencesRef) +{ + return false; +} + +void WKPreferencesSetMinimumZoomFontSize(WKPreferencesRef preferencesRef, double size) +{ + toImpl(preferencesRef)->setMinimumZoomFontSize(size); +} + +double WKPreferencesGetMinimumZoomFontSize(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->minimumZoomFontSize(); +} + +void WKPreferencesSetAntialiasedFontDilationEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setAntialiasedFontDilationEnabled(enabled); +} + +bool WKPreferencesGetAntialiasedFontDilationEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->antialiasedFontDilationEnabled(); +} + +void WKPreferencesSetVisibleDebugOverlayRegions(WKPreferencesRef preferencesRef, WKDebugOverlayRegions visibleRegions) +{ + toImpl(preferencesRef)->setVisibleDebugOverlayRegions(visibleRegions); +} + +WKDebugOverlayRegions WKPreferencesGetVisibleDebugOverlayRegions(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->visibleDebugOverlayRegions(); +} + +void WKPreferencesSetIgnoreViewportScalingConstraints(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setIgnoreViewportScalingConstraints(enabled); +} + +bool WKPreferencesGetIgnoreViewportScalingConstraints(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->ignoreViewportScalingConstraints(); +} + +void WKPreferencesSetMetaRefreshEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setHTTPEquivEnabled(enabled); +} + +bool WKPreferencesGetMetaRefreshEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->httpEquivEnabled(); +} + +void WKPreferencesSetHTTPEquivEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setHTTPEquivEnabled(enabled); +} + +bool WKPreferencesGetHTTPEquivEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->httpEquivEnabled(); +} + +void WKPreferencesSetAllowsAirPlayForMediaPlayback(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setAllowsAirPlayForMediaPlayback(enabled); +} + +bool WKPreferencesGetAllowsAirPlayForMediaPlayback(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->allowsAirPlayForMediaPlayback(); +} + +void WKPreferencesSetResourceUsageOverlayVisible(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setResourceUsageOverlayVisible(enabled); +} + +bool WKPreferencesGetResourceUsageOverlayVisible(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->resourceUsageOverlayVisible(); +} + +void WKPreferencesSetMockCaptureDevicesEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setMockCaptureDevicesEnabled(enabled); +} + +bool WKPreferencesGetMockCaptureDevicesEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->mockCaptureDevicesEnabled(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesRef.h index a9865d15f..c352038bf 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferences.h +++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesRef.h @@ -23,10 +23,10 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKPreferences_h -#define WKPreferences_h +#ifndef WKPreferencesRef_h +#define WKPreferencesRef_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifndef __cplusplus #include <stdbool.h> @@ -43,6 +43,12 @@ enum WKStorageBlockingPolicy { }; typedef enum WKStorageBlockingPolicy WKStorageBlockingPolicy; +enum WKDebugOverlayRegionFlags { + kWKNonFastScrollableRegion = 1 << 0, + kWKWheelEventHandlerRegion = 1 << 1 +}; +typedef unsigned WKDebugOverlayRegions; + WK_EXPORT WKTypeID WKPreferencesGetTypeID(); WK_EXPORT WKPreferencesRef WKPreferencesCreate(); @@ -144,10 +150,6 @@ WK_EXPORT bool WKPreferencesGetPrivateBrowsingEnabled(WKPreferencesRef preferenc WK_EXPORT void WKPreferencesSetDeveloperExtrasEnabled(WKPreferencesRef preferencesRef, bool enabled); WK_EXPORT bool WKPreferencesGetDeveloperExtrasEnabled(WKPreferencesRef preferencesRef); -// Defaults to false. -WK_EXPORT void WKPreferencesSetJavaScriptExperimentsEnabled(WKPreferencesRef preferencesRef, bool enabled); -WK_EXPORT bool WKPreferencesGetJavaScriptExperimentsEnabled(WKPreferencesRef preferencesRef); - // Defaults to true. WK_EXPORT void WKPreferencesSetTextAreasAreResizable(WKPreferencesRef preferencesRef, bool resizable); WK_EXPORT bool WKPreferencesGetTextAreasAreResizable(WKPreferencesRef preferencesRef); @@ -180,6 +182,10 @@ WK_EXPORT bool WKPreferencesGetFullScreenEnabled(WKPreferencesRef preferencesRef WK_EXPORT void WKPreferencesSetAVFoundationEnabled(WKPreferencesRef preferencesRef, bool enabled); WK_EXPORT bool WKPreferencesGetAVFoundationEnabled(WKPreferencesRef preferencesRef); +// Defaults to false. +WK_EXPORT void WKPreferencesSetAVFoundationNSURLSessionEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetAVFoundationNSURLSessionEnabled(WKPreferencesRef preferencesRef); + // Defaults to false WK_EXPORT void WKPreferencesSetWebAudioEnabled(WKPreferencesRef preferencesRef, bool enabled); WK_EXPORT bool WKPreferencesGetWebAudioEnabled(WKPreferencesRef preferencesRef); @@ -216,7 +222,7 @@ WK_EXPORT bool WKPreferencesGetNotificationsEnabled(WKPreferencesRef preferences WK_EXPORT void WKPreferencesSetShouldRespectImageOrientation(WKPreferencesRef preferencesRef, bool enabled); WK_EXPORT bool WKPreferencesGetShouldRespectImageOrientation(WKPreferencesRef preferencesRef); -// Defaults to false +// Defaults to kWKAllowAllStorage WK_EXPORT void WKPreferencesSetStorageBlockingPolicy(WKPreferencesRef preferencesRef, WKStorageBlockingPolicy policy); WK_EXPORT WKStorageBlockingPolicy WKPreferencesGetStorageBlockingPolicy(WKPreferencesRef preferencesRef); @@ -240,12 +246,28 @@ WK_EXPORT bool WKPreferencesGetQTKitEnabled(WKPreferencesRef preferencesRef); WK_EXPORT void WKPreferencesSetAsynchronousSpellCheckingEnabled(WKPreferencesRef preferencesRef, bool enabled); WK_EXPORT bool WKPreferencesGetAsynchronousSpellCheckingEnabled(WKPreferencesRef preferencesRef); +// Defaults to false +WK_EXPORT void WKPreferencesSetMediaStreamEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetMediaStreamEnabled(WKPreferencesRef preferencesRef); + // Defaults to false. WK_EXPORT void WKPreferencesSetSpatialNavigationEnabled(WKPreferencesRef preferencesRef, bool enabled); WK_EXPORT bool WKPreferencesGetSpatialNavigationEnabled(WKPreferencesRef preferencesRef); +// Defaults to 0. +WK_EXPORT void WKPreferencesSetVisibleDebugOverlayRegions(WKPreferencesRef preferencesRef, WKDebugOverlayRegions enabled); +WK_EXPORT WKDebugOverlayRegions WKPreferencesGetVisibleDebugOverlayRegions(WKPreferencesRef preferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetIgnoreViewportScalingConstraints(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetIgnoreViewportScalingConstraints(WKPreferencesRef preferencesRef); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetAllowsAirPlayForMediaPlayback(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetAllowsAirPlayForMediaPlayback(WKPreferencesRef preferencesRef); + #ifdef __cplusplus } #endif -#endif /* WKPreferences_h */ +#endif /* WKPreferencesRef_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h index 1c957563f..0c6cc6976 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2014 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,7 +26,7 @@ #ifndef WKPreferencesPrivate_h #define WKPreferencesPrivate_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { @@ -52,6 +52,11 @@ enum WKEditableLinkBehavior { }; typedef enum WKEditableLinkBehavior WKEditableLinkBehavior; +enum WKJavaScriptRuntimeFlags { + kWKJavaScriptRuntimeFlagsAllEnabled = 0 +}; +typedef unsigned WKJavaScriptRuntimeFlagSet; + // Creates a copy with no identifier. WK_EXPORT WKPreferencesRef WKPreferencesCreateCopy(WKPreferencesRef); @@ -92,28 +97,28 @@ WK_EXPORT void WKPreferencesSetTiledScrollingIndicatorVisible(WKPreferencesRef, WK_EXPORT bool WKPreferencesGetTiledScrollingIndicatorVisible(WKPreferencesRef); // Defaults to true. -WK_EXPORT void WKPreferencesSetCSSCustomFilterEnabled(WKPreferencesRef, bool flag); -WK_EXPORT bool WKPreferencesGetCSSCustomFilterEnabled(WKPreferencesRef); - -// Defaults to false. WK_EXPORT void WKPreferencesSetWebGLEnabled(WKPreferencesRef, bool); WK_EXPORT bool WKPreferencesGetWebGLEnabled(WKPreferencesRef); // Defaults to false. +WK_EXPORT void WKPreferencesSetForceSoftwareWebGLRendering(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetForceSoftwareWebGLRendering(WKPreferencesRef); + +// Defaults to false. WK_EXPORT void WKPreferencesSetAccelerated2DCanvasEnabled(WKPreferencesRef, bool); WK_EXPORT bool WKPreferencesGetAccelerated2DCanvasEnabled(WKPreferencesRef); // Defaults to true -WK_EXPORT void WKPreferencesSetCSSRegionsEnabled(WKPreferencesRef, bool flag); -WK_EXPORT bool WKPreferencesGetCSSRegionsEnabled(WKPreferencesRef); +WK_EXPORT void WKPreferencesSetCSSAnimationTriggersEnabled(WKPreferencesRef, bool flag); +WK_EXPORT bool WKPreferencesGetCSSAnimationTriggersEnabled(WKPreferencesRef); // Defaults to false -WK_EXPORT void WKPreferencesSetCSSGridLayoutEnabled(WKPreferencesRef, bool flag); -WK_EXPORT bool WKPreferencesGetCSSGridLayoutEnabled(WKPreferencesRef); +WK_EXPORT void WKPreferencesSetWebAnimationsEnabled(WKPreferencesRef, bool flag); +WK_EXPORT bool WKPreferencesGetWebAnimationsEnabled(WKPreferencesRef); -// Defaults to false -WK_EXPORT void WKPreferencesSetRegionBasedColumnsEnabled(WKPreferencesRef, bool flag); -WK_EXPORT bool WKPreferencesGetRegionBasedColumnsEnabled(WKPreferencesRef); +// Defaults to true +WK_EXPORT void WKPreferencesSetCSSRegionsEnabled(WKPreferencesRef, bool flag); +WK_EXPORT bool WKPreferencesGetCSSRegionsEnabled(WKPreferencesRef); // Defaults to false. WK_EXPORT void WKPreferencesSetNeedsSiteSpecificQuirks(WKPreferencesRef, bool); @@ -127,6 +132,10 @@ WK_EXPORT bool WKPreferencesGetForceFTPDirectoryListings(WKPreferencesRef prefer WK_EXPORT void WKPreferencesSetFTPDirectoryTemplatePath(WKPreferencesRef preferences, WKStringRef path); WK_EXPORT WKStringRef WKPreferencesCopyFTPDirectoryTemplatePath(WKPreferencesRef preferences); +// Defaults to true. +WK_EXPORT void WKPreferencesSetDOMTimersThrottlingEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetDOMTimersThrottlingEnabled(WKPreferencesRef preferences); + // Defaults to false. WK_EXPORT void WKPreferencesSetWebArchiveDebugModeEnabled(WKPreferencesRef preferences, bool enabled); WK_EXPORT bool WKPreferencesGetWebArchiveDebugModeEnabled(WKPreferencesRef preferences); @@ -171,23 +180,35 @@ WK_EXPORT bool WKPreferencesGetHixie76WebSocketProtocolEnabled(WKPreferencesRef WK_EXPORT void WKPreferencesSetMediaPlaybackRequiresUserGesture(WKPreferencesRef preferencesRef, bool flag); WK_EXPORT bool WKPreferencesGetMediaPlaybackRequiresUserGesture(WKPreferencesRef preferencesRef); +// Defaults to false. +WK_EXPORT void WKPreferencesSetAudioPlaybackRequiresUserGesture(WKPreferencesRef preferencesRef, bool flag); +WK_EXPORT bool WKPreferencesGetAudioPlaybackRequiresUserGesture(WKPreferencesRef preferencesRef); + // Defaults to true. WK_EXPORT void WKPreferencesSetMediaPlaybackAllowsInline(WKPreferencesRef preferencesRef, bool flag); WK_EXPORT bool WKPreferencesGetMediaPlaybackAllowsInline(WKPreferencesRef preferencesRef); // Defaults to false. +WK_EXPORT void WKPreferencesSetInlineMediaPlaybackRequiresPlaysInlineAttribute(WKPreferencesRef preferencesRef, bool flag); +WK_EXPORT bool WKPreferencesGetInlineMediaPlaybackRequiresPlaysInlineAttribute(WKPreferencesRef preferencesRef); + +// Defaults to false on iOS, true elsewhere. +WK_EXPORT void WKPreferencesSetMediaControlsScaleWithPageZoom(WKPreferencesRef preferencesRef, bool flag); +WK_EXPORT bool WKPreferencesGetMediaControlsScaleWithPageZoom(WKPreferencesRef preferencesRef); + +// Defaults to false. WK_EXPORT void WKPreferencesSetShowsToolTipOverTruncatedText(WKPreferencesRef preferencesRef, bool flag); WK_EXPORT bool WKPreferencesGetShowsToolTipOverTruncatedText(WKPreferencesRef preferencesRef); // Defaults to false. WK_EXPORT void WKPreferencesSetMockScrollbarsEnabled(WKPreferencesRef preferencesRef, bool flag); WK_EXPORT bool WKPreferencesGetMockScrollbarsEnabled(WKPreferencesRef preferencesRef); - -// Defaults to false. + +// Deprecated. Always returns false. WK_EXPORT void WKPreferencesSetApplicationChromeModeEnabled(WKPreferencesRef preferencesRef, bool enabled); WK_EXPORT bool WKPreferencesGetApplicationChromeModeEnabled(WKPreferencesRef preferencesRef); -// Defaults to false. +// Deprecated. Always returns false. WK_EXPORT void WKPreferencesSetInspectorUsesWebKitUserInterface(WKPreferencesRef preferencesRef, bool enabled); WK_EXPORT bool WKPreferencesGetInspectorUsesWebKitUserInterface(WKPreferencesRef preferencesRef); @@ -228,14 +249,10 @@ WK_EXPORT void WKPreferencesSetScrollingPerformanceLoggingEnabled(WKPreferencesR WK_EXPORT bool WKPreferencesGetScrollingPerformanceLoggingEnabled(WKPreferencesRef preferencesRef); // Defaults to true -WK_EXPORT void WKPreferencesSetScreenFontSubstitutionEnabled(WKPreferencesRef preferences, bool enabled); -WK_EXPORT bool WKPreferencesGetScreenFontSubstitutionEnabled(WKPreferencesRef preferences); - -// Defaults to true WK_EXPORT void WKPreferencesSetCookieEnabled(WKPreferencesRef preferences, bool enabled); WK_EXPORT bool WKPreferencesGetCookieEnabled(WKPreferencesRef preferences); -// Defaults to false +// Defaults to true on Mac, false elsewhere WK_EXPORT void WKPreferencesSetPDFPluginEnabled(WKPreferencesRef preferences, bool enabled); WK_EXPORT bool WKPreferencesGetPDFPluginEnabled(WKPreferencesRef preferences); @@ -247,7 +264,7 @@ WK_EXPORT bool WKPreferencesGetAggressiveTileRetentionEnabled(WKPreferencesRef p WK_EXPORT void WKPreferencesSetLogsPageMessagesToSystemConsoleEnabled(WKPreferencesRef preferences, bool enabled); WK_EXPORT bool WKPreferencesGetLogsPageMessagesToSystemConsoleEnabled(WKPreferencesRef preferences); -// Defaults to false +// Defaults to true WK_EXPORT void WKPreferencesSetPageVisibilityBasedProcessSuppressionEnabled(WKPreferencesRef preferences, bool enabled); WK_EXPORT bool WKPreferencesGetPageVisibilityBasedProcessSuppressionEnabled(WKPreferencesRef); @@ -283,12 +300,108 @@ WK_EXPORT bool WKPreferencesGetAutostartOriginPlugInSnapshottingEnabled(WKPrefer WK_EXPORT void WKPreferencesSetPrimaryPlugInSnapshotDetectionEnabled(WKPreferencesRef preferencesRef, bool enabled); WK_EXPORT bool WKPreferencesGetPrimaryPlugInSnapshotDetectionEnabled(WKPreferencesRef preferencesRef); +// Defaults to true +WK_EXPORT void WKPreferencesSetThreadedScrollingEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetThreadedScrollingEnabled(WKPreferencesRef preferencesRef); + // Defaults to 5 seconds. WK_EXPORT void WKPreferencesSetIncrementalRenderingSuppressionTimeout(WKPreferencesRef preferencesRef, double timeout); WK_EXPORT double WKPreferencesGetIncrementalRenderingSuppressionTimeout(WKPreferencesRef preferencesRef); +// Defaults to true. +WK_EXPORT void WKPreferencesSetSimpleLineLayoutEnabled(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetSimpleLineLayoutEnabled(WKPreferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetSimpleLineLayoutDebugBordersEnabled(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetSimpleLineLayoutDebugBordersEnabled(WKPreferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetNewBlockInsideInlineModelEnabled(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetNewBlockInsideInlineModelEnabled(WKPreferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetSubpixelCSSOMElementMetricsEnabled(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetSubpixelCSSOMElementMetricsEnabled(WKPreferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetUseGiantTiles(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetUseGiantTiles(WKPreferencesRef); + WK_EXPORT void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef); +// Defaults to false. +WK_EXPORT void WKPreferencesSetUseLegacyTextAlignPositionedElementBehavior(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesUseLegacyTextAlignPositionedElementBehavior(WKPreferencesRef preferencesRef); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetMediaSourceEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetMediaSourceEnabled(WKPreferencesRef preferencesRef); + +// Default to false. +WK_EXPORT void WKPreferencesSetViewGestureDebuggingEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetViewGestureDebuggingEnabled(WKPreferencesRef preferencesRef); + +// Default to false. +WK_EXPORT void WKPreferencesSetShouldConvertPositionStyleOnCopy(WKPreferencesRef preferencesRef, bool convert); +WK_EXPORT bool WKPreferencesGetShouldConvertPositionStyleOnCopy(WKPreferencesRef preferencesRef); + +// Default to false. +WK_EXPORT void WKPreferencesSetTelephoneNumberParsingEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetTelephoneNumberParsingEnabled(WKPreferencesRef preferencesRef); + +// Default to false. +WK_EXPORT void WKPreferencesSetEnableInheritURIQueryComponent(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetEnableInheritURIQueryComponent(WKPreferencesRef preferencesRef); + +// Default to false. +WK_EXPORT void WKPreferencesSetServiceControlsEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetServiceControlsEnabled(WKPreferencesRef preferencesRef); + +// Default to false. +WK_EXPORT void WKPreferencesSetImageControlsEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetImageControlsEnabled(WKPreferencesRef preferencesRef); + +// Default to false. +WK_EXPORT void WKPreferencesSetGamepadsEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetGamepadsEnabled(WKPreferencesRef preferencesRef); + +// Not implemented, should be deleted once there are no callers. +WK_EXPORT void WKPreferencesSetLongMousePressEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetLongMousePressEnabled(WKPreferencesRef preferencesRef); + +// Defaults to 0. Setting this to 0 disables font autosizing on iOS. +WK_EXPORT void WKPreferencesSetMinimumZoomFontSize(WKPreferencesRef preferencesRef, double); +WK_EXPORT double WKPreferencesGetMinimumZoomFontSize(WKPreferencesRef preferencesRef); + +// Not implemented, should be deleted once Safari no longer uses this function. +WK_EXPORT void WKPreferencesSetScreenFontSubstitutionEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetScreenFontSubstitutionEnabled(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetAntialiasedFontDilationEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetAntialiasedFontDilationEnabled(WKPreferencesRef preferences); + +// Defaults to 0. +WK_EXPORT void WKPreferencesSetJavaScriptRuntimeFlags(WKPreferencesRef preferences, WKJavaScriptRuntimeFlagSet javascriptRuntimeFlagSet); +WK_EXPORT WKJavaScriptRuntimeFlagSet WKPreferencesGetJavaScriptRuntimeFlags(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetMetaRefreshEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetMetaRefreshEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetHTTPEquivEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetHTTPEquivEnabled(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetResourceUsageOverlayVisible(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetResourceUsageOverlayVisible(WKPreferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetMockCaptureDevicesEnabled(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetMockCaptureDevicesEnabled(WKPreferencesRef); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.h b/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.h index c77d93ba0..ff7ca8742 100644 --- a/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.h +++ b/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.h @@ -26,8 +26,8 @@ #ifndef WKProtectionSpace_h #define WKProtectionSpace_h -#include <WebKit2/WKBase.h> -#include <WebKit2/WKProtectionSpaceTypes.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKProtectionSpaceTypes.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKProtectionSpaceTypes.h b/Source/WebKit2/UIProcess/API/C/WKProtectionSpaceTypes.h index fd1bd09d2..474146049 100644 --- a/Source/WebKit2/UIProcess/API/C/WKProtectionSpaceTypes.h +++ b/Source/WebKit2/UIProcess/API/C/WKProtectionSpaceTypes.h @@ -26,7 +26,7 @@ #ifndef WKProtectionSpaceTypes_h #define WKProtectionSpaceTypes_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp b/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp index a5711e014..0e3c7a2d6 100644 --- a/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp @@ -26,27 +26,68 @@ #include "config.h" #include "WKResourceCacheManager.h" -#include "WebResourceCacheManagerProxy.h" +#include "APIWebsiteDataStore.h" #include "WKAPICast.h" +#include "WebsiteDataRecord.h" using namespace WebKit; WKTypeID WKResourceCacheManagerGetTypeID() { - return toAPI(WebResourceCacheManagerProxy::APIType); + return toAPI(API::WebsiteDataStore::APIType); } -void WKResourceCacheManagerGetCacheOrigins(WKResourceCacheManagerRef cacheManagerRef, void* context, WKResourceCacheManagerGetCacheOriginsFunction callback) +static WebsiteDataTypes toWebsiteDataTypes(WKResourceCachesToClear cachesToClear) { - toImpl(cacheManagerRef)->getCacheOrigins(ArrayCallback::create(context, callback)); + using WebsiteDataTypes = WebKit::WebsiteDataTypes; + + int websiteDataTypes = WebsiteDataTypeMemoryCache; + + if (cachesToClear == WKResourceCachesToClearAll) + websiteDataTypes |= WebsiteDataTypeDiskCache; + + return static_cast<WebsiteDataTypes>(websiteDataTypes); +} + +void WKResourceCacheManagerGetCacheOrigins(WKResourceCacheManagerRef cacheManager, void* context, WKResourceCacheManagerGetCacheOriginsFunction callback) +{ + auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(cacheManager))->websiteDataStore(); + websiteDataStore.fetchData(toWebsiteDataTypes(WKResourceCachesToClearAll), [context, callback](Vector<WebsiteDataRecord> dataRecords) { + Vector<RefPtr<API::Object>> securityOrigins; + for (const auto& dataRecord : dataRecords) { + for (const auto& origin : dataRecord.origins) + securityOrigins.append(API::SecurityOrigin::create(*origin)); + } + + callback(toAPI(API::Array::create(WTFMove(securityOrigins)).ptr()), nullptr, context); + }); } -void WKResourceCacheManagerClearCacheForOrigin(WKResourceCacheManagerRef cacheManagerRef, WKSecurityOriginRef originRef, WKResourceCachesToClear cachesToClear) +void WKResourceCacheManagerClearCacheForOrigin(WKResourceCacheManagerRef cacheManager, WKSecurityOriginRef origin, WKResourceCachesToClear cachesToClear) { - toImpl(cacheManagerRef)->clearCacheForOrigin(toImpl(originRef), toResourceCachesToClear(cachesToClear)); + auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(cacheManager))->websiteDataStore(); + + Vector<WebsiteDataRecord> dataRecords; + + { + WebsiteDataRecord dataRecord; + dataRecord.add(WebsiteDataTypes::WebsiteDataTypeMemoryCache, &toImpl(origin)->securityOrigin()); + + dataRecords.append(dataRecord); + } + + if (cachesToClear == WKResourceCachesToClearAll) { + WebsiteDataRecord dataRecord; + dataRecord.add(WebsiteDataTypes::WebsiteDataTypeDiskCache, &toImpl(origin)->securityOrigin()); + + dataRecords.append(dataRecord); + } + + websiteDataStore.removeData(toWebsiteDataTypes(cachesToClear), dataRecords, [] { }); } -void WKResourceCacheManagerClearCacheForAllOrigins(WKResourceCacheManagerRef cacheManagerRef, WKResourceCachesToClear cachesToClear) +void WKResourceCacheManagerClearCacheForAllOrigins(WKResourceCacheManagerRef cacheManager, WKResourceCachesToClear cachesToClear) { - toImpl(cacheManagerRef)->clearCacheForAllOrigins(toResourceCachesToClear(cachesToClear)); + auto& websiteDataStore = toImpl(reinterpret_cast<WKWebsiteDataStoreRef>(cacheManager))->websiteDataStore(); + websiteDataStore.removeData(toWebsiteDataTypes(cachesToClear), std::chrono::system_clock::time_point::min(), [] { }); } diff --git a/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h b/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h index 80c4531ff..7f4bb6c51 100644 --- a/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h +++ b/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h @@ -26,7 +26,7 @@ #ifndef WKResourceCacheManager_h #define WKResourceCacheManager_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.cpp b/Source/WebKit2/UIProcess/API/C/WKSessionRef.cpp index a9bfd3cb1..a93579087 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKSessionRef.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Intel Corporation. All rights reserved. + * Copyright (C) 2014 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,30 +24,29 @@ */ #include "config.h" -#include "WKNetworkInfo.h" +#include "WKSessionRef.h" -#if ENABLE(NETWORK_INFO) +#include "APISession.h" #include "WKAPICast.h" -#include "WebNetworkInfo.h" using namespace WebKit; -#endif -WKTypeID WKNetworkInfoGetTypeID() +WKSessionRef WKSessionCreate(bool isEphemeral) { -#if ENABLE(NETWORK_INFO) - return toAPI(WebNetworkInfo::APIType); -#else - return 0; -#endif + // The implementation doesn't support non-ephemeral + if (!isEphemeral) + return nullptr; + + RefPtr<API::Session> session = API::Session::createEphemeral(); + return toAPI(session.release().leakRef()); +} + +WKTypeID WKSessionGetTypeID() +{ + return toAPI(API::Session::APIType); } -WKNetworkInfoRef WKNetworkInfoCreate(double bandwidth, bool isMetered) +bool WKSessionIsEphemeral(WKSessionRef sessionRef) { -#if ENABLE(NETWORK_INFO) - RefPtr<WebNetworkInfo> networkInfo = WebNetworkInfo::create(bandwidth, isMetered); - return toAPI(networkInfo.release().leakRef()); -#else - return 0; -#endif + return toAPI(toImpl(sessionRef)->isEphemeral()); } diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.h b/Source/WebKit2/UIProcess/API/C/WKSessionRef.h index d8afdc432..693902677 100644 --- a/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.h +++ b/Source/WebKit2/UIProcess/API/C/WKSessionRef.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Intel Corporation. All rights reserved. + * Copyright (C) 2014 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,27 +23,24 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKViewEfl_h -#define WKViewEfl_h +#ifndef WKSessionRef_h +#define WKSessionRef_h -#include <WebKit2/WKBase.h> - -typedef struct _cairo_surface cairo_surface_t; +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { #endif -WK_EXPORT void WKViewPaintToCairoSurface(WKViewRef, cairo_surface_t*); - -WK_EXPORT WKImageRef WKViewCreateSnapshot(WKViewRef); +/* FIXME: We can create sessions on demand, because we hardcode the fact that all sessions but the default one are ephemeral. We'll need to create them explicitly once sessions have more configuration options. */ +WK_EXPORT WKSessionRef WKSessionCreate(bool isEphemeral); -WK_EXPORT void WKViewSetThemePath(WKViewRef, WKStringRef); +WK_EXPORT WKTypeID WKSessionGetTypeID(); -WK_EXPORT void WKViewSendTouchEvent(WKViewRef, WKTouchEventRef); +WK_EXPORT bool WKSessionIsEphemeral(WKSessionRef session); #ifdef __cplusplus } #endif -#endif /* WKViewEfl_h */ +#endif /* WKSessionRef_h */ diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp b/Source/WebKit2/UIProcess/API/C/WKSessionStateRef.cpp index 3e69a9908..98e717519 100644 --- a/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKSessionStateRef.cpp @@ -1,7 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. - * Copyright (C) 2011 Igalia S.L. + * Copyright (C) 2014 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,26 +24,29 @@ */ #include "config.h" -#include "WKView.h" +#include "WKSessionStateRef.h" +#include "APIData.h" +#include "APISessionState.h" +#include "LegacySessionStateCoding.h" +#include "SessionState.h" #include "WKAPICast.h" -#include "WKViewPrivate.h" -#include "WebKitWebViewBasePrivate.h" -using namespace WebKit; -using namespace WebCore; - -WKViewRef WKViewCreate(WKContextRef contextRef, WKPageGroupRef pageGroupRef) +WKTypeID WKSessionStateGetTypeID() { - return toAPI(webkitWebViewBaseCreate(toImpl(contextRef), toImpl(pageGroupRef))); + return WebKit::toAPI(API::SessionState::APIType); } -WKPageRef WKViewGetPage(WKViewRef viewRef) +WKSessionStateRef WKSessionStateCreateFromData(WKDataRef data) { - return toAPI(webkitWebViewBaseGetPage(toImpl(viewRef))); + WebKit::SessionState sessionState; + if (!WebKit::decodeLegacySessionState(WebKit::toImpl(data)->bytes(), WebKit::toImpl(data)->size(), sessionState)) + return nullptr; + + return WebKit::toAPI(&API::SessionState::create(WTFMove(sessionState)).leakRef()); } -void WKViewSetFocus(WKViewRef viewRef, bool focused) +WKDataRef WKSessionStateCopyData(WKSessionStateRef sessionState) { - webkitWebViewBaseSetFocus(toImpl(viewRef), focused); + return WebKit::toAPI(WebKit::encodeLegacySessionState(WebKit::toImpl(sessionState)->sessionState()).release().leakRef()); } diff --git a/Source/WebKit2/UIProcess/API/C/WKSessionStateRef.h b/Source/WebKit2/UIProcess/API/C/WKSessionStateRef.h new file mode 100644 index 000000000..e46b66414 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKSessionStateRef.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2014 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKSessionStateRef_h +#define WKSessionStateRef_h + +#include <WebKit/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKSessionStateGetTypeID(); + +WK_EXPORT WKSessionStateRef WKSessionStateCreateFromData(WKDataRef data); + +WK_EXPORT WKDataRef WKSessionStateCopyData(WKSessionStateRef sessionState); + +#ifdef __cplusplus +} +#endif + +#endif // WKSessionStateRef_h diff --git a/Source/WebKit2/UIProcess/API/C/WKTextChecker.cpp b/Source/WebKit2/UIProcess/API/C/WKTextChecker.cpp index 3329da2e6..3279dd7a9 100644 --- a/Source/WebKit2/UIProcess/API/C/WKTextChecker.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKTextChecker.cpp @@ -32,29 +32,29 @@ using namespace WebKit; -void WKTextCheckerSetClient(const WKTextCheckerClient* wkClient) +void WKTextCheckerSetClient(const WKTextCheckerClientBase* wkClient) { if (wkClient && wkClient->version) return; - WebTextChecker::shared()->setClient(wkClient); + WebTextChecker::singleton()->setClient(wkClient); } void WKTextCheckerContinuousSpellCheckingEnabledStateChanged(bool enabled) { - WebTextChecker::shared()->continuousSpellCheckingEnabledStateChanged(enabled); + WebTextChecker::singleton()->continuousSpellCheckingEnabledStateChanged(enabled); } void WKTextCheckerGrammarCheckingEnabledStateChanged(bool enabled) { - WebTextChecker::shared()->grammarCheckingEnabledStateChanged(enabled); + WebTextChecker::singleton()->grammarCheckingEnabledStateChanged(enabled); } void WKTextCheckerCheckSpelling(WKPageRef page, bool startBeforeSelection) { - WebTextChecker::shared()->checkSpelling(toImpl(page), startBeforeSelection); + WebTextChecker::singleton()->checkSpelling(toImpl(page), startBeforeSelection); } void WKTextCheckerChangeSpellingToWord(WKPageRef page, WKStringRef word) { - WebTextChecker::shared()->changeSpellingToWord(toImpl(page), toWTFString(word)); + WebTextChecker::singleton()->changeSpellingToWord(toImpl(page), toWTFString(word)); } diff --git a/Source/WebKit2/UIProcess/API/C/WKTextChecker.h b/Source/WebKit2/UIProcess/API/C/WKTextChecker.h index 6a05ed98a..a32469461 100644 --- a/Source/WebKit2/UIProcess/API/C/WKTextChecker.h +++ b/Source/WebKit2/UIProcess/API/C/WKTextChecker.h @@ -26,7 +26,7 @@ #ifndef WKTextChecker_h #define WKTextChecker_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { @@ -50,9 +50,14 @@ typedef WKArrayRef (*WKTextCheckerGuessesForWord)(uint64_t tag, WKStringRef word typedef void (*WKTextCheckerLearnWord)(uint64_t tag, WKStringRef word, const void *clientInfo); typedef void (*WKTextCheckerIgnoreWord)(uint64_t tag, WKStringRef word, const void *clientInfo); -struct WKTextCheckerClient { +typedef struct WKTextCheckerClientBase { int version; const void * clientInfo; +} WKTextCheckerClientBase; + +typedef struct WKTextCheckerClientV0 { + WKTextCheckerClientBase base; + WKTextCheckerContinousSpellCheckingAllowed continuousSpellCheckingAllowed; WKTextCheckerContinousSpellCheckingEnabled continuousSpellCheckingEnabled; WKTextCheckerSetContinousSpellCheckingEnabled setContinuousSpellCheckingEnabled; @@ -69,12 +74,9 @@ struct WKTextCheckerClient { WKTextCheckerGuessesForWord guessesForWord; WKTextCheckerLearnWord learnWord; WKTextCheckerIgnoreWord ignoreWord; -}; -typedef struct WKTextCheckerClient WKTextCheckerClient; - -enum { kWKTextCheckerClientCurrentVersion = 0 }; +} WKTextCheckerClientV0; -WK_EXPORT void WKTextCheckerSetClient(const WKTextCheckerClient* client); +WK_EXPORT void WKTextCheckerSetClient(const WKTextCheckerClientBase* client); WK_EXPORT void WKTextCheckerContinuousSpellCheckingEnabledStateChanged(bool); WK_EXPORT void WKTextCheckerGrammarCheckingEnabledStateChanged(bool); diff --git a/Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.cpp b/Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.cpp new file mode 100644 index 000000000..bb73853ba --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKUserContentControllerRef.h" + +#include "APIUserContentExtension.h" +#include "APIUserScript.h" +#include "WKAPICast.h" +#include "WebUserContentControllerProxy.h" + +using namespace WebKit; + +WKTypeID WKUserContentControllerGetTypeID() +{ + return toAPI(WebUserContentControllerProxy::APIType); +} + +WKUserContentControllerRef WKUserContentControllerCreate() +{ + return toAPI(&WebUserContentControllerProxy::create().leakRef()); +} + +WKArrayRef WKUserContentControllerCopyUserScripts(WKUserContentControllerRef userContentControllerRef) +{ + Ref<API::Array> userScripts = toImpl(userContentControllerRef)->userScripts().copy(); + return toAPI(&userScripts.leakRef()); +} + +void WKUserContentControllerAddUserScript(WKUserContentControllerRef userContentControllerRef, WKUserScriptRef userScriptRef) +{ + toImpl(userContentControllerRef)->addUserScript(*toImpl(userScriptRef)); +} + +void WKUserContentControllerRemoveAllUserScripts(WKUserContentControllerRef userContentControllerRef) +{ + toImpl(userContentControllerRef)->removeAllUserScripts(); +} + +void WKUserContentControllerAddUserContentFilter(WKUserContentControllerRef userContentControllerRef, WKUserContentFilterRef userContentFilterRef) +{ +#if ENABLE(CONTENT_EXTENSIONS) + toImpl(userContentControllerRef)->addUserContentExtension(*toImpl(userContentFilterRef)); +#endif +} + +void WKUserContentControllerRemoveAllUserContentFilters(WKUserContentControllerRef userContentControllerRef) +{ +#if ENABLE(CONTENT_EXTENSIONS) + toImpl(userContentControllerRef)->removeAllUserContentExtensions(); +#endif +} diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKFullScreenClientGtk.h b/Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.h index a8c92166b..d462e99b1 100644 --- a/Source/WebKit2/UIProcess/API/C/gtk/WKFullScreenClientGtk.h +++ b/Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Igalia S.L. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,32 +23,28 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKFullScreenClientGtk_h -#define WKFullScreenClientGtk_h +#ifndef WKUserContentControllerRef_h +#define WKUserContentControllerRef_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { #endif -typedef bool (*WKFullScreenClientGtkWillEnterFullScreenCallback)(const void* clientInfo); -typedef bool (*WKFullScreenClientGtkWillExitFullScreenCallback)(const void* clientInfo); +WK_EXPORT WKTypeID WKUserContentControllerGetTypeID(); -struct WKFullScreenClientGtk { - int version; - const void* clientInfo; - WKFullScreenClientGtkWillEnterFullScreenCallback willEnterFullScreen; - WKFullScreenClientGtkWillExitFullScreenCallback willExitFullScreen; -}; -typedef struct WKFullScreenClientGtk WKFullScreenClientGtk; +WK_EXPORT WKUserContentControllerRef WKUserContentControllerCreate(); -enum { kWKFullScreenClientGtkCurrentVersion = 0 }; +WK_EXPORT WKArrayRef WKUserContentControllerCopyUserScripts(WKUserContentControllerRef userContentController); +WK_EXPORT void WKUserContentControllerAddUserScript(WKUserContentControllerRef userContentController, WKUserScriptRef userScript); +WK_EXPORT void WKUserContentControllerRemoveAllUserScripts(WKUserContentControllerRef userContentController); -WK_EXPORT void WKViewSetFullScreenClientGtk(WKViewRef viewRef, const WKFullScreenClientGtk* client); +WK_EXPORT void WKUserContentControllerAddUserContentFilter(WKUserContentControllerRef userContentController, WKUserContentFilterRef userContentFilter); +WK_EXPORT void WKUserContentControllerRemoveAllUserContentFilters(WKUserContentControllerRef userContentController); #ifdef __cplusplus } #endif -#endif /* WKFullScreenClientGtk_h */ +#endif /* WKUserContentControllerRef_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKUserContentExtensionStoreRef.cpp b/Source/WebKit2/UIProcess/API/C/WKUserContentExtensionStoreRef.cpp new file mode 100644 index 000000000..6fe872e62 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKUserContentExtensionStoreRef.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKUserContentExtensionStoreRef.h" + +#include "APIUserContentExtensionStore.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKUserContentExtensionStoreGetTypeID() +{ +#if ENABLE(CONTENT_EXTENSIONS) + return toAPI(API::UserContentExtensionStore::APIType); +#else + return 0; +#endif +} diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.h b/Source/WebKit2/UIProcess/API/C/WKUserContentExtensionStoreRef.h index cff864a75..53598ec80 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.h +++ b/Source/WebKit2/UIProcess/API/C/WKUserContentExtensionStoreRef.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Intel Corporation. All rights reserved. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,21 +23,19 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKNetworkInfo_h -#define WKNetworkInfo_h +#ifndef WKUserContentExtensionStoreRef_h +#define WKUserContentExtensionStoreRef_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { #endif -WK_EXPORT WKTypeID WKNetworkInfoGetTypeID(); - -WK_EXPORT WKNetworkInfoRef WKNetworkInfoCreate(double bandwidth, bool isMetered); +WK_EXPORT WKTypeID WKUserContentExtensionStoreGetTypeID(); #ifdef __cplusplus } #endif -#endif // WKNetworkInfo_h +#endif /* WKUserContentExtensionStoreRef_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionCheck.cpp b/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionCheck.cpp new file mode 100644 index 000000000..371c813c3 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionCheck.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "config.h" +#include "WKUserMediaPermissionCheck.h" + +#include "UserMediaPermissionCheckProxy.h" +#include "WKAPICast.h" +#include "WKArray.h" +#include "WKMutableArray.h" +#include "WKString.h" + +using namespace WebKit; + +WKTypeID WKUserMediaPermissionCheckGetTypeID() +{ + return toAPI(UserMediaPermissionCheckProxy::APIType); +} + +void WKUserMediaPermissionCheckSetHasPersistentPermission(WKUserMediaPermissionCheckRef userMediaPermissionRequestRef, bool allowed) +{ + toImpl(userMediaPermissionRequestRef)->setHasPersistentPermission(allowed); +} + diff --git a/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionCheck.h b/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionCheck.h new file mode 100644 index 000000000..e0cb0a339 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionCheck.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef WKUserMediaPermissionCheck_h +#define WKUserMediaPermissionCheck_h + +#include <WebKit/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKUserMediaPermissionCheckGetTypeID(); + +WK_EXPORT void WKUserMediaPermissionCheckSetHasPersistentPermission(WKUserMediaPermissionCheckRef, bool); + +#ifdef __cplusplus +} +#endif + +#endif /* WKMediaDevicesRequest_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionRequest.cpp b/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionRequest.cpp new file mode 100644 index 000000000..c86f86771 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionRequest.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2014 Igalia S.L + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "WKUserMediaPermissionRequest.h" + +#include "UserMediaPermissionRequestProxy.h" +#include "WKAPICast.h" +#include "WKArray.h" +#include "WKMutableArray.h" +#include "WKString.h" + +using namespace WebKit; + +WKTypeID WKUserMediaPermissionRequestGetTypeID() +{ + return toAPI(UserMediaPermissionRequestProxy::APIType); +} + + +void WKUserMediaPermissionRequestAllow(WKUserMediaPermissionRequestRef userMediaPermissionRequestRef, WKStringRef audioDeviceUID, WKStringRef videoDeviceUID) +{ + toImpl(userMediaPermissionRequestRef)->allow(toWTFString(audioDeviceUID), toWTFString(videoDeviceUID)); +} + +void WKUserMediaPermissionRequestDeny(WKUserMediaPermissionRequestRef userMediaPermissionRequestRef) +{ + toImpl(userMediaPermissionRequestRef)->deny(); +} + +WKArrayRef WKUserMediaPermissionRequestVideoDeviceUIDs(WKUserMediaPermissionRequestRef userMediaPermissionRef) +{ + WKMutableArrayRef array = WKMutableArrayCreate(); +#if ENABLE(MEDIA_STREAM) + for (auto& deviceUID : toImpl(userMediaPermissionRef)->videoDeviceUIDs()) + WKArrayAppendItem(array, toAPI(API::String::create(deviceUID).ptr())); +#endif + return array; +} + +WKArrayRef WKUserMediaPermissionRequestAudioDeviceUIDs(WKUserMediaPermissionRequestRef userMediaPermissionRef) +{ + WKMutableArrayRef array = WKMutableArrayCreate(); +#if ENABLE(MEDIA_STREAM) + for (auto& deviceUID : toImpl(userMediaPermissionRef)->audioDeviceUIDs()) + WKArrayAppendItem(array, toAPI(API::String::create(deviceUID).ptr())); +#endif + return array; +} diff --git a/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionRequest.h b/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionRequest.h new file mode 100644 index 000000000..764489a25 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKUserMediaPermissionRequest.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2014 Igalia S.L + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WKUserMediaPermissionRequest_h +#define WKUserMediaPermissionRequest_h + +#include <WebKit/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKUserMediaPermissionRequestGetTypeID(); + +WK_EXPORT void WKUserMediaPermissionRequestAllow(WKUserMediaPermissionRequestRef, WKStringRef audioDeviceUID, WKStringRef videoDeviceUID); +WK_EXPORT void WKUserMediaPermissionRequestDeny(WKUserMediaPermissionRequestRef); + +WK_EXPORT WKArrayRef WKUserMediaPermissionRequestVideoDeviceUIDs(WKUserMediaPermissionRequestRef); +WK_EXPORT WKArrayRef WKUserMediaPermissionRequestAudioDeviceUIDs(WKUserMediaPermissionRequestRef); + +#ifdef __cplusplus +} +#endif + +#endif /* WKUserMediaPermissionRequest_h */ diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.cpp b/Source/WebKit2/UIProcess/API/C/WKUserScriptRef.cpp index cefa2d358..ad71b017c 100644 --- a/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKUserScriptRef.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Intel Corporation. All rights reserved. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,37 +24,34 @@ */ #include "config.h" -#include "WKViewEfl.h" +#include "WKUserScriptRef.h" -#include "EwkView.h" +#include "APIUserScript.h" #include "WKAPICast.h" -#include "WebViewEfl.h" -#include <WebKit2/WKImageCairo.h> using namespace WebKit; -void WKViewPaintToCairoSurface(WKViewRef viewRef, cairo_surface_t* surface) +WKTypeID WKUserScriptGetTypeID() { - static_cast<WebViewEfl*>(toImpl(viewRef))->paintToCairoSurface(surface); + return toAPI(API::UserScript::APIType); } -WKImageRef WKViewCreateSnapshot(WKViewRef viewRef) +WKUserScriptRef WKUserScriptCreateWithSource(WKStringRef sourceRef, _WKUserScriptInjectionTime injectionTime, bool forMainFrameOnly) { - EwkView* ewkView = static_cast<WebViewEfl*>(toImpl(viewRef))->ewkView(); - return WKImageCreateFromCairoSurface(ewkView->takeSnapshot().get(), 0 /* options */); + return toAPI(&API::UserScript::create(WebCore::UserScript { toWTFString(sourceRef), API::UserScript::generateUniqueURL(), { }, { }, toUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::InjectInTopFrameOnly : WebCore::InjectInAllFrames }).leakRef()); } -void WKViewSetThemePath(WKViewRef viewRef, WKStringRef theme) +WKStringRef WKUserScriptCopySource(WKUserScriptRef userScriptRef) { - static_cast<WebViewEfl*>(toImpl(viewRef))->setThemePath(toImpl(theme)->string()); + return toCopiedAPI(toImpl(userScriptRef)->userScript().source()); } -void WKViewSendTouchEvent(WKViewRef viewRef, WKTouchEventRef touchEventRef) +_WKUserScriptInjectionTime WKUserScriptGetInjectionTime(WKUserScriptRef userScriptRef) { -#if ENABLE(TOUCH_EVENTS) - static_cast<WebViewEfl*>(toImpl(viewRef))->sendTouchEvent(toImpl(touchEventRef)); -#else - UNUSED_PARAM(viewRef); - UNUSED_PARAM(touchEventRef); -#endif + return toWKUserScriptInjectionTime(toImpl(userScriptRef)->userScript().injectionTime()); +} + +bool WKUserScriptGetMainFrameOnly(WKUserScriptRef userScriptRef) +{ + return toImpl(userScriptRef)->userScript().injectedFrames() == WebCore::InjectInTopFrameOnly; } diff --git a/Source/WebKit2/UIProcess/API/C/mac/WKInspectorPrivateMac.h b/Source/WebKit2/UIProcess/API/C/WKUserScriptRef.h index aef86a5d9..610f9fb58 100644 --- a/Source/WebKit2/UIProcess/API/C/mac/WKInspectorPrivateMac.h +++ b/Source/WebKit2/UIProcess/API/C/WKUserScriptRef.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,27 +23,26 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKInspectorPrivateMac_h -#define WKInspectorPrivateMac_h +#ifndef WKUserScriptRef_h +#define WKUserScriptRef_h + +#include <WebKit/WKBase.h> +#include <WebKit/WKUserScriptInjectionTime.h> #ifdef __cplusplus extern "C" { #endif -const NSInteger WKInspectorViewTag = 1000; - -// This class is the Web Inspector window delegate. It can be used to add interface -// actions that need to work when the Web Inspector window is key. -WK_EXPORT @interface WKWebInspectorProxyObjCAdapter : NSObject <NSWindowDelegate> { - void* _inspectorProxy; -} +WK_EXPORT WKTypeID WKUserScriptGetTypeID(); -@property (readonly) WKInspectorRef inspectorRef; +WK_EXPORT WKUserScriptRef WKUserScriptCreateWithSource(WKStringRef source, _WKUserScriptInjectionTime injectionTime, bool forMainFrameOnly); -@end +WK_EXPORT WKStringRef WKUserScriptCopySource(WKUserScriptRef userScript); +WK_EXPORT _WKUserScriptInjectionTime WKUserScriptGetInjectionTime(WKUserScriptRef userScript); +WK_EXPORT bool WKUserScriptGetMainFrameOnly(WKUserScriptRef userScript); #ifdef __cplusplus } #endif -#endif // WKInspectorPrivateMac_h +#endif /* WKUserScriptRef_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKVibration.cpp b/Source/WebKit2/UIProcess/API/C/WKVibration.cpp index e9d933ceb..b0aaab430 100644 --- a/Source/WebKit2/UIProcess/API/C/WKVibration.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKVibration.cpp @@ -43,9 +43,12 @@ WKTypeID WKVibrationGetTypeID() #endif } -void WKVibrationSetProvider(WKVibrationRef vibrationRef, const WKVibrationProvider* wkProvider) +void WKVibrationSetProvider(WKVibrationRef vibrationRef, const WKVibrationProviderBase* wkProvider) { #if ENABLE(VIBRATION) toImpl(vibrationRef)->initializeProvider(wkProvider); +#else + UNUSED_PARAM(vibrationRef); + UNUSED_PARAM(wkProvider); #endif } diff --git a/Source/WebKit2/UIProcess/API/C/WKVibration.h b/Source/WebKit2/UIProcess/API/C/WKVibration.h index 4884ecd85..965749c86 100644 --- a/Source/WebKit2/UIProcess/API/C/WKVibration.h +++ b/Source/WebKit2/UIProcess/API/C/WKVibration.h @@ -26,7 +26,7 @@ #ifndef WKVibration_h #define WKVibration_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { @@ -36,19 +36,21 @@ extern "C" { typedef void (*WKVibrationProviderVibrateCallback)(WKVibrationRef vibrationRef, uint32_t vibrationTime, const void* clientInfo); typedef void (*WKVibrationProviderCancelVibrationCallback)(WKVibrationRef vibrationRef, const void* clientInfo); -struct WKVibrationProvider { +typedef struct WKVibrationProviderBase { int version; const void * clientInfo; +} WKVibrationProviderBase; + +typedef struct WKVibrationProviderV0 { + WKVibrationProviderBase base; + WKVibrationProviderVibrateCallback vibrate; WKVibrationProviderCancelVibrationCallback cancelVibration; -}; -typedef struct WKVibrationProvider WKVibrationProvider; - -enum { kWKVibrationProviderCurrentVersion = 0 }; +} WKVibrationProviderV0; WK_EXPORT WKTypeID WKVibrationGetTypeID(); -WK_EXPORT void WKVibrationSetProvider(WKVibrationRef vibrationRef, const WKVibrationProvider* provider); +WK_EXPORT void WKVibrationSetProvider(WKVibrationRef vibrationRef, const WKVibrationProviderBase* provider); #ifdef __cplusplus } diff --git a/Source/WebKit2/UIProcess/API/C/WKViewportAttributes.h b/Source/WebKit2/UIProcess/API/C/WKViewportAttributes.h index 125b09cc4..8ab84edac 100644 --- a/Source/WebKit2/UIProcess/API/C/WKViewportAttributes.h +++ b/Source/WebKit2/UIProcess/API/C/WKViewportAttributes.h @@ -26,8 +26,8 @@ #ifndef WKViewportAttributes_h #define WKViewportAttributes_h -#include <WebKit2/WKBase.h> -#include <WebKit2/WKGeometry.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKGeometry.h> #ifdef __cplusplus extern "C" { diff --git a/Source/WebKit2/UIProcess/API/C/WKColorPickerResultListener.cpp b/Source/WebKit2/UIProcess/API/C/WKWebsiteDataStoreRef.cpp index de5539de1..e9e907b63 100644 --- a/Source/WebKit2/UIProcess/API/C/WKColorPickerResultListener.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKWebsiteDataStoreRef.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Samsung Electronics. All rights reserved. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,7 +10,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS AS IS'' + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS @@ -24,25 +24,22 @@ */ #include "config.h" -#include "WKColorPickerResultListener.h" +#include "WKWebsiteDataStoreRef.h" +#include "APIWebsiteDataStore.h" #include "WKAPICast.h" -#include "WebColorPickerResultListenerProxy.h" -using namespace WebKit; +WKTypeID WKWebsiteDataStoreGetTypeID() +{ + return WebKit::toAPI(API::WebsiteDataStore::APIType); +} -WKTypeID WKColorPickerResultListenerGetTypeID() +WKWebsiteDataStoreRef WKWebsiteDataStoreGetDefaultDataStore() { -#if ENABLE(INPUT_TYPE_COLOR) - return toAPI(WebColorPickerResultListenerProxy::APIType); -#else - return 0; -#endif + return WebKit::toAPI(API::WebsiteDataStore::defaultDataStore().get()); } -void WKColorPickerResultListenerSetColor(WKColorPickerResultListenerRef listenerRef, const WKStringRef color) +WKWebsiteDataStoreRef WKWebsiteDataStoreCreateNonPersistentDataStore() { -#if ENABLE(INPUT_TYPE_COLOR) - toImpl(listenerRef)->setColor(toWTFString(color)); -#endif + return WebKit::toAPI(&API::WebsiteDataStore::createNonPersistentDataStore().leakRef()); } diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKView.h b/Source/WebKit2/UIProcess/API/C/WKWebsiteDataStoreRef.h index 291dfe1b6..36990e3d4 100644 --- a/Source/WebKit2/UIProcess/API/C/gtk/WKView.h +++ b/Source/WebKit2/UIProcess/API/C/WKWebsiteDataStoreRef.h @@ -1,7 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. - * Copyright (C) 2011 Igalia S.L. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,21 +23,22 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKView_h -#define WKView_h +#ifndef WKWebsiteDataStoreRef_h +#define WKWebsiteDataStoreRef_h -#include <WebKit2/WKBase.h> +#include <WebKit/WKBase.h> #ifdef __cplusplus extern "C" { #endif -WK_EXPORT WKViewRef WKViewCreate(WKContextRef context, WKPageGroupRef pageGroup); +WK_EXPORT WKTypeID WKWebsiteDataStoreGetTypeID(); -WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view); +WK_EXPORT WKWebsiteDataStoreRef WKWebsiteDataStoreGetDefaultDataStore(); +WK_EXPORT WKWebsiteDataStoreRef WKWebsiteDataStoreCreateNonPersistentDataStore(); #ifdef __cplusplus } #endif -#endif /* WKView_h */ +#endif /* WKWebsiteDataStoreRef_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKWindowFeaturesRef.cpp b/Source/WebKit2/UIProcess/API/C/WKWindowFeaturesRef.cpp new file mode 100644 index 000000000..e9338a662 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKWindowFeaturesRef.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKWindowFeaturesRef.h" + +#include "APIWindowFeatures.h" +#include "WKAPICast.h" + +WKTypeID WKWindowFeaturesGetTypeID() +{ + return WebKit::toAPI(API::WindowFeatures::APIType); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKWindowFeaturesRef.h b/Source/WebKit2/UIProcess/API/C/WKWindowFeaturesRef.h new file mode 100644 index 000000000..5dc940477 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKWindowFeaturesRef.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKWindowFeaturesRef_h +#define WKWindowFeaturesRef_h + +#include <WebKit/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKWindowFeaturesGetTypeID(); + +#ifdef __cplusplus +} +#endif + +#endif // WKWindowFeaturesRef_h diff --git a/Source/WebKit2/UIProcess/API/C/WebKit2_C.h b/Source/WebKit2/UIProcess/API/C/WebKit2_C.h index 981d52027..bd98fc189 100644 --- a/Source/WebKit2/UIProcess/API/C/WebKit2_C.h +++ b/Source/WebKit2/UIProcess/API/C/WebKit2_C.h @@ -26,43 +26,46 @@ #ifndef WebKit2_C_h #define WebKit2_C_h -#include <WebKit2/WKBase.h> -#include <WebKit2/WKType.h> +#include <WebKit/WKBase.h> +#include <WebKit/WKType.h> -#include <WebKit2/WKArray.h> -#include <WebKit2/WKBackForwardList.h> -#include <WebKit2/WKBackForwardListItem.h> -#include <WebKit2/WKConnectionRef.h> -#include <WebKit2/WKContext.h> -#include <WebKit2/WKData.h> -#include <WebKit2/WKDictionary.h> -#include <WebKit2/WKError.h> -#include <WebKit2/WKFormSubmissionListener.h> -#include <WebKit2/WKFrame.h> -#include <WebKit2/WKFramePolicyListener.h> -#include <WebKit2/WKGeolocationManager.h> -#include <WebKit2/WKGeolocationPermissionRequest.h> -#include <WebKit2/WKGeolocationPosition.h> -#include <WebKit2/WKGraphicsContext.h> -#include <WebKit2/WKHitTestResult.h> -#include <WebKit2/WKMutableArray.h> -#include <WebKit2/WKMutableDictionary.h> -#include <WebKit2/WKNavigationData.h> -#include <WebKit2/WKNumber.h> -#include <WebKit2/WKOpenPanelParameters.h> -#include <WebKit2/WKOpenPanelResultListener.h> -#include <WebKit2/WKPage.h> -#include <WebKit2/WKPageGroup.h> -#include <WebKit2/WKPreferences.h> -#include <WebKit2/WKString.h> -#include <WebKit2/WKURL.h> -#include <WebKit2/WKURLRequest.h> -#include <WebKit2/WKURLResponse.h> +#include <WebKit/WKArray.h> +#include <WebKit/WKBackForwardListRef.h> +#include <WebKit/WKBackForwardListItemRef.h> +#include <WebKit/WKConnectionRef.h> +#include <WebKit/WKContext.h> +#include <WebKit/WKData.h> +#include <WebKit/WKDictionary.h> +#include <WebKit/WKErrorRef.h> +#include <WebKit/WKFormSubmissionListener.h> +#include <WebKit/WKFrame.h> +#include <WebKit/WKFramePolicyListener.h> +#include <WebKit/WKGeolocationManager.h> +#include <WebKit/WKGeolocationPermissionRequest.h> +#include <WebKit/WKGeolocationPosition.h> +#include <WebKit/WKHitTestResult.h> +#include <WebKit/WKMutableArray.h> +#include <WebKit/WKMutableDictionary.h> +#include <WebKit/WKNavigationDataRef.h> +#include <WebKit/WKNumber.h> +#include <WebKit/WKOpenPanelParameters.h> +#include <WebKit/WKOpenPanelResultListener.h> +#include <WebKit/WKPage.h> +#include <WebKit/WKPageConfigurationRef.h> +#include <WebKit/WKPageGroup.h> +#include <WebKit/WKPreferencesRef.h> +#include <WebKit/WKString.h> +#include <WebKit/WKURL.h> +#include <WebKit/WKURLRequest.h> +#include <WebKit/WKURLResponse.h> +#include <WebKit/WKUserContentControllerRef.h> +#include <WebKit/WKUserMediaPermissionRequest.h> +#include <WebKit/WKUserScriptRef.h> #if defined(__OBJC__) && __OBJC__ -#import <WebKit2/WKView.h> +#import <WebKit/WKView.h> #elif !((defined(__APPLE__) && __APPLE__) || defined(BUILDING_QT__)) -#include <WebKit2/WKView.h> +#include <WebKit/WKView.h> #endif #endif /* WebKit2_C_h */ diff --git a/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.cpp b/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.cpp deleted file mode 100644 index 0f6de7a14..000000000 --- a/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2011 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTAwBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WKIconDatabaseCG.h" - -#include "WebIconDatabase.h" -#include "WKAPICast.h" -#include "WKSharedAPICast.h" -#include <WebCore/Image.h> - -using namespace WebKit; -using namespace WebCore; - -CGImageRef WKIconDatabaseTryGetCGImageForURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef urlRef, WKSize size) -{ - Image* image = toImpl(iconDatabaseRef)->imageForPageURL(toWTFString(urlRef)); - return image ? image->getFirstCGImageRefOfSize(IntSize(static_cast<int>(size.width), static_cast<int>(size.height))) : 0; -} - -CFArrayRef WKIconDatabaseTryCopyCGImageArrayForURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef urlRef) -{ - Image* image = toImpl(iconDatabaseRef)->imageForPageURL(toWTFString(urlRef)); - return image ? image->getCGImageArray().leakRef() : 0; -} - diff --git a/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.h b/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.h deleted file mode 100644 index af0f2598b..000000000 --- a/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2011 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WKIconDatabaseCG_h -#define WKIconDatabaseCG_h - -#include <CoreFoundation/CFArray.h> -#include <CoreGraphics/CGImage.h> -#include <WebKit2/WKBase.h> -#include <WebKit2/WKGeometry.h> - -#ifdef __cplusplus -extern "C" { -#endif - -WK_EXPORT CGImageRef WKIconDatabaseTryGetCGImageForURL(WKIconDatabaseRef iconDatabase, WKURLRef url, WKSize size); -WK_EXPORT CFArrayRef WKIconDatabaseTryCopyCGImageArrayForURL(WKIconDatabaseRef iconDatabase, WKURLRef url); - -#ifdef __cplusplus -} -#endif - -#endif /* WKIconDatabaseCG_h */ diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKAPICastEfl.h b/Source/WebKit2/UIProcess/API/C/efl/WKAPICastEfl.h deleted file mode 100644 index 87c5f5efb..000000000 --- a/Source/WebKit2/UIProcess/API/C/efl/WKAPICastEfl.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2012 Samsung Electronics - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef WKAPICastEfl_h -#define WKAPICastEfl_h - -#ifndef WKAPICast_h -#error "Please #include \"WKAPICast.h\" instead of this file directly." -#endif - -#include <WebCore/TextDirection.h> -#include <WebKit2/WKPopupItem.h> - -#if ENABLE(TOUCH_EVENTS) -#include "WebEvent.h" -#include <WebKit2/WKEventEfl.h> -#endif - -namespace WebKit { - -class WebView; -class WebPopupItemEfl; -class WebPopupMenuListenerEfl; - -WK_ADD_API_MAPPING(WKViewRef, WebView) -WK_ADD_API_MAPPING(WKPopupItemRef, WebPopupItemEfl) -WK_ADD_API_MAPPING(WKPopupMenuListenerRef, WebPopupMenuListenerEfl) - -#if ENABLE(TOUCH_EVENTS) -class EwkTouchEvent; -class EwkTouchPoint; - -WK_ADD_API_MAPPING(WKTouchEventRef, EwkTouchEvent) -WK_ADD_API_MAPPING(WKTouchPointRef, EwkTouchPoint) -#endif - -// Enum conversions. -inline WKPopupItemTextDirection toAPI(WebCore::TextDirection direction) -{ - WKPopupItemTextDirection wkDirection = kWKPopupItemTextDirectionLTR; - - switch (direction) { - case WebCore::RTL: - wkDirection = kWKPopupItemTextDirectionRTL; - break; - case WebCore::LTR: - wkDirection = kWKPopupItemTextDirectionLTR; - break; - } - - return wkDirection; -} - -#if ENABLE(TOUCH_EVENTS) -inline WKEventType toAPI(WebEvent::Type type) -{ - switch (type) { - case WebEvent::TouchStart: - return kWKEventTypeTouchStart; - case WebEvent::TouchMove: - return kWKEventTypeTouchMove; - case WebEvent::TouchEnd: - return kWKEventTypeTouchEnd; - case WebEvent::TouchCancel: - return kWKEventTypeTouchCancel; - default: - return kWKEventTypeNoType; - } -} - -inline WKTouchPointState toAPI(WebPlatformTouchPoint::TouchPointState state) -{ - switch (state) { - case WebPlatformTouchPoint::TouchReleased: - return kWKTouchPointStateTouchReleased; - case WebPlatformTouchPoint::TouchPressed: - return kWKTouchPointStateTouchPressed; - case WebPlatformTouchPoint::TouchMoved: - return kWKTouchPointStateTouchMoved; - case WebPlatformTouchPoint::TouchStationary: - return kWKTouchPointStateTouchStationary; - case WebPlatformTouchPoint::TouchCancelled: - return kWKTouchPointStateTouchCancelled; - } - - ASSERT_NOT_REACHED(); - return kWKTouchPointStateTouchCancelled; -} -#endif - -} - -#endif // WKAPICastEfl_h diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.cpp b/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.cpp deleted file mode 100644 index 843aeb0dd..000000000 --- a/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (C) 2013 Samsung Electronics. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WKEventEfl.h" - -#include "EwkTouchEvent.h" -#include "EwkTouchPoint.h" -#include "ImmutableArray.h" -#include "WKAPICast.h" -#include "WebEvent.h" - -using namespace WebKit; - -WKTouchPointRef WKTouchPointCreate(int id, WKPoint position, WKPoint screenPosition, WKTouchPointState state, WKSize radius, float rotationAngle, float forceFactor) -{ -#if ENABLE(TOUCH_EVENTS) - return toAPI(EwkTouchPoint::create(id, state, screenPosition, position, radius, rotationAngle, forceFactor).leakRef()); -#else - UNUSED_PARAM(id); - UNUSED_PARAM(position); - UNUSED_PARAM(screenPosition); - UNUSED_PARAM(state); - UNUSED_PARAM(radius); - UNUSED_PARAM(rotationAngle); - UNUSED_PARAM(forceFactor); - return 0; -#endif -} - -WKTouchEventRef WKTouchEventCreate(WKEventType type, WKArrayRef wkTouchPoints, WKEventModifiers modifiers, double timestamp) -{ -#if ENABLE(TOUCH_EVENTS) - return toAPI(EwkTouchEvent::create(type, wkTouchPoints, modifiers, timestamp).leakRef()); -#else - UNUSED_PARAM(type); - UNUSED_PARAM(wkTouchPoints); - UNUSED_PARAM(modifiers); - UNUSED_PARAM(timestamp); - return 0; -#endif -} - -WKEventType WKTouchEventGetType(WKTouchEventRef event) -{ -#if ENABLE(TOUCH_EVENTS) - return toImpl(event)->eventType(); -#else - UNUSED_PARAM(event); - return kWKEventTypeNoType; -#endif -} - -WKArrayRef WKTouchEventGetTouchPoints(WKTouchEventRef event) -{ -#if ENABLE(TOUCH_EVENTS) - return toImpl(event)->touchPoints(); -#else - UNUSED_PARAM(event); - return 0; -#endif -} - -WKEventModifiers WKTouchEventGetModifiers(WKTouchEventRef event) -{ -#if ENABLE(TOUCH_EVENTS) - return toImpl(event)->modifiers(); -#else - UNUSED_PARAM(event); - return 0; -#endif -} - -double WKTouchEventGetTimestamp(WKTouchEventRef event) -{ -#if ENABLE(TOUCH_EVENTS) - return toImpl(event)->timestamp(); -#else - UNUSED_PARAM(event); - return 0; -#endif -} - -uint32_t WKTouchPointGetID(WKTouchPointRef point) -{ -#if ENABLE(TOUCH_EVENTS) - return toImpl(point)->id(); -#else - UNUSED_PARAM(point); - return 0; -#endif -} - -WKTouchPointState WKTouchPointGetState(WKTouchPointRef point) -{ -#if ENABLE(TOUCH_EVENTS) - return toImpl(point)->state(); -#else - UNUSED_PARAM(point); - return kWKTouchPointStateTouchCancelled; -#endif -} - -WKPoint WKTouchPointGetScreenPosition(WKTouchPointRef point) -{ -#if ENABLE(TOUCH_EVENTS) - return toImpl(point)->screenPosition(); -#else - UNUSED_PARAM(point); - return WKPointMake(0, 0); -#endif -} - -WKPoint WKTouchPointGetPosition(WKTouchPointRef point) -{ -#if ENABLE(TOUCH_EVENTS) - return toImpl(point)->position(); -#else - UNUSED_PARAM(point); - return WKPointMake(0, 0); -#endif -} - -WKSize WKTouchPointGetRadius(WKTouchPointRef point) -{ -#if ENABLE(TOUCH_EVENTS) - return toImpl(point)->radius(); -#else - UNUSED_PARAM(point); - return WKSizeMake(0, 0); -#endif -} - -float WKTouchPointGetRotationAngle(WKTouchPointRef point) -{ -#if ENABLE(TOUCH_EVENTS) - return toImpl(point)->rotationAngle(); -#else - UNUSED_PARAM(point); - return 0; -#endif -} - -float WKTouchPointGetForceFactor(WKTouchPointRef point) -{ -#if ENABLE(TOUCH_EVENTS) - return toImpl(point)->forceFactor(); -#else - UNUSED_PARAM(point); - return 0; -#endif -} diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.h b/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.h deleted file mode 100644 index b5439219e..000000000 --- a/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2013 Samsung Electronics. All rights reserved. - * Copyright (C) 2012-2013 Nokia Corporation and/or its subsidiary(-ies). - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WKEventEfl_h -#define WKEventEfl_h - -#include <WebKit2/WKEvent.h> -#include <WebKit2/WKGeometry.h> - -#ifdef __cplusplus -extern "C" { -#endif - -enum WKEventType { - kWKEventTypeNoType = -1, - kWKEventTypeTouchStart, - kWKEventTypeTouchMove, - kWKEventTypeTouchEnd, - kWKEventTypeTouchCancel -}; -typedef enum WKEventType WKEventType; - -enum WKTouchPointState { - kWKTouchPointStateTouchReleased, - kWKTouchPointStateTouchPressed, - kWKTouchPointStateTouchMoved, - kWKTouchPointStateTouchStationary, - kWKTouchPointStateTouchCancelled -}; -typedef enum WKTouchPointState WKTouchPointState; - -WK_EXPORT WKTouchPointRef WKTouchPointCreate(int id, WKPoint position, WKPoint screenPosition, WKTouchPointState, WKSize radius, float rotationAngle, float forceFactor); -WK_EXPORT WKTouchEventRef WKTouchEventCreate(WKEventType, WKArrayRef, WKEventModifiers, double timestamp); - -WK_EXPORT WKEventType WKTouchEventGetType(WKTouchEventRef); -WK_EXPORT WKArrayRef WKTouchEventGetTouchPoints(WKTouchEventRef); -WK_EXPORT WKEventModifiers WKTouchEventGetModifiers(WKTouchEventRef); -WK_EXPORT double WKTouchEventGetTimestamp(WKTouchEventRef); - -WK_EXPORT uint32_t WKTouchPointGetID(WKTouchPointRef); -WK_EXPORT WKTouchPointState WKTouchPointGetState(WKTouchPointRef); -WK_EXPORT WKPoint WKTouchPointGetScreenPosition(WKTouchPointRef); -WK_EXPORT WKPoint WKTouchPointGetPosition(WKTouchPointRef); -WK_EXPORT WKSize WKTouchPointGetRadius(WKTouchPointRef); -WK_EXPORT float WKTouchPointGetRotationAngle(WKTouchPointRef); -WK_EXPORT float WKTouchPointGetForceFactor(WKTouchPointRef); - -#ifdef __cplusplus -} -#endif - -#endif /* WKEventEfl_h */ diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKPageEfl.cpp b/Source/WebKit2/UIProcess/API/C/efl/WKPageEfl.cpp deleted file mode 100644 index 2d5ec91b5..000000000 --- a/Source/WebKit2/UIProcess/API/C/efl/WKPageEfl.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2013 Samsung Electronics. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTAwBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WKPageEfl.h" - -#include "WKAPICast.h" -#include "WebPageProxy.h" - -using namespace WebKit; - -void WKPageSetUIPopupMenuClient(WKPageRef pageRef, const WKPageUIPopupMenuClient* wkClient) -{ - toImpl(pageRef)->initializeUIPopupMenuClient(wkClient); -} diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKPageEfl.h b/Source/WebKit2/UIProcess/API/C/efl/WKPageEfl.h deleted file mode 100644 index 77b9d140b..000000000 --- a/Source/WebKit2/UIProcess/API/C/efl/WKPageEfl.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2013 Samsung Electronics. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTAwBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WKPageEfl_h -#define WKPageEfl_h - -#include <WebKit2/WKBase.h> -#include <WebKit2/WKGeometry.h> -#include <WebKit2/WKPopupItem.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void (*WKPageShowPopupMenuCallback)(WKPageRef page, WKPopupMenuListenerRef menuListenerRef, WKRect rect, WKPopupItemTextDirection textDirection, double pageScaleFactor, WKArrayRef itemsRef, int32_t selectedIndex, const void* clientInfo); -typedef void (*WKPageHidePopupMenuCallback)(WKPageRef page, const void* clientInfo); - -struct WKPageUIPopupMenuClient { - int version; - const void* clientInfo; - WKPageShowPopupMenuCallback showPopupMenu; - WKPageHidePopupMenuCallback hidePopupMenu; -}; -typedef struct WKPageUIPopupMenuClient WKPageUIPopupMenuClient; - -enum { kWKPageUIPopupMenuClientCurrentVersion = 0 }; - -WK_EXPORT void WKPageSetUIPopupMenuClient(WKPageRef page, const WKPageUIPopupMenuClient* client); - -#ifdef __cplusplus -} -#endif - -#endif /* WKPageEfl_h */ diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKPopupItem.cpp b/Source/WebKit2/UIProcess/API/C/efl/WKPopupItem.cpp deleted file mode 100644 index 7b0ea45ec..000000000 --- a/Source/WebKit2/UIProcess/API/C/efl/WKPopupItem.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2013 Samsung Electronics. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTAwBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WKPopupItem.h" - -#include "WKAPICast.h" -#include "WebPopupItemEfl.h" - -using namespace WebKit; -using namespace WebCore; - -WKPopupItemType WKPopupItemGetType(WKPopupItemRef itemRef) -{ - switch (toImpl(itemRef)->itemType()) { - case WebPopupItem::Separator: - return kWKPopupItemTypeSeparator; - case WebPopupItem::Item: - return kWKPopupItemTypeItem; - default: - ASSERT_NOT_REACHED(); - return kWKPopupItemTypeItem; - } -} - -WKPopupItemTextDirection WKPopupItemGetTextDirection(WKPopupItemRef itemRef) -{ - switch (toImpl(itemRef)->textDirection()) { - case RTL: - return kWKPopupItemTextDirectionRTL; - case LTR: - return kWKPopupItemTextDirectionLTR; - default: - ASSERT_NOT_REACHED(); - return kWKPopupItemTextDirectionLTR; - } -} - -bool WKPopupItemHasTextDirectionOverride(WKPopupItemRef itemRef) -{ - return toImpl(itemRef)->hasTextDirectionOverride(); -} - -WKStringRef WKPopupItemCopyText(WKPopupItemRef itemRef) -{ - return toCopiedAPI(toImpl(itemRef)->text()); -} - -WKStringRef WKPopupItemCopyToolTipText(WKPopupItemRef itemRef) -{ - return toCopiedAPI(toImpl(itemRef)->toolTipText()); -} - -WKStringRef WKPopupItemCopyAccessibilityText(WKPopupItemRef itemRef) -{ - return toCopiedAPI(toImpl(itemRef)->accessibilityText()); -} - -bool WKPopupItemIsEnabled(WKPopupItemRef itemRef) -{ - return toImpl(itemRef)->isEnabled(); -} - -bool WKPopupItemIsLabel(WKPopupItemRef itemRef) -{ - return toImpl(itemRef)->isLabel(); -} - -bool WKPopupItemIsSelected(WKPopupItemRef itemRef) -{ - return toImpl(itemRef)->isSelected(); -} diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKPopupItem.h b/Source/WebKit2/UIProcess/API/C/efl/WKPopupItem.h deleted file mode 100644 index b418ed526..000000000 --- a/Source/WebKit2/UIProcess/API/C/efl/WKPopupItem.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2013 Samsung Electronics. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTAwBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WKPopupItem_h -#define WKPopupItem_h - -#include <WebKit2/WKBase.h> - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - kWKPopupItemTypeSeparator, - kWKPopupItemTypeItem -}; -typedef uint32_t WKPopupItemType; - -enum { - kWKPopupItemTextDirectionRTL, - kWKPopupItemTextDirectionLTR -}; -typedef uint32_t WKPopupItemTextDirection; - -WK_EXPORT WKPopupItemType WKPopupItemGetType(WKPopupItemRef item); - -WK_EXPORT WKPopupItemTextDirection WKPopupItemGetTextDirection(WKPopupItemRef item); -WK_EXPORT bool WKPopupItemHasTextDirectionOverride(WKPopupItemRef item); - -WK_EXPORT WKStringRef WKPopupItemCopyText(WKPopupItemRef item); -WK_EXPORT WKStringRef WKPopupItemCopyToolTipText(WKPopupItemRef item); -WK_EXPORT WKStringRef WKPopupItemCopyAccessibilityText(WKPopupItemRef item); - -WK_EXPORT bool WKPopupItemIsEnabled(WKPopupItemRef item); -WK_EXPORT bool WKPopupItemIsLabel(WKPopupItemRef item); -WK_EXPORT bool WKPopupItemIsSelected(WKPopupItemRef item); - -#ifdef __cplusplus -} -#endif - -#endif /* WKPopupItem_h */ diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKPopupMenuListener.cpp b/Source/WebKit2/UIProcess/API/C/efl/WKPopupMenuListener.cpp deleted file mode 100644 index 34f82b455..000000000 --- a/Source/WebKit2/UIProcess/API/C/efl/WKPopupMenuListener.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2013 Samsung Electronics. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTAwBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WKPopupMenuListener.h" - -#include "WKAPICast.h" -#include "WebPopupMenuListenerEfl.h" - -using namespace WebKit; - -void WKPopupMenuListenerSetSelection(WKPopupMenuListenerRef listenerRef, int selectedIndex) -{ - toImpl(listenerRef)->valueChanged(selectedIndex); -} diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKPopupMenuListener.h b/Source/WebKit2/UIProcess/API/C/efl/WKPopupMenuListener.h deleted file mode 100644 index 854991679..000000000 --- a/Source/WebKit2/UIProcess/API/C/efl/WKPopupMenuListener.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2013 Samsung Electronics. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTAwBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WKPopupMenuListener_h -#define WKPopupMenuListener_h - -#include <WebKit2/WKBase.h> - -#ifdef __cplusplus -extern "C" { -#endif - -WK_EXPORT void WKPopupMenuListenerSetSelection(WKPopupMenuListenerRef listener, int selectedIndex); - -#ifdef __cplusplus -} -#endif - -#endif /* WKPopupMenuListener_h */ diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKAPICastGtk.h b/Source/WebKit2/UIProcess/API/C/gtk/WKAPICastGtk.h deleted file mode 100644 index 9eb0c78ad..000000000 --- a/Source/WebKit2/UIProcess/API/C/gtk/WKAPICastGtk.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WKAPICastGtk_h -#define WKAPICastGtk_h - -#ifndef WKAPICast_h -#error "Please #include \"WKAPICast.h\" instead of this file directly." -#endif - -typedef struct _WebKitWebViewBase WebKitWebViewBase; - -namespace WebKit { - -WK_ADD_API_MAPPING(WKViewRef, WebKitWebViewBase) - -} - -#endif // WKAPICastGtk_h diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKInspectorClientGtk.h b/Source/WebKit2/UIProcess/API/C/gtk/WKInspectorClientGtk.h deleted file mode 100644 index 865e19ae3..000000000 --- a/Source/WebKit2/UIProcess/API/C/gtk/WKInspectorClientGtk.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2012 Igalia S.L. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WKInspectorClientGtk_h -#define WKInspectorClientGtk_h - -#include <WebKit2/WKBase.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef bool (*WKInspectorClientGtkInspectorCallback)(WKInspectorRef inspector, const void* clientInfo); -typedef void (*WKInspectorClientGtkInspectorDidCloseCallback)(WKInspectorRef inspector, const void* clientInfo); -typedef void (*WKInspectorClientGtkInspectedURLChangedCallback)(WKInspectorRef inspector, WKStringRef url, const void* clientInfo); -typedef void (*WKInspectorClientGtkDidChangeAttachedHeightCallback)(WKInspectorRef inspector, unsigned height, const void* clientInfo); - -struct WKInspectorClientGtk { - int version; - const void* clientInfo; - WKInspectorClientGtkInspectorCallback openWindow; - WKInspectorClientGtkInspectorDidCloseCallback didClose; - WKInspectorClientGtkInspectorCallback bringToFront; - WKInspectorClientGtkInspectedURLChangedCallback inspectedURLChanged; - WKInspectorClientGtkInspectorCallback attach; - WKInspectorClientGtkInspectorCallback detach; - WKInspectorClientGtkDidChangeAttachedHeightCallback didChangeAttachedHeight; -}; -typedef struct WKInspectorClientGtk WKInspectorClientGtk; - -enum { kWKInspectorClientGtkCurrentVersion = 0 }; - -WK_EXPORT void WKInspectorSetInspectorClientGtk(WKInspectorRef inspectorRef, const WKInspectorClientGtk* client); - -#ifdef __cplusplus -} -#endif - -#endif /* WKInspectorClientGtk_h */ diff --git a/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.h b/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.h deleted file mode 100644 index 937a4a604..000000000 --- a/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2013 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WKContextPrivateMac_h -#define WKContextPrivateMac_h - -#include <WebKit2/WKBase.h> - -#ifdef __cplusplus -extern "C" { -#endif - -WK_EXPORT bool WKContextGetProcessSuppressionEnabled(WKContextRef context); -WK_EXPORT void WKContextSetProcessSuppressionEnabled(WKContextRef context, bool enabled); - -WK_EXPORT bool WKContextIsPlugInUpdateAvailable(WKContextRef context, WKStringRef plugInBundleIdentifier); - -WK_EXPORT WKDictionaryRef WKContextCopyPlugInInfoForBundleIdentifier(WKContextRef context, WKStringRef plugInBundleIdentifier); - -typedef void (^WKContextGetInfoForInstalledPlugInsBlock)(WKArrayRef, WKErrorRef); -WK_EXPORT void WKContextGetInfoForInstalledPlugIns(WKContextRef context, WKContextGetInfoForInstalledPlugInsBlock block); - -WK_EXPORT void WKContextResetHSTSHosts(WKContextRef context); - -/* DEPRECATED - Please use constants from WKPluginInformation instead. */ - -/* Value type: WKStringRef */ -WK_EXPORT WKStringRef WKPlugInInfoPathKey(); - -/* Value type: WKStringRef */ -WK_EXPORT WKStringRef WKPlugInInfoBundleIdentifierKey(); - -/* Value type: WKStringRef */ -WK_EXPORT WKStringRef WKPlugInInfoVersionKey(); - -/* Value type: WKUInt64Ref */ -WK_EXPORT WKStringRef WKPlugInInfoLoadPolicyKey(); - -/* Value type: WKBooleanRef */ -WK_EXPORT WKStringRef WKPlugInInfoUpdatePastLastBlockedVersionIsKnownAvailableKey(); - -/* Value type: WKBooleanRef */ -WK_EXPORT WKStringRef WKPlugInInfoIsSandboxedKey(); - -#ifdef __cplusplus -} -#endif - -#endif /* WKContextPrivateMac_h */ diff --git a/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.mm b/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.mm deleted file mode 100644 index 9fb8a2ad8..000000000 --- a/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.mm +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2013 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "config.h" -#import "WKContextPrivateMac.h" - -#import "ImmutableArray.h" -#import "ImmutableDictionary.h" -#import "PluginInfoStore.h" -#import "PluginInformation.h" -#import "PluginSandboxProfile.h" -#import "StringUtilities.h" -#import "WKAPICast.h" -#import "WKPluginInformation.h" -#import "WKSharedAPICast.h" -#import "WKStringCF.h" -#import "WebContext.h" -#import "WebNumber.h" -#import "WebString.h" -#import <WebKitSystemInterface.h> -#import <wtf/RetainPtr.h> - -using namespace WebKit; - -bool WKContextGetProcessSuppressionEnabled(WKContextRef contextRef) -{ - return toImpl(contextRef)->processSuppressionEnabled(); -} - -void WKContextSetProcessSuppressionEnabled(WKContextRef contextRef, bool enabled) -{ - toImpl(contextRef)->setProcessSuppressionEnabled(enabled); -} - -bool WKContextIsPlugInUpdateAvailable(WKContextRef contextRef, WKStringRef plugInBundleIdentifierRef) -{ - return WKIsPluginUpdateAvailable((NSString *)adoptCF(WKStringCopyCFString(kCFAllocatorDefault, plugInBundleIdentifierRef)).get()); -} - -WKDictionaryRef WKContextCopyPlugInInfoForBundleIdentifier(WKContextRef contextRef, WKStringRef plugInBundleIdentifierRef) -{ - PluginModuleInfo plugin = toImpl(contextRef)->pluginInfoStore().findPluginWithBundleIdentifier(toWTFString(plugInBundleIdentifierRef)); - if (plugin.path.isNull()) - return 0; - - RefPtr<ImmutableDictionary> dictionary = createPluginInformationDictionary(plugin); - return toAPI(dictionary.release().leakRef()); -} - -void WKContextGetInfoForInstalledPlugIns(WKContextRef contextRef, WKContextGetInfoForInstalledPlugInsBlock block) -{ - Vector<PluginModuleInfo> plugins = toImpl(contextRef)->pluginInfoStore().plugins(); - - Vector<RefPtr<APIObject>> pluginInfoDictionaries; - for (const auto& plugin: plugins) - pluginInfoDictionaries.append(createPluginInformationDictionary(plugin)); - - RefPtr<ImmutableArray> array = ImmutableArray::adopt(pluginInfoDictionaries); - - toImpl(contextRef)->ref(); - dispatch_async(dispatch_get_main_queue(), ^() { - block(toAPI(array.get()), 0); - - toImpl(contextRef)->deref(); - }); -} - -void WKContextResetHSTSHosts(WKContextRef context) -{ - return toImpl(context)->resetHSTSHosts(); -} - - -/* DEPRECATED - Please use constants from WKPluginInformation instead. */ - -WKStringRef WKPlugInInfoPathKey() -{ - return WKPluginInformationPathKey(); -} - -WKStringRef WKPlugInInfoBundleIdentifierKey() -{ - return WKPluginInformationBundleIdentifierKey(); -} - -WKStringRef WKPlugInInfoVersionKey() -{ - return WKPluginInformationBundleVersionKey(); -} - -WKStringRef WKPlugInInfoLoadPolicyKey() -{ - return WKPluginInformationDefaultLoadPolicyKey(); -} - -WKStringRef WKPlugInInfoUpdatePastLastBlockedVersionIsKnownAvailableKey() -{ - return WKPluginInformationUpdatePastLastBlockedVersionIsKnownAvailableKey(); -} - -WKStringRef WKPlugInInfoIsSandboxedKey() -{ - return WKPluginInformationHasSandboxProfileKey(); -} diff --git a/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.cpp b/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.cpp deleted file mode 100644 index 5e45950cb..000000000 --- a/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2011 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WKPagePrivateMac.h" - -#include "WKAPICast.h" -#include "WebContext.h" -#include "WebPageGroup.h" -#include "WebPageProxy.h" -#include "WebPreferences.h" - -using namespace WebKit; - -pid_t WKPageGetProcessIdentifier(WKPageRef pageRef) -{ - return toImpl(pageRef)->processIdentifier(); -} - -bool WKPageIsURLKnownHSTSHost(WKPageRef page, WKURLRef url) -{ - WebPageProxy* webPageProxy = toImpl(page); - bool privateBrowsingEnabled = webPageProxy->pageGroup()->preferences()->privateBrowsingEnabled(); - - return webPageProxy->process()->context()->isURLKnownHSTSHost(toImpl(url)->string(), privateBrowsingEnabled); -} diff --git a/Source/WebKit2/UIProcess/API/C/soup/WKAPICastSoup.h b/Source/WebKit2/UIProcess/API/C/soup/WKAPICastSoup.h deleted file mode 100644 index c8a954460..000000000 --- a/Source/WebKit2/UIProcess/API/C/soup/WKAPICastSoup.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Portions Copyright (c) 2012 Igalia S.L. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WKAPICastSoup_h -#define WKAPICastSoup_h - -#ifndef WKAPICast_h -#error "Please #include \"WKAPICast.h\" instead of this file directly." -#endif - -namespace WebKit { - -class WebSoupRequestManagerProxy; - -WK_ADD_API_MAPPING(WKSoupRequestManagerRef, WebSoupRequestManagerProxy) - -} - -#endif // WKAPICastSoup_h diff --git a/Source/WebKit2/UIProcess/API/C/soup/WKContextSoup.cpp b/Source/WebKit2/UIProcess/API/C/soup/WKContextSoup.cpp deleted file mode 100644 index f7549f003..000000000 --- a/Source/WebKit2/UIProcess/API/C/soup/WKContextSoup.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2012 Igalia S.L. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTAwBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WKContextSoup.h" - -#include "WKAPICast.h" -#include "WebContext.h" - -// Supplements -#include "WebSoupRequestManagerProxy.h" - -using namespace WebKit; - -WKSoupRequestManagerRef WKContextGetSoupRequestManager(WKContextRef contextRef) -{ - return toAPI(toImpl(contextRef)->supplement<WebSoupRequestManagerProxy>()); -} - diff --git a/Source/WebKit2/UIProcess/API/C/soup/WKCookieManagerSoup.cpp b/Source/WebKit2/UIProcess/API/C/soup/WKCookieManagerSoup.cpp deleted file mode 100644 index 86b31aa47..000000000 --- a/Source/WebKit2/UIProcess/API/C/soup/WKCookieManagerSoup.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2012 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WKCookieManagerSoup.h" - -#include "SoupCookiePersistentStorageType.h" -#include "WKAPICast.h" -#include "WebCookieManagerProxy.h" - -using namespace WebKit; - -inline SoupCookiePersistentStorageType toSoupCookiePersistentStorageType(WKCookieStorageType wkCookieStorageType) -{ - switch (wkCookieStorageType) { - case kWKCookieStorageTypeText: - return SoupCookiePersistentStorageText; - case kWKCookieStorageTypeSQLite: - return SoupCookiePersistentStorageSQLite; - } - - ASSERT_NOT_REACHED(); - return SoupCookiePersistentStorageText; -} - -void WKCookieManagerSetCookiePersistentStorage(WKCookieManagerRef cookieManager, WKStringRef storagePath, WKCookieStorageType storageType) -{ - toImpl(cookieManager)->setCookiePersistentStorage(toWTFString(storagePath), storageType); -} diff --git a/Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.cpp b/Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.cpp deleted file mode 100644 index 1cbf76554..000000000 --- a/Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2012 Igalia S.L. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WKSoupRequestManager.h" - -#include "WKAPICast.h" -#include "WebSoupRequestManagerProxy.h" - -using namespace WebKit; - -WKTypeID WKSoupRequestManagerGetTypeID() -{ - return toAPI(WebSoupRequestManagerProxy::APIType); -} - -void WKSoupRequestManagerSetClient(WKSoupRequestManagerRef soupRequestManagerRef, const WKSoupRequestManagerClient* wkClient) -{ - toImpl(soupRequestManagerRef)->initializeClient(wkClient); -} - -void WKSoupRequestManagerRegisterURIScheme(WKSoupRequestManagerRef soupRequestManagerRef, WKStringRef schemeRef) -{ - toImpl(soupRequestManagerRef)->registerURIScheme(toWTFString(schemeRef)); -} - -void WKSoupRequestManagerDidHandleURIRequest(WKSoupRequestManagerRef soupRequestManagerRef, WKDataRef data, uint64_t contentLength, WKStringRef mimeTypeRef, uint64_t requestID) -{ - toImpl(soupRequestManagerRef)->didHandleURIRequest(toImpl(data), contentLength, toWTFString(mimeTypeRef), requestID); -} - -void WKSoupRequestManagerDidReceiveURIRequestData(WKSoupRequestManagerRef soupRequestManagerRef, WKDataRef data, uint64_t requestID) -{ - toImpl(soupRequestManagerRef)->didReceiveURIRequestData(toImpl(data), requestID); -} diff --git a/Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.h b/Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.h deleted file mode 100644 index 6892de4bf..000000000 --- a/Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2012 Igalia S.L. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WKSoupRequestManager_h -#define WKSoupRequestManager_h - -#include <WebKit2/WKBase.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void (*WKSoupRequestManagerDidReceiveURIRequestCallback)(WKSoupRequestManagerRef soupRequestManagerRef, WKURLRef urlRef, WKPageRef pageRef, uint64_t requestID, const void* clientInfo); -typedef void (*WKSoupRequestManagerDidFailToLoadURIRequestCallback)(WKSoupRequestManagerRef soupRequestManagerRef, uint64_t requestID, const void* clientInfo); - -struct WKSoupRequestManagerClient { - int version; - const void* clientInfo; - WKSoupRequestManagerDidReceiveURIRequestCallback didReceiveURIRequest; - WKSoupRequestManagerDidFailToLoadURIRequestCallback didFailToLoadURIRequest; -}; -typedef struct WKSoupRequestManagerClient WKSoupRequestManagerClient; - -enum { kWKSoupRequestManagerClientCurrentVersion = 0 }; - -WK_EXPORT WKTypeID WKSoupRequestManagerGetTypeID(); - -WK_EXPORT void WKSoupRequestManagerSetClient(WKSoupRequestManagerRef, const WKSoupRequestManagerClient* client); -WK_EXPORT void WKSoupRequestManagerRegisterURIScheme(WKSoupRequestManagerRef, WKStringRef schemeRef); -WK_EXPORT void WKSoupRequestManagerDidHandleURIRequest(WKSoupRequestManagerRef, WKDataRef, uint64_t contentLength, WKStringRef mimeTypeRef, uint64_t requestID); -WK_EXPORT void WKSoupRequestManagerDidReceiveURIRequestData(WKSoupRequestManagerRef, WKDataRef, uint64_t requestID); - -#ifdef __cplusplus -} -#endif - -#endif /* WKSoupRequestManager_h */ |