diff options
author | Steve Block <steveblock@google.com> | 2011-05-25 19:08:45 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-06-08 13:51:31 +0100 |
commit | 2bde8e466a4451c7319e3a072d118917957d6554 (patch) | |
tree | 28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Source/WebKit2/UIProcess/API/C | |
parent | 6939c99b71d9372d14a0c74a772108052e8c48c8 (diff) | |
download | external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2 |
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Source/WebKit2/UIProcess/API/C')
22 files changed, 492 insertions, 13 deletions
diff --git a/Source/WebKit2/UIProcess/API/C/WKAPICast.h b/Source/WebKit2/UIProcess/API/C/WKAPICast.h index a2983e9..a440c6f 100644 --- a/Source/WebKit2/UIProcess/API/C/WKAPICast.h +++ b/Source/WebKit2/UIProcess/API/C/WKAPICast.h @@ -29,12 +29,16 @@ #include "CacheModel.h" #include "FontSmoothingLevel.h" +#include "HTTPCookieAcceptPolicy.h" +#include "ResourceCachesToClear.h" #include "WKContext.h" +#include "WKCookieManager.h" #include "WKCredentialTypes.h" #include "WKPage.h" #include "WKPreferencesPrivate.h" #include "WKProtectionSpaceTypes.h" #include "WKSharedAPICast.h" +#include <WebCore/CookieJar.h> #include <WebCore/Credential.h> #include <WebCore/FrameLoaderTypes.h> #include <WebCore/ProtectionSpace.h> @@ -58,8 +62,10 @@ class WebFramePolicyListenerProxy; class WebFrameProxy; class WebGeolocationManagerProxy; class WebGeolocationPosition; +class WebIconDatabase; class WebInspectorProxy; class WebKeyValueStorageManagerProxy; +class WebMediaCacheManagerProxy; class WebNavigationData; class WebOpenPanelParameters; class WebOpenPanelResultListenerProxy; @@ -86,7 +92,9 @@ 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(WKIconDatabaseRef, WebIconDatabase) WK_ADD_API_MAPPING(WKKeyValueStorageManagerRef, WebKeyValueStorageManagerProxy) +WK_ADD_API_MAPPING(WKMediaCacheManagerRef, WebMediaCacheManagerProxy) WK_ADD_API_MAPPING(WKNavigationDataRef, WebNavigationData) WK_ADD_API_MAPPING(WKOpenPanelParametersRef, WebOpenPanelParameters) WK_ADD_API_MAPPING(WKOpenPanelResultListenerRef, WebOpenPanelResultListenerProxy) @@ -235,6 +243,49 @@ inline WebCore::CredentialPersistence toCredentialPersistence(WKCredentialPersis } } +inline ResourceCachesToClear toResourceCachesToClear(WKResourceCachesToClear wkResourceCachesToClear) +{ + switch (wkResourceCachesToClear) { + case kWKAllResourceCaches: + return AllResourceCaches; + case kWKInMemoryResourceCachesOnly: + return InMemoryResourceCachesOnly; + } + + ASSERT_NOT_REACHED(); + return AllResourceCaches; +} + +inline HTTPCookieAcceptPolicy toHTTPCookieAcceptPolicy(WKHTTPCookieAcceptPolicy policy) +{ + switch (policy) { + case kWKHTTPCookieAcceptPolicyAlways: + return HTTPCookieAcceptPolicyAlways; + case kWKHTTPCookieAcceptPolicyNever: + return HTTPCookieAcceptPolicyNever; + case kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain: + return HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain; + } + + ASSERT_NOT_REACHED(); + return HTTPCookieAcceptPolicyAlways; +} + +inline WKHTTPCookieAcceptPolicy toAPI(HTTPCookieAcceptPolicy policy) +{ + switch (policy) { + case HTTPCookieAcceptPolicyAlways: + return kWKHTTPCookieAcceptPolicyAlways; + case HTTPCookieAcceptPolicyNever: + return kWKHTTPCookieAcceptPolicyNever; + case HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain: + return kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain; + } + + ASSERT_NOT_REACHED(); + return kWKHTTPCookieAcceptPolicyAlways; +} + } // namespace WebKit #if defined(WIN32) || defined(_WIN32) diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.cpp b/Source/WebKit2/UIProcess/API/C/WKContext.cpp index 6e4e5e0..bf196b7 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKContext.cpp @@ -148,9 +148,9 @@ void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef contextRef, toImpl(contextRef)->setDomainRelaxationForbiddenForURLScheme(toImpl(urlScheme)->string()); } -void WKContextClearResourceCaches(WKContextRef contextRef) +void WKContextClearResourceCaches(WKContextRef contextRef, WKResourceCachesToClear cachesToClear) { - toImpl(contextRef)->clearResourceCaches(); + toImpl(contextRef)->clearResourceCaches(toResourceCachesToClear(cachesToClear)); } void WKContextClearApplicationCache(WKContextRef contextRef) @@ -178,11 +178,21 @@ WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef contextRef) return toAPI(toImpl(contextRef)->geolocationManagerProxy()); } +WKIconDatabaseRef WKContextGetIconDatabase(WKContextRef contextRef) +{ + return toAPI(toImpl(contextRef)->iconDatabase()); +} + WKKeyValueStorageManagerRef WKContextGetKeyValueStorageManager(WKContextRef contextRef) { return toAPI(toImpl(contextRef)->keyValueStorageManagerProxy()); } +WKMediaCacheManagerRef WKContextGetMediaCacheManager(WKContextRef contextRef) +{ + return toAPI(toImpl(contextRef)->mediaCacheManagerProxy()); +} + WKPluginSiteDataManagerRef WKContextGetPluginSiteDataManager(WKContextRef contextRef) { return toAPI(toImpl(contextRef)->pluginSiteDataManager()); @@ -203,7 +213,17 @@ void WKContextStopMemorySampler(WKContextRef contextRef) toImpl(contextRef)->stopMemorySampler(); } +void WKContextSetIconDatabasePath(WKContextRef contextRef, WKStringRef iconDatabasePath) +{ + toImpl(contextRef)->setIconDatabasePath(toImpl(iconDatabasePath)->string()); +} + void WKContextSetDatabaseDirectory(WKContextRef contextRef, WKStringRef databaseDirectory) { toImpl(contextRef)->setDatabaseDirectory(toImpl(databaseDirectory)->string()); } + +void WKContextSetLocalStorageDirectory(WKContextRef contextRef, WKStringRef localStorageDirectory) +{ + toImpl(contextRef)->setLocalStorageDirectory(toImpl(localStorageDirectory)->string()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.h b/Source/WebKit2/UIProcess/API/C/WKContext.h index f8e7cee..606574f 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.h +++ b/Source/WebKit2/UIProcess/API/C/WKContext.h @@ -39,6 +39,12 @@ enum { }; typedef uint32_t WKCacheModel; +enum { + kWKAllResourceCaches = 0, + kWKInMemoryResourceCachesOnly = 1 +}; +typedef uint32_t WKResourceCachesToClear; + // 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); @@ -71,6 +77,7 @@ typedef struct WKContextHistoryClient WKContextHistoryClient; // Download Client typedef void (*WKContextDownloadDidStartCallback)(WKContextRef context, WKDownloadRef download, const void *clientInfo); +typedef void (*WKContextDownloadDidReceiveAuthenticationChallengeCallback)(WKContextRef context, WKDownloadRef download, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo); typedef void (*WKContextDownloadDidReceiveResponseCallback)(WKContextRef context, WKDownloadRef download, WKURLResponseRef response, const void *clientInfo); typedef void (*WKContextDownloadDidReceiveDataCallback)(WKContextRef context, WKDownloadRef download, uint64_t length, const void *clientInfo); typedef bool (*WKContextDownloadShouldDecodeSourceDataOfMIMETypeCallback)(WKContextRef context, WKDownloadRef download, WKStringRef mimeType, const void *clientInfo); @@ -85,6 +92,7 @@ struct WKContextDownloadClient { int version; const void * clientInfo; WKContextDownloadDidStartCallback didStart; + WKContextDownloadDidReceiveAuthenticationChallengeCallback didReceiveAuthenticationChallenge; WKContextDownloadDidReceiveResponseCallback didReceiveResponse; WKContextDownloadDidReceiveDataCallback didReceiveData; WKContextDownloadShouldDecodeSourceDataOfMIMETypeCallback shouldDecodeSourceDataOfMIMEType; @@ -117,7 +125,7 @@ WK_EXPORT void WKContextAddVisitedLink(WKContextRef context, WKStringRef visited WK_EXPORT void WKContextSetCacheModel(WKContextRef context, WKCacheModel cacheModel); WK_EXPORT WKCacheModel WKContextGetCacheModel(WKContextRef context); -WK_EXPORT void WKContextClearResourceCaches(WKContextRef context); +WK_EXPORT void WKContextClearResourceCaches(WKContextRef context, WKResourceCachesToClear cachesToClear); WK_EXPORT void WKContextClearApplicationCache(WKContextRef context); WK_EXPORT void WKContextStartMemorySampler(WKContextRef context, WKDoubleRef interval); @@ -127,7 +135,9 @@ WK_EXPORT WKApplicationCacheManagerRef WKContextGetApplicationCacheManager(WKCon WK_EXPORT WKCookieManagerRef WKContextGetCookieManager(WKContextRef context); WK_EXPORT WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef context); WK_EXPORT WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef context); +WK_EXPORT WKIconDatabaseRef WKContextGetIconDatabase(WKContextRef context); WK_EXPORT WKKeyValueStorageManagerRef WKContextGetKeyValueStorageManager(WKContextRef context); +WK_EXPORT WKMediaCacheManagerRef WKContextGetMediaCacheManager(WKContextRef context); WK_EXPORT WKPluginSiteDataManagerRef WKContextGetPluginSiteDataManager(WKContextRef context); WK_EXPORT WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRef context); diff --git a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h index bcd24a5..5fd7dd3 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h @@ -54,9 +54,12 @@ WK_EXPORT void WKContextRegisterURLSchemeAsSecure(WKContextRef context, WKString WK_EXPORT void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef context, WKStringRef urlScheme); -// FIXME: This function is only effective if called before the Web process is launched. But -// we should really change this setting to be on WebPreferences and changeable at runtime. +WK_EXPORT void WKContextSetIconDatabasePath(WKContextRef context, WKStringRef iconDatabasePath); + +// 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 WKContextSetDatabaseDirectory(WKContextRef context, WKStringRef databaseDirectory); +WK_EXPORT void WKContextSetLocalStorageDirectory(WKContextRef context, WKStringRef localStorageDirectory); #ifdef __cplusplus } diff --git a/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp b/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp index 83578f7..50e2732 100644 --- a/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp @@ -58,6 +58,16 @@ void WKCookieManagerDeleteAllCookies(WKCookieManagerRef cookieManagerRef) toImpl(cookieManagerRef)->deleteAllCookies(); } +void WKCookieManagerSetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, WKHTTPCookieAcceptPolicy policy) +{ + toImpl(cookieManager)->setHTTPCookieAcceptPolicy(toHTTPCookieAcceptPolicy(policy)); +} + +void WKCookieManagerGetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, void* context, WKCookieManagerGetHTTPCookieAcceptPolicyFunction callback) +{ + toImpl(cookieManager)->getHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicyCallback::create(context, callback)); +} + void WKCookieManagerStartObservingCookieChanges(WKCookieManagerRef cookieManager) { toImpl(cookieManager)->startObservingCookieChanges(); diff --git a/Source/WebKit2/UIProcess/API/C/WKCookieManager.h b/Source/WebKit2/UIProcess/API/C/WKCookieManager.h index 75d8ef5..4da60f4 100644 --- a/Source/WebKit2/UIProcess/API/C/WKCookieManager.h +++ b/Source/WebKit2/UIProcess/API/C/WKCookieManager.h @@ -32,6 +32,13 @@ extern "C" { #endif +enum { + kWKHTTPCookieAcceptPolicyAlways = 0, + kWKHTTPCookieAcceptPolicyNever = 1, + kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain = 2 +}; +typedef uint32_t WKHTTPCookieAcceptPolicy; + // Cookie Manager Client typedef void (*WKCookieManagerCookiesDidChangeCallback)(WKCookieManagerRef cookieManager, const void *clientInfo); @@ -52,6 +59,10 @@ WK_EXPORT void WKCookieManagerGetHostnamesWithCookies(WKCookieManagerRef cookieM WK_EXPORT void WKCookieManagerDeleteCookiesForHostname(WKCookieManagerRef cookieManager, WKStringRef hostname); WK_EXPORT void WKCookieManagerDeleteAllCookies(WKCookieManagerRef cookieManager); +WK_EXPORT void WKCookieManagerSetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, WKHTTPCookieAcceptPolicy policy); +typedef void (*WKCookieManagerGetHTTPCookieAcceptPolicyFunction)(WKHTTPCookieAcceptPolicy, WKErrorRef, void*); +WK_EXPORT void WKCookieManagerGetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, void* context, WKCookieManagerGetHTTPCookieAcceptPolicyFunction callback); + WK_EXPORT void WKCookieManagerStartObservingCookieChanges(WKCookieManagerRef cookieManager); WK_EXPORT void WKCookieManagerStopObservingCookieChanges(WKCookieManagerRef cookieManager); diff --git a/Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp new file mode 100644 index 0000000..c8e87a0 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.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 "WKIconDatabase.h" + +#include "WKAPICast.h" +#include "WebIconDatabase.h" + +using namespace WebKit; + +WKTypeID WKIconDatabaseGetTypeID() +{ + return toAPI(WebIconDatabase::APIType); +} + +void WKIconDatabaseRetainIconForURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef pageURLRef) +{ + toImpl(iconDatabaseRef)->retainIconForPageURL(toWTFString(pageURLRef)); +} + +void WKIconDatabaseReleaseIconForURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef pageURLRef) +{ + toImpl(iconDatabaseRef)->releaseIconForPageURL(toWTFString(pageURLRef)); +} + +void WKIconDatabaseEnableDatabaseCleanup(WKIconDatabaseRef iconDatabaseRef) +{ + toImpl(iconDatabaseRef)->enableDatabaseCleanup(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h new file mode 100644 index 0000000..1ea1860 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h @@ -0,0 +1,45 @@ +/* + * 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 WKIconDatabase_h +#define WKIconDatabase_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKIconDatabaseGetTypeID(); + +WK_EXPORT void WKIconDatabaseRetainIconForURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL); +WK_EXPORT void WKIconDatabaseReleaseIconForURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL); +WK_EXPORT void WKIconDatabaseEnableDatabaseCleanup(WKIconDatabaseRef iconDatabase); + +#ifdef __cplusplus +} +#endif + +#endif /* WKIconDatabase_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.cpp b/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.cpp new file mode 100644 index 0000000..6e2ecce --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.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 "WKMediaCacheManager.h" + +#include "WKAPICast.h" +#include "WebMediaCacheManagerProxy.h" + +using namespace WebKit; + +WKTypeID WKMediaCacheManagerGetTypeID() +{ + return toAPI(WebMediaCacheManagerProxy::APIType); +} + +void WKMediaCacheManagerGetHostnamesWithMediaCache(WKMediaCacheManagerRef mediaCacheManagerRef, void* context, WKMediaCacheManagerGetHostnamesWithMediaCacheFunction callback) +{ + toImpl(mediaCacheManagerRef)->getHostnamesWithMediaCache(ArrayCallback::create(context, callback)); +} + +void WKMediaCacheManagerClearCacheForHostname(WKMediaCacheManagerRef mediaCacheManagerRef, WKStringRef hostname) +{ + toImpl(mediaCacheManagerRef)->clearCacheForHostname(toWTFString(hostname)); +} + +void WKMediaCacheManagerClearCacheForAllHostnames(WKMediaCacheManagerRef mediaCacheManagerRef) +{ + toImpl(mediaCacheManagerRef)->clearCacheForAllHostnames(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.h b/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.h new file mode 100644 index 0000000..eee1b92 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKMediaCacheManager.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 WKMediaCacheManager_h +#define WKMediaCacheManager_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKMediaCacheManagerGetTypeID(); + +typedef void (*WKMediaCacheManagerGetHostnamesWithMediaCacheFunction)(WKArrayRef, WKErrorRef, void*); +WK_EXPORT void WKMediaCacheManagerGetHostnamesWithMediaCache(WKMediaCacheManagerRef mediaCacheManager, void* context, WKMediaCacheManagerGetHostnamesWithMediaCacheFunction function); + +WK_EXPORT void WKMediaCacheManagerClearCacheForHostname(WKMediaCacheManagerRef mediaCacheManager, WKStringRef hostname); +WK_EXPORT void WKMediaCacheManagerClearCacheForAllHostnames(WKMediaCacheManagerRef mediaCacheManager); + +#ifdef __cplusplus +} +#endif + +#endif // WKMediaCacheManager_h diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.cpp b/Source/WebKit2/UIProcess/API/C/WKPage.cpp index c4e8eae..7061e39 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPage.cpp @@ -56,7 +56,7 @@ WKPageGroupRef WKPageGetPageGroup(WKPageRef pageRef) void WKPageLoadURL(WKPageRef pageRef, WKURLRef URLRef) { - toImpl(pageRef)->loadURL(toImpl(URLRef)->string()); + toImpl(pageRef)->loadURL(toWTFString(URLRef)); } void WKPageLoadURLRequest(WKPageRef pageRef, WKURLRequestRef urlRequestRef) diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.h b/Source/WebKit2/UIProcess/API/C/WKPage.h index 655e999..03f49f7 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPage.h +++ b/Source/WebKit2/UIProcess/API/C/WKPage.h @@ -173,6 +173,7 @@ typedef void (*WKPageDrawHeaderCallback)(WKPageRef page, WKFrameRef frame, WKRec typedef void (*WKPageDrawFooterCallback)(WKPageRef page, WKFrameRef frame, WKRect rect, const void* clientInfo); typedef void (*WKPagePrintFrameCallback)(WKPageRef page, WKFrameRef frame, const void* clientInfo); typedef void (*WKPageDidCompleteRubberBandForMainFrameCallback)(WKPageRef page, WKSize initialOverhang, const void* clientInfo); +typedef void (*WKPageSaveDataToFileInDownloadsFolderCallback)(WKPageRef page, WKStringRef suggestedFilename, WKStringRef mimeType, WKURLRef originatingURL, WKDataRef data, const void* clientInfo); struct WKPageUIClient { int version; @@ -210,6 +211,7 @@ struct WKPageUIClient { WKPagePrintFrameCallback printFrame; WKPageCallback runModal; WKPageDidCompleteRubberBandForMainFrameCallback didCompleteRubberBandForMainFrame; + WKPageSaveDataToFileInDownloadsFolderCallback saveDataToFileInDownloadsFolder; }; typedef struct WKPageUIClient WKPageUIClient; diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp index 7ba9ba0..0122531 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp @@ -311,6 +311,16 @@ bool WKPreferencesGetAcceleratedDrawingEnabled(WKPreferencesRef preferencesRef) return toImpl(preferencesRef)->acceleratedDrawingEnabled(); } +void WKPreferencesSetCanvasUsesAcceleratedDrawing(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setCanvasUsesAcceleratedDrawing(flag); +} + +bool WKPreferencesGetCanvasUsesAcceleratedDrawing(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->canvasUsesAcceleratedDrawing(); +} + void WKPreferencesSetAcceleratedCompositingEnabled(WKPreferencesRef preferencesRef, bool flag) { toImpl(preferencesRef)->setAcceleratedCompositingEnabled(flag); @@ -480,3 +490,43 @@ bool WKPreferencesGetJavaScriptCanAccessClipboard(WKPreferencesRef preferencesRe { return toImpl(preferencesRef)->javaScriptCanAccessClipboard(); } + +void WKPreferencesSetFullScreenEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setFullScreenEnabled(enabled); +} + +bool WKPreferencesGetFullScreenEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->fullScreenEnabled(); +} + +void WKPreferencesSetWebSecurityEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setWebSecurityEnabled(enabled); +} + +bool WKPreferencesGetWebSecurityEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->webSecurityEnabled(); +} + +void WKPreferencesSetUniversalAccessFromFileURLsAllowed(WKPreferencesRef preferencesRef, bool allowed) +{ + toImpl(preferencesRef)->setAllowUniversalAccessFromFileURLs(allowed); +} + +bool WKPreferencesGetUniversalAccessFromFileURLsAllowed(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->allowUniversalAccessFromFileURLs(); +} + +void WKPreferencesSetFileAccessFromFileURLsAllowed(WKPreferencesRef preferencesRef, bool allowed) +{ + toImpl(preferencesRef)->setAllowFileAccessFromFileURLs(allowed); +} + +bool WKPreferencesGetFileAccessFromFileURLsAllowed(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->allowFileAccessFromFileURLs(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.h b/Source/WebKit2/UIProcess/API/C/WKPreferences.h index 5c6c478..f2486bf 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferences.h +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.h @@ -150,6 +150,11 @@ WK_EXPORT bool WKPreferencesGetShouldPrintBackgrounds(WKPreferencesRef preferenc WK_EXPORT void WKPreferencesSetJavaScriptCanAccessClipboard(WKPreferencesRef preferencesRef, bool enabled); WK_EXPORT bool WKPreferencesGetJavaScriptCanAccessClipboard(WKPreferencesRef preferencesRef); +// Defaults to false +WK_EXPORT void WKPreferencesSetFullScreenEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetFullScreenEnabled(WKPreferencesRef preferencesRef); + + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h index 426119b..ddf1b9a 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h @@ -52,6 +52,10 @@ WK_EXPORT void WKPreferencesSetAcceleratedDrawingEnabled(WKPreferencesRef, bool) WK_EXPORT bool WKPreferencesGetAcceleratedDrawingEnabled(WKPreferencesRef); // Defaults to true. +WK_EXPORT void WKPreferencesSetCanvasUsesAcceleratedDrawing(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetCanvasUsesAcceleratedDrawing(WKPreferencesRef); + +// Defaults to true. WK_EXPORT void WKPreferencesSetAcceleratedCompositingEnabled(WKPreferencesRef, bool); WK_EXPORT bool WKPreferencesGetAcceleratedCompositingEnabled(WKPreferencesRef); @@ -99,6 +103,18 @@ WK_EXPORT bool WKPreferencesGetPaginateDuringLayoutEnabled(WKPreferencesRef pref WK_EXPORT void WKPreferencesSetDOMPasteAllowed(WKPreferencesRef preferences, bool enabled); WK_EXPORT bool WKPreferencesGetDOMPasteAllowed(WKPreferencesRef preferences); +// Defaults to true. +WK_EXPORT void WKPreferencesSetWebSecurityEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetWebSecurityEnabled(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetUniversalAccessFromFileURLsAllowed(WKPreferencesRef preferences, bool allowed); +WK_EXPORT bool WKPreferencesGetUniversalAccessFromFileURLsAllowed(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetFileAccessFromFileURLsAllowed(WKPreferencesRef preferences, bool allowed); +WK_EXPORT bool WKPreferencesGetFileAccessFromFileURLsAllowed(WKPreferencesRef preferences); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.cpp b/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.cpp new file mode 100644 index 0000000..5e50dd8 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTAwBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WKIconDatabaseCG.h" + +#include "WebIconDatabase.h" +#include "WKAPICast.h" +#include "WKSharedAPICast.h" +#include <WebCore/Image.h> + +using namespace WebKit; +using namespace WebCore; + +CGImageRef WKIconDatabaseGetCGImageForURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef urlRef) +{ + Image* image = toImpl(iconDatabaseRef)->imageForPageURL(toWTFString(urlRef)); + return image ? image->getCGImageRef() : 0; +} diff --git a/Source/WebKit2/UIProcess/API/C/win/WKBaseWin.h b/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.h index e2ee9a7..48cf5bf 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKBaseWin.h +++ b/Source/WebKit2/UIProcess/API/C/cg/WKIconDatabaseCG.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * 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,13 +23,20 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKBaseWin_h -#define WKBaseWin_h +#ifndef WKIconDatabaseCG_h +#define WKIconDatabaseCG_h -#ifndef WKBase_h -#error "Please #include \"WKBase.h\" instead of this file directly." +#include <CoreGraphics/CGImage.h> +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { #endif -typedef const struct OpaqueWKView* WKViewRef; +WK_EXPORT CGImageRef WKIconDatabaseGetCGImageForURL(WKIconDatabaseRef iconDatabase, WKURLRef urlString); + +#ifdef __cplusplus +} +#endif -#endif /* WKBaseWin_h */ +#endif /* WKIconDatabaseCG_h */ diff --git a/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h b/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h index 6acb1a6..09cf06f 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h +++ b/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h @@ -33,8 +33,10 @@ namespace WebKit { class WebView; +class WebEditCommandProxy; WK_ADD_API_MAPPING(WKViewRef, WebView) +WK_ADD_API_MAPPING(WKEditCommandRef, WebEditCommandProxy) } diff --git a/Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h b/Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h index c8a9c34..0d49ac9 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h +++ b/Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h @@ -28,6 +28,7 @@ #include <WebKit2/WKBase.h> #include <WebKit2/WKContext.h> +#include <WebKit2/WKCookieManager.h> #ifndef __cplusplus #include <stdbool.h> @@ -40,6 +41,9 @@ extern "C" { // Defaults to true. WK_EXPORT void WKContextSetShouldPaintNativeControls(WKContextRef, bool); +// Defaults to WKHTTPCookieAcceptPolicyAlways. +WK_EXPORT void WKContextSetInitialHTTPCookieAcceptPolicy(WKContextRef, WKHTTPCookieAcceptPolicy); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp b/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp index 110951f..4971540 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp +++ b/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp @@ -36,3 +36,8 @@ void WKContextSetShouldPaintNativeControls(WKContextRef contextRef, bool b) { toImpl(contextRef)->setShouldPaintNativeControls(b); } + +void WKContextSetInitialHTTPCookieAcceptPolicy(WKContextRef contextRef, WKHTTPCookieAcceptPolicy policy) +{ + toImpl(contextRef)->setInitialHTTPCookieAcceptPolicy(toHTTPCookieAcceptPolicy(policy)); +} diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.cpp b/Source/WebKit2/UIProcess/API/C/win/WKView.cpp index 62603fe..05ae0d7 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKView.cpp +++ b/Source/WebKit2/UIProcess/API/C/win/WKView.cpp @@ -72,6 +72,11 @@ void WKViewSetInitialFocus(WKViewRef viewRef, bool forward) toImpl(viewRef)->setInitialFocus(forward); } +void WKViewSetScrollOffsetOnNextResize(WKViewRef viewRef, WKSize scrollOffset) +{ + toImpl(viewRef)->setScrollOffsetOnNextResize(toIntSize(scrollOffset)); +} + void WKViewSetFindIndicatorCallback(WKViewRef viewRef, WKViewFindIndicatorCallback callback, void* context) { toImpl(viewRef)->setFindIndicatorCallback(callback, context); @@ -81,3 +86,20 @@ WKViewFindIndicatorCallback WKViewGetFindIndicatorCallback(WKViewRef viewRef, vo { return toImpl(viewRef)->getFindIndicatorCallback(context); } + +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)); +} diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.h b/Source/WebKit2/UIProcess/API/C/win/WKView.h index 213897e..c8ac44c 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKView.h +++ b/Source/WebKit2/UIProcess/API/C/win/WKView.h @@ -27,12 +27,31 @@ #define WKView_h #include <WebKit2/WKBase.h> +#include <WebKit2/WKGeometry.h> #include <windows.h> #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); + +struct WKViewUndoClient { + int version; + const void * clientInfo; + WKViewRegisterEditCommandCallback registerEditCommand; + WKViewClearAllEditCommandsCallback clearAllEditCommands; +}; +typedef struct WKViewUndoClient WKViewUndoClient; + WK_EXPORT WKTypeID WKViewGetTypeID(); WK_EXPORT WKViewRef WKViewCreate(RECT rect, WKContextRef context, WKPageGroupRef pageGroup, HWND parentWindow); @@ -41,10 +60,15 @@ 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); |