diff options
author | Ben Murdoch <benm@google.com> | 2011-05-24 11:24:40 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-02 09:53:15 +0100 |
commit | 81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch) | |
tree | 7a9e5ed86ff429fd347a25153107221543909b19 /Source/WebKit2/UIProcess/API/C | |
parent | 94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff) | |
download | external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2 |
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/WebKit2/UIProcess/API/C')
20 files changed, 767 insertions, 15 deletions
diff --git a/Source/WebKit2/UIProcess/API/C/WKAPICast.h b/Source/WebKit2/UIProcess/API/C/WKAPICast.h index 5ce3b1f..a2983e9 100644 --- a/Source/WebKit2/UIProcess/API/C/WKAPICast.h +++ b/Source/WebKit2/UIProcess/API/C/WKAPICast.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,9 +45,12 @@ class AuthenticationChallengeProxy; class AuthenticationDecisionListener; class DownloadProxy; class GeolocationPermissionRequestProxy; +class WebApplicationCacheManagerProxy; class WebBackForwardList; class WebBackForwardListItem; +class WebResourceCacheManagerProxy; class WebContext; +class WebCookieManagerProxy; class WebCredential; class WebDatabaseManagerProxy; class WebFormSubmissionListenerProxy; @@ -56,19 +59,24 @@ class WebFrameProxy; class WebGeolocationManagerProxy; class WebGeolocationPosition; class WebInspectorProxy; +class WebKeyValueStorageManagerProxy; class WebNavigationData; class WebOpenPanelParameters; class WebOpenPanelResultListenerProxy; class WebPageGroup; class WebPageProxy; +class WebPluginSiteDataManager; class WebPreferences; class WebProtectionSpace; +WK_ADD_API_MAPPING(WKApplicationCacheManagerRef, WebApplicationCacheManagerProxy) WK_ADD_API_MAPPING(WKAuthenticationChallengeRef, AuthenticationChallengeProxy) WK_ADD_API_MAPPING(WKAuthenticationDecisionListenerRef, AuthenticationDecisionListener) WK_ADD_API_MAPPING(WKBackForwardListItemRef, WebBackForwardListItem) WK_ADD_API_MAPPING(WKBackForwardListRef, WebBackForwardList) +WK_ADD_API_MAPPING(WKResourceCacheManagerRef, WebResourceCacheManagerProxy) WK_ADD_API_MAPPING(WKContextRef, WebContext) +WK_ADD_API_MAPPING(WKCookieManagerRef, WebCookieManagerProxy) WK_ADD_API_MAPPING(WKCredentialRef, WebCredential) WK_ADD_API_MAPPING(WKDatabaseManagerRef, WebDatabaseManagerProxy) WK_ADD_API_MAPPING(WKDownloadRef, DownloadProxy) @@ -78,11 +86,13 @@ WK_ADD_API_MAPPING(WKFrameRef, WebFrameProxy) WK_ADD_API_MAPPING(WKGeolocationManagerRef, WebGeolocationManagerProxy) WK_ADD_API_MAPPING(WKGeolocationPermissionRequestRef, GeolocationPermissionRequestProxy) WK_ADD_API_MAPPING(WKGeolocationPositionRef, WebGeolocationPosition) +WK_ADD_API_MAPPING(WKKeyValueStorageManagerRef, WebKeyValueStorageManagerProxy) WK_ADD_API_MAPPING(WKNavigationDataRef, WebNavigationData) WK_ADD_API_MAPPING(WKOpenPanelParametersRef, WebOpenPanelParameters) WK_ADD_API_MAPPING(WKOpenPanelResultListenerRef, WebOpenPanelResultListenerProxy) WK_ADD_API_MAPPING(WKPageGroupRef, WebPageGroup) WK_ADD_API_MAPPING(WKPageRef, WebPageProxy) +WK_ADD_API_MAPPING(WKPluginSiteDataManagerRef, WebPluginSiteDataManager) WK_ADD_API_MAPPING(WKPreferencesRef, WebPreferences) WK_ADD_API_MAPPING(WKProtectionSpaceRef, WebProtectionSpace) diff --git a/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.cpp b/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.cpp new file mode 100644 index 0000000..2d95c67 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKApplicationCacheManager.h" + +#include "WKAPICast.h" +#include "WebApplicationCacheManagerProxy.h" + +using namespace WebKit; + +WKTypeID WKApplicationCacheManagerGetTypeID() +{ + return toAPI(WebApplicationCacheManagerProxy::APIType); +} + +void WKApplicationCacheManagerGetApplicationCacheOrigins(WKApplicationCacheManagerRef applicationCacheManagerRef, void* context, WKApplicationCacheManagerGetApplicationCacheOriginsFunction callback) +{ + toImpl(applicationCacheManagerRef)->getApplicationCacheOrigins(ArrayCallback::create(context, callback)); +} + +void WKApplicationCacheManagerDeleteEntriesForOrigin(WKApplicationCacheManagerRef applicationCacheManagerRef, WKSecurityOriginRef originRef) +{ + toImpl(applicationCacheManagerRef)->deleteEntriesForOrigin(toImpl(originRef)); +} + +void WKApplicationCacheManagerDeleteAllEntries(WKApplicationCacheManagerRef applicationCacheManagerRef) +{ + toImpl(applicationCacheManagerRef)->deleteAllEntries(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.h b/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.h new file mode 100644 index 0000000..c40039e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKApplicationCacheManager_h +#define WKApplicationCacheManager_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKApplicationCacheManagerGetTypeID(); + +typedef void (*WKApplicationCacheManagerGetApplicationCacheOriginsFunction)(WKArrayRef, WKErrorRef, void*); +WK_EXPORT void WKApplicationCacheManagerGetApplicationCacheOrigins(WKApplicationCacheManagerRef applicationCacheManager, void* context, WKApplicationCacheManagerGetApplicationCacheOriginsFunction function); + +WK_EXPORT void WKApplicationCacheManagerDeleteEntriesForOrigin(WKApplicationCacheManagerRef applicationCacheManager, WKSecurityOriginRef origin); +WK_EXPORT void WKApplicationCacheManagerDeleteAllEntries(WKApplicationCacheManagerRef applicationCacheManager); + +#ifdef __cplusplus +} +#endif + +#endif // WKApplicationCacheManager_h diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.cpp b/Source/WebKit2/UIProcess/API/C/WKContext.cpp index 82bd13d..6e4e5e0 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKContext.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 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 @@ -158,6 +158,16 @@ void WKContextClearApplicationCache(WKContextRef contextRef) toImpl(contextRef)->clearApplicationCache(); } +WKCookieManagerRef WKContextGetCookieManager(WKContextRef contextRef) +{ + return toAPI(toImpl(contextRef)->cookieManagerProxy()); +} + +WKApplicationCacheManagerRef WKContextGetApplicationCacheManager(WKContextRef contextRef) +{ + return toAPI(toImpl(contextRef)->applicationCacheManagerProxy()); +} + WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef contextRef) { return toAPI(toImpl(contextRef)->databaseManagerProxy()); @@ -168,6 +178,21 @@ WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef contextRef) return toAPI(toImpl(contextRef)->geolocationManagerProxy()); } +WKKeyValueStorageManagerRef WKContextGetKeyValueStorageManager(WKContextRef contextRef) +{ + return toAPI(toImpl(contextRef)->keyValueStorageManagerProxy()); +} + +WKPluginSiteDataManagerRef WKContextGetPluginSiteDataManager(WKContextRef contextRef) +{ + return toAPI(toImpl(contextRef)->pluginSiteDataManager()); +} + +WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRef contextRef) +{ + return toAPI(toImpl(contextRef)->resourceCacheManagerProxy()); +} + void WKContextStartMemorySampler(WKContextRef contextRef, WKDoubleRef interval) { toImpl(contextRef)->startMemorySampler(toImpl(interval)->value()); diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.h b/Source/WebKit2/UIProcess/API/C/WKContext.h index 810ad20..f8e7cee 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.h +++ b/Source/WebKit2/UIProcess/API/C/WKContext.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 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 @@ -119,12 +119,17 @@ WK_EXPORT WKCacheModel WKContextGetCacheModel(WKContextRef context); WK_EXPORT void WKContextClearResourceCaches(WKContextRef context); WK_EXPORT void WKContextClearApplicationCache(WKContextRef context); - + WK_EXPORT void WKContextStartMemorySampler(WKContextRef context, WKDoubleRef interval); WK_EXPORT void WKContextStopMemorySampler(WKContextRef context); +WK_EXPORT WKApplicationCacheManagerRef WKContextGetApplicationCacheManager(WKContextRef context); +WK_EXPORT WKCookieManagerRef WKContextGetCookieManager(WKContextRef context); WK_EXPORT WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef context); WK_EXPORT WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef context); +WK_EXPORT WKKeyValueStorageManagerRef WKContextGetKeyValueStorageManager(WKContextRef context); +WK_EXPORT WKPluginSiteDataManagerRef WKContextGetPluginSiteDataManager(WKContextRef context); +WK_EXPORT WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRef context); #ifdef __cplusplus } diff --git a/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp b/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp new file mode 100644 index 0000000..83578f7 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKCookieManager.h" + +#include "WKAPICast.h" +#include "WebCookieManagerProxy.h" + +using namespace WebKit; + +WKTypeID WKCookieManagerGetTypeID() +{ + return toAPI(WebCookieManagerProxy::APIType); +} + +void WKCookieManagerSetClient(WKCookieManagerRef cookieManagerRef, const WKCookieManagerClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(cookieManagerRef)->initializeClient(wkClient); +} + +void WKCookieManagerGetHostnamesWithCookies(WKCookieManagerRef cookieManagerRef, void* context, WKCookieManagerGetCookieHostnamesFunction callback) +{ + toImpl(cookieManagerRef)->getHostnamesWithCookies(ArrayCallback::create(context, callback)); +} + +void WKCookieManagerDeleteCookiesForHostname(WKCookieManagerRef cookieManagerRef, WKStringRef hostname) +{ + toImpl(cookieManagerRef)->deleteCookiesForHostname(toImpl(hostname)->string()); +} + +void WKCookieManagerDeleteAllCookies(WKCookieManagerRef cookieManagerRef) +{ + toImpl(cookieManagerRef)->deleteAllCookies(); +} + +void WKCookieManagerStartObservingCookieChanges(WKCookieManagerRef cookieManager) +{ + toImpl(cookieManager)->startObservingCookieChanges(); +} + +void WKCookieManagerStopObservingCookieChanges(WKCookieManagerRef cookieManager) +{ + toImpl(cookieManager)->stopObservingCookieChanges(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKCookieManager.h b/Source/WebKit2/UIProcess/API/C/WKCookieManager.h new file mode 100644 index 0000000..75d8ef5 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKCookieManager.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKCookieManager_h +#define WKCookieManager_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +// Cookie Manager Client +typedef void (*WKCookieManagerCookiesDidChangeCallback)(WKCookieManagerRef cookieManager, const void *clientInfo); + +struct WKCookieManagerClient { + int version; + const void * clientInfo; + WKCookieManagerCookiesDidChangeCallback cookiesDidChange; +}; +typedef struct WKCookieManagerClient WKCookieManagerClient; + +WK_EXPORT WKTypeID WKCookieManagerGetTypeID(); + +WK_EXPORT void WKCookieManagerSetClient(WKCookieManagerRef cookieManager, const WKCookieManagerClient* client); + +typedef void (*WKCookieManagerGetCookieHostnamesFunction)(WKArrayRef, WKErrorRef, void*); +WK_EXPORT void WKCookieManagerGetHostnamesWithCookies(WKCookieManagerRef cookieManager, void* context, WKCookieManagerGetCookieHostnamesFunction function); + +WK_EXPORT void WKCookieManagerDeleteCookiesForHostname(WKCookieManagerRef cookieManager, WKStringRef hostname); +WK_EXPORT void WKCookieManagerDeleteAllCookies(WKCookieManagerRef cookieManager); + +WK_EXPORT void WKCookieManagerStartObservingCookieChanges(WKCookieManagerRef cookieManager); +WK_EXPORT void WKCookieManagerStopObservingCookieChanges(WKCookieManagerRef cookieManager); + +#ifdef __cplusplus +} +#endif + +#endif // WKCookieManager_h diff --git a/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.cpp b/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.cpp new file mode 100644 index 0000000..f050692 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKKeyValueStorageManager.h" + +#include "WKAPICast.h" +#include "WebKeyValueStorageManagerProxy.h" + +using namespace WebKit; + +WKTypeID WKKeyValueStorageManagerGetTypeID() +{ + return toAPI(WebKeyValueStorageManagerProxy::APIType); +} + +void WKKeyValueStorageManagerGetKeyValueStorageOrigins(WKKeyValueStorageManagerRef keyValueStorageManagerRef, void* context, WKKeyValueStorageManagerGetKeyValueStorageOriginsFunction callback) +{ + toImpl(keyValueStorageManagerRef)->getKeyValueStorageOrigins(ArrayCallback::create(context, callback)); +} + +void WKKeyValueStorageManagerDeleteEntriesForOrigin(WKKeyValueStorageManagerRef keyValueStorageManagerRef, WKSecurityOriginRef originRef) +{ + toImpl(keyValueStorageManagerRef)->deleteEntriesForOrigin(toImpl(originRef)); +} + +void WKKeyValueStorageManagerDeleteAllEntries(WKKeyValueStorageManagerRef keyValueStorageManagerRef) +{ + toImpl(keyValueStorageManagerRef)->deleteAllEntries(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.h b/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.h new file mode 100644 index 0000000..a0ee278 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKKeyValueStorageManager_h +#define WKKeyValueStorageManager_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKKeyValueStorageManagerGetTypeID(); + +typedef void (*WKKeyValueStorageManagerGetKeyValueStorageOriginsFunction)(WKArrayRef, WKErrorRef, void*); +WK_EXPORT void WKKeyValueStorageManagerGetKeyValueStorageOrigins(WKKeyValueStorageManagerRef keyValueStorageManager, void* context, WKKeyValueStorageManagerGetKeyValueStorageOriginsFunction function); + +WK_EXPORT void WKKeyValueStorageManagerDeleteEntriesForOrigin(WKKeyValueStorageManagerRef keyValueStorageManager, WKSecurityOriginRef origin); +WK_EXPORT void WKKeyValueStorageManagerDeleteAllEntries(WKKeyValueStorageManagerRef keyValueStorageManager); + +#ifdef __cplusplus +} +#endif + +#endif // WKKeyValueStorageManager_h diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.cpp b/Source/WebKit2/UIProcess/API/C/WKPage.cpp index 1d5763f..c4e8eae 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPage.cpp @@ -27,6 +27,7 @@ #include "WKPage.h" #include "WKPagePrivate.h" +#include "PrintInfo.h" #include "WKAPICast.h" #include "WebBackForwardList.h" #include "WebData.h" @@ -170,6 +171,11 @@ double WKPageGetEstimatedProgress(WKPageRef pageRef) return toImpl(pageRef)->estimatedProgress(); } +void WKPageSetMemoryCacheClientCallsEnabled(WKPageRef pageRef, bool memoryCacheClientCallsEnabled) +{ + toImpl(pageRef)->setMemoryCacheClientCallsEnabled(memoryCacheClientCallsEnabled); +} + WKStringRef WKPageCopyUserAgent(WKPageRef pageRef) { return toCopiedAPI(toImpl(pageRef)->userAgent()); @@ -301,6 +307,31 @@ bool WKPageHasVerticalScrollbar(WKPageRef pageRef) return toImpl(pageRef)->hasVerticalScrollbar(); } +bool WKPageIsPinnedToLeftSide(WKPageRef pageRef) +{ + return toImpl(pageRef)->isPinnedToLeftSide(); +} + +bool WKPageIsPinnedToRightSide(WKPageRef pageRef) +{ + return toImpl(pageRef)->isPinnedToRightSide(); +} + +bool WKPageCanDelete(WKPageRef pageRef) +{ + return toImpl(pageRef)->canDelete(); +} + +bool WKPageHasSelectedRange(WKPageRef pageRef) +{ + return toImpl(pageRef)->hasSelectedRange(); +} + +bool WKPageIsContentEditable(WKPageRef pageRef) +{ + return toImpl(pageRef)->isContentEditable(); +} + void WKPageFindString(WKPageRef pageRef, WKStringRef string, WKFindOptions options, unsigned maxMatchCount) { toImpl(pageRef)->findString(toImpl(string)->string(), toFindOptions(options), maxMatchCount); @@ -367,11 +398,11 @@ void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClient* wkClient) void WKPageRunJavaScriptInMainFrame(WKPageRef pageRef, WKStringRef scriptRef, void* context, WKPageRunJavaScriptFunction callback) { - toImpl(pageRef)->runJavaScriptInMainFrame(toImpl(scriptRef)->string(), StringCallback::create(context, callback)); + toImpl(pageRef)->runJavaScriptInMainFrame(toImpl(scriptRef)->string(), ScriptValueCallback::create(context, callback)); } #ifdef __BLOCKS__ -static void callRunJavaScriptBlockAndRelease(WKStringRef resultValue, WKErrorRef error, void* context) +static void callRunJavaScriptBlockAndRelease(WKSerializedScriptValueRef resultValue, WKErrorRef error, void* context) { WKPageRunJavaScriptBlock block = (WKPageRunJavaScriptBlock)context; block(resultValue, error); @@ -452,3 +483,69 @@ WK_EXPORT WKURLRef WKPageCopyPendingAPIRequestURL(WKPageRef pageRef) return 0; return toCopiedURLAPI(toImpl(pageRef)->pendingAPIRequestURL()); } + +void WKPageSetDebugPaintFlags(WKPageDebugPaintFlags flags) +{ + WebPageProxy::setDebugPaintFlags(flags); +} + +WKPageDebugPaintFlags WKPageGetDebugPaintFlags() +{ + return WebPageProxy::debugPaintFlags(); +} + +void WKPageValidateCommand(WKPageRef pageRef, WKStringRef command, void* context, WKPageValidateCommandCallback callback) +{ + toImpl(pageRef)->validateCommand(toImpl(command)->string(), ValidateCommandCallback::create(context, callback)); +} + +void WKPageExecuteCommand(WKPageRef pageRef, WKStringRef command) +{ + toImpl(pageRef)->executeEditCommand(toImpl(command)->string()); +} + +#if PLATFORM(MAC) || PLATFORM(WIN) +struct ComputedPagesContext { + ComputedPagesContext(WKPageComputePagesForPrintingFunction callback, void* context) + : callback(callback) + , context(context) + { + } + WKPageComputePagesForPrintingFunction callback; + void* context; +}; + +static void computedPagesCallback(const Vector<WebCore::IntRect>& rects, double scaleFactor, WKErrorRef error, void* untypedContext) +{ + OwnPtr<ComputedPagesContext> context = adoptPtr(static_cast<ComputedPagesContext*>(untypedContext)); + Vector<WKRect> wkRects(rects.size()); + for (size_t i = 0; i < rects.size(); ++i) + wkRects[i] = toAPI(rects[i]); + context->callback(wkRects.data(), wkRects.size(), scaleFactor, error, context->context); +} + +static PrintInfo printInfoFromWKPrintInfo(const WKPrintInfo& printInfo) +{ + PrintInfo result; + result.pageSetupScaleFactor = printInfo.pageSetupScaleFactor; + result.availablePaperWidth = printInfo.availablePaperWidth; + result.availablePaperHeight = printInfo.availablePaperHeight; + return result; +} + +void WKPageComputePagesForPrinting(WKPageRef page, WKFrameRef frame, WKPrintInfo printInfo, WKPageComputePagesForPrintingFunction callback, void* context) +{ + toImpl(page)->computePagesForPrinting(toImpl(frame), printInfoFromWKPrintInfo(printInfo), ComputedPagesCallback::create(new ComputedPagesContext(callback, context), computedPagesCallback)); +} + +void WKPageBeginPrinting(WKPageRef page, WKFrameRef frame, WKPrintInfo printInfo) +{ + toImpl(page)->beginPrinting(toImpl(frame), printInfoFromWKPrintInfo(printInfo)); +} + +void WKPageDrawPagesToPDF(WKPageRef page, WKFrameRef frame, uint32_t first, uint32_t count, WKPageDrawToPDFFunction callback, void* context) +{ + toImpl(page)->drawPagesToPDF(toImpl(frame), first, count, DataCallback::create(context, callback)); +} +#endif + diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.h b/Source/WebKit2/UIProcess/API/C/WKPage.h index e6ebc5c..655e999 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.h +++ b/Source/WebKit2/UIProcess/API/C/WKPage.h @@ -61,6 +61,7 @@ typedef void (*WKPageDidRunInsecureContentForFrameCallback)(WKPageRef page, WKFr typedef bool (*WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback)(WKPageRef page, WKFrameRef frame, WKProtectionSpaceRef protectionSpace, const void *clientInfo); typedef void (*WKPageDidReceiveAuthenticationChallengeInFrameCallback)(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo); typedef void (*WKPageDidChangeBackForwardListCallback)(WKPageRef page, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void *clientInfo); +typedef bool (*WKPageShouldGoToBackForwardListItemCallback)(WKPageRef page, WKBackForwardListItemRef item, const void *clientInfo); struct WKPageLoaderClient { int version; @@ -93,20 +94,23 @@ struct WKPageLoaderClient { WKPageCallback processDidCrash; WKPageDidChangeBackForwardListCallback didChangeBackForwardList; + WKPageShouldGoToBackForwardListItemCallback shouldGoToBackForwardListItem; }; typedef struct WKPageLoaderClient WKPageLoaderClient; // Policy Client. typedef void (*WKPageDecidePolicyForNavigationActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); typedef void (*WKPageDecidePolicyForNewWindowActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); -typedef void (*WKPageDecidePolicyForMIMETypeCallback)(WKPageRef page, WKFrameRef frame, WKStringRef MIMEType, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); +typedef void (*WKPageDecidePolicyForResponseCallback)(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo); +typedef void (*WKPageUnableToImplementPolicyCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void* clientInfo); struct WKPagePolicyClient { int version; const void * clientInfo; WKPageDecidePolicyForNavigationActionCallback decidePolicyForNavigationAction; WKPageDecidePolicyForNewWindowActionCallback decidePolicyForNewWindowAction; - WKPageDecidePolicyForMIMETypeCallback decidePolicyForMIMEType; + WKPageDecidePolicyForResponseCallback decidePolicyForResponse; + WKPageUnableToImplementPolicyCallback unableToImplementPolicy; }; typedef struct WKPagePolicyClient WKPagePolicyClient; @@ -147,7 +151,7 @@ typedef bool (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef m typedef WKStringRef (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void *clientInfo); typedef void (*WKPageSetStatusTextCallback)(WKPageRef page, WKStringRef text, const void *clientInfo); typedef void (*WKPageMouseDidMoveOverElementCallback)(WKPageRef page, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo); -typedef void (*WKPageMissingPluginButtonClickedCallback)(WKPageRef page, WKStringRef mimeType, WKStringRef url, const void* clientInfo); +typedef void (*WKPageMissingPluginButtonClickedCallback)(WKPageRef page, WKStringRef mimeType, WKStringRef url, WKStringRef pluginsPageURL, const void* clientInfo); typedef void (*WKPageDidNotHandleKeyEventCallback)(WKPageRef page, WKNativeEventPtr event, const void *clientInfo); typedef bool (*WKPageGetToolbarsAreVisibleCallback)(WKPageRef page, const void *clientInfo); typedef void (*WKPageSetToolbarsAreVisibleCallback)(WKPageRef page, bool toolbarsVisible, const void *clientInfo); @@ -267,11 +271,15 @@ WK_EXPORT WKBackForwardListRef WKPageGetBackForwardList(WKPageRef page); WK_EXPORT WKStringRef WKPageCopyTitle(WKPageRef page); +WK_EXPORT WKURLRef WKPageCopyPendingAPIRequestURL(WKPageRef page); + WK_EXPORT WKFrameRef WKPageGetMainFrame(WKPageRef page); WK_EXPORT WKFrameRef WKPageGetFocusedFrame(WKPageRef page); // The focused frame may be inactive. WK_EXPORT WKFrameRef WKPageGetFrameSetLargestFrame(WKPageRef page); WK_EXPORT double WKPageGetEstimatedProgress(WKPageRef page); +WK_EXPORT void WKPageSetMemoryCacheClientCallsEnabled(WKPageRef page, bool memoryCacheClientCallsEnabled); + #if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR WK_EXPORT WKInspectorRef WKPageGetInspector(WKPageRef page); #endif @@ -314,6 +322,13 @@ WK_EXPORT WKSize WKPageFixedLayoutSize(WKPageRef page); WK_EXPORT bool WKPageHasHorizontalScrollbar(WKPageRef page); WK_EXPORT bool WKPageHasVerticalScrollbar(WKPageRef page); +WK_EXPORT bool WKPageIsPinnedToLeftSide(WKPageRef page); +WK_EXPORT bool WKPageIsPinnedToRightSide(WKPageRef page); + +WK_EXPORT bool WKPageCanDelete(WKPageRef page); +WK_EXPORT bool WKPageHasSelectedRange(WKPageRef page); +WK_EXPORT bool WKPageIsContentEditable(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); @@ -326,10 +341,10 @@ WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, const WKPagePolicyClien WK_EXPORT void WKPageSetPageResourceLoadClient(WKPageRef page, const WKPageResourceLoadClient* client); WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, const WKPageUIClient* client); -typedef void (*WKPageRunJavaScriptFunction)(WKStringRef, WKErrorRef, void*); +typedef void (*WKPageRunJavaScriptFunction)(WKSerializedScriptValueRef, WKErrorRef, void*); WK_EXPORT void WKPageRunJavaScriptInMainFrame(WKPageRef page, WKStringRef script, void* context, WKPageRunJavaScriptFunction function); #ifdef __BLOCKS__ -typedef void (^WKPageRunJavaScriptBlock)(WKStringRef, WKErrorRef); +typedef void (^WKPageRunJavaScriptBlock)(WKSerializedScriptValueRef, WKErrorRef); WK_EXPORT void WKPageRunJavaScriptInMainFrame_b(WKPageRef page, WKStringRef script, WKPageRunJavaScriptBlock block); #endif @@ -350,7 +365,21 @@ WK_EXPORT void WKPageGetContentsAsString_b(WKPageRef page, WKPageGetContentsAsSt typedef void (*WKPageForceRepaintFunction)(WKErrorRef, void*); WK_EXPORT void WKPageForceRepaint(WKPageRef page, void* context, WKPageForceRepaintFunction function); -WK_EXPORT WKURLRef WKPageCopyPendingAPIRequestURL(WKPageRef page); +/* + Some of the more common command name strings include the following, although any WebCore EditorCommand string is supported: + + "Cut" + "Copy" + "Paste" + "SelectAll" + "Undo" + "Redo" +*/ + +// state represents the state of the command in a menu (on is 1, off is 0, and mixed is -1), typically used to add a checkmark next to the menu item. +typedef void (*WKPageValidateCommandCallback)(WKStringRef command, bool isEnabled, int32_t state, WKErrorRef, void* context); +WK_EXPORT void WKPageValidateCommand(WKPageRef page, WKStringRef command, void* context, WKPageValidateCommandCallback callback); +WK_EXPORT void WKPageExecuteCommand(WKPageRef page, WKStringRef command); #ifdef __cplusplus } diff --git a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h index 3bf50c3..2c1f985 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h @@ -41,6 +41,29 @@ typedef void (^WKPageRenderTreeExternalRepresentationBlock)(WKStringRef, WKError WK_EXPORT void WKPageRenderTreeExternalRepresentation_b(WKPageRef page, WKPageRenderTreeExternalRepresentationBlock block); #endif +enum { + kWKDebugFlashViewUpdates = 1 << 0, + kWKDebugFlashBackingStoreUpdates = 1 << 1 +}; +typedef unsigned WKPageDebugPaintFlags; + +WK_EXPORT void WKPageSetDebugPaintFlags(WKPageDebugPaintFlags flags); +WK_EXPORT WKPageDebugPaintFlags WKPageGetDebugPaintFlags(void); + +struct WKPrintInfo { + float pageSetupScaleFactor; + float availablePaperWidth; + float availablePaperHeight; +}; +typedef struct WKPrintInfo WKPrintInfo; + +typedef void (*WKPageComputePagesForPrintingFunction)(WKRect* pageRects, uint32_t pageCount, double resultPageScaleFactor, WKErrorRef error, void* functionContext); +WK_EXPORT void WKPageComputePagesForPrinting(WKPageRef page, WKFrameRef frame, WKPrintInfo, WKPageComputePagesForPrintingFunction, void* context); + +typedef void (*WKPageDrawToPDFFunction)(WKDataRef data, WKErrorRef error, void* functionContext); +WK_EXPORT void WKPageBeginPrinting(WKPageRef page, WKFrameRef frame, WKPrintInfo); +WK_EXPORT void WKPageDrawPagesToPDF(WKPageRef page, WKFrameRef frame, uint32_t first, uint32_t count, WKPageDrawToPDFFunction callback, void* context); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.cpp b/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.cpp new file mode 100644 index 0000000..8cfe143 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKPluginSiteDataManager.h" + +#include "WKAPICast.h" +#include "WebPluginSiteDataManager.h" +#include <WebCore/npapi.h> + +using namespace WebKit; +using namespace std; + +WKTypeID WKPluginSiteDataManagerGetTypeID() +{ + return toAPI(WebPluginSiteDataManager::APIType); +} + +void WKPluginSiteDataManagerGetSitesWithData(WKPluginSiteDataManagerRef managerRef, void* context, WKPluginSiteDataManagerGetSitesWithDataFunction callback) +{ + toImpl(managerRef)->getSitesWithData(ArrayCallback::create(context, callback)); +} + +static uint64_t toNPClearSiteDataFlags(WKClearSiteDataFlags flags) +{ + if (flags == kWKClearSiteDataFlagsClearAll) + return NP_CLEAR_ALL; + + uint64_t result = 0; + if (flags & kWKClearSiteDataFlagsClearCache) + result |= NP_CLEAR_CACHE; + return result; +} + +void WKPluginSiteDataManagerClearSiteData(WKPluginSiteDataManagerRef managerRef, WKArrayRef sitesRef, WKClearSiteDataFlags flags, uint64_t maxAgeInSeconds, void* context, WKPluginSiteDataManagerClearSiteDataFunction function) +{ + toImpl(managerRef)->clearSiteData(toImpl(sitesRef), toNPClearSiteDataFlags(flags), maxAgeInSeconds, VoidCallback::create(context, function)); +} + +void WKPluginSiteDataManagerClearAllSiteData(WKPluginSiteDataManagerRef managerRef, void* context, WKPluginSiteDataManagerClearSiteDataFunction function) +{ + toImpl(managerRef)->clearSiteData(0, NP_CLEAR_ALL, numeric_limits<uint64_t>::max(), VoidCallback::create(context, function)); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.h b/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.h new file mode 100644 index 0000000..66e76fb --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKPluginSiteDataManager_h +#define WKPluginSiteDataManager_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKPluginSiteDataManagerGetTypeID(); + +typedef void (*WKPluginSiteDataManagerGetSitesWithDataFunction)(WKArrayRef, WKErrorRef, void*); +WK_EXPORT void WKPluginSiteDataManagerGetSitesWithData(WKPluginSiteDataManagerRef manager, void* context, WKPluginSiteDataManagerGetSitesWithDataFunction function); + +enum { + kWKClearSiteDataFlagsClearAll = 0, + kWKClearSiteDataFlagsClearCache = 1 << 0, +}; +typedef uint64_t WKClearSiteDataFlags; + +typedef void (*WKPluginSiteDataManagerClearSiteDataFunction)(WKErrorRef, void*); + +WK_EXPORT void WKPluginSiteDataManagerClearSiteData(WKPluginSiteDataManagerRef manager, WKArrayRef sites, WKClearSiteDataFlags flags, uint64_t maxAgeInSeconds, void* context, WKPluginSiteDataManagerClearSiteDataFunction function); +WK_EXPORT void WKPluginSiteDataManagerClearAllSiteData(WKPluginSiteDataManagerRef manager, void* context, WKPluginSiteDataManagerClearSiteDataFunction function); + +#ifdef __cplusplus +} +#endif + +#endif // WKPluginSiteDataManager_h diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp index 97e9403..7ba9ba0 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp @@ -301,6 +301,16 @@ WKFontSmoothingLevel WKPreferencesGetFontSmoothingLevel(WKPreferencesRef prefere return toAPI(static_cast<FontSmoothingLevel>(toImpl(preferencesRef)->fontSmoothingLevel())); } +void WKPreferencesSetAcceleratedDrawingEnabled(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setAcceleratedDrawingEnabled(flag); +} + +bool WKPreferencesGetAcceleratedDrawingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->acceleratedDrawingEnabled(); +} + void WKPreferencesSetAcceleratedCompositingEnabled(WKPreferencesRef preferencesRef, bool flag) { toImpl(preferencesRef)->setAcceleratedCompositingEnabled(flag); diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h index ff9beec..426119b 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h @@ -47,6 +47,10 @@ typedef enum WKFontSmoothingLevel WKFontSmoothingLevel; WK_EXPORT void WKPreferencesSetFontSmoothingLevel(WKPreferencesRef, WKFontSmoothingLevel); WK_EXPORT WKFontSmoothingLevel WKPreferencesGetFontSmoothingLevel(WKPreferencesRef); +// Defaults to false. +WK_EXPORT void WKPreferencesSetAcceleratedDrawingEnabled(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetAcceleratedDrawingEnabled(WKPreferencesRef); + // Defaults to true. WK_EXPORT void WKPreferencesSetAcceleratedCompositingEnabled(WKPreferencesRef, bool); WK_EXPORT bool WKPreferencesGetAcceleratedCompositingEnabled(WKPreferencesRef); diff --git a/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp b/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp new file mode 100644 index 0000000..483beeb --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKResourceCacheManager.h" + +#include "WebResourceCacheManagerProxy.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKResourceCacheManagerGetTypeID() +{ + return toAPI(WebResourceCacheManagerProxy::APIType); +} + +void WKResourceCacheManagerGetCacheOrigins(WKResourceCacheManagerRef cacheManagerRef, void* context, WKResourceCacheManagerGetCacheOriginsFunction callback) +{ + toImpl(cacheManagerRef)->getCacheOrigins(ArrayCallback::create(context, callback)); +} + +void WKResourceCacheManagerClearCacheForOrigin(WKResourceCacheManagerRef cacheManagerRef, WKSecurityOriginRef originRef) +{ + toImpl(cacheManagerRef)->clearCacheForOrigin(toImpl(originRef)); +} + +void WKResourceCacheManagerClearCacheForAllOrigins(WKResourceCacheManagerRef cacheManagerRef) +{ + toImpl(cacheManagerRef)->clearCacheForAllOrigins(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h b/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h new file mode 100644 index 0000000..479169d --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKResourceCacheManager_h +#define WKResourceCacheManager_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKResourceCacheManagerGetTypeID(); + +typedef void (*WKResourceCacheManagerGetCacheOriginsFunction)(WKArrayRef, WKErrorRef, void*); +WK_EXPORT void WKResourceCacheManagerGetCacheOrigins(WKResourceCacheManagerRef contextRef, void* context, WKResourceCacheManagerGetCacheOriginsFunction function); + +WK_EXPORT void WKResourceCacheManagerClearCacheForOrigin(WKResourceCacheManagerRef cacheManger, WKSecurityOriginRef origin); +WK_EXPORT void WKResourceCacheManagerClearCacheForAllOrigins(WKResourceCacheManagerRef cacheManager); + +#ifdef __cplusplus +} +#endif + +#endif // WKResourceCacheManager_h diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp b/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp index aa88151..e3d6c69 100644 --- a/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp +++ b/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp @@ -37,9 +37,9 @@ using namespace WebKit; using namespace WebCore; -WKViewRef WKViewCreate(GdkRectangle rect, WKContextRef contextRef, WKPageGroupRef pageGroupRef) +WKViewRef WKViewCreate(WKContextRef contextRef, WKPageGroupRef pageGroupRef) { - RefPtr<WebView> view = WebView::create(rect, toImpl(contextRef), toImpl(pageGroupRef)); + RefPtr<WebView> view = WebView::create(toImpl(contextRef), toImpl(pageGroupRef)); return toAPI(view.release().leakRef()); } diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKView.h b/Source/WebKit2/UIProcess/API/C/gtk/WKView.h index 5415fd3..82e55ab 100644 --- a/Source/WebKit2/UIProcess/API/C/gtk/WKView.h +++ b/Source/WebKit2/UIProcess/API/C/gtk/WKView.h @@ -35,13 +35,14 @@ extern "C" { #endif -WK_EXPORT WKViewRef WKViewCreate(GdkRectangle rect, WKContextRef context, WKPageGroupRef pageGroup); +WK_EXPORT WKViewRef WKViewCreate(WKContextRef context, WKPageGroupRef pageGroup); WK_EXPORT GtkWidget* WKViewGetWindow(WKViewRef view); WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view); WK_EXPORT WKURLRef WKURLCreateWithURL(const char*); + #ifdef __cplusplus } #endif |