diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-09-13 12:51:20 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-19 20:50:05 +0200 |
commit | d441d6f39bb846989d95bcf5caf387b42414718d (patch) | |
tree | e367e64a75991c554930278175d403c072de6bb8 /Source/WebKit2/UIProcess/API/C | |
parent | 0060b2994c07842f4c59de64b5e3e430525c4b90 (diff) | |
download | qtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz |
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit.
Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/WebKit2/UIProcess/API/C')
56 files changed, 2255 insertions, 691 deletions
diff --git a/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp b/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp new file mode 100644 index 000000000..2ed74d376 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp @@ -0,0 +1,198 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * Copyright (C) 2013 Intel Corporation. All rights reserved. + * + * 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. + */ + +#include "config.h" +#if USE(COORDINATED_GRAPHICS) + +#include "WKView.h" + +#include "WKAPICast.h" +#include "WebView.h" + +using namespace WebCore; +using namespace WebKit; + +WKViewRef WKViewCreate(WKContextRef contextRef, WKPageGroupRef pageGroupRef) +{ + RefPtr<WebView> webView = WebView::create(toImpl(contextRef), toImpl(pageGroupRef)); + return toAPI(webView.release().leakRef()); +} + +void WKViewInitialize(WKViewRef viewRef) +{ + toImpl(viewRef)->initialize(); +} + +WKSize WKViewGetSize(WKViewRef viewRef) +{ + return toAPI(toImpl(viewRef)->size()); +} + +void WKViewSetSize(WKViewRef viewRef, WKSize size) +{ + toImpl(viewRef)->setSize(toIntSize(size)); +} + +void WKViewSetViewClient(WKViewRef viewRef, const WKViewClient* client) +{ + toImpl(viewRef)->initializeClient(client); +} + +bool WKViewIsFocused(WKViewRef viewRef) +{ + return toImpl(viewRef)->isFocused(); +} + +void WKViewSetIsFocused(WKViewRef viewRef, bool isFocused) +{ + toImpl(viewRef)->setFocused(isFocused); +} + +bool WKViewIsVisible(WKViewRef viewRef) +{ + return toImpl(viewRef)->isVisible(); +} + +void WKViewSetIsVisible(WKViewRef viewRef, bool isVisible) +{ + toImpl(viewRef)->setVisible(isVisible); +} + +float WKViewGetContentScaleFactor(WKViewRef viewRef) +{ + return toImpl(viewRef)->contentScaleFactor(); +} + +void WKViewSetContentScaleFactor(WKViewRef viewRef, float scale) +{ + toImpl(viewRef)->setContentScaleFactor(scale); +} + +WKPoint WKViewGetContentPosition(WKViewRef viewRef) +{ + const WebCore::FloatPoint& result = toImpl(viewRef)->contentPosition(); + return WKPointMake(result.x(), result.y()); +} + +void WKViewSetContentPosition(WKViewRef viewRef, WKPoint position) +{ + toImpl(viewRef)->setContentPosition(WebCore::FloatPoint(position.x, position.y)); +} + +void WKViewSetUserViewportTranslation(WKViewRef viewRef, double tx, double ty) +{ + toImpl(viewRef)->setUserViewportTranslation(tx, ty); +} + +WKPoint WKViewUserViewportToContents(WKViewRef viewRef, WKPoint point) +{ + const WebCore::IntPoint& result = toImpl(viewRef)->userViewportToContents(toIntPoint(point)); + return WKPointMake(result.x(), result.y()); +} + +WKPoint WKViewUserViewportToScene(WKViewRef viewRef, WKPoint point) +{ + WebCore::IntPoint result = toImpl(viewRef)->userViewportToScene(toIntPoint(point)); + return WKPointMake(result.x(), result.y()); +} + +WKPoint WKViewContentsToUserViewport(WKViewRef viewRef, WKPoint point) +{ + WebCore::IntPoint result = toImpl(viewRef)->contentsToUserViewport(toIntPoint(point)); + return WKPointMake(result.x(), result.y()); +} + +void WKViewPaintToCurrentGLContext(WKViewRef viewRef) +{ + toImpl(viewRef)->paintToCurrentGLContext(); +} + +WKPageRef WKViewGetPage(WKViewRef viewRef) +{ + return toImpl(viewRef)->pageRef(); +} + +void WKViewSetDrawsBackground(WKViewRef viewRef, bool flag) +{ + toImpl(viewRef)->setDrawsBackground(flag); +} + +bool WKViewGetDrawsBackground(WKViewRef viewRef) +{ + return toImpl(viewRef)->drawsBackground(); +} + +void WKViewSetDrawsTransparentBackground(WKViewRef viewRef, bool flag) +{ + toImpl(viewRef)->setDrawsTransparentBackground(flag); +} + +bool WKViewGetDrawsTransparentBackground(WKViewRef viewRef) +{ + return toImpl(viewRef)->drawsTransparentBackground(); +} + +void WKViewSuspendActiveDOMObjectsAndAnimations(WKViewRef viewRef) +{ + toImpl(viewRef)->suspendActiveDOMObjectsAndAnimations(); +} + +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(); +#else + UNUSED_PARAM(viewRef); + return false; +#endif +} + +void WKViewSetOpacity(WKViewRef view, double opacity) +{ + toImpl(view)->setOpacity(opacity); +} + +double WKViewOpacity(WKViewRef view) +{ + return toImpl(view)->opacity(); +} + +void WKViewFindZoomableAreaForRect(WKViewRef viewRef, WKRect wkRect) +{ + IntRect rect = toIntRect(wkRect); + toImpl(viewRef)->findZoomableAreaForPoint(rect.center(), rect.size()); +} + +#endif // USE(COORDINATED_GRAPHICS) diff --git a/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h b/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h new file mode 100644 index 000000000..1ee55ea34 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * Copyright (C) 2013 Intel Corporation. All rights reserved. + * + * 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 WKView_h +#define WKView_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKGeometry.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*WKViewCallback)(WKViewRef view, const void* clientInfo); +typedef void (*WKViewViewNeedsDisplayCallback)(WKViewRef view, WKRect area, const void* clientInfo); +typedef void (*WKViewPageDidChangeContentsSizeCallback)(WKViewRef view, WKSize size, const void* clientInfo); +typedef void (*WKViewWebProcessCrashedCallback)(WKViewRef view, WKURLRef url, const void* clientInfo); +typedef void (*WKViewPageDidChangeContentsPositionCallback)(WKViewRef view, WKPoint position, const void* clientInfo); +typedef void (*WKViewPageDidRenderFrameCallback)(WKViewRef view, WKSize contentsSize, WKRect coveredRect, const void* clientInfo); +typedef void (*WKViewPageDidChangeViewportAttributesCallback)(WKViewRef view, WKViewportAttributesRef, const void* clientInfo); +typedef void (*WKViewPageDidChangeTooltipCallback)(WKViewRef view, WKStringRef newTooltip, const void* clientInfo); +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 { + int version; + const void* clientInfo; + + // Version 0 + WKViewViewNeedsDisplayCallback viewNeedsDisplay; + WKViewPageDidChangeContentsSizeCallback didChangeContentsSize; + WKViewWebProcessCrashedCallback webProcessCrashed; + WKViewCallback webProcessDidRelaunch; + WKViewPageDidChangeContentsPositionCallback didChangeContentsPosition; + WKViewPageDidRenderFrameCallback didRenderFrame; + WKViewCallback didCompletePageTransition; + WKViewPageDidChangeViewportAttributesCallback didChangeViewportAttributes; + WKViewPageDidChangeTooltipCallback didChangeTooltip; + WKViewDidFindZoomableAreaCallback didFindZoomableArea; + WKViewDoneWithTouchEventCallback doneWithTouchEvent; +}; +typedef struct WKViewClient WKViewClient; + +enum { kWKViewClientCurrentVersion = 0 }; + +WK_EXPORT WKViewRef WKViewCreate(WKContextRef context, WKPageGroupRef pageGroup); + +WK_EXPORT void WKViewInitialize(WKViewRef); + +WK_EXPORT WKSize WKViewGetSize(WKViewRef); +WK_EXPORT void WKViewSetSize(WKViewRef, WKSize size); + +WK_EXPORT void WKViewSetViewClient(WKViewRef, const WKViewClient*); + +WK_EXPORT bool WKViewIsFocused(WKViewRef); +WK_EXPORT void WKViewSetIsFocused(WKViewRef, bool); + +WK_EXPORT bool WKViewIsVisible(WKViewRef); +WK_EXPORT void WKViewSetIsVisible(WKViewRef, bool); + +WK_EXPORT float WKViewGetContentScaleFactor(WKViewRef); +WK_EXPORT void WKViewSetContentScaleFactor(WKViewRef, float); + +WK_EXPORT WKPoint WKViewGetContentPosition(WKViewRef); +WK_EXPORT void WKViewSetContentPosition(WKViewRef, WKPoint); + +WK_EXPORT void WKViewSetUserViewportTranslation(WKViewRef, double tx, double ty); +WK_EXPORT WKPoint WKViewUserViewportToContents(WKViewRef, WKPoint); +WK_EXPORT WKPoint WKViewUserViewportToScene(WKViewRef, WKPoint); +WK_EXPORT WKPoint WKViewContentsToUserViewport(WKViewRef, WKPoint); + +WK_EXPORT void WKViewPaintToCurrentGLContext(WKViewRef); + +WK_EXPORT WKPageRef WKViewGetPage(WKViewRef); + +WK_EXPORT void WKViewSetDrawsBackground(WKViewRef, bool); +WK_EXPORT bool WKViewGetDrawsBackground(WKViewRef); + +WK_EXPORT void WKViewSetDrawsTransparentBackground(WKViewRef, bool); +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); +WK_EXPORT double WKViewOpacity(WKViewRef view); + +WK_EXPORT void WKViewFindZoomableAreaForRect(WKViewRef, WKRect); + +#ifdef __cplusplus +} +#endif + +#endif /* WKView_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKAPICast.h b/Source/WebKit2/UIProcess/API/C/WKAPICast.h index 3c0584c06..64c8d1abf 100644 --- a/Source/WebKit2/UIProcess/API/C/WKAPICast.h +++ b/Source/WebKit2/UIProcess/API/C/WKAPICast.h @@ -30,9 +30,11 @@ #include "CacheModel.h" #include "FontSmoothingLevel.h" #include "HTTPCookieAcceptPolicy.h" +#include "InjectedBundleHitTestResultMediaType.h" +#include "PluginModuleInfo.h" #include "ProcessModel.h" #include "ResourceCachesToClear.h" -#include "WebGrammarDetail.h" +#include "WKBundleHitTestResult.h" #include "WKContext.h" #include "WKCookieManager.h" #include "WKCredentialTypes.h" @@ -42,6 +44,7 @@ #include "WKProtectionSpaceTypes.h" #include "WKResourceCacheManager.h" #include "WKSharedAPICast.h" +#include "WebGrammarDetail.h" #include <WebCore/Credential.h> #include <WebCore/FrameLoaderTypes.h> #include <WebCore/ProtectionSpace.h> @@ -74,9 +77,7 @@ class WebGrammarDetail; class WebHitTestResult; class WebIconDatabase; class WebInspectorProxy; -class WebIntentData; -class WebIntentServiceInfo; -class WebKeyValueStorageManagerProxy; +class WebKeyValueStorageManager; class WebMediaCacheManagerProxy; class WebNavigationData; class WebNetworkInfoManagerProxy; @@ -95,6 +96,7 @@ class WebRenderLayer; class WebRenderObject; class WebTextChecker; class WebVibrationProxy; +class WebViewportAttributes; WK_ADD_API_MAPPING(WKApplicationCacheManagerRef, WebApplicationCacheManagerProxy) WK_ADD_API_MAPPING(WKAuthenticationChallengeRef, AuthenticationChallengeProxy) @@ -103,6 +105,7 @@ WK_ADD_API_MAPPING(WKBackForwardListItemRef, WebBackForwardListItem) 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) @@ -119,9 +122,7 @@ WK_ADD_API_MAPPING(WKGeolocationPositionRef, WebGeolocationPosition) WK_ADD_API_MAPPING(WKGrammarDetailRef, WebGrammarDetail) WK_ADD_API_MAPPING(WKHitTestResultRef, WebHitTestResult) WK_ADD_API_MAPPING(WKIconDatabaseRef, WebIconDatabase) -WK_ADD_API_MAPPING(WKIntentDataRef, WebIntentData) -WK_ADD_API_MAPPING(WKIntentServiceInfoRef, WebIntentServiceInfo) -WK_ADD_API_MAPPING(WKKeyValueStorageManagerRef, WebKeyValueStorageManagerProxy) +WK_ADD_API_MAPPING(WKKeyValueStorageManagerRef, WebKeyValueStorageManager) WK_ADD_API_MAPPING(WKMediaCacheManagerRef, WebMediaCacheManagerProxy) WK_ADD_API_MAPPING(WKNavigationDataRef, WebNavigationData) WK_ADD_API_MAPPING(WKNetworkInfoManagerRef, WebNetworkInfoManagerProxy) @@ -141,10 +142,41 @@ WK_ADD_API_MAPPING(WKRenderLayerRef, WebRenderLayer) WK_ADD_API_MAPPING(WKRenderObjectRef, WebRenderObject) WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker) WK_ADD_API_MAPPING(WKVibrationRef, WebVibrationProxy) +WK_ADD_API_MAPPING(WKViewportAttributesRef, WebViewportAttributes) WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy) /* Enum conversions */ +inline BundleHitTestResultMediaType toBundleHitTestResultMediaType(WKBundleHitTestResultMediaType wkMediaType) +{ + switch (wkMediaType) { + case kWKBundleHitTestResultMediaTypeNone: + return BundleHitTestResultMediaTypeNone; + case kWKBundleHitTestResultMediaTypeAudio: + return BundleHitTestResultMediaTypeAudio; + case kWKBundleHitTestResultMediaTypeVideo: + return BundleHitTestResultMediaTypeVideo; + } + + ASSERT_NOT_REACHED(); + return BundleHitTestResultMediaTypeNone; +} + +inline WKBundleHitTestResultMediaType toAPI(BundleHitTestResultMediaType mediaType) +{ + switch (mediaType) { + case BundleHitTestResultMediaTypeNone: + return kWKBundleHitTestResultMediaTypeNone; + case BundleHitTestResultMediaTypeAudio: + return kWKBundleHitTestResultMediaTypeAudio; + case BundleHitTestResultMediaTypeVideo: + return kWKBundleHitTestResultMediaTypeVideo; + } + + ASSERT_NOT_REACHED(); + return kWKBundleHitTestResultMediaTypeNone; +} + inline CacheModel toCacheModel(WKCacheModel wkCacheModel) { switch (wkCacheModel) { @@ -210,10 +242,6 @@ inline FontSmoothingLevel toFontSmoothingLevel(WKFontSmoothingLevel wkLevel) return FontSmoothingLevelMedium; case kWKFontSmoothingLevelStrong: return FontSmoothingLevelStrong; -#if PLATFORM(WIN) - case kWKFontSmoothingLevelWindows: - return FontSmoothingLevelWindows; -#endif } ASSERT_NOT_REACHED(); @@ -232,10 +260,6 @@ inline WKFontSmoothingLevel toAPI(FontSmoothingLevel level) return kWKFontSmoothingLevelMedium; case FontSmoothingLevelStrong: return kWKFontSmoothingLevelStrong; -#if PLATFORM(WIN) - case FontSmoothingLevelWindows: - return kWKFontSmoothingLevelWindows; -#endif } ASSERT_NOT_REACHED(); @@ -414,6 +438,36 @@ inline WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPol return kWKAllowAllStorage; } +inline WKPluginLoadPolicy toWKPluginLoadPolicy(PluginModuleLoadPolicy pluginModuleLoadPolicy) +{ + switch (pluginModuleLoadPolicy) { + case PluginModuleLoadNormally: + return kWKPluginLoadPolicyLoadNormally; + case PluginModuleLoadUnsandboxed: + return kWKPluginLoadPolicyLoadUnsandboxed; + case PluginModuleBlocked: + return kWKPluginLoadPolicyBlocked; + } + + ASSERT_NOT_REACHED(); + return kWKPluginLoadPolicyBlocked; +} + +inline PluginModuleLoadPolicy toPluginModuleLoadPolicy(WKPluginLoadPolicy pluginLoadPolicy) +{ + switch (pluginLoadPolicy) { + case kWKPluginLoadPolicyLoadNormally: + return PluginModuleLoadNormally; + case kWKPluginLoadPolicyBlocked: + return PluginModuleBlocked; + case kWKPluginLoadPolicyLoadUnsandboxed: + return PluginModuleLoadUnsandboxed; + } + + ASSERT_NOT_REACHED(); + return PluginModuleBlocked; +} + inline ProxyingRefPtr<WebGrammarDetail> toAPI(const WebCore::GrammarDetail& grammarDetail) { return ProxyingRefPtr<WebGrammarDetail>(WebGrammarDetail::create(grammarDetail)); @@ -421,10 +475,6 @@ inline ProxyingRefPtr<WebGrammarDetail> toAPI(const WebCore::GrammarDetail& gram } // namespace WebKit -#if (defined(WIN32) || defined(_WIN32)) && !defined(BUILDING_QT__) -#include "WKAPICastWin.h" -#endif - #if defined(BUILDING_GTK__) #include "WKAPICastGtk.h" #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.cpp b/Source/WebKit2/UIProcess/API/C/WKContext.cpp index ac461157f..1629a5627 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKContext.cpp @@ -32,9 +32,26 @@ #include "WebURLRequest.h" #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> -#include <wtf/UnusedParam.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" { @@ -62,6 +79,11 @@ WKContextRef WKContextCreateWithInjectedBundlePath(WKStringRef pathRef) return toAPI(context.release().leakRef()); } +void WKContextSetClient(WKContextRef contextRef, const WKContextClient* wkClient) +{ + toImpl(contextRef)->initializeClient(wkClient); +} + void WKContextSetInjectedBundleClient(WKContextRef contextRef, const WKContextInjectedBundleClient* wkClient) { toImpl(contextRef)->initializeInjectedBundleClient(wkClient); @@ -131,6 +153,16 @@ WKProcessModel WKContextGetProcessModel(WKContextRef contextRef) return toAPI(toImpl(contextRef)->processModel()); } +void WKContextSetMaximumNumberOfProcesses(WKContextRef contextRef, unsigned numberOfProcesses) +{ + toImpl(contextRef)->setMaximumNumberOfProcesses(numberOfProcesses); +} + +unsigned WKContextGetMaximumNumberOfProcesses(WKContextRef contextRef) +{ + return toImpl(contextRef)->maximumNumberOfProcesses(); +} + void WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef contextRef, bool alwaysUseComplexTextCodePath) { toImpl(contextRef)->setAlwaysUsesComplexTextCodePath(alwaysUseComplexTextCodePath); @@ -168,18 +200,18 @@ void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef contextRef, WKCookieManagerRef WKContextGetCookieManager(WKContextRef contextRef) { - return toAPI(toImpl(contextRef)->cookieManagerProxy()); + return toAPI(toImpl(contextRef)->supplement<WebCookieManagerProxy>()); } WKApplicationCacheManagerRef WKContextGetApplicationCacheManager(WKContextRef contextRef) { - return toAPI(toImpl(contextRef)->applicationCacheManagerProxy()); + return toAPI(toImpl(contextRef)->supplement<WebApplicationCacheManagerProxy>()); } WKBatteryManagerRef WKContextGetBatteryManager(WKContextRef contextRef) { #if ENABLE(BATTERY_STATUS) - return toAPI(toImpl(contextRef)->batteryManagerProxy()); + return toAPI(toImpl(contextRef)->supplement<WebBatteryManagerProxy>()); #else return 0; #endif @@ -188,7 +220,7 @@ WKBatteryManagerRef WKContextGetBatteryManager(WKContextRef contextRef) WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef contextRef) { #if ENABLE(SQL_DATABASE) - return toAPI(toImpl(contextRef)->databaseManagerProxy()); + return toAPI(toImpl(contextRef)->supplement<WebDatabaseManagerProxy>()); #else return 0; #endif @@ -196,13 +228,13 @@ WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef contextRef) WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef contextRef) { - return toAPI(toImpl(contextRef)->geolocationManagerProxy()); + return toAPI(toImpl(contextRef)->supplement<WebGeolocationManagerProxy>()); } WKNetworkInfoManagerRef WKContextGetNetworkInfoManager(WKContextRef contextRef) { #if ENABLE(NETWORK_INFO) - return toAPI(toImpl(contextRef)->networkInfoManagerProxy()); + return toAPI(toImpl(contextRef)->supplement<WebNetworkInfoManagerProxy>()); #else return 0; #endif @@ -215,17 +247,17 @@ WKIconDatabaseRef WKContextGetIconDatabase(WKContextRef contextRef) WKKeyValueStorageManagerRef WKContextGetKeyValueStorageManager(WKContextRef contextRef) { - return toAPI(toImpl(contextRef)->keyValueStorageManagerProxy()); + return toAPI(toImpl(contextRef)->supplement<WebKeyValueStorageManager>()); } WKMediaCacheManagerRef WKContextGetMediaCacheManager(WKContextRef contextRef) { - return toAPI(toImpl(contextRef)->mediaCacheManagerProxy()); + return toAPI(toImpl(contextRef)->supplement<WebMediaCacheManagerProxy>()); } WKNotificationManagerRef WKContextGetNotificationManager(WKContextRef contextRef) { - return toAPI(toImpl(contextRef)->notificationManagerProxy()); + return toAPI(toImpl(contextRef)->supplement<WebNotificationManagerProxy>()); } WKPluginSiteDataManagerRef WKContextGetPluginSiteDataManager(WKContextRef contextRef) @@ -239,7 +271,7 @@ WKPluginSiteDataManagerRef WKContextGetPluginSiteDataManager(WKContextRef contex WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRef contextRef) { - return toAPI(toImpl(contextRef)->resourceCacheManagerProxy()); + return toAPI(toImpl(contextRef)->supplement<WebResourceCacheManagerProxy>()); } void WKContextStartMemorySampler(WKContextRef contextRef, WKDoubleRef interval) @@ -257,6 +289,16 @@ void WKContextSetIconDatabasePath(WKContextRef contextRef, WKStringRef iconDatab toImpl(contextRef)->setIconDatabasePath(toImpl(iconDatabasePath)->string()); } +void WKContextAllowSpecificHTTPSCertificateForHost(WKContextRef contextRef, WKCertificateInfoRef certificateRef, WKStringRef hostRef) +{ + 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()); @@ -299,7 +341,12 @@ void WKContextWarmInitialProcess(WKContextRef contextRef) void WKContextGetStatistics(WKContextRef contextRef, void* context, WKContextGetStatisticsFunction callback) { - toImpl(contextRef)->getWebCoreStatistics(DictionaryCallback::create(context, callback)); + toImpl(contextRef)->getStatistics(0xFFFFFFFF, DictionaryCallback::create(context, callback)); +} + +void WKContextGetStatisticsWithOptions(WKContextRef contextRef, WKStatisticsOptions optionsMask, void* context, WKContextGetStatisticsFunction callback) +{ + toImpl(contextRef)->getStatistics(optionsMask, DictionaryCallback::create(context, callback)); } void WKContextGarbageCollectJavaScriptObjects(WKContextRef contextRef) @@ -317,6 +364,30 @@ void WKContextSetUsesNetworkProcess(WKContextRef contextRef, bool usesNetworkPro toImpl(contextRef)->setUsesNetworkProcess(usesNetworkProcess); } +WKDictionaryRef WKContextCopyPlugInAutoStartOriginHashes(WKContextRef contextRef) +{ + return toAPI(toImpl(contextRef)->plugInAutoStartOriginHashes().leakRef()); +} + +void WKContextSetPlugInAutoStartOriginHashes(WKContextRef contextRef, WKDictionaryRef dictionaryRef) +{ + if (!dictionaryRef) + return; + toImpl(contextRef)->setPlugInAutoStartOriginHashes(*toImpl(dictionaryRef)); +} + +void WKContextSetPlugInAutoStartOrigins(WKContextRef contextRef, WKArrayRef arrayRef) +{ + if (!arrayRef) + return; + toImpl(contextRef)->setPlugInAutoStartOrigins(*toImpl(arrayRef)); +} + +void WKContextSetInvalidMessageFunction(WKContextInvalidMessageFunction invalidMessageFunction) +{ + WebContext::setInvalidMessageCallback(invalidMessageFunction); +} + // Deprecated functions. void _WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKStringRef pluginsDirectory) { diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.h b/Source/WebKit2/UIProcess/API/C/WKContext.h index 8f77cbd8f..3ce731e78 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.h +++ b/Source/WebKit2/UIProcess/API/C/WKContext.h @@ -39,6 +39,24 @@ enum { }; typedef uint32_t WKCacheModel; +// Context Client +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); + +struct WKContextClient { + int version; + const void * clientInfo; + + // Version 0. + WKContextPlugInAutoStartOriginHashesChangedCallback plugInAutoStartOriginHashesChanged; + WKContextNetworkProcessDidCrashCallback networkProcessDidCrash; + WKContextPlugInInformationBecameAvailableCallback plugInInformationBecameAvailable; +}; +typedef struct WKContextClient WKContextClient; + +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); @@ -129,11 +147,18 @@ enum { }; typedef uint32_t WKProcessModel; +enum { + kWKStatisticsOptionsWebContent = 1 << 0, + kWKStatisticsOptionsNetworking = 1 << 1 +}; +typedef uint32_t WKStatisticsOptions; + WK_EXPORT WKTypeID WKContextGetTypeID(); WK_EXPORT WKContextRef WKContextCreate(); WK_EXPORT WKContextRef WKContextCreateWithInjectedBundlePath(WKStringRef path); +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); @@ -152,6 +177,9 @@ WK_EXPORT WKCacheModel WKContextGetCacheModel(WKContextRef context); WK_EXPORT void WKContextSetProcessModel(WKContextRef context, WKProcessModel processModel); WK_EXPORT WKProcessModel WKContextGetProcessModel(WKContextRef context); +WK_EXPORT void WKContextSetMaximumNumberOfProcesses(WKContextRef context, unsigned numberOfProcesses); +WK_EXPORT unsigned WKContextGetMaximumNumberOfProcesses(WKContextRef context); + WK_EXPORT void WKContextStartMemorySampler(WKContextRef context, WKDoubleRef interval); WK_EXPORT void WKContextStopMemorySampler(WKContextRef context); @@ -170,10 +198,15 @@ WK_EXPORT WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRe 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); + WK_EXPORT void WKContextGarbageCollectJavaScriptObjects(WKContextRef context); WK_EXPORT void WKContextSetJavaScriptGarbageCollectorTimerEnabled(WKContextRef context, bool enable); +WK_EXPORT WKDictionaryRef WKContextCopyPlugInAutoStartOriginHashes(WKContextRef context); +WK_EXPORT void WKContextSetPlugInAutoStartOriginHashes(WKContextRef context, WKDictionaryRef dictionary); +WK_EXPORT void WKContextSetPlugInAutoStartOrigins(WKContextRef contextRef, WKArrayRef arrayRef); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h index 79c2ef50f..79e7f7f25 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h @@ -56,8 +56,11 @@ WK_EXPORT void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef co 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); @@ -76,6 +79,9 @@ WK_EXPORT void WKContextWarmInitialProcess(WKContextRef context); // At some point it should be removed. WK_EXPORT void WKContextSetUsesNetworkProcess(WKContextRef context, bool usesNetworkProcess); +typedef void (*WKContextInvalidMessageFunction)(WKStringRef messageName); +WK_EXPORT void WKContextSetInvalidMessageFunction(WKContextInvalidMessageFunction invalidMessageFunction); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKDownload.cpp b/Source/WebKit2/UIProcess/API/C/WKDownload.cpp index 45dea68ec..3588fd563 100644 --- a/Source/WebKit2/UIProcess/API/C/WKDownload.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKDownload.cpp @@ -37,6 +37,11 @@ WKTypeID WKDownloadGetTypeID() return toAPI(DownloadProxy::APIType); } +uint64_t WKDownloadGetID(WKDownloadRef download) +{ + return toImpl(download)->downloadID(); +} + WKURLRequestRef WKDownloadCopyRequest(WKDownloadRef download) { return toAPI(WebURLRequest::create(toImpl(download)->request()).leakRef()); diff --git a/Source/WebKit2/UIProcess/API/C/WKDownload.h b/Source/WebKit2/UIProcess/API/C/WKDownload.h index b81268156..8acc9106d 100644 --- a/Source/WebKit2/UIProcess/API/C/WKDownload.h +++ b/Source/WebKit2/UIProcess/API/C/WKDownload.h @@ -38,6 +38,7 @@ extern "C" { WK_EXPORT WKTypeID WKDownloadGetTypeID(); +WK_EXPORT uint64_t WKDownloadGetID(WKDownloadRef download); WK_EXPORT WKURLRequestRef WKDownloadCopyRequest(WKDownloadRef download); WK_EXPORT WKDataRef WKDownloadGetResumeData(WKDownloadRef download); WK_EXPORT void WKDownloadCancel(WKDownloadRef download); diff --git a/Source/WebKit2/UIProcess/API/C/WKFrame.cpp b/Source/WebKit2/UIProcess/API/C/WKFrame.cpp index 067c090c7..3bb375f7d 100644 --- a/Source/WebKit2/UIProcess/API/C/WKFrame.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKFrame.cpp @@ -96,16 +96,6 @@ WKPageRef WKFrameGetPage(WKFrameRef frameRef) return toAPI(toImpl(frameRef)->page()); } -WKArrayRef WKFrameCopyChildFrames(WKFrameRef frameRef) -{ - return toAPI(toImpl(frameRef)->childFrames().leakRef()); -} - -WKFrameRef WKFrameGetParentFrame(WKFrameRef frameRef) -{ - return toAPI(toImpl(frameRef)->parentFrame()); -} - WKCertificateInfoRef WKFrameGetCertificateInfo(WKFrameRef frameRef) { return toAPI(toImpl(frameRef)->certificateInfo()); @@ -183,3 +173,16 @@ 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; +} diff --git a/Source/WebKit2/UIProcess/API/C/WKFrame.h b/Source/WebKit2/UIProcess/API/C/WKFrame.h index eec939e6c..d8221cc0c 100644 --- a/Source/WebKit2/UIProcess/API/C/WKFrame.h +++ b/Source/WebKit2/UIProcess/API/C/WKFrame.h @@ -58,10 +58,6 @@ WK_EXPORT WKStringRef WKFrameCopyTitle(WKFrameRef frame); WK_EXPORT WKPageRef WKFrameGetPage(WKFrameRef frame); -WK_EXPORT WKArrayRef WKFrameCopyChildFrames(WKFrameRef frame); - -WK_EXPORT WKFrameRef WKFrameGetParentFrame(WKFrameRef frame); - WK_EXPORT WKCertificateInfoRef WKFrameGetCertificateInfo(WKFrameRef frame); WK_EXPORT bool WKFrameCanProvideSource(WKFrameRef frame); @@ -88,6 +84,12 @@ typedef void (^WKFrameGetWebArchiveBlock)(WKDataRef archiveData, WKErrorRef erro 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 } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKInspector.cpp b/Source/WebKit2/UIProcess/API/C/WKInspector.cpp index 891388c9a..e638609bb 100644 --- a/Source/WebKit2/UIProcess/API/C/WKInspector.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKInspector.cpp @@ -45,15 +45,27 @@ WKPageRef WKInspectorGetPage(WKInspectorRef inspectorRef) #if ENABLE(INSPECTOR) return toAPI(toImpl(inspectorRef)->page()); #else + UNUSED_PARAM(inspectorRef); return 0; #endif } +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 } @@ -63,14 +75,35 @@ 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 } @@ -78,6 +111,8 @@ void WKInspectorClose(WKInspectorRef inspectorRef) { #if ENABLE(INSPECTOR) toImpl(inspectorRef)->close(); +#else + UNUSED_PARAM(inspectorRef); #endif } @@ -85,6 +120,8 @@ void WKInspectorShowConsole(WKInspectorRef inspectorRef) { #if ENABLE(INSPECTOR) toImpl(inspectorRef)->showConsole(); +#else + UNUSED_PARAM(inspectorRef); #endif } @@ -92,6 +129,8 @@ void WKInspectorShowResources(WKInspectorRef inspectorRef) { #if ENABLE(INSPECTOR) toImpl(inspectorRef)->showResources(); +#else + UNUSED_PARAM(inspectorRef); #endif } @@ -99,6 +138,9 @@ void WKInspectorShowMainResourceForFrame(WKInspectorRef inspectorRef, WKFrameRef { #if ENABLE(INSPECTOR) toImpl(inspectorRef)->showMainResourceForFrame(toImpl(frameRef)); +#else + UNUSED_PARAM(inspectorRef); + UNUSED_PARAM(frameRef); #endif } @@ -107,6 +149,7 @@ bool WKInspectorIsAttached(WKInspectorRef inspectorRef) #if ENABLE(INSPECTOR) return toImpl(inspectorRef)->isAttached(); #else + UNUSED_PARAM(inspectorRef); return false; #endif } @@ -115,6 +158,8 @@ void WKInspectorAttach(WKInspectorRef inspectorRef) { #if ENABLE(INSPECTOR) toImpl(inspectorRef)->attach(); +#else + UNUSED_PARAM(inspectorRef); #endif } @@ -122,6 +167,8 @@ void WKInspectorDetach(WKInspectorRef inspectorRef) { #if ENABLE(INSPECTOR) toImpl(inspectorRef)->detach(); +#else + UNUSED_PARAM(inspectorRef); #endif } @@ -130,6 +177,7 @@ bool WKInspectorIsDebuggingJavaScript(WKInspectorRef inspectorRef) #if ENABLE(INSPECTOR) return toImpl(inspectorRef)->isDebuggingJavaScript(); #else + UNUSED_PARAM(inspectorRef); return false; #endif } @@ -138,6 +186,8 @@ void WKInspectorToggleJavaScriptDebugging(WKInspectorRef inspectorRef) { #if ENABLE(INSPECTOR) toImpl(inspectorRef)->toggleJavaScriptDebugging(); +#else + UNUSED_PARAM(inspectorRef); #endif } @@ -146,6 +196,7 @@ bool WKInspectorIsProfilingJavaScript(WKInspectorRef inspectorRef) #if ENABLE(INSPECTOR) return toImpl(inspectorRef)->isProfilingJavaScript(); #else + UNUSED_PARAM(inspectorRef); return false; #endif } @@ -154,6 +205,8 @@ void WKInspectorToggleJavaScriptProfiling(WKInspectorRef inspectorRef) { #if ENABLE(INSPECTOR) toImpl(inspectorRef)->toggleJavaScriptProfiling(); +#else + UNUSED_PARAM(inspectorRef); #endif } @@ -162,6 +215,7 @@ bool WKInspectorIsProfilingPage(WKInspectorRef inspectorRef) #if ENABLE(INSPECTOR) return toImpl(inspectorRef)->isProfilingPage(); #else + UNUSED_PARAM(inspectorRef); return false; #endif } @@ -170,5 +224,7 @@ void WKInspectorTogglePageProfiling(WKInspectorRef inspectorRef) { #if ENABLE(INSPECTOR) toImpl(inspectorRef)->togglePageProfiling(); +#else + UNUSED_PARAM(inspectorRef); #endif } diff --git a/Source/WebKit2/UIProcess/API/C/WKInspector.h b/Source/WebKit2/UIProcess/API/C/WKInspector.h index fd3438afa..203e1b3cf 100644 --- a/Source/WebKit2/UIProcess/API/C/WKInspector.h +++ b/Source/WebKit2/UIProcess/API/C/WKInspector.h @@ -40,9 +40,14 @@ WK_EXPORT WKTypeID WKInspectorGetTypeID(); WK_EXPORT WKPageRef WKInspectorGetPage(WKInspectorRef inspector); +WK_EXPORT bool WKInspectorIsConnected(WKInspectorRef inspector); WK_EXPORT bool WKInspectorIsVisible(WKInspectorRef inspector); WK_EXPORT bool WKInspectorIsFront(WKInspectorRef inspector); + +WK_EXPORT void WKInspectorConnect(WKInspectorRef inspector); + WK_EXPORT void WKInspectorShow(WKInspectorRef inspector); +WK_EXPORT void WKInspectorHide(WKInspectorRef inspector); WK_EXPORT void WKInspectorClose(WKInspectorRef inspector); WK_EXPORT void WKInspectorShowConsole(WKInspectorRef inspector); diff --git a/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp b/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp deleted file mode 100644 index 92e61871c..000000000 --- a/Source/WebKit2/UIProcess/API/C/WKIntentData.cpp +++ /dev/null @@ -1,103 +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 "WKIntentData.h" - -#include "ImmutableArray.h" -#include "ImmutableDictionary.h" -#include "WKAPICast.h" -#include "WKDictionary.h" -#include "WKString.h" -#include "WebSerializedScriptValue.h" - -#if ENABLE(WEB_INTENTS) -#include "WebIntentData.h" -#endif - -using namespace WebKit; - -WKTypeID WKIntentDataGetTypeID() -{ -#if ENABLE(WEB_INTENTS) - return toAPI(WebIntentData::APIType); -#else - return 0; -#endif -} - -WKStringRef WKIntentDataCopyAction(WKIntentDataRef intentRef) -{ -#if ENABLE(WEB_INTENTS) - return toCopiedAPI(toImpl(intentRef)->action()); -#else - return 0; -#endif -} - -WKStringRef WKIntentDataCopyType(WKIntentDataRef intentRef) -{ -#if ENABLE(WEB_INTENTS) - return toCopiedAPI(toImpl(intentRef)->payloadType()); -#else - return 0; -#endif -} - -WKURLRef WKIntentDataCopyService(WKIntentDataRef intentRef) -{ -#if ENABLE(WEB_INTENTS) - return toCopiedURLAPI(toImpl(intentRef)->service()); -#else - return 0; -#endif -} - -WKArrayRef WKIntentDataCopySuggestions(WKIntentDataRef intentRef) -{ -#if ENABLE(WEB_INTENTS) - return toAPI(toImpl(intentRef)->suggestions().leakRef()); -#else - return 0; -#endif -} - -WKStringRef WKIntentDataCopyExtraValue(WKIntentDataRef intentRef, WKStringRef key) -{ -#if ENABLE(WEB_INTENTS) - return toCopiedAPI(toImpl(intentRef)->extra(toWTFString(key))); -#else - return 0; -#endif -} - -WKDictionaryRef WKIntentDataCopyExtras(WKIntentDataRef intentRef) -{ -#if ENABLE(WEB_INTENTS) - return toAPI(toImpl(intentRef)->extras().leakRef()); -#else - return 0; -#endif -} diff --git a/Source/WebKit2/UIProcess/API/C/WKIntentServiceInfo.cpp b/Source/WebKit2/UIProcess/API/C/WKIntentServiceInfo.cpp deleted file mode 100644 index 5a30fb71a..000000000 --- a/Source/WebKit2/UIProcess/API/C/WKIntentServiceInfo.cpp +++ /dev/null @@ -1,89 +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 "WKIntentServiceInfo.h" - -#include "WKAPICast.h" - -#if ENABLE(WEB_INTENTS_TAG) -#include "WebIntentServiceInfo.h" -#endif - -using namespace WebKit; - -WKTypeID WKIntentServiceInfoGetTypeID() -{ -#if ENABLE(WEB_INTENTS_TAG) - return toAPI(WebIntentServiceInfo::APIType); -#else - return 0; -#endif -} - -WKStringRef WKIntentServiceInfoCopyAction(WKIntentServiceInfoRef serviceRef) -{ -#if ENABLE(WEB_INTENTS_TAG) - return toCopiedAPI(toImpl(serviceRef)->action()); -#else - return 0; -#endif -} - -WKStringRef WKIntentServiceInfoCopyType(WKIntentServiceInfoRef serviceRef) -{ -#if ENABLE(WEB_INTENTS_TAG) - return toCopiedAPI(toImpl(serviceRef)->payloadType()); -#else - return 0; -#endif -} - -WKURLRef WKIntentServiceInfoCopyHref(WKIntentServiceInfoRef serviceRef) -{ -#if ENABLE(WEB_INTENTS_TAG) - return toCopiedURLAPI(toImpl(serviceRef)->href()); -#else - return 0; -#endif -} - -WKStringRef WKIntentServiceInfoCopyTitle(WKIntentServiceInfoRef serviceRef) -{ -#if ENABLE(WEB_INTENTS_TAG) - return toCopiedAPI(toImpl(serviceRef)->title()); -#else - return 0; -#endif -} - -WKStringRef WKIntentServiceInfoCopyDisposition(WKIntentServiceInfoRef serviceRef) -{ -#if ENABLE(WEB_INTENTS_TAG) - return toCopiedAPI(toImpl(serviceRef)->disposition()); -#else - return 0; -#endif -} diff --git a/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.cpp b/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.cpp index f050692b4..d33c056bf 100644 --- a/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.cpp @@ -27,13 +27,13 @@ #include "WKKeyValueStorageManager.h" #include "WKAPICast.h" -#include "WebKeyValueStorageManagerProxy.h" +#include "WebKeyValueStorageManager.h" using namespace WebKit; WKTypeID WKKeyValueStorageManagerGetTypeID() { - return toAPI(WebKeyValueStorageManagerProxy::APIType); + return toAPI(WebKeyValueStorageManager::APIType); } void WKKeyValueStorageManagerGetKeyValueStorageOrigins(WKKeyValueStorageManagerRef keyValueStorageManagerRef, void* context, WKKeyValueStorageManagerGetKeyValueStorageOriginsFunction callback) diff --git a/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp b/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp index ba09d4d81..e0100bed8 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp @@ -44,6 +44,12 @@ WKStringRef WKNavigationDataCopyTitle(WKNavigationDataRef navigationDataRef) WKURLRef WKNavigationDataCopyURL(WKNavigationDataRef navigationDataRef) { + // This returns the URL of the original request for backwards-compatibility purposes. + return toCopiedURLAPI(toImpl(navigationDataRef)->originalRequest().url()); +} + +WKURLRef WKNavigationDataCopyNavigationDestinationURL(WKNavigationDataRef navigationDataRef) +{ return toCopiedURLAPI(toImpl(navigationDataRef)->url()); } diff --git a/Source/WebKit2/UIProcess/API/C/WKNavigationData.h b/Source/WebKit2/UIProcess/API/C/WKNavigationData.h index cf5d1e53a..e5d3a15f8 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNavigationData.h +++ b/Source/WebKit2/UIProcess/API/C/WKNavigationData.h @@ -35,8 +35,11 @@ extern "C" { WK_EXPORT WKTypeID WKNavigationDataGetTypeID(); WK_EXPORT WKStringRef WKNavigationDataCopyTitle(WKNavigationDataRef navigationData); -WK_EXPORT WKURLRef WKNavigationDataCopyURL(WKNavigationDataRef navigationData); WK_EXPORT WKURLRequestRef WKNavigationDataCopyOriginalRequest(WKNavigationDataRef navigationData); +WK_EXPORT WKURLRef WKNavigationDataCopyNavigationDestinationURL(WKNavigationDataRef navigationDataRef); + +// This returns the URL of the original request for backwards-compatibility purposes. +WK_EXPORT WKURLRef WKNavigationDataCopyURL(WKNavigationDataRef navigationData); #ifdef __cplusplus } diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp index 6a7c53e8f..29ecf543b 100644 --- a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp @@ -56,3 +56,8 @@ WKStringRef WKOpenPanelParametersCopyCapture(WKOpenPanelParametersRef parameters return 0; #endif } + +WKArrayRef WKOpenPanelParametersCopySelectedFileNames(WKOpenPanelParametersRef parametersRef) +{ + 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 ddcaae265..3801c2f7b 100644 --- a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h +++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h @@ -45,6 +45,8 @@ WK_EXPORT WKArrayRef WKOpenPanelParametersCopyAcceptedMIMETypes(WKOpenPanelParam WK_EXPORT WKStringRef WKOpenPanelParametersCopyCapture(WKOpenPanelParametersRef parameters); +WK_EXPORT WKArrayRef WKOpenPanelParametersCopySelectedFileNames(WKOpenPanelParametersRef parametersRef); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.cpp b/Source/WebKit2/UIProcess/API/C/WKPage.cpp index c0e17c429..611186f5a 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPage.cpp @@ -29,6 +29,7 @@ #include "PrintInfo.h" #include "WKAPICast.h" +#include "WKPluginInformation.h" #include "WebBackForwardList.h" #include "WebData.h" #include "WebPageProxy.h" @@ -39,6 +40,10 @@ #include <Block.h> #endif +#if ENABLE(CONTEXT_MENUS) +#include "WebContextMenuItem.h" +#endif + using namespace WebCore; using namespace WebKit; @@ -62,31 +67,81 @@ void WKPageLoadURL(WKPageRef pageRef, WKURLRef URLRef) toImpl(pageRef)->loadURL(toWTFString(URLRef)); } +void WKPageLoadURLWithUserData(WKPageRef pageRef, WKURLRef URLRef, WKTypeRef userDataRef) +{ + toImpl(pageRef)->loadURL(toWTFString(URLRef), toImpl(userDataRef)); +} + void WKPageLoadURLRequest(WKPageRef pageRef, WKURLRequestRef urlRequestRef) { toImpl(pageRef)->loadURLRequest(toImpl(urlRequestRef)); } +void WKPageLoadURLRequestWithUserData(WKPageRef pageRef, WKURLRequestRef urlRequestRef, WKTypeRef userDataRef) +{ + toImpl(pageRef)->loadURLRequest(toImpl(urlRequestRef), toImpl(userDataRef)); +} + +void WKPageLoadFile(WKPageRef pageRef, WKURLRef fileURL, WKURLRef resourceDirectoryURL) +{ + toImpl(pageRef)->loadFile(toWTFString(fileURL), toWTFString(resourceDirectoryURL)); +} + +void WKPageLoadFileWithUserData(WKPageRef pageRef, WKURLRef fileURL, WKURLRef resourceDirectoryURL, WKTypeRef userDataRef) +{ + toImpl(pageRef)->loadFile(toWTFString(fileURL), toWTFString(resourceDirectoryURL), toImpl(userDataRef)); +} + +void WKPageLoadData(WKPageRef pageRef, WKDataRef dataRef, WKStringRef MIMETypeRef, WKStringRef encodingRef, WKURLRef baseURLRef) +{ + toImpl(pageRef)->loadData(toImpl(dataRef), toWTFString(MIMETypeRef), toWTFString(encodingRef), toWTFString(baseURLRef)); +} + +void WKPageLoadDataWithUserData(WKPageRef pageRef, WKDataRef dataRef, WKStringRef MIMETypeRef, WKStringRef encodingRef, WKURLRef baseURLRef, WKTypeRef userDataRef) +{ + toImpl(pageRef)->loadData(toImpl(dataRef), toWTFString(MIMETypeRef), toWTFString(encodingRef), toWTFString(baseURLRef), toImpl(userDataRef)); +} + void WKPageLoadHTMLString(WKPageRef pageRef, WKStringRef htmlStringRef, WKURLRef baseURLRef) { toImpl(pageRef)->loadHTMLString(toWTFString(htmlStringRef), toWTFString(baseURLRef)); } +void WKPageLoadHTMLStringWithUserData(WKPageRef pageRef, WKStringRef htmlStringRef, WKURLRef baseURLRef, WKTypeRef userDataRef) +{ + toImpl(pageRef)->loadHTMLString(toWTFString(htmlStringRef), toWTFString(baseURLRef), toImpl(userDataRef)); +} + void WKPageLoadAlternateHTMLString(WKPageRef pageRef, WKStringRef htmlStringRef, WKURLRef baseURLRef, WKURLRef unreachableURLRef) { toImpl(pageRef)->loadAlternateHTMLString(toWTFString(htmlStringRef), toWTFString(baseURLRef), toWTFString(unreachableURLRef)); } +void WKPageLoadAlternateHTMLStringWithUserData(WKPageRef pageRef, WKStringRef htmlStringRef, WKURLRef baseURLRef, WKURLRef unreachableURLRef, WKTypeRef userDataRef) +{ + toImpl(pageRef)->loadAlternateHTMLString(toWTFString(htmlStringRef), toWTFString(baseURLRef), toWTFString(unreachableURLRef), toImpl(userDataRef)); +} + void WKPageLoadPlainTextString(WKPageRef pageRef, WKStringRef plainTextStringRef) { toImpl(pageRef)->loadPlainTextString(toWTFString(plainTextStringRef)); } +void WKPageLoadPlainTextStringWithUserData(WKPageRef pageRef, WKStringRef plainTextStringRef, WKTypeRef userDataRef) +{ + toImpl(pageRef)->loadPlainTextString(toWTFString(plainTextStringRef), toImpl(userDataRef)); +} + void WKPageLoadWebArchiveData(WKPageRef pageRef, WKDataRef webArchiveDataRef) { toImpl(pageRef)->loadWebArchiveData(toImpl(webArchiveDataRef)); } +void WKPageLoadWebArchiveDataWithUserData(WKPageRef pageRef, WKDataRef webArchiveDataRef, WKTypeRef userDataRef) +{ + toImpl(pageRef)->loadWebArchiveData(toImpl(webArchiveDataRef), toImpl(userDataRef)); +} + void WKPageStopLoading(WKPageRef pageRef) { toImpl(pageRef)->stopLoading(); @@ -187,6 +242,7 @@ WKInspectorRef WKPageGetInspector(WKPageRef pageRef) #if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR return toAPI(toImpl(pageRef)->inspector()); #else + UNUSED_PARAM(pageRef); return 0; #endif } @@ -262,6 +318,12 @@ WKStringRef WKPageGetSessionHistoryURLValueType() return toAPI(sessionHistoryURLValueType); } +WKStringRef WKPageGetSessionBackForwardListItemValueType() +{ + static WebString* sessionBackForwardListValueType = WebString::create("SessionBackForwardListItem").leakRef(); + return toAPI(sessionBackForwardListValueType); +} + WKDataRef WKPageCopySessionState(WKPageRef pageRef, void *context, WKPageSessionStateFilterCallback filter) { return toAPI(toImpl(pageRef)->sessionStateData(filter, context).leakRef()); @@ -392,6 +454,27 @@ bool WKPageIsPinnedToBottomSide(WKPageRef pageRef) return toImpl(pageRef)->isPinnedToBottomSide(); } + +bool WKPageRubberBandsAtBottom(WKPageRef pageRef) +{ + return toImpl(pageRef)->rubberBandsAtBottom(); +} + +void WKPageSetRubberBandsAtBottom(WKPageRef pageRef, bool rubberBandsAtBottom) +{ + toImpl(pageRef)->setRubberBandsAtBottom(rubberBandsAtBottom); +} + +bool WKPageRubberBandsAtTop(WKPageRef pageRef) +{ + return toImpl(pageRef)->rubberBandsAtTop(); +} + +void WKPageSetRubberBandsAtTop(WKPageRef pageRef, bool rubberBandsAtTop) +{ + toImpl(pageRef)->setRubberBandsAtTop(rubberBandsAtTop); +} + void WKPageSetPaginationMode(WKPageRef pageRef, WKPaginationMode paginationMode) { Pagination::Mode mode; @@ -496,6 +579,21 @@ void WKPageCenterSelectionInVisibleArea(WKPageRef pageRef) return toImpl(pageRef)->centerSelectionInVisibleArea(); } +void WKPageFindStringMatches(WKPageRef pageRef, WKStringRef string, WKFindOptions options, unsigned maxMatchCount) +{ + toImpl(pageRef)->findStringMatches(toImpl(string)->string(), toFindOptions(options), maxMatchCount); +} + +void WKPageGetImageForFindMatch(WKPageRef pageRef, int32_t matchIndex) +{ + toImpl(pageRef)->getImageForFindMatch(matchIndex); +} + +void WKPageSelectFindMatch(WKPageRef pageRef, int32_t matchIndex) +{ + toImpl(pageRef)->selectFindMatch(matchIndex); +} + void WKPageFindString(WKPageRef pageRef, WKStringRef string, WKFindOptions options, unsigned maxMatchCount) { toImpl(pageRef)->findString(toImpl(string)->string(), toFindOptions(options), maxMatchCount); @@ -523,6 +621,11 @@ void WKPageSetPageFindClient(WKPageRef pageRef, const WKPageFindClient* wkClient toImpl(pageRef)->initializeFindClient(wkClient); } +void WKPageSetPageFindMatchesClient(WKPageRef pageRef, const WKPageFindMatchesClient* wkClient) +{ + toImpl(pageRef)->initializeFindMatchesClient(wkClient); +} + void WKPageSetPageFormClient(WKPageRef pageRef, const WKPageFormClient* wkClient) { toImpl(pageRef)->initializeFormClient(wkClient); @@ -538,11 +641,6 @@ void WKPageSetPagePolicyClient(WKPageRef pageRef, const WKPagePolicyClient* wkCl toImpl(pageRef)->initializePolicyClient(wkClient); } -void WKPageSetPageResourceLoadClient(WKPageRef pageRef, const WKPageResourceLoadClient* wkClient) -{ - toImpl(pageRef)->initializeResourceLoadClient(wkClient); -} - void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClient* wkClient) { toImpl(pageRef)->initializeUIClient(wkClient); @@ -624,6 +722,11 @@ void WKPageGetContentsAsString_b(WKPageRef pageRef, WKPageGetSourceForFrameBlock } #endif +void WKPageGetSelectionAsWebArchiveData(WKPageRef pageRef, void* context, WKPageGetSelectionAsWebArchiveDataFunction callback) +{ + toImpl(pageRef)->getSelectionAsWebArchiveData(DataCallback::create(context, callback)); +} + void WKPageGetContentsAsMHTMLData(WKPageRef pageRef, bool useBinaryEncoding, void* context, WKPageGetContentsAsMHTMLDataFunction callback) { #if ENABLE(MHTML) @@ -688,7 +791,7 @@ void WKPageExecuteCommand(WKPageRef pageRef, WKStringRef command) toImpl(pageRef)->executeEditCommand(toImpl(command)->string()); } -#if PLATFORM(MAC) || PLATFORM(WIN) +#if PLATFORM(MAC) struct ComputedPagesContext { ComputedPagesContext(WKPageComputePagesForPrintingFunction callback, void* context) : callback(callback) @@ -738,13 +841,6 @@ void WKPageEndPrinting(WKPageRef page) } #endif -void WKPageDeliverIntentToFrame(WKPageRef page, WKFrameRef frame, WKIntentDataRef intent) -{ -#if ENABLE(WEB_INTENTS) - toImpl(page)->deliverIntentToFrame(toImpl(frame), toImpl(intent)); -#endif -} - WKImageRef WKPageCreateSnapshotOfVisibleContent(WKPageRef) { return 0; @@ -774,3 +870,101 @@ void WKPageSetMayStartMediaWhenInWindow(WKPageRef pageRef, bool mayStartMedia) { toImpl(pageRef)->setMayStartMediaWhenInWindow(mayStartMedia); } + + +void WKPageSelectContextMenuItem(WKPageRef page, WKContextMenuItemRef item) +{ +#if ENABLE(CONTEXT_MENUS) + toImpl(page)->contextMenuItemSelected(*(toImpl(item)->data())); +#endif +} + +WKScrollPinningBehavior WKPageGetScrollPinningBehavior(WKPageRef page) +{ + ScrollPinningBehavior pinning = toImpl(page)->scrollPinningBehavior(); + + switch (pinning) { + case WebCore::ScrollPinningBehavior::DoNotPin: + return kWKScrollPinningBehaviorDoNotPin; + case WebCore::ScrollPinningBehavior::PinToTop: + return kWKScrollPinningBehaviorPinToTop; + case WebCore::ScrollPinningBehavior::PinToBottom: + return kWKScrollPinningBehaviorPinToBottom; + } + + ASSERT_NOT_REACHED(); + return kWKScrollPinningBehaviorDoNotPin; +} + +void WKPageSetScrollPinningBehavior(WKPageRef page, WKScrollPinningBehavior pinning) +{ + ScrollPinningBehavior corePinning = ScrollPinningBehavior::DoNotPin; + + switch (pinning) { + case kWKScrollPinningBehaviorDoNotPin: + corePinning = ScrollPinningBehavior::DoNotPin; + break; + case kWKScrollPinningBehaviorPinToTop: + corePinning = ScrollPinningBehavior::PinToTop; + break; + case kWKScrollPinningBehaviorPinToBottom: + corePinning = ScrollPinningBehavior::PinToBottom; + break; + default: + ASSERT_NOT_REACHED(); + } + + toImpl(page)->setScrollPinningBehavior(corePinning); +} + + + +// -- DEPRECATED -- + +void WKPageSetInvalidMessageFunction(WKPageInvalidMessageFunction) +{ + // FIXME: Remove this function when doing so won't break WebKit nightlies. +} + +WKStringRef WKPageGetPluginInformationBundleIdentifierKey() +{ + return WKPluginInformationBundleIdentifierKey(); +} + +WKStringRef WKPageGetPluginInformationBundleVersionKey() +{ + return WKPluginInformationBundleVersionKey(); +} + +WKStringRef WKPageGetPluginInformationDisplayNameKey() +{ + return WKPluginInformationDisplayNameKey(); +} + +WKStringRef WKPageGetPluginInformationFrameURLKey() +{ + return WKPluginInformationFrameURLKey(); +} + +WKStringRef WKPageGetPluginInformationMIMETypeKey() +{ + return WKPluginInformationMIMETypeKey(); +} + +WKStringRef WKPageGetPluginInformationPageURLKey() +{ + return WKPluginInformationPageURLKey(); +} + +WKStringRef WKPageGetPluginInformationPluginspageAttributeURLKey() +{ + return WKPluginInformationPluginspageAttributeURLKey(); +} + +WKStringRef WKPageGetPluginInformationPluginURLKey() +{ + return WKPluginInformationPluginURLKey(); +} + +// -- DEPRECATED -- + diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.h b/Source/WebKit2/UIProcess/API/C/WKPage.h index b002eef0f..dc57c523d 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.h +++ b/Source/WebKit2/UIProcess/API/C/WKPage.h @@ -49,6 +49,14 @@ enum { }; typedef uint32_t WKFocusDirection; +enum { + kWKPluginLoadPolicyLoadNormally = 0, + kWKPluginLoadPolicyBlocked, + kWKPluginLoadPolicyInactive, + kWKPluginLoadPolicyLoadUnsandboxed, +}; +typedef uint32_t WKPluginLoadPolicy; + typedef void (*WKPageCallback)(WKPageRef page, const void* clientInfo); // FrameLoad Client @@ -73,13 +81,14 @@ typedef void (*WKPageDidChangeBackForwardListCallback)(WKPageRef page, WKBackFor 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 (*WKPagePluginDidFailCallback)(WKPageRef page, WKErrorCode errorCode, WKStringRef mimeType, WKStringRef pluginIdentifier, WKStringRef pluginVersion, const void* clientInfo); -typedef void (*WKPageDidReceiveIntentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKIntentDataRef intent, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageRegisterIntentServiceForFrameCallback)(WKPageRef page, WKFrameRef frame, WKIntentServiceInfoRef serviceInfo, 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; @@ -124,17 +133,22 @@ struct WKPageLoaderClient { WKPageWillGoToBackForwardListItemCallback willGoToBackForwardListItem; WKPageCallback interactionOccurredWhileProcessUnresponsive; - WKPagePluginDidFailCallback pluginDidFail; + WKPagePluginDidFailCallback_deprecatedForUseWithV1 pluginDidFail_deprecatedForUseWithV1; // Version 2 - WKPageDidReceiveIntentForFrameCallback didReceiveIntentForFrame; - WKPageRegisterIntentServiceForFrameCallback registerIntentServiceForFrame; + 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 = 2 }; +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); @@ -166,28 +180,6 @@ typedef struct WKPageFormClient WKPageFormClient; enum { kWKPageFormClientCurrentVersion = 0 }; -// Resource Load Client. -typedef void (*WKPageDidInitiateLoadForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKURLRequestRef request, bool pageIsProvisionallyLoading, const void* clientInfo); -typedef void (*WKPageDidSendRequestForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKURLRequestRef request, WKURLResponseRef redirectResponse, const void* clientInfo); -typedef void (*WKPageDidReceiveResponseForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKURLResponseRef response, const void* clientInfo); -typedef void (*WKPageDidReceiveContentLengthForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, uint64_t contentLength, const void* clientInfo); -typedef void (*WKPageDidFinishLoadForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, const void* clientInfo); -typedef void (*WKPageDidFailLoadForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKErrorRef error, const void* clientInfo); - -struct WKPageResourceLoadClient { - int version; - const void * clientInfo; - WKPageDidInitiateLoadForResourceCallback didInitiateLoadForResource; - WKPageDidSendRequestForResourceCallback didSendRequestForResource; - WKPageDidReceiveResponseForResourceCallback didReceiveResponseForResource; - WKPageDidReceiveContentLengthForResourceCallback didReceiveContentLengthForResource; - WKPageDidFinishLoadForResourceCallback didFinishLoadForResource; - WKPageDidFailLoadForResourceCallback didFailLoadForResource; -}; -typedef struct WKPageResourceLoadClient WKPageResourceLoadClient; - -enum { kWKPageResourceLoadClientCurrentVersion = 0 }; - enum { kWKPluginUnavailabilityReasonPluginMissing, kWKPluginUnavailabilityReasonPluginCrashed, @@ -229,14 +221,15 @@ typedef void (*WKPagePrintFrameCallback)(WKPageRef page, WKFrameRef frame, const 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 (*WKPageUnavailablePluginButtonClickedCallback)(WKPageRef page, WKPluginUnavailabilityReason pluginUnavailabilityReason, WKStringRef mimeType, WKStringRef url, WKStringRef pluginsPageURL, 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; @@ -287,11 +280,12 @@ struct WKPageUIClient { WKPageCreateNewPageCallback createNewPage; WKPageMouseDidMoveOverElementCallback mouseDidMoveOverElement; WKPageDecidePolicyForNotificationPermissionRequestCallback decidePolicyForNotificationPermissionRequest; - WKPageUnavailablePluginButtonClickedCallback unavailablePluginButtonClicked; + WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1 unavailablePluginButtonClicked_deprecatedForUseWithV1; // Version 2 WKPageShowColorPickerCallback showColorPicker; WKPageHideColorPickerCallback hideColorPicker; + WKPageUnavailablePluginButtonClickedCallback unavailablePluginButtonClicked; }; typedef struct WKPageUIClient WKPageUIClient; @@ -317,10 +311,26 @@ 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); @@ -337,22 +347,39 @@ struct WKPageContextMenuClient { // Version 2 WKPageGetContextMenuFromProposedContextMenuCallback getContextMenuFromProposedMenu; + + // Version 3 + WKPageShowContextMenuCallback showContextMenu; + WKPageHideContextMenuCallback hideContextMenu; }; typedef struct WKPageContextMenuClient WKPageContextMenuClient; -enum { kWKPageContextMenuClientCurrentVersion = 2 }; +enum { kWKPageContextMenuClientCurrentVersion = 3 }; WK_EXPORT WKTypeID WKPageGetTypeID(); WK_EXPORT WKContextRef WKPageGetContext(WKPageRef page); WK_EXPORT WKPageGroupRef WKPageGetPageGroup(WKPageRef page); +// URL Requests WK_EXPORT void WKPageLoadURL(WKPageRef page, WKURLRef url); +WK_EXPORT void WKPageLoadURLWithUserData(WKPageRef page, WKURLRef url, WKTypeRef userData); WK_EXPORT void WKPageLoadURLRequest(WKPageRef page, WKURLRequestRef urlRequest); +WK_EXPORT void WKPageLoadURLRequestWithUserData(WKPageRef page, WKURLRequestRef urlRequest, WKTypeRef userData); +WK_EXPORT void WKPageLoadFile(WKPageRef page, WKURLRef fileURL, WKURLRef resourceDirectoryURL); +WK_EXPORT void WKPageLoadFileWithUserData(WKPageRef page, WKURLRef fileURL, WKURLRef resourceDirectoryURL, WKTypeRef userData); + +// Data Requests +WK_EXPORT void WKPageLoadData(WKPageRef page, WKDataRef data, WKStringRef MIMEType, WKStringRef encoding, WKURLRef baseURL); +WK_EXPORT void WKPageLoadDataWithUserData(WKPageRef page, WKDataRef data, WKStringRef MIMEType, WKStringRef encoding, WKURLRef baseURL, WKTypeRef userData); WK_EXPORT void WKPageLoadHTMLString(WKPageRef page, WKStringRef htmlString, WKURLRef baseURL); +WK_EXPORT void WKPageLoadHTMLStringWithUserData(WKPageRef page, WKStringRef htmlString, WKURLRef baseURL, WKTypeRef userData); WK_EXPORT void WKPageLoadAlternateHTMLString(WKPageRef page, WKStringRef htmlString, WKURLRef baseURL, WKURLRef unreachableURL); +WK_EXPORT void WKPageLoadAlternateHTMLStringWithUserData(WKPageRef page, WKStringRef htmlString, WKURLRef baseURL, WKURLRef unreachableURL, WKTypeRef userData); WK_EXPORT void WKPageLoadPlainTextString(WKPageRef page, WKStringRef plainTextString); +WK_EXPORT void WKPageLoadPlainTextStringWithUserData(WKPageRef page, WKStringRef plainTextString, WKTypeRef userData); WK_EXPORT void WKPageLoadWebArchiveData(WKPageRef page, WKDataRef webArchiveData); +WK_EXPORT void WKPageLoadWebArchiveDataWithUserData(WKPageRef page, WKDataRef webArchiveData, WKTypeRef userData); WK_EXPORT void WKPageStopLoading(WKPageRef page); WK_EXPORT void WKPageReload(WKPageRef page); @@ -407,6 +434,7 @@ WK_EXPORT void WKPageSetCustomTextEncodingName(WKPageRef page, WKStringRef encod WK_EXPORT void WKPageTerminate(WKPageRef page); 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); @@ -445,6 +473,11 @@ 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); +WK_EXPORT bool WKPageRubberBandsAtTop(WKPageRef); +WK_EXPORT void WKPageSetRubberBandsAtTop(WKPageRef, bool rubberBandsAtTop); + WK_EXPORT bool WKPageCanDelete(WKPageRef page); WK_EXPORT bool WKPageHasSelectedRange(WKPageRef page); WK_EXPORT bool WKPageIsContentEditable(WKPageRef page); @@ -455,13 +488,16 @@ WK_EXPORT void WKPageCenterSelectionInVisibleArea(WKPageRef page); WK_EXPORT void WKPageFindString(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount); WK_EXPORT void WKPageHideFindUI(WKPageRef page); WK_EXPORT void WKPageCountStringMatches(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount); +WK_EXPORT void WKPageFindStringMatches(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount); +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 WKPageSetPageResourceLoadClient(WKPageRef page, const WKPageResourceLoadClient* client); WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, const WKPageUIClient* client); typedef void (*WKPageRunJavaScriptFunction)(WKSerializedScriptValueRef, WKErrorRef, void*); @@ -488,11 +524,12 @@ WK_EXPORT void WKPageGetContentsAsString_b(WKPageRef page, WKPageGetContentsAsSt typedef void (*WKPageGetContentsAsMHTMLDataFunction)(WKDataRef, WKErrorRef, void*); WK_EXPORT void WKPageGetContentsAsMHTMLData(WKPageRef page, bool useBinaryEncoding, void* context, WKPageGetContentsAsMHTMLDataFunction function); +typedef void (*WKPageGetSelectionAsWebArchiveDataFunction)(WKDataRef, WKErrorRef, void*); +WK_EXPORT void WKPageGetSelectionAsWebArchiveData(WKPageRef page, void* context, WKPageGetSelectionAsWebArchiveDataFunction function); + typedef void (*WKPageForceRepaintFunction)(WKErrorRef, void*); WK_EXPORT void WKPageForceRepaint(WKPageRef page, void* context, WKPageForceRepaintFunction function); -WK_EXPORT void WKPageDeliverIntentToFrame(WKPageRef page, WKFrameRef frame, WKIntentDataRef intent); - /* Some of the more common command name strings include the following, although any WebCore EditorCommand string is supported: @@ -511,6 +548,36 @@ WK_EXPORT void WKPageExecuteCommand(WKPageRef page, WKStringRef command); WK_EXPORT void WKPagePostMessageToInjectedBundle(WKPageRef page, WKStringRef messageName, WKTypeRef messageBody); +WK_EXPORT void WKPageSelectContextMenuItem(WKPageRef page, WKContextMenuItemRef item); + + + +/* DEPRECATED - Please use constants from WKPluginInformation instead. */ + +/* Value type: WKStringRef */ +WK_EXPORT WKStringRef WKPageGetPluginInformationBundleIdentifierKey(); + +/* Value type: WKStringRef */ +WK_EXPORT WKStringRef WKPageGetPluginInformationBundleVersionKey(); + +/* Value type: WKStringRef */ +WK_EXPORT WKStringRef WKPageGetPluginInformationDisplayNameKey(); + +/* Value type: WKURLRef */ +WK_EXPORT WKStringRef WKPageGetPluginInformationFrameURLKey(); + +/* Value type: WKStringRef */ +WK_EXPORT WKStringRef WKPageGetPluginInformationMIMETypeKey(); + +/* Value type: WKURLRef */ +WK_EXPORT WKStringRef WKPageGetPluginInformationPageURLKey(); + +/* Value type: WKURLRef */ +WK_EXPORT WKStringRef WKPageGetPluginInformationPluginspageAttributeURLKey(); + +/* Value type: WKURLRef */ +WK_EXPORT WKStringRef WKPageGetPluginInformationPluginURLKey(); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h index 4f0e85ba5..114990aa3 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h @@ -97,6 +97,19 @@ WK_EXPORT void WKPageSetMayStartMediaWhenInWindow(WKPageRef page, bool mayStartM WK_EXPORT WKArrayRef WKPageCopyRelatedPages(WKPageRef page); +typedef void (*WKPageInvalidMessageFunction)(uint32_t messageID); +WK_EXPORT void WKPageSetInvalidMessageFunction(WKPageInvalidMessageFunction function); + +enum { + kWKScrollPinningBehaviorDoNotPin, + kWKScrollPinningBehaviorPinToTop, + kWKScrollPinningBehaviorPinToBottom +}; +typedef uint32_t WKScrollPinningBehavior; + +WK_EXPORT WKScrollPinningBehavior WKPageGetScrollPinningBehavior(WKPageRef page); +WK_EXPORT void WKPageSetScrollPinningBehavior(WKPageRef page, WKScrollPinningBehavior pinning); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.cpp b/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.cpp index 39539f449..1105ca27a 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.cpp @@ -35,7 +35,6 @@ #endif using namespace WebKit; -using namespace std; WKTypeID WKPluginSiteDataManagerGetTypeID() { @@ -87,7 +86,7 @@ void WKPluginSiteDataManagerClearSiteData(WKPluginSiteDataManagerRef managerRef, void WKPluginSiteDataManagerClearAllSiteData(WKPluginSiteDataManagerRef managerRef, void* context, WKPluginSiteDataManagerClearSiteDataFunction function) { #if ENABLE(NETSCAPE_PLUGIN_API) - toImpl(managerRef)->clearSiteData(0, NP_CLEAR_ALL, numeric_limits<uint64_t>::max(), VoidCallback::create(context, function)); + toImpl(managerRef)->clearSiteData(0, NP_CLEAR_ALL, std::numeric_limits<uint64_t>::max(), VoidCallback::create(context, function)); #else UNUSED_PARAM(managerRef); UNUSED_PARAM(context); diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp index cb4cff018..86af62ea6 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp @@ -28,6 +28,7 @@ #include "WKPreferencesPrivate.h" #include "WKAPICast.h" +#include "WebContext.h" #include "WebPreferences.h" #include <WebCore/Settings.h> #include <wtf/PassRefPtr.h> @@ -68,6 +69,16 @@ bool WKPreferencesGetJavaScriptEnabled(WKPreferencesRef preferencesRef) return toImpl(preferencesRef)->javaScriptEnabled(); } +void WKPreferencesSetJavaScriptMarkupEnabled(WKPreferencesRef preferencesRef, bool javaScriptMarkupEnabled) +{ + toImpl(preferencesRef)->setJavaScriptMarkupEnabled(javaScriptMarkupEnabled); +} + +bool WKPreferencesGetJavaScriptMarkupEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->javaScriptMarkupEnabled(); +} + void WKPreferencesSetLoadsImagesAutomatically(WKPreferencesRef preferencesRef, bool loadsImagesAutomatically) { toImpl(preferencesRef)->setLoadsImagesAutomatically(loadsImagesAutomatically); @@ -408,6 +419,16 @@ bool WKPreferencesGetAcceleratedCompositingEnabled(WKPreferencesRef preferencesR return toImpl(preferencesRef)->acceleratedCompositingEnabled(); } +void WKPreferencesSetAcceleratedCompositingForOverflowScrollEnabled(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setAcceleratedCompositingForOverflowScrollEnabled(flag); +} + +bool WKPreferencesGetAcceleratedCompositingForOverflowScrollEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->acceleratedCompositingForOverflowScrollEnabled(); +} + void WKPreferencesSetCompositingBordersVisible(WKPreferencesRef preferencesRef, bool flag) { toImpl(preferencesRef)->setCompositingBordersVisible(flag); @@ -428,6 +449,16 @@ bool WKPreferencesGetCompositingRepaintCountersVisible(WKPreferencesRef preferen return toImpl(preferencesRef)->compositingRepaintCountersVisible(); } +void WKPreferencesSetTiledScrollingIndicatorVisible(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setTiledScrollingIndicatorVisible(flag); +} + +bool WKPreferencesGetTiledScrollingIndicatorVisible(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->tiledScrollingIndicatorVisible(); +} + void WKPreferencesSetCSSCustomFilterEnabled(WKPreferencesRef preferencesRef, bool flag) { toImpl(preferencesRef)->setCSSCustomFilterEnabled(flag); @@ -638,6 +669,16 @@ bool WKPreferencesGetFullScreenEnabled(WKPreferencesRef preferencesRef) return toImpl(preferencesRef)->fullScreenEnabled(); } +void WKPreferencesSetAsynchronousSpellCheckingEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setAsynchronousSpellCheckingEnabled(enabled); +} + +bool WKPreferencesGetAsynchronousSpellCheckingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->asynchronousSpellCheckingEnabled(); +} + void WKPreferencesSetAVFoundationEnabled(WKPreferencesRef preferencesRef, bool enabled) { toImpl(preferencesRef)->setAVFoundationEnabled(enabled); @@ -944,6 +985,36 @@ bool WKPreferencesGetPlugInSnapshottingEnabled(WKPreferencesRef preferencesRef) return toImpl(preferencesRef)->plugInSnapshottingEnabled(); } +void WKPreferencesSetSnapshotAllPlugIns(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setSnapshotAllPlugIns(enabled); +} + +bool WKPreferencesGetSnapshotAllPlugIns(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->snapshotAllPlugIns(); +} + +void WKPreferencesSetAutostartOriginPlugInSnapshottingEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setAutostartOriginPlugInSnapshottingEnabled(enabled); +} + +bool WKPreferencesGetAutostartOriginPlugInSnapshottingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->autostartOriginPlugInSnapshottingEnabled(); +} + +void WKPreferencesSetPrimaryPlugInSnapshotDetectionEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setPrimaryPlugInSnapshotDetectionEnabled(enabled); +} + +bool WKPreferencesGetPrimaryPlugInSnapshotDetectionEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->primaryPlugInSnapshotDetectionEnabled(); +} + void WKPreferencesSetPDFPluginEnabled(WKPreferencesRef preferencesRef, bool enabled) { toImpl(preferencesRef)->setPDFPluginEnabled(enabled); @@ -974,3 +1045,102 @@ bool WKPreferencesGetTextAutosizingEnabled(WKPreferencesRef preferencesRef) return toImpl(preferencesRef)->textAutosizingEnabled(); } +void WKPreferencesSetAggressiveTileRetentionEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setAggressiveTileRetentionEnabled(enabled); +} + +bool WKPreferencesGetAggressiveTileRetentionEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->aggressiveTileRetentionEnabled(); +} + +void WKPreferencesSetQTKitEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setQTKitEnabled(enabled); +} + +bool WKPreferencesGetQTKitEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->isQTKitEnabled(); +} + +void WKPreferencesSetLogsPageMessagesToSystemConsoleEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setLogsPageMessagesToSystemConsoleEnabled(enabled); +} + +bool WKPreferencesGetLogsPageMessagesToSystemConsoleEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->logsPageMessagesToSystemConsoleEnabled(); +} + +void WKPreferencesSetPageVisibilityBasedProcessSuppressionEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setPageVisibilityBasedProcessSuppressionEnabled(enabled); +} + +bool WKPreferencesGetPageVisibilityBasedProcessSuppressionEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->pageVisibilityBasedProcessSuppressionEnabled(); +} + +void WKPreferencesSetSmartInsertDeleteEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setSmartInsertDeleteEnabled(enabled); +} + +bool WKPreferencesGetSmartInsertDeleteEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->smartInsertDeleteEnabled(); +} + +void WKPreferencesSetSelectTrailingWhitespaceEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setSelectTrailingWhitespaceEnabled(enabled); +} + +bool WKPreferencesGetSelectTrailingWhitespaceEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->selectTrailingWhitespaceEnabled(); +} + +void WKPreferencesSetShowsURLsInToolTipsEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setShowsURLsInToolTipsEnabled(enabled); +} + +bool WKPreferencesGetShowsURLsInToolTipsEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->showsURLsInToolTipsEnabled(); +} + +void WKPreferencesSetHiddenPageDOMTimerThrottlingEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setHiddenPageDOMTimerThrottlingEnabled(enabled); +} + +bool WKPreferencesGetHiddenPageDOMTimerThrottlingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->hiddenPageDOMTimerThrottlingEnabled(); +} + +void WKPreferencesSetHiddenPageCSSAnimationSuspensionEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setHiddenPageCSSAnimationSuspensionEnabled(enabled); +} + +bool WKPreferencesGetHiddenPageCSSAnimationSuspensionEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->hiddenPageCSSAnimationSuspensionEnabled(); +} + +void WKPreferencesSetIncrementalRenderingSuppressionTimeout(WKPreferencesRef preferencesRef, double timeout) +{ + toImpl(preferencesRef)->setIncrementalRenderingSuppressionTimeout(timeout); +} + +double WKPreferencesGetIncrementalRenderingSuppressionTimeout(WKPreferencesRef preferencesRef) +{ + return toAPI(toImpl(preferencesRef)->incrementalRenderingSuppressionTimeout()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.h b/Source/WebKit2/UIProcess/API/C/WKPreferences.h index 4033d8cf1..bf36bb60e 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferences.h +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.h @@ -53,6 +53,10 @@ WK_EXPORT void WKPreferencesSetJavaScriptEnabled(WKPreferencesRef preferences, b WK_EXPORT bool WKPreferencesGetJavaScriptEnabled(WKPreferencesRef preferences); // Defaults to true. +WK_EXPORT void WKPreferencesSetJavaScriptMarkupEnabled(WKPreferencesRef preferences, bool javaScriptEnabled); +WK_EXPORT bool WKPreferencesGetJavaScriptMarkupEnabled(WKPreferencesRef preferences); + +// Defaults to true. WK_EXPORT void WKPreferencesSetLoadsImagesAutomatically(WKPreferencesRef preferences, bool loadsImagesAutomatically); WK_EXPORT bool WKPreferencesGetLoadsImagesAutomatically(WKPreferencesRef preferences); @@ -228,6 +232,14 @@ WK_EXPORT bool WKPreferencesGetEncodingDetectorEnabled(WKPreferencesRef preferen WK_EXPORT void WKPreferencesSetTextAutosizingEnabled(WKPreferencesRef preferences, bool textAutosizingEnabled); WK_EXPORT bool WKPreferencesGetTextAutosizingEnabled(WKPreferencesRef preferences); +// Defaults to true. +WK_EXPORT void WKPreferencesSetQTKitEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetQTKitEnabled(WKPreferencesRef preferencesRef); + +// Defaults to false +WK_EXPORT void WKPreferencesSetAsynchronousSpellCheckingEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetAsynchronousSpellCheckingEnabled(WKPreferencesRef preferencesRef); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h index a796bcb43..1c957563f 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h @@ -76,6 +76,10 @@ WK_EXPORT void WKPreferencesSetAcceleratedCompositingEnabled(WKPreferencesRef, b WK_EXPORT bool WKPreferencesGetAcceleratedCompositingEnabled(WKPreferencesRef); // Defaults to false. +WK_EXPORT void WKPreferencesSetAcceleratedCompositingForOverflowScrollEnabled(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetAcceleratedCompositingForOverflowScrollEnabled(WKPreferencesRef); + +// Defaults to false. WK_EXPORT void WKPreferencesSetCompositingBordersVisible(WKPreferencesRef, bool); WK_EXPORT bool WKPreferencesGetCompositingBordersVisible(WKPreferencesRef); @@ -83,6 +87,10 @@ WK_EXPORT bool WKPreferencesGetCompositingBordersVisible(WKPreferencesRef); WK_EXPORT void WKPreferencesSetCompositingRepaintCountersVisible(WKPreferencesRef, bool); WK_EXPORT bool WKPreferencesGetCompositingRepaintCountersVisible(WKPreferencesRef); +// Defaults to false. +WK_EXPORT void WKPreferencesSetTiledScrollingIndicatorVisible(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetTiledScrollingIndicatorVisible(WKPreferencesRef); + // Defaults to true. WK_EXPORT void WKPreferencesSetCSSCustomFilterEnabled(WKPreferencesRef, bool flag); WK_EXPORT bool WKPreferencesGetCSSCustomFilterEnabled(WKPreferencesRef); @@ -231,6 +239,54 @@ WK_EXPORT bool WKPreferencesGetCookieEnabled(WKPreferencesRef preferences); WK_EXPORT void WKPreferencesSetPDFPluginEnabled(WKPreferencesRef preferences, bool enabled); WK_EXPORT bool WKPreferencesGetPDFPluginEnabled(WKPreferencesRef preferences); +// Defaults to false +WK_EXPORT void WKPreferencesSetAggressiveTileRetentionEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetAggressiveTileRetentionEnabled(WKPreferencesRef preferences); + +// Defaults to false +WK_EXPORT void WKPreferencesSetLogsPageMessagesToSystemConsoleEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetLogsPageMessagesToSystemConsoleEnabled(WKPreferencesRef preferences); + +// Defaults to false +WK_EXPORT void WKPreferencesSetPageVisibilityBasedProcessSuppressionEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetPageVisibilityBasedProcessSuppressionEnabled(WKPreferencesRef); + +// Defaults to true +WK_EXPORT void WKPreferencesSetSmartInsertDeleteEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetSmartInsertDeleteEnabled(WKPreferencesRef preferences); + +// Defaults to false +WK_EXPORT void WKPreferencesSetSelectTrailingWhitespaceEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetSelectTrailingWhitespaceEnabled(WKPreferencesRef preferences); + +// Defaults to false +WK_EXPORT void WKPreferencesSetShowsURLsInToolTipsEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetShowsURLsInToolTipsEnabled(WKPreferencesRef preferences); + +// Defaults to true on Mac, false on other platforms. +WK_EXPORT void WKPreferencesSetHiddenPageDOMTimerThrottlingEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetHiddenPageDOMTimerThrottlingEnabled(WKPreferencesRef preferences); + +// Defaults to true on Mac, false on other platforms. +WK_EXPORT void WKPreferencesSetHiddenPageCSSAnimationSuspensionEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetHiddenPageCSSAnimationSuspensionEnabled(WKPreferencesRef preferences); + +// Defaults to false +WK_EXPORT void WKPreferencesSetSnapshotAllPlugIns(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetSnapshotAllPlugIns(WKPreferencesRef preferencesRef); + +// Defaults to true +WK_EXPORT void WKPreferencesSetAutostartOriginPlugInSnapshottingEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetAutostartOriginPlugInSnapshottingEnabled(WKPreferencesRef preferencesRef); + +// Defaults to true +WK_EXPORT void WKPreferencesSetPrimaryPlugInSnapshotDetectionEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetPrimaryPlugInSnapshotDetectionEnabled(WKPreferencesRef preferencesRef); + +// Defaults to 5 seconds. +WK_EXPORT void WKPreferencesSetIncrementalRenderingSuppressionTimeout(WKPreferencesRef preferencesRef, double timeout); +WK_EXPORT double WKPreferencesGetIncrementalRenderingSuppressionTimeout(WKPreferencesRef preferencesRef); + WK_EXPORT void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef); #ifdef __cplusplus diff --git a/Source/WebKit2/UIProcess/API/C/WKVibration.h b/Source/WebKit2/UIProcess/API/C/WKVibration.h index f300b46e8..4884ecd85 100644 --- a/Source/WebKit2/UIProcess/API/C/WKVibration.h +++ b/Source/WebKit2/UIProcess/API/C/WKVibration.h @@ -33,7 +33,7 @@ extern "C" { #endif // Provider. -typedef void (*WKVibrationProviderVibrateCallback)(WKVibrationRef vibrationRef, uint64_t vibrationTime, const void* clientInfo); +typedef void (*WKVibrationProviderVibrateCallback)(WKVibrationRef vibrationRef, uint32_t vibrationTime, const void* clientInfo); typedef void (*WKVibrationProviderCancelVibrationCallback)(WKVibrationRef vibrationRef, const void* clientInfo); struct WKVibrationProvider { diff --git a/Source/WebKit2/UIProcess/API/C/WKViewportAttributes.cpp b/Source/WebKit2/UIProcess/API/C/WKViewportAttributes.cpp new file mode 100644 index 000000000..e30af5666 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKViewportAttributes.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2013 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 followlayoutSizeing disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list Viewof conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT HOLDERS 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 "WKViewportAttributes.h" + +#include "WKAPICast.h" +#include "WebViewportAttributes.h" + +using namespace WebKit; + +WKTypeID WKViewportAttributesGetTypeID() +{ + return toAPI(WebViewportAttributes::APIType); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKViewportAttributes.h b/Source/WebKit2/UIProcess/API/C/WKViewportAttributes.h new file mode 100644 index 000000000..125b09cc4 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKViewportAttributes.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2013 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 Viewof conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT HOLDERS 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 WKViewportAttributes_h +#define WKViewportAttributes_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKGeometry.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKViewportAttributesGetTypeID(); + +#ifdef __cplusplus +} +#endif + +#endif /* WKViewportAttributes_h */ diff --git a/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp b/Source/WebKit2/UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp index 7b3cf6e82..118c4d8cb 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp +++ b/Source/WebKit2/UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2013 Intel Corporation. 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,15 @@ */ #include "config.h" -#include "WKViewPrivate.h" +#include "WKIconDatabaseCairo.h" #include "WKAPICast.h" -#include "WebView.h" +#include "WebIconDatabase.h" +using namespace WebCore; using namespace WebKit; -void WKViewSetOverrideCursor(WKViewRef viewRef, HCURSOR overrideCursor) +cairo_surface_t* WKIconDatabaseTryGetCairoSurfaceForURL(WKIconDatabaseRef iconDatabase, WKURLRef url) { - toImpl(viewRef)->setOverrideCursor(overrideCursor); + return toImpl(iconDatabase)->nativeImageForPageURL(toWTFString(url)).get(); } diff --git a/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.h b/Source/WebKit2/UIProcess/API/C/cairo/WKIconDatabaseCairo.h index 5f89fd4e1..ea6231148 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.h +++ b/Source/WebKit2/UIProcess/API/C/cairo/WKIconDatabaseCairo.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2013 Intel Corporation. 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,16 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKViewPrivate_h -#define WKViewPrivate_h - #include <WebKit2/WKBase.h> -#include <windows.h> + +typedef struct _cairo_surface cairo_surface_t; #ifdef __cplusplus extern "C" { #endif -WK_EXPORT void WKViewSetOverrideCursor(WKViewRef viewRef, HCURSOR overrideCursor); +WK_EXPORT cairo_surface_t* WKIconDatabaseTryGetCairoSurfaceForURL(WKIconDatabaseRef iconDatabase, WKURLRef url); #ifdef __cplusplus } #endif - -#endif /* WKViewPrivate_h */ diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKAPICastEfl.h b/Source/WebKit2/UIProcess/API/C/efl/WKAPICastEfl.h index 5a068ef36..87c5f5efb 100644 --- a/Source/WebKit2/UIProcess/API/C/efl/WKAPICastEfl.h +++ b/Source/WebKit2/UIProcess/API/C/efl/WKAPICastEfl.h @@ -24,11 +24,85 @@ #error "Please #include \"WKAPICast.h\" instead of this file directly." #endif -typedef struct _Evas_Object Evas_Object; +#include <WebCore/TextDirection.h> +#include <WebKit2/WKPopupItem.h> + +#if ENABLE(TOUCH_EVENTS) +#include "WebEvent.h" +#include <WebKit2/WKEventEfl.h> +#endif namespace WebKit { -WK_ADD_API_MAPPING(WKViewRef, Evas_Object) +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 } diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.cpp b/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.cpp new file mode 100644 index 000000000..843aeb0dd --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.cpp @@ -0,0 +1,174 @@ +/* + * 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 new file mode 100644 index 000000000..b5439219e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.h @@ -0,0 +1,75 @@ +/* + * 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/win/WKContextWin.cpp b/Source/WebKit2/UIProcess/API/C/efl/WKPageEfl.cpp index 4971540e4..2d5ec91b5 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp +++ b/Source/WebKit2/UIProcess/API/C/efl/WKPageEfl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * 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 @@ -12,7 +12,7 @@ * * 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 + * 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 @@ -24,20 +24,14 @@ */ #include "config.h" -#include "WKContext.h" -#include "WKContextPrivateWin.h" +#include "WKPageEfl.h" #include "WKAPICast.h" -#include "WebContext.h" +#include "WebPageProxy.h" using namespace WebKit; -void WKContextSetShouldPaintNativeControls(WKContextRef contextRef, bool b) +void WKPageSetUIPopupMenuClient(WKPageRef pageRef, const WKPageUIPopupMenuClient* wkClient) { - toImpl(contextRef)->setShouldPaintNativeControls(b); -} - -void WKContextSetInitialHTTPCookieAcceptPolicy(WKContextRef contextRef, WKHTTPCookieAcceptPolicy policy) -{ - toImpl(contextRef)->setInitialHTTPCookieAcceptPolicy(toHTTPCookieAcceptPolicy(policy)); + toImpl(pageRef)->initializeUIPopupMenuClient(wkClient); } diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKPageEfl.h b/Source/WebKit2/UIProcess/API/C/efl/WKPageEfl.h new file mode 100644 index 000000000..77b9d140b --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/efl/WKPageEfl.h @@ -0,0 +1,56 @@ +/* + * 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 new file mode 100644 index 000000000..7b0ea45ec --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/efl/WKPopupItem.cpp @@ -0,0 +1,94 @@ +/* + * 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 new file mode 100644 index 000000000..b418ed526 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/efl/WKPopupItem.h @@ -0,0 +1,64 @@ +/* + * 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 new file mode 100644 index 000000000..34f82b455 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/efl/WKPopupMenuListener.cpp @@ -0,0 +1,37 @@ +/* + * 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 new file mode 100644 index 000000000..854991679 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/efl/WKPopupMenuListener.h @@ -0,0 +1,41 @@ +/* + * 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/efl/WKView.cpp b/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp deleted file mode 100644 index f4436aedd..000000000 --- a/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp +++ /dev/null @@ -1,51 +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. - */ - -#include "config.h" -#include "WKView.h" - -#include "EwkViewImpl.h" -#include "WKAPICast.h" -#include "ewk_view_private.h" - -using namespace WebKit; - -WKViewRef WKViewCreate(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef) -{ - return toAPI(ewk_view_base_add(canvas, contextRef, pageGroupRef, EwkViewImpl::LegacyBehavior)); -} - -WKViewRef WKViewCreateWithFixedLayout(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef) -{ - return toAPI(ewk_view_base_add(canvas, contextRef, pageGroupRef, EwkViewImpl::DefaultBehavior)); -} - -WKPageRef WKViewGetPage(WKViewRef viewRef) -{ - EwkViewImpl* viewImpl = EwkViewImpl::fromEvasObject(toImpl(viewRef)); - - return viewImpl->wkPage(); -} - -WKImageRef WKViewGetSnapshot(WKViewRef viewRef) -{ - EwkViewImpl* viewImpl = EwkViewImpl::fromEvasObject(toImpl(viewRef)); - - return viewImpl->takeSnapshot(); -} diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKView.h b/Source/WebKit2/UIProcess/API/C/efl/WKView.h deleted file mode 100644 index ca17a9945..000000000 --- a/Source/WebKit2/UIProcess/API/C/efl/WKView.h +++ /dev/null @@ -1,43 +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 WKView_h -#define WKView_h - -#include <WebKit2/WKBase.h> - -typedef struct _Evas Evas; - -#ifdef __cplusplus -extern "C" { -#endif - -WK_EXPORT WKViewRef WKViewCreate(Evas* canvas, WKContextRef context, WKPageGroupRef pageGroup); - -WK_EXPORT WKViewRef WKViewCreateWithFixedLayout(Evas* canvas, WKContextRef context, WKPageGroupRef pageGroup); - -WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view); - -WK_EXPORT WKImageRef WKViewGetSnapshot(WKViewRef viewRef); - -#ifdef __cplusplus -} -#endif - -#endif /* WKView_h */ diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.cpp b/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.cpp new file mode 100644 index 000000000..cefa2d358 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2013 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 "WKViewEfl.h" + +#include "EwkView.h" +#include "WKAPICast.h" +#include "WebViewEfl.h" +#include <WebKit2/WKImageCairo.h> + +using namespace WebKit; + +void WKViewPaintToCairoSurface(WKViewRef viewRef, cairo_surface_t* surface) +{ + static_cast<WebViewEfl*>(toImpl(viewRef))->paintToCairoSurface(surface); +} + +WKImageRef WKViewCreateSnapshot(WKViewRef viewRef) +{ + EwkView* ewkView = static_cast<WebViewEfl*>(toImpl(viewRef))->ewkView(); + return WKImageCreateFromCairoSurface(ewkView->takeSnapshot().get(), 0 /* options */); +} + +void WKViewSetThemePath(WKViewRef viewRef, WKStringRef theme) +{ + static_cast<WebViewEfl*>(toImpl(viewRef))->setThemePath(toImpl(theme)->string()); +} + +void WKViewSendTouchEvent(WKViewRef viewRef, WKTouchEventRef touchEventRef) +{ +#if ENABLE(TOUCH_EVENTS) + static_cast<WebViewEfl*>(toImpl(viewRef))->sendTouchEvent(toImpl(touchEventRef)); +#else + UNUSED_PARAM(viewRef); + UNUSED_PARAM(touchEventRef); +#endif +} diff --git a/Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h b/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.h index 0d49ac99a..d8afdc432 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h +++ b/Source/WebKit2/UIProcess/API/C/efl/WKViewEfl.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2013 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,29 +23,27 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKContextPrivateWin_h -#define WKContextPrivateWin_h +#ifndef WKViewEfl_h +#define WKViewEfl_h #include <WebKit2/WKBase.h> -#include <WebKit2/WKContext.h> -#include <WebKit2/WKCookieManager.h> -#ifndef __cplusplus -#include <stdbool.h> -#endif +typedef struct _cairo_surface cairo_surface_t; #ifdef __cplusplus extern "C" { #endif -// Defaults to true. -WK_EXPORT void WKContextSetShouldPaintNativeControls(WKContextRef, bool); +WK_EXPORT void WKViewPaintToCairoSurface(WKViewRef, cairo_surface_t*); + +WK_EXPORT WKImageRef WKViewCreateSnapshot(WKViewRef); + +WK_EXPORT void WKViewSetThemePath(WKViewRef, WKStringRef); -// Defaults to WKHTTPCookieAcceptPolicyAlways. -WK_EXPORT void WKContextSetInitialHTTPCookieAcceptPolicy(WKContextRef, WKHTTPCookieAcceptPolicy); +WK_EXPORT void WKViewSendTouchEvent(WKViewRef, WKTouchEventRef); #ifdef __cplusplus } #endif -#endif /* WKContextPrivateWin_h */ +#endif /* WKViewEfl_h */ diff --git a/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.h b/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.h new file mode 100644 index 000000000..937a4a604 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.h @@ -0,0 +1,71 @@ +/* + * 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 new file mode 100644 index 000000000..9fb8a2ad8 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.mm @@ -0,0 +1,126 @@ +/* + * 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 index d881cdd32..5e45950cb 100644 --- a/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.cpp +++ b/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.cpp @@ -27,7 +27,10 @@ #include "WKPagePrivateMac.h" #include "WKAPICast.h" +#include "WebContext.h" +#include "WebPageGroup.h" #include "WebPageProxy.h" +#include "WebPreferences.h" using namespace WebKit; @@ -35,3 +38,11 @@ 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/mac/WKPagePrivateMac.h b/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.h index 1890da5ea..8357ba56a 100644 --- a/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.h +++ b/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.h @@ -33,6 +33,7 @@ extern "C" { #endif WK_EXPORT pid_t WKPageGetProcessIdentifier(WKPageRef page); +WK_EXPORT bool WKPageIsURLKnownHSTSHost(WKPageRef page, WKURLRef url); #ifdef __cplusplus } diff --git a/Source/WebKit2/UIProcess/API/C/qt/WKIconDatabaseQt.cpp b/Source/WebKit2/UIProcess/API/C/qt/WKIconDatabaseQt.cpp new file mode 100644 index 000000000..eee5c6f6d --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/qt/WKIconDatabaseQt.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). + * 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 "WKIconDatabaseQt.h" + +#include "WKAPICast.h" +#include "WKSharedAPICast.h" +#include "WebIconDatabase.h" +#include <QPixmap> + +using namespace WebKit; +using namespace WebCore; + +QImage WKIconDatabaseTryGetQImageForURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef urlRef) +{ + QPixmap* pixmap = toImpl(iconDatabaseRef)->nativeImageForPageURL(toWTFString(urlRef)); + return pixmap ? pixmap->toImage() : QImage(); +} diff --git a/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h b/Source/WebKit2/UIProcess/API/C/qt/WKIconDatabaseQt.h index 5b71cf303..b472dfb98 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h +++ b/Source/WebKit2/UIProcess/API/C/qt/WKIconDatabaseQt.h @@ -1,5 +1,6 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). + * 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 @@ -23,21 +24,16 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKAPICastWin_h -#define WKAPICastWin_h +#ifndef WKIconDatabaseQt_h +#define WKIconDatabaseQt_h -#ifndef WKAPICast_h -#error "Please #include \"WKAPICast.h\" instead of this file directly." -#endif +#include <WebKit2/WKBase.h> +#include <WebKit2/WKGeometry.h> -namespace WebKit { +QT_BEGIN_NAMESPACE +class QImage; +QT_END_NAMESPACE -class WebView; -class WebEditCommandProxy; +WK_EXPORT QImage WKIconDatabaseTryGetQImageForURL(WKIconDatabaseRef iconDatabase, WKURLRef url); -WK_ADD_API_MAPPING(WKViewRef, WebView) -WK_ADD_API_MAPPING(WKEditCommandRef, WebEditCommandProxy) - -} // namespace WebKit - -#endif // WKAPICastWin_h +#endif /* WKIconDatabaseQt_h */ diff --git a/Source/WebKit2/UIProcess/API/C/soup/WKContextSoup.cpp b/Source/WebKit2/UIProcess/API/C/soup/WKContextSoup.cpp index e4e88d384..f7549f003 100644 --- a/Source/WebKit2/UIProcess/API/C/soup/WKContextSoup.cpp +++ b/Source/WebKit2/UIProcess/API/C/soup/WKContextSoup.cpp @@ -29,10 +29,13 @@ #include "WKAPICast.h" #include "WebContext.h" +// Supplements +#include "WebSoupRequestManagerProxy.h" + using namespace WebKit; WKSoupRequestManagerRef WKContextGetSoupRequestManager(WKContextRef contextRef) { - return toAPI(toImpl(contextRef)->soupRequestManagerProxy()); + return toAPI(toImpl(contextRef)->supplement<WebSoupRequestManagerProxy>()); } diff --git a/Source/WebKit2/UIProcess/API/C/WKIntentServiceInfo.h b/Source/WebKit2/UIProcess/API/C/soup/WKCookieManagerSoup.cpp index 121cffde8..86b31aa47 100644 --- a/Source/WebKit2/UIProcess/API/C/WKIntentServiceInfo.h +++ b/Source/WebKit2/UIProcess/API/C/soup/WKCookieManagerSoup.cpp @@ -23,24 +23,29 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKIntentServiceInfo_h -#define WKIntentServiceInfo_h +#include "config.h" +#include "WKCookieManagerSoup.h" -#include <WebKit2/WKBase.h> +#include "SoupCookiePersistentStorageType.h" +#include "WKAPICast.h" +#include "WebCookieManagerProxy.h" -#ifdef __cplusplus -extern "C" { -#endif +using namespace WebKit; -WK_EXPORT WKTypeID WKIntentServiceInfoGetTypeID(); -WK_EXPORT WKStringRef WKIntentServiceInfoCopyAction(WKIntentServiceInfoRef serviceRef); -WK_EXPORT WKStringRef WKIntentServiceInfoCopyType(WKIntentServiceInfoRef serviceRef); -WK_EXPORT WKURLRef WKIntentServiceInfoCopyHref(WKIntentServiceInfoRef serviceRef); -WK_EXPORT WKStringRef WKIntentServiceInfoCopyTitle(WKIntentServiceInfoRef serviceRef); -WK_EXPORT WKStringRef WKIntentServiceInfoCopyDisposition(WKIntentServiceInfoRef serviceRef); +inline SoupCookiePersistentStorageType toSoupCookiePersistentStorageType(WKCookieStorageType wkCookieStorageType) +{ + switch (wkCookieStorageType) { + case kWKCookieStorageTypeText: + return SoupCookiePersistentStorageText; + case kWKCookieStorageTypeSQLite: + return SoupCookiePersistentStorageSQLite; + } -#ifdef __cplusplus + ASSERT_NOT_REACHED(); + return SoupCookiePersistentStorageText; } -#endif -#endif // WKIntentServiceInfo_h +void WKCookieManagerSetCookiePersistentStorage(WKCookieManagerRef cookieManager, WKStringRef storagePath, WKCookieStorageType storageType) +{ + toImpl(cookieManager)->setCookiePersistentStorage(toWTFString(storagePath), storageType); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKIntentData.h b/Source/WebKit2/UIProcess/API/C/soup/WKCookieManagerSoup.h index caf1b459f..0a7b4ff05 100644 --- a/Source/WebKit2/UIProcess/API/C/WKIntentData.h +++ b/Source/WebKit2/UIProcess/API/C/soup/WKCookieManagerSoup.h @@ -23,8 +23,8 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKIntentData_h -#define WKIntentData_h +#ifndef WKCookieManagerSoup_h +#define WKCookieManagerSoup_h #include <WebKit2/WKBase.h> @@ -32,17 +32,16 @@ extern "C" { #endif -WK_EXPORT WKTypeID WKIntentDataGetTypeID(); +enum { + kWKCookieStorageTypeText = 0, + kWKCookieStorageTypeSQLite = 1 +}; +typedef uint32_t WKCookieStorageType; -WK_EXPORT WKStringRef WKIntentDataCopyAction(WKIntentDataRef intentRef); -WK_EXPORT WKStringRef WKIntentDataCopyType(WKIntentDataRef intentRef); -WK_EXPORT WKURLRef WKIntentDataCopyService(WKIntentDataRef intentRef); -WK_EXPORT WKArrayRef WKIntentDataCopySuggestions(WKIntentDataRef intentRef); -WK_EXPORT WKStringRef WKIntentDataCopyExtraValue(WKIntentDataRef intentRef, WKStringRef key); -WK_EXPORT WKDictionaryRef WKIntentDataCopyExtras(WKIntentDataRef intentRef); +WK_EXPORT void WKCookieManagerSetCookiePersistentStorage(WKCookieManagerRef cookieManager, WKStringRef storagePath, WKCookieStorageType storageType); #ifdef __cplusplus } #endif -#endif // WKIntentData_h +#endif // WKCookieManagerSoup_h diff --git a/Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.h b/Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.h index 4dba13908..6892de4bf 100644 --- a/Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.h +++ b/Source/WebKit2/UIProcess/API/C/soup/WKSoupRequestManager.h @@ -26,7 +26,6 @@ #ifndef WKSoupRequestManager_h #define WKSoupRequestManager_h -#include "WKAPICast.h" #include <WebKit2/WKBase.h> #ifdef __cplusplus diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.cpp b/Source/WebKit2/UIProcess/API/C/win/WKView.cpp deleted file mode 100644 index 16b1c1980..000000000 --- a/Source/WebKit2/UIProcess/API/C/win/WKView.cpp +++ /dev/null @@ -1,127 +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 "WKView.h" - -#include "WKAPICast.h" -#include "WebView.h" - -using namespace WebKit; - -WKTypeID WKViewGetTypeID() -{ - return toAPI(APIObject::TypeView); -} - -WKViewRef WKViewCreate(RECT rect, WKContextRef contextRef, WKPageGroupRef pageGroupRef, HWND parentWindow) -{ - RefPtr<WebView> view = WebView::create(rect, toImpl(contextRef), toImpl(pageGroupRef), parentWindow); - return toAPI(view.release().leakRef()); -} - -HWND WKViewGetWindow(WKViewRef viewRef) -{ - return toImpl(viewRef)->window(); -} - -WKPageRef WKViewGetPage(WKViewRef viewRef) -{ - return toAPI(toImpl(viewRef)->page()); -} - -void WKViewSetParentWindow(WKViewRef viewRef, HWND hostWindow) -{ - toImpl(viewRef)->setParentWindow(hostWindow); -} - -void WKViewWindowAncestryDidChange(WKViewRef viewRef) -{ - toImpl(viewRef)->windowAncestryDidChange(); -} - -void WKViewSetIsInWindow(WKViewRef viewRef, bool isInWindow) -{ - toImpl(viewRef)->setIsInWindow(isInWindow); -} - -void WKViewSetInitialFocus(WKViewRef viewRef, bool forward) -{ - bool isKeyboardEventValid = false; - toImpl(viewRef)->setInitialFocus(forward, isKeyboardEventValid, WebKeyboardEvent()); -} - -void WKViewSetScrollOffsetOnNextResize(WKViewRef viewRef, WKSize scrollOffset) -{ - toImpl(viewRef)->setScrollOffsetOnNextResize(toIntSize(scrollOffset)); -} - -void WKViewSetFindIndicatorCallback(WKViewRef viewRef, WKViewFindIndicatorCallback callback, void* context) -{ - toImpl(viewRef)->setFindIndicatorCallback(callback, context); -} - -WKViewFindIndicatorCallback WKViewGetFindIndicatorCallback(WKViewRef viewRef, void** context) -{ - return toImpl(viewRef)->getFindIndicatorCallback(context); -} - -bool WKViewIsPageOverlayInstalled(WKViewRef viewRef) -{ - return toImpl(viewRef)->pageOverlayInstalled(); -} - -void WKViewSetViewUndoClient(WKViewRef viewRef, const WKViewUndoClient* wkClient) -{ - if (wkClient && wkClient->version) - return; - toImpl(viewRef)->initializeUndoClient(wkClient); -} - -void WKViewReapplyEditCommand(WKViewRef viewRef, WKEditCommandRef command) -{ - toImpl(viewRef)->reapplyEditCommand(toImpl(command)); -} - -void WKViewUnapplyEditCommand(WKViewRef viewRef, WKEditCommandRef command) -{ - toImpl(viewRef)->unapplyEditCommand(toImpl(command)); -} - -void WKViewSetDrawsTransparentBackground(WKViewRef viewRef, bool drawsTransparentBackground) -{ - toImpl(viewRef)->page()->setDrawsTransparentBackground(drawsTransparentBackground); -} - -bool WKViewDrawsTransparentBackground(WKViewRef viewRef) -{ - return toImpl(viewRef)->page()->drawsTransparentBackground(); -} - -void WKViewSetCustomDropTarget(WKViewRef viewRef, IDropTarget* dropTarget) -{ - return toImpl(viewRef)->setCustomDropTarget(dropTarget); -} - diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.h b/Source/WebKit2/UIProcess/API/C/win/WKView.h deleted file mode 100644 index b54093f63..000000000 --- a/Source/WebKit2/UIProcess/API/C/win/WKView.h +++ /dev/null @@ -1,96 +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 WKView_h -#define WKView_h - -#include <WebKit2/WKBase.h> -#include <WebKit2/WKGeometry.h> -#include <windows.h> - -struct IDropTarget; - -#ifdef __cplusplus -extern "C" { -#endif - -// Undo Client. -enum { - kWKViewUndo = 0, - kWKViewRedo = 1 -}; -typedef uint32_t WKViewUndoType; - -typedef void (*WKViewRegisterEditCommandCallback)(WKViewRef, WKEditCommandRef, WKViewUndoType undoOrRedo, const void *clientInfo); -typedef void (*WKViewClearAllEditCommandsCallback)(WKViewRef, const void *clientInfo); -typedef bool (*WKViewCanUndoRedoCallback)(WKViewRef, WKViewUndoType undoOrRedo, const void *clientInfo); -typedef void (*WKViewExecuteUndoRedoCallback)(WKViewRef, WKViewUndoType undoOrRedo, const void *clientInfo); - -struct WKViewUndoClient { - int version; - const void * clientInfo; - WKViewRegisterEditCommandCallback registerEditCommand; - WKViewClearAllEditCommandsCallback clearAllEditCommands; - WKViewCanUndoRedoCallback canUndoRedo; - WKViewExecuteUndoRedoCallback executeUndoRedo; -}; -typedef struct WKViewUndoClient WKViewUndoClient; - -enum { kWKViewUndoClientCurrentVersion = 0 }; - -WK_EXPORT WKTypeID WKViewGetTypeID(); - -WK_EXPORT WKViewRef WKViewCreate(RECT rect, WKContextRef context, WKPageGroupRef pageGroup, HWND parentWindow); - -WK_EXPORT HWND WKViewGetWindow(WKViewRef view); - -WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view); - -WK_EXPORT void WKViewSetViewUndoClient(WKViewRef view, const WKViewUndoClient* client); -WK_EXPORT void WKViewReapplyEditCommand(WKViewRef view, WKEditCommandRef command); -WK_EXPORT void WKViewUnapplyEditCommand(WKViewRef view, WKEditCommandRef command); - -WK_EXPORT void WKViewSetParentWindow(WKViewRef view, HWND parentWindow); -WK_EXPORT void WKViewWindowAncestryDidChange(WKViewRef view); -WK_EXPORT void WKViewSetIsInWindow(WKViewRef view, bool isInWindow); -WK_EXPORT void WKViewSetInitialFocus(WKViewRef view, bool forward); -WK_EXPORT void WKViewSetScrollOffsetOnNextResize(WKViewRef view, WKSize scrollOffset); - -typedef void (*WKViewFindIndicatorCallback)(WKViewRef, HBITMAP selectionBitmap, RECT selectionRectInWindowCoordinates, bool fadeout, void*); -WK_EXPORT void WKViewSetFindIndicatorCallback(WKViewRef view, WKViewFindIndicatorCallback callback, void* context); -WK_EXPORT WKViewFindIndicatorCallback WKViewGetFindIndicatorCallback(WKViewRef view, void** context); - -WK_EXPORT bool WKViewIsPageOverlayInstalled(WKViewRef view); - -WK_EXPORT void WKViewSetDrawsTransparentBackground(WKViewRef view, bool drawsTransparentBackground); -WK_EXPORT bool WKViewDrawsTransparentBackground(WKViewRef view); - -WK_EXPORT void WKViewSetCustomDropTarget(WKViewRef view, IDropTarget*); - -#ifdef __cplusplus -} -#endif - -#endif /* WKView_h */ |