diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/API/C')
61 files changed, 5021 insertions, 0 deletions
diff --git a/Source/WebKit2/UIProcess/API/C/WKAPICast.h b/Source/WebKit2/UIProcess/API/C/WKAPICast.h new file mode 100644 index 0000000..15cb7ee --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKAPICast.h @@ -0,0 +1,233 @@ +/* + * 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 WKAPICast_h +#define WKAPICast_h + +#include "CacheModel.h" +#include "FontSmoothingLevel.h" +#include "WKContext.h" +#include "WKCredentialTypes.h" +#include "WKPage.h" +#include "WKPreferencesPrivate.h" +#include "WKProtectionSpaceTypes.h" +#include "WKSharedAPICast.h" +#include <WebCore/Credential.h> +#include <WebCore/FrameLoaderTypes.h> +#include <WebCore/ProtectionSpace.h> + +namespace WebKit { + +class AuthenticationChallengeProxy; +class AuthenticationDecisionListener; +class DownloadProxy; +class GeolocationPermissionRequestProxy; +class WebBackForwardList; +class WebBackForwardListItem; +class WebContext; +class WebCredential; +class WebDatabaseManagerProxy; +class WebFormSubmissionListenerProxy; +class WebFramePolicyListenerProxy; +class WebFrameProxy; +class WebGeolocationManagerProxy; +class WebGeolocationPosition; +class WebInspectorProxy; +class WebNavigationData; +class WebOpenPanelParameters; +class WebOpenPanelResultListenerProxy; +class WebPageGroup; +class WebPageProxy; +class WebPreferences; +class WebProtectionSpace; + +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(WKContextRef, WebContext) +WK_ADD_API_MAPPING(WKCredentialRef, WebCredential) +WK_ADD_API_MAPPING(WKDatabaseManagerRef, WebDatabaseManagerProxy) +WK_ADD_API_MAPPING(WKDownloadRef, DownloadProxy) +WK_ADD_API_MAPPING(WKFormSubmissionListenerRef, WebFormSubmissionListenerProxy) +WK_ADD_API_MAPPING(WKFramePolicyListenerRef, WebFramePolicyListenerProxy) +WK_ADD_API_MAPPING(WKFrameRef, WebFrameProxy) +WK_ADD_API_MAPPING(WKGeolocationManagerRef, WebGeolocationManagerProxy) +WK_ADD_API_MAPPING(WKGeolocationPermissionRequestRef, GeolocationPermissionRequestProxy) +WK_ADD_API_MAPPING(WKGeolocationPositionRef, WebGeolocationPosition) +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(WKPreferencesRef, WebPreferences) +WK_ADD_API_MAPPING(WKProtectionSpaceRef, WebProtectionSpace) + +#if ENABLE(INSPECTOR) +WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy) +#endif + +/* Enum conversions */ + +inline CacheModel toCacheModel(WKCacheModel wkCacheModel) +{ + switch (wkCacheModel) { + case kWKCacheModelDocumentViewer: + return CacheModelDocumentViewer; + case kWKCacheModelDocumentBrowser: + return CacheModelDocumentBrowser; + case kWKCacheModelPrimaryWebBrowser: + return CacheModelPrimaryWebBrowser; + } + + ASSERT_NOT_REACHED(); + return CacheModelDocumentViewer; +} + +inline WKCacheModel toAPI(CacheModel cacheModel) +{ + switch (cacheModel) { + case CacheModelDocumentViewer: + return kWKCacheModelDocumentViewer; + case CacheModelDocumentBrowser: + return kWKCacheModelDocumentBrowser; + case CacheModelPrimaryWebBrowser: + return kWKCacheModelPrimaryWebBrowser; + } + + return kWKCacheModelDocumentViewer; +} + +inline FontSmoothingLevel toFontSmoothingLevel(WKFontSmoothingLevel wkLevel) +{ + switch (wkLevel) { + case kWKFontSmoothingLevelNoSubpixelAntiAliasing: + return FontSmoothingLevelNoSubpixelAntiAliasing; + case kWKFontSmoothingLevelLight: + return FontSmoothingLevelLight; + case kWKFontSmoothingLevelMedium: + return FontSmoothingLevelMedium; + case kWKFontSmoothingLevelStrong: + return FontSmoothingLevelStrong; +#if PLATFORM(WIN) + case kWKFontSmoothingLevelWindows: + return FontSmoothingLevelWindows; +#endif + } + + ASSERT_NOT_REACHED(); + return FontSmoothingLevelMedium; +} + + +inline WKFontSmoothingLevel toAPI(FontSmoothingLevel level) +{ + switch (level) { + case FontSmoothingLevelNoSubpixelAntiAliasing: + return kWKFontSmoothingLevelNoSubpixelAntiAliasing; + case FontSmoothingLevelLight: + return kWKFontSmoothingLevelLight; + case FontSmoothingLevelMedium: + return kWKFontSmoothingLevelMedium; + case FontSmoothingLevelStrong: + return kWKFontSmoothingLevelStrong; +#if PLATFORM(WIN) + case FontSmoothingLevelWindows: + return kWKFontSmoothingLevelWindows; +#endif + } + + ASSERT_NOT_REACHED(); + return kWKFontSmoothingLevelMedium; +} + +inline WKProtectionSpaceServerType toAPI(WebCore::ProtectionSpaceServerType type) +{ + switch (type) { + case WebCore::ProtectionSpaceServerHTTP: + return kWKProtectionSpaceServerTypeHTTP; + case WebCore::ProtectionSpaceServerHTTPS: + return kWKProtectionSpaceServerTypeHTTPS; + case WebCore::ProtectionSpaceServerFTP: + return kWKProtectionSpaceServerTypeFTP; + case WebCore::ProtectionSpaceServerFTPS: + return kWKProtectionSpaceServerTypeFTPS; + case WebCore::ProtectionSpaceProxyHTTP: + return kWKProtectionSpaceProxyTypeHTTP; + case WebCore::ProtectionSpaceProxyHTTPS: + return kWKProtectionSpaceProxyTypeHTTPS; + case WebCore::ProtectionSpaceProxyFTP: + return kWKProtectionSpaceProxyTypeFTP; + case WebCore::ProtectionSpaceProxySOCKS: + return kWKProtectionSpaceProxyTypeSOCKS; + } + return kWKProtectionSpaceServerTypeHTTP; +} + +inline WKProtectionSpaceAuthenticationScheme toAPI(WebCore::ProtectionSpaceAuthenticationScheme type) +{ + switch (type) { + case WebCore::ProtectionSpaceAuthenticationSchemeDefault: + return kWKProtectionSpaceAuthenticationSchemeDefault; + case WebCore::ProtectionSpaceAuthenticationSchemeHTTPBasic: + return kWKProtectionSpaceAuthenticationSchemeHTTPBasic; + case WebCore::ProtectionSpaceAuthenticationSchemeHTTPDigest: + return kWKProtectionSpaceAuthenticationSchemeHTTPDigest; + case WebCore::ProtectionSpaceAuthenticationSchemeHTMLForm: + return kWKProtectionSpaceAuthenticationSchemeHTMLForm; + case WebCore::ProtectionSpaceAuthenticationSchemeNTLM: + return kWKProtectionSpaceAuthenticationSchemeNTLM; + case WebCore::ProtectionSpaceAuthenticationSchemeNegotiate: + return kWKProtectionSpaceAuthenticationSchemeNegotiate; + case WebCore::ProtectionSpaceAuthenticationSchemeClientCertificateRequested: + return kWKProtectionSpaceAuthenticationSchemeClientCertificateRequested; + case WebCore::ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested: + return kWKProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested; + default: + return kWKProtectionSpaceAuthenticationSchemeUnknown; + } +} + +inline WebCore::CredentialPersistence toCredentialPersistence(WKCredentialPersistence type) +{ + switch (type) { + case kWKCredentialPersistenceNone: + return WebCore::CredentialPersistenceNone; + case kWKCredentialPersistenceForSession: + return WebCore::CredentialPersistenceForSession; + case kWKCredentialPersistencePermanent: + return WebCore::CredentialPersistencePermanent; + default: + return WebCore::CredentialPersistenceNone; + } +} + +} // namespace WebKit + +#if defined(WIN32) || defined(_WIN32) +#include "WKAPICastWin.h" +#endif + +#endif // WKAPICast_h diff --git a/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp b/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp new file mode 100644 index 0000000..0997577 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp @@ -0,0 +1,58 @@ +/* + * 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 "WKAuthenticationChallenge.h" + +#include "AuthenticationChallengeProxy.h" +#include "WebCredential.h" +#include "WebProtectionSpace.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKAuthenticationChallengeGetTypeID() +{ + return toAPI(AuthenticationChallengeProxy::APIType); +} + +WKAuthenticationDecisionListenerRef WKAuthenticationChallengeGetDecisionListener(WKAuthenticationChallengeRef challenge) +{ + return toAPI(toImpl(challenge)->listener()); +} + +WKProtectionSpaceRef WKAuthenticationChallengeGetProtectionSpace(WKAuthenticationChallengeRef challenge) +{ + return toAPI(toImpl(challenge)->protectionSpace()); +} + +WKCredentialRef WKAuthenticationChallengeGetProposedCredential(WKAuthenticationChallengeRef challenge) +{ + return toAPI(toImpl(challenge)->proposedCredential()); +} + +int WKAuthenticationChallengeGetPreviousFailureCount(WKAuthenticationChallengeRef challenge) +{ + return toImpl(challenge)->previousFailureCount(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.h b/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.h new file mode 100644 index 0000000..3802f41 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.h @@ -0,0 +1,46 @@ +/* + * 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 WKAuthenticationChallenge_h +#define WKAuthenticationChallenge_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKAuthenticationChallengeGetTypeID(); + +WK_EXPORT WKAuthenticationDecisionListenerRef WKAuthenticationChallengeGetDecisionListener(WKAuthenticationChallengeRef); +WK_EXPORT WKProtectionSpaceRef WKAuthenticationChallengeGetProtectionSpace(WKAuthenticationChallengeRef); +WK_EXPORT WKCredentialRef WKAuthenticationChallengeGetProposedCredential(WKAuthenticationChallengeRef); +WK_EXPORT int WKAuthenticationChallengeGetPreviousFailureCount(WKAuthenticationChallengeRef); + +#ifdef __cplusplus +} +#endif + +#endif // WKAuthenticationChallenge_h diff --git a/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp b/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp new file mode 100644 index 0000000..959f5c2 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp @@ -0,0 +1,46 @@ +/* + * 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 "WKAuthenticationDecisionListener.h" + +#include "AuthenticationDecisionListener.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKAuthenticationDecisionListenerGetTypeID() +{ + return toAPI(AuthenticationDecisionListener::APIType); +} + +void WKAuthenticationDecisionListenerUseCredential(WKAuthenticationDecisionListenerRef authenticationListener, WKCredentialRef credential) +{ + toImpl(authenticationListener)->useCredential(toImpl(credential)); +} + +void WKAuthenticationDecisionListenerCancel(WKAuthenticationDecisionListenerRef authenticationListener) +{ + toImpl(authenticationListener)->cancel(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.h b/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.h new file mode 100644 index 0000000..f072461 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.h @@ -0,0 +1,44 @@ +/* + * 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 WKAuthenticationDecisionListener_h +#define WKAuthenticationDecisionListener_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKAuthenticationDecisionListenerGetTypeID(); + +WK_EXPORT void WKAuthenticationDecisionListenerUseCredential(WKAuthenticationDecisionListenerRef authenticationListener, WKCredentialRef credential); +WK_EXPORT void WKAuthenticationDecisionListenerCancel(WKAuthenticationDecisionListenerRef authenticationListener); + +#ifdef __cplusplus +} +#endif + +#endif /* WKFramePolicyListener_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp b/Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp new file mode 100644 index 0000000..c2343ca --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardList.cpp @@ -0,0 +1,76 @@ +/* + * 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 "WKBackForwardList.h" + +#include "WebBackForwardList.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKBackForwardListGetTypeID() +{ + return toAPI(WebBackForwardList::APIType); +} + +WKBackForwardListItemRef WKBackForwardListGetCurrentItem(WKBackForwardListRef listRef) +{ + return toAPI(toImpl(listRef)->currentItem()); +} + +WKBackForwardListItemRef WKBackForwardListGetBackItem(WKBackForwardListRef listRef) +{ + return toAPI(toImpl(listRef)->backItem()); +} + +WKBackForwardListItemRef WKBackForwardListGetForwardItem(WKBackForwardListRef listRef) +{ + return toAPI(toImpl(listRef)->forwardItem()); +} + +WKBackForwardListItemRef WKBackForwardListGetItemAtIndex(WKBackForwardListRef listRef, int index) +{ + return toAPI(toImpl(listRef)->itemAtIndex(index)); +} + +unsigned WKBackForwardListGetBackListCount(WKBackForwardListRef listRef) +{ + return toImpl(listRef)->backListCount(); +} + +unsigned WKBackForwardListGetForwardListCount(WKBackForwardListRef listRef) +{ + return toImpl(listRef)->forwardListCount(); +} + +WKArrayRef WKBackForwardListCopyBackListWithLimit(WKBackForwardListRef listRef, unsigned limit) +{ + return toAPI(toImpl(listRef)->backListAsImmutableArrayWithLimit(limit).releaseRef()); +} + +WKArrayRef WKBackForwardListCopyForwardListWithLimit(WKBackForwardListRef listRef, unsigned limit) +{ + return toAPI(toImpl(listRef)->forwardListAsImmutableArrayWithLimit(limit).releaseRef()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardList.h b/Source/WebKit2/UIProcess/API/C/WKBackForwardList.h new file mode 100644 index 0000000..214a6bc --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardList.h @@ -0,0 +1,52 @@ +/* + * 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 WKBackForwardList_h +#define WKBackForwardList_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBackForwardListGetTypeID(); + +WK_EXPORT WKBackForwardListItemRef WKBackForwardListGetCurrentItem(WKBackForwardListRef list); +WK_EXPORT WKBackForwardListItemRef WKBackForwardListGetBackItem(WKBackForwardListRef list); +WK_EXPORT WKBackForwardListItemRef WKBackForwardListGetForwardItem(WKBackForwardListRef list); +WK_EXPORT WKBackForwardListItemRef WKBackForwardListGetItemAtIndex(WKBackForwardListRef list, int index); + +WK_EXPORT unsigned WKBackForwardListGetBackListCount(WKBackForwardListRef list); +WK_EXPORT unsigned WKBackForwardListGetForwardListCount(WKBackForwardListRef list); + +WK_EXPORT WKArrayRef WKBackForwardListCopyBackListWithLimit(WKBackForwardListRef list, unsigned limit); +WK_EXPORT WKArrayRef WKBackForwardListCopyForwardListWithLimit(WKBackForwardListRef list, unsigned limit); + +#ifdef __cplusplus +} +#endif + +#endif // WKBackForwardList_h diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp new file mode 100644 index 0000000..2165737 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp @@ -0,0 +1,46 @@ +/* + * 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 + * 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 "WKBackForwardListItem.h" + +#include "WKAPICast.h" +#include "WebBackForwardListItem.h" + +using namespace WebKit; + +WKTypeID WKBackForwardListItemGetTypeID() +{ + return toAPI(WebBackForwardListItem::APIType); +} + +WKURLRef WKBackForwardListItemCopyURL(WKBackForwardListItemRef itemRef) +{ + return toCopiedURLAPI(toImpl(itemRef)->url()); +} + +WKStringRef WKBackForwardListItemCopyTitle(WKBackForwardListItemRef itemRef) +{ + return toCopiedAPI(toImpl(itemRef)->title()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.h b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.h new file mode 100644 index 0000000..b0bf1de --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.h @@ -0,0 +1,44 @@ +/* + * 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 + * 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 WKBackForwardListItem_h +#define WKBackForwardListItem_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKBackForwardListItemGetTypeID(); + +WK_EXPORT WKURLRef WKBackForwardListItemCopyURL(WKBackForwardListItemRef item); +WK_EXPORT WKStringRef WKBackForwardListItemCopyTitle(WKBackForwardListItemRef item); + +#ifdef __cplusplus +} +#endif + +#endif /* WKBackForwardListItem_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.cpp b/Source/WebKit2/UIProcess/API/C/WKContext.cpp new file mode 100644 index 0000000..c207225 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKContext.cpp @@ -0,0 +1,178 @@ +/* + * 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 "WKContext.h" +#include "WKContextPrivate.h" + +#include "WKAPICast.h" +#include "WebContext.h" +#include "WebURLRequest.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/text/WTFString.h> + +using namespace WebKit; + +WKTypeID WKContextGetTypeID() +{ + return toAPI(WebContext::APIType); +} + +WKContextRef WKContextCreate() +{ + RefPtr<WebContext> context = WebContext::create(String()); + return toAPI(context.release().releaseRef()); +} + +WKContextRef WKContextCreateWithInjectedBundlePath(WKStringRef pathRef) +{ + RefPtr<WebContext> context = WebContext::create(toImpl(pathRef)->string()); + return toAPI(context.release().releaseRef()); +} + +WKContextRef WKContextGetSharedProcessContext() +{ + return toAPI(WebContext::sharedProcessContext()); +} + +WKContextRef WKContextGetSharedThreadContext() +{ + return toAPI(WebContext::sharedThreadContext()); +} + +void WKContextSetInjectedBundleClient(WKContextRef contextRef, const WKContextInjectedBundleClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(contextRef)->initializeInjectedBundleClient(wkClient); +} + +void WKContextSetHistoryClient(WKContextRef contextRef, const WKContextHistoryClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(contextRef)->initializeHistoryClient(wkClient); +} + +void WKContextSetDownloadClient(WKContextRef contextRef, const WKContextDownloadClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(contextRef)->initializeDownloadClient(wkClient); +} + +void WKContextDownloadURLRequest(WKContextRef contextRef, const WKURLRequestRef requestRef) +{ + toImpl(contextRef)->download(0, toImpl(requestRef)->resourceRequest()); +} + +void WKContextSetInitializationUserDataForInjectedBundle(WKContextRef contextRef, WKTypeRef userDataRef) +{ + toImpl(contextRef)->setInjectedBundleInitializationUserData(toImpl(userDataRef)); +} + +void WKContextPostMessageToInjectedBundle(WKContextRef contextRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef) +{ + toImpl(contextRef)->postMessageToInjectedBundle(toImpl(messageNameRef)->string(), toImpl(messageBodyRef)); +} + +void WKContextGetGlobalStatistics(WKContextStatistics* statistics) +{ + const WebContext::Statistics& webContextStatistics = WebContext::statistics(); + + statistics->wkViewCount = webContextStatistics.wkViewCount; + statistics->wkPageCount = webContextStatistics.wkPageCount; + statistics->wkFrameCount = webContextStatistics.wkViewCount; +} + +void WKContextAddVisitedLink(WKContextRef contextRef, WKStringRef visitedURL) +{ + toImpl(contextRef)->addVisitedLink(toImpl(visitedURL)->string()); +} + +void WKContextSetCacheModel(WKContextRef contextRef, WKCacheModel cacheModel) +{ + toImpl(contextRef)->setCacheModel(toCacheModel(cacheModel)); +} + +WKCacheModel WKContextGetCacheModel(WKContextRef contextRef) +{ + return toAPI(toImpl(contextRef)->cacheModel()); +} + +void _WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef contextRef, bool alwaysUseComplexTextCodePath) +{ + toImpl(contextRef)->setAlwaysUsesComplexTextCodePath(alwaysUseComplexTextCodePath); +} + +void _WKContextSetAdditionalPluginsDirectory(WKContextRef contextRef, WKStringRef pluginsDirectory) +{ + toImpl(contextRef)->setAdditionalPluginsDirectory(toImpl(pluginsDirectory)->string()); +} + +void _WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef contextRef, WKStringRef urlScheme) +{ + toImpl(contextRef)->registerURLSchemeAsEmptyDocument(toImpl(urlScheme)->string()); +} + +void WKContextRegisterURLSchemeAsSecure(WKContextRef contextRef, WKStringRef urlScheme) +{ + toImpl(contextRef)->registerURLSchemeAsSecure(toImpl(urlScheme)->string()); +} + +void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef contextRef, WKStringRef urlScheme) +{ + toImpl(contextRef)->setDomainRelaxationForbiddenForURLScheme(toImpl(urlScheme)->string()); +} + +void WKContextClearResourceCaches(WKContextRef contextRef) +{ + toImpl(contextRef)->clearResourceCaches(); +} + +void WKContextClearApplicationCache(WKContextRef contextRef) +{ + toImpl(contextRef)->clearApplicationCache(); +} + +WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef contextRef) +{ + return toAPI(toImpl(contextRef)->databaseManagerProxy()); +} + +WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef contextRef) +{ + return toAPI(toImpl(contextRef)->geolocationManagerProxy()); +} + +void WKContextStartMemorySampler(WKContextRef contextRef, WKDoubleRef interval) +{ + toImpl(contextRef)->startMemorySampler(toImpl(interval)->value()); +} + +void WKContextStopMemorySampler(WKContextRef contextRef) +{ + toImpl(contextRef)->stopMemorySampler(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.h b/Source/WebKit2/UIProcess/API/C/WKContext.h new file mode 100644 index 0000000..810ad20 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKContext.h @@ -0,0 +1,133 @@ +/* + * 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 WKContext_h +#define WKContext_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKCacheModelDocumentViewer = 0, + kWKCacheModelDocumentBrowser = 1, + kWKCacheModelPrimaryWebBrowser = 2 +}; +typedef uint32_t WKCacheModel; + +// 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); + +struct WKContextInjectedBundleClient { + int version; + const void * clientInfo; + WKContextDidReceiveMessageFromInjectedBundleCallback didReceiveMessageFromInjectedBundle; + WKContextDidReceiveSynchronousMessageFromInjectedBundleCallback didReceiveSynchronousMessageFromInjectedBundle; +}; +typedef struct WKContextInjectedBundleClient WKContextInjectedBundleClient; + +// History Client +typedef void (*WKContextDidNavigateWithNavigationDataCallback)(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo); +typedef void (*WKContextDidPerformClientRedirectCallback)(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo); +typedef void (*WKContextDidPerformServerRedirectCallback)(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo); +typedef void (*WKContextDidUpdateHistoryTitleCallback)(WKContextRef context, WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void *clientInfo); +typedef void (*WKContextPopulateVisitedLinksCallback)(WKContextRef context, const void *clientInfo); + +struct WKContextHistoryClient { + int version; + const void * clientInfo; + WKContextDidNavigateWithNavigationDataCallback didNavigateWithNavigationData; + WKContextDidPerformClientRedirectCallback didPerformClientRedirect; + WKContextDidPerformServerRedirectCallback didPerformServerRedirect; + WKContextDidUpdateHistoryTitleCallback didUpdateHistoryTitle; + WKContextPopulateVisitedLinksCallback populateVisitedLinks; +}; +typedef struct WKContextHistoryClient WKContextHistoryClient; + +// Download Client +typedef void (*WKContextDownloadDidStartCallback)(WKContextRef context, WKDownloadRef download, const void *clientInfo); +typedef void (*WKContextDownloadDidReceiveResponseCallback)(WKContextRef context, WKDownloadRef download, WKURLResponseRef response, const void *clientInfo); +typedef void (*WKContextDownloadDidReceiveDataCallback)(WKContextRef context, WKDownloadRef download, uint64_t length, const void *clientInfo); +typedef bool (*WKContextDownloadShouldDecodeSourceDataOfMIMETypeCallback)(WKContextRef context, WKDownloadRef download, WKStringRef mimeType, const void *clientInfo); +typedef WKStringRef (*WKContextDownloadDecideDestinationWithSuggestedFilenameCallback)(WKContextRef context, WKDownloadRef download, WKStringRef filename, bool* allowOverwrite, const void *clientInfo); +typedef void (*WKContextDownloadDidCreateDestinationCallback)(WKContextRef context, WKDownloadRef download, WKStringRef path, const void *clientInfo); +typedef void (*WKContextDownloadDidFinishCallback)(WKContextRef context, WKDownloadRef download, const void *clientInfo); +typedef void (*WKContextDownloadDidFailCallback)(WKContextRef context, WKDownloadRef download, WKErrorRef error, const void *clientInfo); +typedef void (*WKContextDownloadDidCancel)(WKContextRef context, WKDownloadRef download, const void *clientInfo); +typedef void (*WKContextDownloadProcessDidCrashCallback)(WKContextRef context, WKDownloadRef download, const void *clientInfo); + +struct WKContextDownloadClient { + int version; + const void * clientInfo; + WKContextDownloadDidStartCallback didStart; + WKContextDownloadDidReceiveResponseCallback didReceiveResponse; + WKContextDownloadDidReceiveDataCallback didReceiveData; + WKContextDownloadShouldDecodeSourceDataOfMIMETypeCallback shouldDecodeSourceDataOfMIMEType; + WKContextDownloadDecideDestinationWithSuggestedFilenameCallback decideDestinationWithSuggestedFilename; + WKContextDownloadDidCreateDestinationCallback didCreateDestination; + WKContextDownloadDidFinishCallback didFinish; + WKContextDownloadDidFailCallback didFail; + WKContextDownloadDidCancel didCancel; + WKContextDownloadProcessDidCrashCallback processDidCrash; +}; +typedef struct WKContextDownloadClient WKContextDownloadClient; + +WK_EXPORT WKTypeID WKContextGetTypeID(); + +WK_EXPORT WKContextRef WKContextCreate(); +WK_EXPORT WKContextRef WKContextCreateWithInjectedBundlePath(WKStringRef path); +WK_EXPORT WKContextRef WKContextGetSharedProcessContext(); + +WK_EXPORT void WKContextSetInjectedBundleClient(WKContextRef context, const WKContextInjectedBundleClient* client); +WK_EXPORT void WKContextSetHistoryClient(WKContextRef context, const WKContextHistoryClient* client); +WK_EXPORT void WKContextSetDownloadClient(WKContextRef context, const WKContextDownloadClient* client); + +WK_EXPORT void WKContextDownloadURLRequest(WKContextRef context, const WKURLRequestRef request); + +WK_EXPORT void WKContextSetInitializationUserDataForInjectedBundle(WKContextRef context, WKTypeRef userData); +WK_EXPORT void WKContextPostMessageToInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody); + +WK_EXPORT void WKContextAddVisitedLink(WKContextRef context, WKStringRef visitedURL); + +WK_EXPORT void WKContextSetCacheModel(WKContextRef context, WKCacheModel cacheModel); +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 WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef context); +WK_EXPORT WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef context); + +#ifdef __cplusplus +} +#endif + +#endif /* WKContext_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h new file mode 100644 index 0000000..8bcb1b6 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h @@ -0,0 +1,61 @@ +/* + * 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 WKContextPrivate_h +#define WKContextPrivate_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKContext.h> + +#ifdef __cplusplus +extern "C" { +#endif + +struct WKContextStatistics { + unsigned wkViewCount; + unsigned wkPageCount; + unsigned wkFrameCount; +}; +typedef struct WKContextStatistics WKContextStatistics; + +WK_EXPORT void WKContextGetGlobalStatistics(WKContextStatistics* statistics); + +WK_EXPORT WKContextRef WKContextGetSharedThreadContext(); + +WK_EXPORT void _WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKStringRef pluginsDirectory); + +WK_EXPORT void _WKContextRegisterURLSchemeAsEmptyDocument(WKContextRef context, WKStringRef urlScheme); + +WK_EXPORT void _WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef context, bool alwaysUseComplexTextCodePath); + +WK_EXPORT void WKContextRegisterURLSchemeAsSecure(WKContextRef context, WKStringRef urlScheme); + +WK_EXPORT void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef context, WKStringRef urlScheme); + +#ifdef __cplusplus +} +#endif + +#endif /* WKContextPrivate_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKCredential.cpp b/Source/WebKit2/UIProcess/API/C/WKCredential.cpp new file mode 100644 index 0000000..25e1185 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKCredential.cpp @@ -0,0 +1,49 @@ +/* + * 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 "WKCredential.h" + +#include "WebCredential.h" +#include "WebString.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKCredentialGetTypeID() +{ + return toAPI(WebCredential::APIType); +} + +WKCredentialRef WKCredentialCreate(WKStringRef username, WKStringRef password, WKCredentialPersistence persistence) +{ + RefPtr<WebCredential> credential = WebCredential::create(toImpl(username), toImpl(password), toCredentialPersistence(persistence)); + return toAPI(credential.release().releaseRef()); +} + +WKStringRef WKCredentialCopyUser(WKCredentialRef credentialRef) +{ + return toCopiedAPI(toImpl(credentialRef)->user()); +} + diff --git a/Source/WebKit2/UIProcess/API/C/WKCredential.h b/Source/WebKit2/UIProcess/API/C/WKCredential.h new file mode 100644 index 0000000..8b2602e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKCredential.h @@ -0,0 +1,45 @@ +/* + * 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 WKCredential_h +#define WKCredential_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKCredentialTypes.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKCredentialGetTypeID(); + +WK_EXPORT WKCredentialRef WKCredentialCreate(WKStringRef username, WKStringRef password, WKCredentialPersistence); +WK_EXPORT WKStringRef WKCredentialCopyUser(WKCredentialRef); + +#ifdef __cplusplus +} +#endif + +#endif // WKCredential_h diff --git a/Source/WebKit2/UIProcess/API/C/WKCredentialTypes.h b/Source/WebKit2/UIProcess/API/C/WKCredentialTypes.h new file mode 100644 index 0000000..bba31ac --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKCredentialTypes.h @@ -0,0 +1,44 @@ +/* + * 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 WKCredentialTypes_h +#define WKCredentialTypes_h + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKCredentialPersistenceNone, + kWKCredentialPersistenceForSession, + kWKCredentialPersistencePermanent +}; +typedef uint32_t WKCredentialPersistence; + +#ifdef __cplusplus +} +#endif + +#endif /* WKCredentialTypes_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp b/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp new file mode 100644 index 0000000..226ef8c --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp @@ -0,0 +1,153 @@ +/* + * 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 "WKDatabaseManager.h" + +#include "WebDatabaseManagerProxy.h" +#include "WKAPICast.h" + +#ifdef __BLOCKS__ +#include <Block.h> +#endif + +using namespace WebKit; + +WKTypeID WKDatabaseManagerGetTypeID() +{ + return toAPI(WebDatabaseManagerProxy::APIType); +} + +WKStringRef WKDatabaseManagerGetOriginKey() +{ + static WebString* key = WebString::create(WebDatabaseManagerProxy::originKey()).releaseRef(); + return toAPI(key); +} + +WKStringRef WKDatabaseManagerGetOriginQuotaKey() +{ + static WebString* key = WebString::create(WebDatabaseManagerProxy::originQuotaKey()).releaseRef(); + return toAPI(key); +} + +WKStringRef WKDatabaseManagerGetOriginUsageKey() +{ + static WebString* key = WebString::create(WebDatabaseManagerProxy::originUsageKey()).releaseRef(); + return toAPI(key); +} + +WKStringRef WKDatabaseManagerGetDatabaseDetailsKey() +{ + static WebString* key = WebString::create(WebDatabaseManagerProxy::databaseDetailsKey()).releaseRef(); + return toAPI(key); +} + +WKStringRef WKDatabaseManagerGetDatabaseDetailsNameKey() +{ + static WebString* key = WebString::create(WebDatabaseManagerProxy::databaseDetailsNameKey()).releaseRef(); + return toAPI(key); +} + +WKStringRef WKDatabaseManagerGetDatabaseDetailsDisplayNameKey() +{ + static WebString* key = WebString::create(WebDatabaseManagerProxy::databaseDetailsDisplayNameKey()).releaseRef(); + return toAPI(key); +} + +WKStringRef WKDatabaseManagerGetDatabaseDetailsExpectedUsageKey() +{ + static WebString* key = WebString::create(WebDatabaseManagerProxy::databaseDetailsExpectedUsageKey()).releaseRef(); + return toAPI(key); +} + +WKStringRef WKDatabaseManagerGetDatabaseDetailsCurrentUsageKey() +{ + static WebString* key = WebString::create(WebDatabaseManagerProxy::databaseDetailsCurrentUsageKey()).releaseRef(); + return toAPI(key); +} + +void WKDatabaseManagerSetClient(WKDatabaseManagerRef databaseManagerRef, const WKDatabaseManagerClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(databaseManagerRef)->initializeClient(wkClient); +} + +void WKDatabaseManagerGetDatabasesByOrigin(WKDatabaseManagerRef databaseManagerRef, void* context, WKDatabaseManagerGetDatabasesByOriginFunction callback) +{ + toImpl(databaseManagerRef)->getDatabasesByOrigin(ArrayCallback::create(context, callback)); +} + +#ifdef __BLOCKS__ +static void callGetDatabasesByOriginBlockAndDispose(WKArrayRef resultValue, WKErrorRef errorRef, void* context) +{ + WKDatabaseManagerGetDatabasesByOriginBlock block = (WKDatabaseManagerGetDatabasesByOriginBlock)context; + block(resultValue, errorRef); + Block_release(block); +} + +void WKDatabaseManagerGetDatabasesByOrigin_b(WKDatabaseManagerRef databaseManagerRef, WKDatabaseManagerGetDatabasesByOriginBlock block) +{ + WKDatabaseManagerGetDatabasesByOrigin(databaseManagerRef, Block_copy(block), callGetDatabasesByOriginBlockAndDispose); +} +#endif + +void WKDatabaseManagerGetDatabaseOrigins(WKDatabaseManagerRef databaseManagerRef, void* context, WKDatabaseManagerGetDatabaseOriginsFunction callback) +{ + toImpl(databaseManagerRef)->getDatabaseOrigins(ArrayCallback::create(context, callback)); +} + +#ifdef __BLOCKS__ +static void callGetDatabaseOriginsBlockBlockAndDispose(WKArrayRef resultValue, WKErrorRef errorRef, void* context) +{ + WKDatabaseManagerGetDatabaseOriginsBlock block = (WKDatabaseManagerGetDatabaseOriginsBlock)context; + block(resultValue, errorRef); + Block_release(block); +} + +void WKDatabaseManagerGetDatabaseOrigins_b(WKDatabaseManagerRef databaseManagerRef, WKDatabaseManagerGetDatabaseOriginsBlock block) +{ + WKDatabaseManagerGetDatabaseOrigins(databaseManagerRef, Block_copy(block), callGetDatabaseOriginsBlockBlockAndDispose); +} +#endif + +void WKDatabaseManagerDeleteDatabasesWithNameForOrigin(WKDatabaseManagerRef databaseManagerRef, WKStringRef databaseNameRef, WKSecurityOriginRef originRef) +{ + toImpl(databaseManagerRef)->deleteDatabaseWithNameForOrigin(toWTFString(databaseNameRef), toImpl(originRef)); +} + +void WKDatabaseManagerDeleteDatabasesForOrigin(WKDatabaseManagerRef databaseManagerRef, WKSecurityOriginRef originRef) +{ + toImpl(databaseManagerRef)->deleteDatabasesForOrigin(toImpl(originRef)); +} + +void WKDatabaseManagerDeleteAllDatabases(WKDatabaseManagerRef databaseManagerRef) +{ + toImpl(databaseManagerRef)->deleteAllDatabases(); +} + +void WKDatabaseManagerSetQuotaForOrigin(WKDatabaseManagerRef databaseManagerRef, WKSecurityOriginRef originRef, uint64_t quota) +{ + toImpl(databaseManagerRef)->setQuotaForOrigin(toImpl(originRef), quota); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.h b/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.h new file mode 100644 index 0000000..0a5eff6 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.h @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WKDatabaseManager_h +#define WKDatabaseManager_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* Value type: WKSecurityOriginRef */ +WK_EXPORT WKStringRef WKDatabaseManagerGetOriginKey(); + +/* Value type: WKUInt64Ref */ +WK_EXPORT WKStringRef WKDatabaseManagerGetOriginQuotaKey(); + +/* Value type: WKUInt64Ref */ +WK_EXPORT WKStringRef WKDatabaseManagerGetOriginUsageKey(); + +/* Value type: WKArrayRef (array of WKDictionaryRef's with keys that include: + - WKDatabaseManagerGetDatabaseNameKey() + - WKDatabaseManagerGetDatabaseDisplayNameKey() + - WKDatabaseManagerGetDatabaseExpectedUsageKey() + - WKDatabaseManagerGetDatabaseCurrentUsageKey() + */ +WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsKey(); + +/* Value type: WKStringRef */ +WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsNameKey(); + +/* Value type: WKStringRef */ +WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsDisplayNameKey(); + +/* Value type: WKUInt64Ref */ +WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsExpectedUsageKey(); + +/* Value type: WKUInt64Ref */ +WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsCurrentUsageKey(); + + +// Database Manager Client +typedef void (*WKDatabaseManagerDidModifyOriginCallback)(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin, const void *clientInfo); +typedef void (*WKDatabaseManagerDidModifyDatabaseCallback)(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin, WKStringRef databaseIdentifier, const void *clientInfo); + +struct WKDatabaseManagerClient { + int version; + const void * clientInfo; + WKDatabaseManagerDidModifyOriginCallback didModifyOrigin; + WKDatabaseManagerDidModifyDatabaseCallback didModifyDatabase; +}; +typedef struct WKDatabaseManagerClient WKDatabaseManagerClient; + + +WK_EXPORT WKTypeID WKDatabaseManagerGetTypeID(); + +WK_EXPORT void WKDatabaseManagerSetClient(WKDatabaseManagerRef databaseManager, const WKDatabaseManagerClient* client); + +typedef void (*WKDatabaseManagerGetDatabasesByOriginFunction)(WKArrayRef, WKErrorRef, void*); +WK_EXPORT void WKDatabaseManagerGetDatabasesByOrigin(WKDatabaseManagerRef databaseManager, void* context, WKDatabaseManagerGetDatabasesByOriginFunction function); +#ifdef __BLOCKS__ +typedef void (^WKDatabaseManagerGetDatabasesByOriginBlock)(WKArrayRef, WKErrorRef); +WK_EXPORT void WKDatabaseManagerGetDatabasesByOrigin_b(WKDatabaseManagerRef databaseManager, WKDatabaseManagerGetDatabasesByOriginBlock block); +#endif + +typedef void (*WKDatabaseManagerGetDatabaseOriginsFunction)(WKArrayRef, WKErrorRef, void*); +WK_EXPORT void WKDatabaseManagerGetDatabaseOrigins(WKDatabaseManagerRef contextRef, void* context, WKDatabaseManagerGetDatabaseOriginsFunction function); +#ifdef __BLOCKS__ +typedef void (^WKDatabaseManagerGetDatabaseOriginsBlock)(WKArrayRef, WKErrorRef); +WK_EXPORT void WKDatabaseManagerGetDatabaseOrigins_b(WKDatabaseManagerRef databaseManager, WKDatabaseManagerGetDatabaseOriginsBlock block); +#endif + +WK_EXPORT void WKDatabaseManagerDeleteDatabasesWithNameForOrigin(WKDatabaseManagerRef databaseManager, WKStringRef databaseName, WKSecurityOriginRef origin); +WK_EXPORT void WKDatabaseManagerDeleteDatabasesForOrigin(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin); +WK_EXPORT void WKDatabaseManagerDeleteAllDatabases(WKDatabaseManagerRef databaseManager); + +WK_EXPORT void WKDatabaseManagerSetQuotaForOrigin(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin, uint64_t quota); + +#ifdef __cplusplus +} +#endif + +#endif // WKDatabaseManager_h diff --git a/Source/WebKit2/UIProcess/API/C/WKDownload.cpp b/Source/WebKit2/UIProcess/API/C/WKDownload.cpp new file mode 100644 index 0000000..8960e2a --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKDownload.cpp @@ -0,0 +1,52 @@ +/* + * 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 "WKDownload.h" + +#include "DownloadProxy.h" +#include "WKAPICast.h" +#include "WebURLRequest.h" + +using namespace WebKit; + +WKTypeID WKDownloadGetTypeID() +{ + return toAPI(DownloadProxy::APIType); +} + +WKURLRequestRef WKDownloadCopyRequest(WKDownloadRef download) +{ + return toAPI(WebURLRequest::create(toImpl(download)->request()).leakRef()); +} + +WKDataRef WKDownloadGetResumeData(WKDownloadRef download) +{ + return toAPI(toImpl(download)->resumeData()); +} + +void WKDownloadCancel(WKDownloadRef download) +{ + return toImpl(download)->cancel(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKDownload.h b/Source/WebKit2/UIProcess/API/C/WKDownload.h new file mode 100644 index 0000000..b812681 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKDownload.h @@ -0,0 +1,49 @@ +/* + * 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 WKDownload_h +#define WKDownload_h + +#include <WebKit2/WKBase.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKDownloadGetTypeID(); + +WK_EXPORT WKURLRequestRef WKDownloadCopyRequest(WKDownloadRef download); +WK_EXPORT WKDataRef WKDownloadGetResumeData(WKDownloadRef download); +WK_EXPORT void WKDownloadCancel(WKDownloadRef download); + +#ifdef __cplusplus +} +#endif + +#endif // WKDownload_h diff --git a/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.cpp b/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.cpp new file mode 100644 index 0000000..ae98831 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.cpp @@ -0,0 +1,41 @@ +/* + * 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 "WKFormSubmissionListener.h" + +#include "WKAPICast.h" +#include "WebFormSubmissionListenerProxy.h" + +using namespace WebKit; + +WKTypeID WKFormSubmissionListenerGetTypeID() +{ + return toAPI(WebFormSubmissionListenerProxy::APIType); +} + +void WKFormSubmissionListenerContinue(WKFormSubmissionListenerRef submissionListener) +{ + toImpl(submissionListener)->continueSubmission(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.h b/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.h new file mode 100644 index 0000000..4b9b79a --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKFormSubmissionListener.h @@ -0,0 +1,43 @@ +/* + * 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 WKFormSubmissionListener_h +#define WKFormSubmissionListener_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKFormSubmissionListenerGetTypeID(); + +WK_EXPORT void WKFormSubmissionListenerContinue(WKFormSubmissionListenerRef submissionListener); + +#ifdef __cplusplus +} +#endif + +#endif /* WKFormSubmissionListener_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKFrame.cpp b/Source/WebKit2/UIProcess/API/C/WKFrame.cpp new file mode 100644 index 0000000..7c9ae11 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKFrame.cpp @@ -0,0 +1,164 @@ +/* + * 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 "WKFrame.h" + +#include "WKAPICast.h" +#include "WebFrameProxy.h" + +#ifdef __BLOCKS__ +#include <Block.h> +#endif + +using namespace WebKit; + +WKTypeID WKFrameGetTypeID() +{ + return toAPI(WebFrameProxy::APIType); +} + +bool WKFrameIsMainFrame(WKFrameRef frameRef) +{ + return toImpl(frameRef)->isMainFrame(); +} + +WKFrameLoadState WKFrameGetFrameLoadState(WKFrameRef frameRef) +{ + WebFrameProxy* frame = toImpl(frameRef); + switch (frame->loadState()) { + case WebFrameProxy::LoadStateProvisional: + return kWKFrameLoadStateProvisional; + case WebFrameProxy::LoadStateCommitted: + return kWKFrameLoadStateCommitted; + case WebFrameProxy::LoadStateFinished: + return kWKFrameLoadStateFinished; + } + + ASSERT_NOT_REACHED(); + return kWKFrameLoadStateFinished; +} + +WKURLRef WKFrameCopyProvisionalURL(WKFrameRef frameRef) +{ + return toCopiedURLAPI(toImpl(frameRef)->provisionalURL()); +} + +WKURLRef WKFrameCopyURL(WKFrameRef frameRef) +{ + return toCopiedURLAPI(toImpl(frameRef)->url()); +} + +WKURLRef WKFrameCopyUnreachableURL(WKFrameRef frameRef) +{ + return toCopiedURLAPI(toImpl(frameRef)->unreachableURL()); +} + +WKStringRef WKFrameCopyMIMEType(WKFrameRef frameRef) +{ + return toCopiedAPI(toImpl(frameRef)->mimeType()); +} + +WKStringRef WKFrameCopyTitle(WKFrameRef frameRef) +{ + return toCopiedAPI(toImpl(frameRef)->title()); +} + +WKPageRef WKFrameGetPage(WKFrameRef frameRef) +{ + return toAPI(toImpl(frameRef)->page()); +} + +WKArrayRef WKFrameCopyChildFrames(WKFrameRef frameRef) +{ + return toAPI(toImpl(frameRef)->childFrames().releaseRef()); +} + +WKCertificateInfoRef WKFrameGetCertificateInfo(WKFrameRef frameRef) +{ + return toAPI(toImpl(frameRef)->certificateInfo()); +} + +bool WKFrameCanProvideSource(WKFrameRef frameRef) +{ + return toImpl(frameRef)->canProvideSource(); +} + +bool WKFrameCanShowMIMEType(WKFrameRef frameRef, WKStringRef mimeTypeRef) +{ + return toImpl(frameRef)->canShowMIMEType(toWTFString(mimeTypeRef)); +} + +bool WKFrameIsDisplayingStandaloneImageDocument(WKFrameRef frameRef) +{ + return toImpl(frameRef)->isDisplayingStandaloneImageDocument(); +} + +bool WKFrameIsDisplayingMarkupDocument(WKFrameRef frameRef) +{ + return toImpl(frameRef)->isDisplayingMarkupDocument(); +} + +bool WKFrameIsFrameSet(WKFrameRef frameRef) +{ + return toImpl(frameRef)->isFrameSet(); +} + +void WKFrameGetMainResourceData(WKFrameRef frameRef, WKFrameGetMainResourceDataFunction callback, void* context) +{ + toImpl(frameRef)->getMainResourceData(DataCallback::create(context, callback)); +} + +#ifdef __BLOCKS__ +static void callGetMainResourceDataBlockAndDispose(WKDataRef data, WKErrorRef error, void* context) +{ + WKFrameGetMainResourceDataBlock block = (WKFrameGetMainResourceDataBlock)context; + block(data, error); + Block_release(block); +} + +void WKFrameGetMainResourceData_b(WKFrameRef frameRef, WKFrameGetMainResourceDataBlock block) +{ + WKFrameGetMainResourceData(frameRef, callGetMainResourceDataBlockAndDispose, Block_copy(block)); +} +#endif + +void WKFrameGetWebArchive(WKFrameRef frameRef, WKFrameGetWebArchiveFunction callback, void* context) +{ + toImpl(frameRef)->getWebArchive(DataCallback::create(context, callback)); +} + +#ifdef __BLOCKS__ +static void callGetWebArchiveBlockAndDispose(WKDataRef archiveData, WKErrorRef error, void* context) +{ + WKFrameGetWebArchiveBlock block = (WKFrameGetWebArchiveBlock)context; + block(archiveData, error); + Block_release(block); +} + +void WKFrameGetWebArchive_b(WKFrameRef frameRef, WKFrameGetWebArchiveBlock block) +{ + WKFrameGetWebArchive(frameRef, callGetWebArchiveBlockAndDispose, Block_copy(block)); +} +#endif diff --git a/Source/WebKit2/UIProcess/API/C/WKFrame.h b/Source/WebKit2/UIProcess/API/C/WKFrame.h new file mode 100644 index 0000000..f812aeb --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKFrame.h @@ -0,0 +1,89 @@ +/* + * 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 WKFrame_h +#define WKFrame_h + +#include <WebKit2/WKBase.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +enum WKFrameLoadState { + kWKFrameLoadStateProvisional = 0, + kWKFrameLoadStateCommitted = 1, + kWKFrameLoadStateFinished = 2 +}; +typedef enum WKFrameLoadState WKFrameLoadState; + +WK_EXPORT WKTypeID WKFrameGetTypeID(); + +WK_EXPORT bool WKFrameIsMainFrame(WKFrameRef frame); +WK_EXPORT WKFrameLoadState WKFrameGetFrameLoadState(WKFrameRef frame); +WK_EXPORT WKURLRef WKFrameCopyProvisionalURL(WKFrameRef frame); +WK_EXPORT WKURLRef WKFrameCopyURL(WKFrameRef frame); +WK_EXPORT WKURLRef WKFrameCopyUnreachableURL(WKFrameRef frame); + +WK_EXPORT WKStringRef WKFrameCopyMIMEType(WKFrameRef frame); +WK_EXPORT WKStringRef WKFrameCopyTitle(WKFrameRef frame); + +WK_EXPORT WKPageRef WKFrameGetPage(WKFrameRef frame); + +WK_EXPORT WKArrayRef WKFrameCopyChildFrames(WKFrameRef frame); + +WK_EXPORT WKCertificateInfoRef WKFrameGetCertificateInfo(WKFrameRef frame); + +WK_EXPORT bool WKFrameCanProvideSource(WKFrameRef frame); +WK_EXPORT bool WKFrameCanShowMIMEType(WKFrameRef frame, WKStringRef mimeType); + +WK_EXPORT bool WKFrameIsDisplayingStandaloneImageDocument(WKFrameRef frame); +WK_EXPORT bool WKFrameIsDisplayingMarkupDocument(WKFrameRef frame); + +WK_EXPORT bool WKFrameIsFrameSet(WKFrameRef frame); + +typedef void (*WKFrameGetMainResourceDataFunction)(WKDataRef data, WKErrorRef error, void* functionContext); +WK_EXPORT void WKFrameGetMainResourceData(WKFrameRef frame, WKFrameGetMainResourceDataFunction function, void* functionContext); +#ifdef __BLOCKS__ +typedef void (^WKFrameGetMainResourceDataBlock)(WKDataRef data, WKErrorRef error); +WK_EXPORT void WKFrameGetMainResourceData_b(WKFrameRef frame, WKFrameGetMainResourceDataBlock block); +#endif + +typedef void (*WKFrameGetWebArchiveFunction)(WKDataRef archiveData, WKErrorRef error, void* functionContext); +WK_EXPORT void WKFrameGetWebArchive(WKFrameRef frame, WKFrameGetWebArchiveFunction function, void* functionContext); +#ifdef __BLOCKS__ +typedef void (^WKFrameGetWebArchiveBlock)(WKDataRef archiveData, WKErrorRef error); +WK_EXPORT void WKFrameGetWebArchive_b(WKFrameRef frame, WKFrameGetWebArchiveBlock block); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* WKFrame_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp b/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp new file mode 100644 index 0000000..d44d0d3 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp @@ -0,0 +1,52 @@ +/* + * 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 "WKFramePolicyListener.h" + +#include "WKAPICast.h" +#include "WebFramePolicyListenerProxy.h" +#include "WebFrameProxy.h" + +using namespace WebKit; + +WKTypeID WKFramePolicyListenerGetTypeID() +{ + return toAPI(WebFramePolicyListenerProxy::APIType); +} + +void WKFramePolicyListenerUse(WKFramePolicyListenerRef policyListenerRef) +{ + toImpl(policyListenerRef)->use(); +} + +void WKFramePolicyListenerDownload(WKFramePolicyListenerRef policyListenerRef) +{ + toImpl(policyListenerRef)->download(); +} + +void WKFramePolicyListenerIgnore(WKFramePolicyListenerRef policyListenerRef) +{ + toImpl(policyListenerRef)->ignore(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.h b/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.h new file mode 100644 index 0000000..99b013d --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.h @@ -0,0 +1,45 @@ +/* + * 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 WKFramePolicyListener_h +#define WKFramePolicyListener_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKFramePolicyListenerGetTypeID(); + +WK_EXPORT void WKFramePolicyListenerUse(WKFramePolicyListenerRef policyListener); +WK_EXPORT void WKFramePolicyListenerDownload(WKFramePolicyListenerRef policyListener); +WK_EXPORT void WKFramePolicyListenerIgnore(WKFramePolicyListenerRef policyListener); + +#ifdef __cplusplus +} +#endif + +#endif /* WKFramePolicyListener_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp new file mode 100644 index 0000000..ed399ad --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp @@ -0,0 +1,53 @@ +/* + * 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 "WKGeolocationManager.h" + +#include "WKAPICast.h" +#include "WebGeolocationManagerProxy.h" + +using namespace WebKit; + +WKTypeID WKGeolocationManagerGetTypeID() +{ + return toAPI(WebGeolocationManagerProxy::APIType); +} + +void WKGeolocationManagerSetProvider(WKGeolocationManagerRef geolocationManagerRef, const WKGeolocationProvider* wkProvider) +{ + if (wkProvider && wkProvider->version) + return; + toImpl(geolocationManagerRef)->initializeProvider(wkProvider); +} + +void WKGeolocationManagerProviderDidChangePosition(WKGeolocationManagerRef geolocationManagerRef, WKGeolocationPositionRef positionRef) +{ + toImpl(geolocationManagerRef)->providerDidChangePosition(toImpl(positionRef)); +} + +void WKGeolocationManagerProviderDidFailToDeterminePosition(WKGeolocationManagerRef geolocationManagerRef) +{ + toImpl(geolocationManagerRef)->providerDidFailToDeterminePosition(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h new file mode 100644 index 0000000..07cbd79 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h @@ -0,0 +1,58 @@ +/* + * 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 WKGeolocationManager_h +#define WKGeolocationManager_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +// Provider. +typedef void (*WKGeolocationProviderStartUpdatingCallback)(WKGeolocationManagerRef geolocationManager, const void* clientInfo); +typedef void (*WKGeolocationProviderStopUpdatingCallback)(WKGeolocationManagerRef geolocationManager, const void* clientInfo); + +struct WKGeolocationProvider { + int version; + const void * clientInfo; + WKGeolocationProviderStartUpdatingCallback startUpdating; + WKGeolocationProviderStopUpdatingCallback stopUpdating; +}; +typedef struct WKGeolocationProvider WKGeolocationProvider; + +WK_EXPORT WKTypeID WKGeolocationManagerGetTypeID(); + +WK_EXPORT void WKGeolocationManagerSetProvider(WKGeolocationManagerRef geolocationManager, const WKGeolocationProvider* provider); + +WK_EXPORT void WKGeolocationManagerProviderDidChangePosition(WKGeolocationManagerRef geolocationManager, WKGeolocationPositionRef position); +WK_EXPORT void WKGeolocationManagerProviderDidFailToDeterminePosition(WKGeolocationManagerRef geolocationManager); + +#ifdef __cplusplus +} +#endif + +#endif /* WKGeolocationManager_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp b/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp new file mode 100644 index 0000000..ca52798 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.cpp @@ -0,0 +1,46 @@ +/* + * 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 "WKGeolocationPermissionRequest.h" + +#include "GeolocationPermissionRequestProxy.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKGeolocationPermissionRequestGetTypeID() +{ + return toAPI(GeolocationPermissionRequestProxy::APIType); +} + +void WKGeolocationPermissionRequestAllow(WKGeolocationPermissionRequestRef geolocationPermissionRequestRef) +{ + return toImpl(geolocationPermissionRequestRef)->allow(); +} + +void WKGeolocationPermissionRequestDeny(WKGeolocationPermissionRequestRef geolocationPermissionRequestRef) +{ + return toImpl(geolocationPermissionRequestRef)->deny(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.h b/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.h new file mode 100644 index 0000000..ee27b66 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationPermissionRequest.h @@ -0,0 +1,44 @@ +/* + * 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 WKGeolocationPermissionRequest_h +#define WKGeolocationPermissionRequest_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKGeolocationPermissionRequestGetTypeID(); + +WK_EXPORT void WKGeolocationPermissionRequestAllow(WKGeolocationPermissionRequestRef geolocationPermissionRequest); +WK_EXPORT void WKGeolocationPermissionRequestDeny(WKGeolocationPermissionRequestRef geolocationPermissionRequest); + +#ifdef __cplusplus +} +#endif + +#endif /* WKGeolocationPermissionRequest_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp new file mode 100644 index 0000000..7977369 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp @@ -0,0 +1,42 @@ +/* + * 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 "WKGeolocationPosition.h" + +#include "WKAPICast.h" +#include "WebGeolocationPosition.h" + +using namespace WebKit; + +WKTypeID WKGeolocationPositionGetTypeID() +{ + return toAPI(WebGeolocationPosition::APIType); +} + +WKGeolocationPositionRef WKGeolocationPositionCreate(double timestamp, double latitude, double longitude, double accuracy) +{ + RefPtr<WebGeolocationPosition> position = WebGeolocationPosition::create(timestamp, latitude, longitude, accuracy); + return toAPI(position.release().releaseRef()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.h b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.h new file mode 100644 index 0000000..85183fd --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.h @@ -0,0 +1,43 @@ +/* + * 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 WKGeolocationPosition_h +#define WKGeolocationPosition_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKGeolocationPositionGetTypeID(); + +WK_EXPORT WKGeolocationPositionRef WKGeolocationPositionCreate(double timestamp, double latitude, double longitude, double accuracy); + +#ifdef __cplusplus +} +#endif + +#endif /* WKGeolocationPosition_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKInspector.cpp b/Source/WebKit2/UIProcess/API/C/WKInspector.cpp new file mode 100644 index 0000000..7a87265 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKInspector.cpp @@ -0,0 +1,110 @@ +/* + * 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 "WKInspector.h" + +#if ENABLE(INSPECTOR) + +#include "WKAPICast.h" +#include "WebInspectorProxy.h" + +using namespace WebKit; + +WKTypeID WKInspectorGetTypeID() +{ + return toAPI(WebInspectorProxy::APIType); +} + +WKPageRef WKInspectorGetPage(WKInspectorRef inspectorRef) +{ + return toAPI(toImpl(inspectorRef)->page()); +} + +bool WKInspectorIsVisible(WKInspectorRef inspectorRef) +{ + return toImpl(inspectorRef)->isVisible(); +} + +void WKInspectorShow(WKInspectorRef inspectorRef) +{ + toImpl(inspectorRef)->show(); +} + +void WKInspectorClose(WKInspectorRef inspectorRef) +{ + toImpl(inspectorRef)->close(); +} + +void WKInspectorShowConsole(WKInspectorRef inspectorRef) +{ + toImpl(inspectorRef)->showConsole(); +} + +bool WKInspectorIsAttached(WKInspectorRef inspectorRef) +{ + return toImpl(inspectorRef)->isAttached(); +} + +void WKInspectorAttach(WKInspectorRef inspectorRef) +{ + toImpl(inspectorRef)->attach(); +} + +void WKInspectorDetach(WKInspectorRef inspectorRef) +{ + toImpl(inspectorRef)->detach(); +} + +bool WKInspectorIsDebuggingJavaScript(WKInspectorRef inspectorRef) +{ + return toImpl(inspectorRef)->isDebuggingJavaScript(); +} + +void WKInspectorToggleJavaScriptDebugging(WKInspectorRef inspectorRef) +{ + toImpl(inspectorRef)->toggleJavaScriptDebugging(); +} + +bool WKInspectorIsProfilingJavaScript(WKInspectorRef inspectorRef) +{ + return toImpl(inspectorRef)->isProfilingJavaScript(); +} + +void WKInspectorToggleJavaScriptProfiling(WKInspectorRef inspectorRef) +{ + toImpl(inspectorRef)->toggleJavaScriptProfiling(); +} + +bool WKInspectorIsProfilingPage(WKInspectorRef inspectorRef) +{ + return toImpl(inspectorRef)->isProfilingPage(); +} + +void WKInspectorTogglePageProfiling(WKInspectorRef inspectorRef) +{ + toImpl(inspectorRef)->togglePageProfiling(); +} + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/UIProcess/API/C/WKInspector.h b/Source/WebKit2/UIProcess/API/C/WKInspector.h new file mode 100644 index 0000000..c147015 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKInspector.h @@ -0,0 +1,70 @@ +/* + * 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 WKInspector_h +#define WKInspector_h + +#include <WebKit2/WKBase.h> + +#if ENABLE(INSPECTOR) + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKInspectorGetTypeID(); + +WK_EXPORT WKPageRef WKInspectorGetPage(WKInspectorRef inspector); + +WK_EXPORT bool WKInspectorIsVisible(WKInspectorRef inspector); +WK_EXPORT void WKInspectorShow(WKInspectorRef inspector); +WK_EXPORT void WKInspectorClose(WKInspectorRef inspector); + +WK_EXPORT void WKInspectorShowConsole(WKInspectorRef inspector); + +WK_EXPORT bool WKInspectorIsAttached(WKInspectorRef inspector); +WK_EXPORT void WKInspectorAttach(WKInspectorRef inspector); +WK_EXPORT void WKInspectorDetach(WKInspectorRef inspector); + +WK_EXPORT bool WKInspectorIsDebuggingJavaScript(WKInspectorRef inspector); +WK_EXPORT void WKInspectorToggleJavaScriptDebugging(WKInspectorRef inspector); + +WK_EXPORT bool WKInspectorIsProfilingJavaScript(WKInspectorRef inspector); +WK_EXPORT void WKInspectorToggleJavaScriptProfiling(WKInspectorRef inspector); + +WK_EXPORT bool WKInspectorIsProfilingPage(WKInspectorRef inspector); +WK_EXPORT void WKInspectorTogglePageProfiling(WKInspectorRef inspector); + +#ifdef __cplusplus +} +#endif + +#endif // ENABLE(INSPECTOR) + +#endif // WKInspector_h diff --git a/Source/WebKit2/UIProcess/API/C/WKNativeEvent.h b/Source/WebKit2/UIProcess/API/C/WKNativeEvent.h new file mode 100644 index 0000000..ee0bd17 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKNativeEvent.h @@ -0,0 +1,52 @@ +/* + * 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 WKNativeEvent_h +#define WKNativeEvent_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __APPLE__ +#ifdef __OBJC__ +@class NSEvent; +#elif __cplusplus +class NSEvent; +#else +struct NSEvent; +#endif +typedef NSEvent *WKNativeEventPtr; +#elif defined(WIN32) || defined(_WIN32) +typedef const struct tagMSG* WKNativeEventPtr; +#else +typedef const void* WKNativeEventPtr; +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* WKNativeEvent_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp b/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp new file mode 100644 index 0000000..90eb142 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKNavigationData.cpp @@ -0,0 +1,46 @@ +/* + * 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 "WKNavigationData.h" + +#include "WKAPICast.h" +#include "WebNavigationData.h" + +using namespace WebKit; + +WKTypeID WKNavigationDataGetTypeID() +{ + return toAPI(WebNavigationData::APIType); +} + +WKStringRef WKNavigationDataCopyTitle(WKNavigationDataRef navigationDataRef) +{ + return toCopiedAPI(toImpl(navigationDataRef)->title()); +} + +WKURLRef WKNavigationDataCopyURL(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 new file mode 100644 index 0000000..c855b54 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKNavigationData.h @@ -0,0 +1,44 @@ +/* + * 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 WKNavigationData_h +#define WKNavigationData_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKNavigationDataGetTypeID(); + +WK_EXPORT WKStringRef WKNavigationDataCopyTitle(WKNavigationDataRef navigationData); +WK_EXPORT WKURLRef WKNavigationDataCopyURL(WKNavigationDataRef navigationData); + +#ifdef __cplusplus +} +#endif + +#endif /* WKNavigationData_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp new file mode 100644 index 0000000..3cf89cf --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp @@ -0,0 +1,41 @@ +/* + * 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 "WKOpenPanelParameters.h" + +#include "WKAPICast.h" +#include "WebOpenPanelParameters.h" + +using namespace WebKit; + +WKTypeID WKOpenPanelParametersGetTypeID() +{ + return toAPI(WebOpenPanelParameters::APIType); +} + +bool WKOpenPanelParametersGetAllowsMultipleFiles(WKOpenPanelParametersRef parametersRef) +{ + return toImpl(parametersRef)->allowMultipleFiles(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h new file mode 100644 index 0000000..f32731c --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h @@ -0,0 +1,47 @@ +/* + * 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 WKOpenPanelParameters_h +#define WKOpenPanelParameters_h + +#include <WebKit2/WKBase.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKOpenPanelParametersGetTypeID(); + +WK_EXPORT bool WKOpenPanelParametersGetAllowsMultipleFiles(WKOpenPanelParametersRef parameters); + +#ifdef __cplusplus +} +#endif + +#endif /* WKOpenPanelParameters_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp b/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp new file mode 100644 index 0000000..5b143f2 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.cpp @@ -0,0 +1,46 @@ +/* + * 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 "WKOpenPanelResultListener.h" + +#include "WKAPICast.h" +#include "WebOpenPanelResultListenerProxy.h" + +using namespace WebKit; + +WKTypeID WKOpenPanelResultListenerGetTypeID() +{ + return toAPI(WebOpenPanelResultListenerProxy::APIType); +} + +void WKOpenPanelResultListenerChooseFiles(WKOpenPanelResultListenerRef listenerRef, WKArrayRef fileURLsRef) +{ + toImpl(listenerRef)->chooseFiles(toImpl(fileURLsRef)); +} + +void WKOpenPanelResultListenerCancel(WKOpenPanelResultListenerRef listenerRef) +{ + toImpl(listenerRef)->cancel(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.h b/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.h new file mode 100644 index 0000000..d581738 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKOpenPanelResultListener.h @@ -0,0 +1,44 @@ +/* + * 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 WKOpenPanelResultListener_h +#define WKOpenPanelResultListener_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKOpenPanelResultListenerGetTypeID(); + +WK_EXPORT void WKOpenPanelResultListenerChooseFiles(WKOpenPanelResultListenerRef listener, WKArrayRef fileURLs); +WK_EXPORT void WKOpenPanelResultListenerCancel(WKOpenPanelResultListenerRef listener); + +#ifdef __cplusplus +} +#endif + +#endif /* WKOpenPanelResultListener_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.cpp b/Source/WebKit2/UIProcess/API/C/WKPage.cpp new file mode 100644 index 0000000..edcbf87 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPage.cpp @@ -0,0 +1,431 @@ +/* + * 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 "WKPage.h" +#include "WKPagePrivate.h" + +#include "WKAPICast.h" +#include "WebBackForwardList.h" +#include "WebData.h" +#include "WebPageProxy.h" + +#ifdef __BLOCKS__ +#include <Block.h> +#endif + +using namespace WebKit; + +WKTypeID WKPageGetTypeID() +{ + return toAPI(WebPageProxy::APIType); +} + +WKContextRef WKPageGetContext(WKPageRef pageRef) +{ + return toAPI(toImpl(pageRef)->context()); +} + +WKPageGroupRef WKPageGetPageGroup(WKPageRef pageRef) +{ + return toAPI(toImpl(pageRef)->pageGroup()); +} + +void WKPageLoadURL(WKPageRef pageRef, WKURLRef URLRef) +{ + toImpl(pageRef)->loadURL(toImpl(URLRef)->string()); +} + +void WKPageLoadURLRequest(WKPageRef pageRef, WKURLRequestRef urlRequestRef) +{ + toImpl(pageRef)->loadURLRequest(toImpl(urlRequestRef)); +} + +void WKPageLoadHTMLString(WKPageRef pageRef, WKStringRef htmlStringRef, WKURLRef baseURLRef) +{ + toImpl(pageRef)->loadHTMLString(toWTFString(htmlStringRef), toWTFString(baseURLRef)); +} + +void WKPageLoadAlternateHTMLString(WKPageRef pageRef, WKStringRef htmlStringRef, WKURLRef baseURLRef, WKURLRef unreachableURLRef) +{ + toImpl(pageRef)->loadAlternateHTMLString(toWTFString(htmlStringRef), toWTFString(baseURLRef), toWTFString(unreachableURLRef)); +} + +void WKPageLoadPlainTextString(WKPageRef pageRef, WKStringRef plainTextStringRef) +{ + toImpl(pageRef)->loadPlainTextString(toWTFString(plainTextStringRef)); +} + +void WKPageStopLoading(WKPageRef pageRef) +{ + toImpl(pageRef)->stopLoading(); +} + +void WKPageReload(WKPageRef pageRef) +{ + toImpl(pageRef)->reload(false); +} + +void WKPageReloadFromOrigin(WKPageRef pageRef) +{ + toImpl(pageRef)->reload(true); +} + +bool WKPageTryClose(WKPageRef pageRef) +{ + return toImpl(pageRef)->tryClose(); +} + +void WKPageClose(WKPageRef pageRef) +{ + toImpl(pageRef)->close(); +} + +bool WKPageIsClosed(WKPageRef pageRef) +{ + return toImpl(pageRef)->isClosed(); +} + +void WKPageGoForward(WKPageRef pageRef) +{ + toImpl(pageRef)->goForward(); +} + +bool WKPageCanGoForward(WKPageRef pageRef) +{ + return toImpl(pageRef)->canGoForward(); +} + +void WKPageGoBack(WKPageRef pageRef) +{ + toImpl(pageRef)->goBack(); +} + +bool WKPageCanGoBack(WKPageRef pageRef) +{ + return toImpl(pageRef)->canGoBack(); +} + +void WKPageGoToBackForwardListItem(WKPageRef pageRef, WKBackForwardListItemRef itemRef) +{ + toImpl(pageRef)->goToBackForwardItem(toImpl(itemRef)); +} + +WKBackForwardListRef WKPageGetBackForwardList(WKPageRef pageRef) +{ + return toAPI(toImpl(pageRef)->backForwardList()); +} + +WKStringRef WKPageCopyTitle(WKPageRef pageRef) +{ + return toCopiedAPI(toImpl(pageRef)->pageTitle()); +} + +WKFrameRef WKPageGetMainFrame(WKPageRef pageRef) +{ + return toAPI(toImpl(pageRef)->mainFrame()); +} + +WKFrameRef WKPageGetFocusedFrame(WKPageRef pageRef) +{ + return toAPI(toImpl(pageRef)->focusedFrame()); +} + +WKFrameRef WKPageGetFrameSetLargestFrame(WKPageRef pageRef) +{ + return toAPI(toImpl(pageRef)->frameSetLargestFrame()); +} + +#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR +WKInspectorRef WKPageGetInspector(WKPageRef pageRef) +{ + return toAPI(toImpl(pageRef)->inspector()); +} +#endif + +double WKPageGetEstimatedProgress(WKPageRef pageRef) +{ + return toImpl(pageRef)->estimatedProgress(); +} + +WKStringRef WKPageCopyUserAgent(WKPageRef pageRef) +{ + return toCopiedAPI(toImpl(pageRef)->userAgent()); +} + +WKStringRef WKPageCopyApplicationNameForUserAgent(WKPageRef pageRef) +{ + return toCopiedAPI(toImpl(pageRef)->applicationNameForUserAgent()); +} + +void WKPageSetApplicationNameForUserAgent(WKPageRef pageRef, WKStringRef applicationNameRef) +{ + toImpl(pageRef)->setApplicationNameForUserAgent(toWTFString(applicationNameRef)); +} + +WKStringRef WKPageCopyCustomUserAgent(WKPageRef pageRef) +{ + return toCopiedAPI(toImpl(pageRef)->customUserAgent()); +} + +void WKPageSetCustomUserAgent(WKPageRef pageRef, WKStringRef userAgentRef) +{ + toImpl(pageRef)->setCustomUserAgent(toWTFString(userAgentRef)); +} + +bool WKPageSupportsTextEncoding(WKPageRef pageRef) +{ + return toImpl(pageRef)->supportsTextEncoding(); +} + +WKStringRef WKPageCopyCustomTextEncodingName(WKPageRef pageRef) +{ + return toCopiedAPI(toImpl(pageRef)->customTextEncodingName()); +} + +void WKPageSetCustomTextEncodingName(WKPageRef pageRef, WKStringRef encodingNameRef) +{ + toImpl(pageRef)->setCustomTextEncodingName(toWTFString(encodingNameRef)); +} + +void WKPageTerminate(WKPageRef pageRef) +{ + toImpl(pageRef)->terminateProcess(); +} + +WKStringRef WKPageGetSessionHistoryURLValueType() +{ + static WebString* sessionHistoryURLValueType = WebString::create("SessionHistoryURL").releaseRef(); + return toAPI(sessionHistoryURLValueType); +} + +WKDataRef WKPageCopySessionState(WKPageRef pageRef, void *context, WKPageSessionStateFilterCallback filter) +{ + return toAPI(toImpl(pageRef)->sessionStateData(filter, context).releaseRef()); +} + +void WKPageRestoreFromSessionState(WKPageRef pageRef, WKDataRef sessionStateData) +{ + toImpl(pageRef)->restoreFromSessionStateData(toImpl(sessionStateData)); +} + +double WKPageGetTextZoomFactor(WKPageRef pageRef) +{ + return toImpl(pageRef)->textZoomFactor(); +} + +bool WKPageSupportsTextZoom(WKPageRef pageRef) +{ + return toImpl(pageRef)->supportsTextZoom(); +} + +void WKPageSetTextZoomFactor(WKPageRef pageRef, double zoomFactor) +{ + toImpl(pageRef)->setTextZoomFactor(zoomFactor); +} + +double WKPageGetPageZoomFactor(WKPageRef pageRef) +{ + return toImpl(pageRef)->pageZoomFactor(); +} + +void WKPageSetPageZoomFactor(WKPageRef pageRef, double zoomFactor) +{ + toImpl(pageRef)->setPageZoomFactor(zoomFactor); +} + +void WKPageSetPageAndTextZoomFactors(WKPageRef pageRef, double pageZoomFactor, double textZoomFactor) +{ + toImpl(pageRef)->setPageAndTextZoomFactors(pageZoomFactor, textZoomFactor); +} + +void WKPageScaleWebView(WKPageRef pageRef, double scale, WKPoint origin) +{ + toImpl(pageRef)->scaleWebView(scale, toIntPoint(origin)); +} + +void WKPageSetUseFixedLayout(WKPageRef pageRef, bool fixed) +{ + toImpl(pageRef)->setUseFixedLayout(fixed); +} + +void WKPageSetFixedLayoutSize(WKPageRef pageRef, WKSize size) +{ + toImpl(pageRef)->setFixedLayoutSize(toIntSize(size)); +} + +bool WKPageUseFixedLayout(WKPageRef pageRef) +{ + return toImpl(pageRef)->useFixedLayout(); +} + +WKSize WKPageFixedLayoutSize(WKPageRef pageRef) +{ + return toAPI(toImpl(pageRef)->fixedLayoutSize()); +} + +double WKPageGetViewScaleFactor(WKPageRef pageRef) +{ + return toImpl(pageRef)->viewScaleFactor(); +} + +void WKPageFindString(WKPageRef pageRef, WKStringRef string, WKFindOptions options, unsigned maxMatchCount) +{ + toImpl(pageRef)->findString(toImpl(string)->string(), toFindOptions(options), maxMatchCount); +} + +void WKPageHideFindUI(WKPageRef pageRef) +{ + toImpl(pageRef)->hideFindUI(); +} + +void WKPageCountStringMatches(WKPageRef pageRef, WKStringRef string, WKFindOptions options, unsigned maxMatchCount) +{ + toImpl(pageRef)->countStringMatches(toImpl(string)->string(), toFindOptions(options), maxMatchCount); +} + +void WKPageSetPageContextMenuClient(WKPageRef pageRef, const WKPageContextMenuClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeContextMenuClient(wkClient); +} + +void WKPageSetPageFindClient(WKPageRef pageRef, const WKPageFindClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeFindClient(wkClient); +} + +void WKPageSetPageFormClient(WKPageRef pageRef, const WKPageFormClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeFormClient(wkClient); +} + +void WKPageSetPageLoaderClient(WKPageRef pageRef, const WKPageLoaderClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeLoaderClient(wkClient); +} + +void WKPageSetPagePolicyClient(WKPageRef pageRef, const WKPagePolicyClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializePolicyClient(wkClient); +} + +void WKPageSetPageResourceLoadClient(WKPageRef pageRef, const WKPageResourceLoadClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeResourceLoadClient(wkClient); +} + +void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + toImpl(pageRef)->initializeUIClient(wkClient); +} + +void WKPageRunJavaScriptInMainFrame(WKPageRef pageRef, WKStringRef scriptRef, void* context, WKPageRunJavaScriptFunction callback) +{ + toImpl(pageRef)->runJavaScriptInMainFrame(toImpl(scriptRef)->string(), StringCallback::create(context, callback)); +} + +#ifdef __BLOCKS__ +static void callRunJavaScriptBlockAndRelease(WKStringRef resultValue, WKErrorRef error, void* context) +{ + WKPageRunJavaScriptBlock block = (WKPageRunJavaScriptBlock)context; + block(resultValue, error); + Block_release(block); +} + +void WKPageRunJavaScriptInMainFrame_b(WKPageRef pageRef, WKStringRef scriptRef, WKPageRunJavaScriptBlock block) +{ + WKPageRunJavaScriptInMainFrame(pageRef, scriptRef, Block_copy(block), callRunJavaScriptBlockAndRelease); +} +#endif + +void WKPageRenderTreeExternalRepresentation(WKPageRef pageRef, void* context, WKPageRenderTreeExternalRepresentationFunction callback) +{ + toImpl(pageRef)->getRenderTreeExternalRepresentation(StringCallback::create(context, callback)); +} + +#ifdef __BLOCKS__ +static void callRenderTreeExternalRepresentationBlockAndDispose(WKStringRef resultValue, WKErrorRef error, void* context) +{ + WKPageRenderTreeExternalRepresentationBlock block = (WKPageRenderTreeExternalRepresentationBlock)context; + block(resultValue, error); + Block_release(block); +} + +void WKPageRenderTreeExternalRepresentation_b(WKPageRef pageRef, WKPageRenderTreeExternalRepresentationBlock block) +{ + WKPageRenderTreeExternalRepresentation(pageRef, Block_copy(block), callRenderTreeExternalRepresentationBlockAndDispose); +} +#endif + +void WKPageGetSourceForFrame(WKPageRef pageRef, WKFrameRef frameRef, void* context, WKPageGetSourceForFrameFunction callback) +{ + toImpl(pageRef)->getSourceForFrame(toImpl(frameRef), StringCallback::create(context, callback)); +} + +#ifdef __BLOCKS__ +static void callGetSourceForFrameBlockBlockAndDispose(WKStringRef resultValue, WKErrorRef error, void* context) +{ + WKPageGetSourceForFrameBlock block = (WKPageGetSourceForFrameBlock)context; + block(resultValue, error); + Block_release(block); +} + +void WKPageGetSourceForFrame_b(WKPageRef pageRef, WKFrameRef frameRef, WKPageGetSourceForFrameBlock block) +{ + WKPageGetSourceForFrame(pageRef, frameRef, Block_copy(block), callGetSourceForFrameBlockBlockAndDispose); +} +#endif + +void WKPageGetContentsAsString(WKPageRef pageRef, void* context, WKPageGetContentsAsStringFunction callback) +{ + toImpl(pageRef)->getContentsAsString(StringCallback::create(context, callback)); +} + +#ifdef __BLOCKS__ +static void callContentsAsStringBlockBlockAndDispose(WKStringRef resultValue, WKErrorRef error, void* context) +{ + WKPageGetContentsAsStringBlock block = (WKPageGetContentsAsStringBlock)context; + block(resultValue, error); + Block_release(block); +} + +void WKPageGetContentsAsString_b(WKPageRef pageRef, WKPageGetSourceForFrameBlock block) +{ + WKPageGetContentsAsString(pageRef, Block_copy(block), callContentsAsStringBlockBlockAndDispose); +} +#endif diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.h b/Source/WebKit2/UIProcess/API/C/WKPage.h new file mode 100644 index 0000000..05730e5 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPage.h @@ -0,0 +1,352 @@ +/* + * 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 WKPage_h +#define WKPage_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKEvent.h> +#include <WebKit2/WKFindOptions.h> +#include <WebKit2/WKGeometry.h> +#include <WebKit2/WKNativeEvent.h> +#include <WebKit2/WKPageLoadTypes.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// FrameLoad Client +typedef void (*WKPageDidStartProvisionalLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFailProvisionalLoadWithErrorForFrameCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidCommitLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFinishDocumentLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFinishLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFailLoadWithErrorForFrameCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidSameDocumentNavigationForFrameCallback)(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidReceiveTitleForFrameCallback)(WKPageRef page, WKStringRef title, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFirstLayoutForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidRemoveFrameFromHierarchyCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidDisplayInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef void (*WKPageDidRunInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo); +typedef bool (*WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback)(WKPageRef page, WKFrameRef frame, WKProtectionSpaceRef protectionSpace, const void *clientInfo); +typedef void (*WKPageDidReceiveAuthenticationChallengeInFrameCallback)(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo); + +// Progress Client +typedef void (*WKPageDidStartProgressCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageDidChangeProgressCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageDidFinishProgressCallback)(WKPageRef page, const void *clientInfo); + +// WebProcess Client +// FIXME: These three functions should not be part of this client. +typedef void (*WKPageProcessDidBecomeUnresponsiveCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageProcessDidBecomeResponsiveCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageProcessDidCrashCallback)(WKPageRef page, const void *clientInfo); + +typedef void (*WKPageDidChangeBackForwardListCallback)(WKPageRef page, const void *clientInfo); + +struct WKPageLoaderClient { + int version; + const void * clientInfo; + WKPageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame; + WKPageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame; + WKPageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame; + WKPageDidCommitLoadForFrameCallback didCommitLoadForFrame; + WKPageDidFinishDocumentLoadForFrameCallback didFinishDocumentLoadForFrame; + WKPageDidFinishLoadForFrameCallback didFinishLoadForFrame; + WKPageDidFailLoadWithErrorForFrameCallback didFailLoadWithErrorForFrame; + WKPageDidSameDocumentNavigationForFrameCallback didSameDocumentNavigationForFrame; + WKPageDidReceiveTitleForFrameCallback didReceiveTitleForFrame; + WKPageDidFirstLayoutForFrameCallback didFirstLayoutForFrame; + WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback didFirstVisuallyNonEmptyLayoutForFrame; + WKPageDidRemoveFrameFromHierarchyCallback didRemoveFrameFromHierarchy; + WKPageDidDisplayInsecureContentForFrameCallback didDisplayInsecureContentForFrame; + WKPageDidRunInsecureContentForFrameCallback didRunInsecureContentForFrame; + WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback canAuthenticateAgainstProtectionSpaceInFrame; + WKPageDidReceiveAuthenticationChallengeInFrameCallback didReceiveAuthenticationChallengeInFrame; + + // FIXME: Move to progress client. + WKPageDidStartProgressCallback didStartProgress; + WKPageDidChangeProgressCallback didChangeProgress; + WKPageDidFinishProgressCallback didFinishProgress; + + // FIXME: These three functions should not be part of this client. + WKPageProcessDidBecomeUnresponsiveCallback processDidBecomeUnresponsive; + WKPageProcessDidBecomeResponsiveCallback processDidBecomeResponsive; + WKPageProcessDidCrashCallback processDidCrash; + + WKPageDidChangeBackForwardListCallback didChangeBackForwardList; +}; +typedef struct WKPageLoaderClient WKPageLoaderClient; + +// Policy Client. +typedef void (*WKPageDecidePolicyForNavigationActionCallback)(WKPageRef page, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo); +typedef void (*WKPageDecidePolicyForNewWindowActionCallback)(WKPageRef page, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo); +typedef void (*WKPageDecidePolicyForMIMETypeCallback)(WKPageRef page, WKStringRef MIMEType, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo); + +struct WKPagePolicyClient { + int version; + const void * clientInfo; + WKPageDecidePolicyForNavigationActionCallback decidePolicyForNavigationAction; + WKPageDecidePolicyForNewWindowActionCallback decidePolicyForNewWindowAction; + WKPageDecidePolicyForMIMETypeCallback decidePolicyForMIMEType; +}; +typedef struct WKPagePolicyClient WKPagePolicyClient; + +// Form Client. +typedef void (*WKPageWillSubmitFormCallback)(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef userData, WKFormSubmissionListenerRef listener, const void* clientInfo); + +struct WKPageFormClient { + int version; + const void * clientInfo; + WKPageWillSubmitFormCallback willSubmitForm; +}; +typedef struct WKPageFormClient WKPageFormClient; + +// Resource Load Client. +typedef void (*WKPageDidInitiateLoadForResourceCallback)(WKPageRef page, WKFrameRef frame, uint64_t resourceIdentifier, WKURLRequestRef request, 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; + +// UI Client +typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo); +typedef void (*WKPageShowPageCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageCloseCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void *clientInfo); +typedef bool (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo); +typedef WKStringRef (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void *clientInfo); +typedef void (*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 (*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); +typedef bool (*WKPageGetMenuBarIsVisibleCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageSetMenuBarIsVisibleCallback)(WKPageRef page, bool menuBarVisible, const void *clientInfo); +typedef bool (*WKPageGetStatusBarIsVisibleCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageSetStatusBarIsVisibleCallback)(WKPageRef page, bool statusBarVisible, const void *clientInfo); +typedef bool (*WKPageGetIsResizableCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageSetIsResizableCallback)(WKPageRef page, bool resizable, const void *clientInfo); +typedef WKRect (*WKPageGetWindowFrameCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageSetWindowFrameCallback)(WKPageRef page, WKRect frame, const void *clientInfo); +typedef bool (*WKPageRunBeforeUnloadConfirmPanelCallback)(WKPageRef page, WKStringRef message, WKFrameRef frame, const void *clientInfo); +typedef void (*WKPageDidDrawCallback)(WKPageRef page, const void *clientInfo); +typedef void (*WKPageDidScrollCallback)(WKPageRef page, const void *clientInfo); +typedef unsigned long long (*WKPageExceededDatabaseQuotaCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentUsage, unsigned long long expectedUsage, const void *clientInfo); +typedef void (*WKPageRunOpenPanelCallback)(WKPageRef page, WKFrameRef frame, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener, const void *clientInfo); +typedef void (*WKPageDecidePolicyForGeolocationPermissionRequestCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKGeolocationPermissionRequestRef permissionRequest, const void* clientInfo); + +struct WKPageUIClient { + int version; + const void * clientInfo; + WKPageCreateNewPageCallback createNewPage; + WKPageShowPageCallback showPage; + WKPageCloseCallback close; + WKPageRunJavaScriptAlertCallback runJavaScriptAlert; + WKPageRunJavaScriptConfirmCallback runJavaScriptConfirm; + WKPageRunJavaScriptPromptCallback runJavaScriptPrompt; + WKPageSetStatusTextCallback setStatusText; + WKPageMouseDidMoveOverElementCallback mouseDidMoveOverElement; + WKPageMissingPluginButtonClickedCallback missingPluginButtonClicked; + WKPageDidNotHandleKeyEventCallback didNotHandleKeyEvent; + WKPageGetToolbarsAreVisibleCallback toolbarsAreVisible; + WKPageSetToolbarsAreVisibleCallback setToolbarsAreVisible; + WKPageGetMenuBarIsVisibleCallback menuBarIsVisible; + WKPageSetMenuBarIsVisibleCallback setMenuBarIsVisible; + WKPageGetStatusBarIsVisibleCallback statusBarIsVisible; + WKPageSetStatusBarIsVisibleCallback setStatusBarIsVisible; + WKPageGetIsResizableCallback isResizable; + WKPageSetIsResizableCallback setIsResizable; + WKPageGetWindowFrameCallback getWindowFrame; + WKPageSetWindowFrameCallback setWindowFrame; + WKPageRunBeforeUnloadConfirmPanelCallback runBeforeUnloadConfirmPanel; + WKPageDidDrawCallback didDraw; + WKPageDidScrollCallback pageDidScroll; + WKPageExceededDatabaseQuotaCallback exceededDatabaseQuota; + WKPageRunOpenPanelCallback runOpenPanel; + WKPageDecidePolicyForGeolocationPermissionRequestCallback decidePolicyForGeolocationPermissionRequest; +}; +typedef struct WKPageUIClient WKPageUIClient; + +// Find client. +typedef void (*WKPageDidFindStringCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo); +typedef void (*WKPageDidFailToFindStringCallback)(WKPageRef page, WKStringRef string, const void* clientInfo); +typedef void (*WKPageDidCountStringMatchesCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo); + +struct WKPageFindClient { + int version; + const void * clientInfo; + WKPageDidFindStringCallback didFindString; + WKPageDidFailToFindStringCallback didFailToFindString; + WKPageDidCountStringMatchesCallback didCountStringMatches; +}; +typedef struct WKPageFindClient WKPageFindClient; + +enum { + kWKMoreThanMaximumMatchCount = -1 +}; + +// ContextMenu client +typedef void (*WKPageGetContextMenuFromProposedContextMenuCallback)(WKPageRef page, WKArrayRef proposedMenu, WKArrayRef* newMenu, WKTypeRef userData, const void* clientInfo); +typedef void (*WKPageCustomContextMenuItemSelectedCallback)(WKPageRef page, WKContextMenuItemRef contextMenuItem, const void* clientInfo); + +struct WKPageContextMenuClient { + int version; + const void * clientInfo; + WKPageGetContextMenuFromProposedContextMenuCallback getContextMenuFromProposedMenu; + WKPageCustomContextMenuItemSelectedCallback customContextMenuItemSelected; +}; +typedef struct WKPageContextMenuClient WKPageContextMenuClient; + +WK_EXPORT WKTypeID WKPageGetTypeID(); + +WK_EXPORT WKContextRef WKPageGetContext(WKPageRef page); +WK_EXPORT WKPageGroupRef WKPageGetPageGroup(WKPageRef page); + +WK_EXPORT void WKPageLoadURL(WKPageRef page, WKURLRef url); +WK_EXPORT void WKPageLoadURLRequest(WKPageRef page, WKURLRequestRef urlRequest); +WK_EXPORT void WKPageLoadHTMLString(WKPageRef page, WKStringRef htmlString, WKURLRef baseURL); +WK_EXPORT void WKPageLoadAlternateHTMLString(WKPageRef page, WKStringRef htmlString, WKURLRef baseURL, WKURLRef unreachableURL); +WK_EXPORT void WKPageLoadPlainTextString(WKPageRef page, WKStringRef plainTextString); + +WK_EXPORT void WKPageStopLoading(WKPageRef page); +WK_EXPORT void WKPageReload(WKPageRef page); +WK_EXPORT void WKPageReloadFromOrigin(WKPageRef page); + +WK_EXPORT bool WKPageTryClose(WKPageRef page); +WK_EXPORT void WKPageClose(WKPageRef page); +WK_EXPORT bool WKPageIsClosed(WKPageRef page); + +WK_EXPORT void WKPageGoForward(WKPageRef page); +WK_EXPORT bool WKPageCanGoForward(WKPageRef page); +WK_EXPORT void WKPageGoBack(WKPageRef page); +WK_EXPORT bool WKPageCanGoBack(WKPageRef page); +WK_EXPORT void WKPageGoToBackForwardListItem(WKPageRef page, WKBackForwardListItemRef item); +WK_EXPORT WKBackForwardListRef WKPageGetBackForwardList(WKPageRef page); + +WK_EXPORT WKStringRef WKPageCopyTitle(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); + +#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR +WK_EXPORT WKInspectorRef WKPageGetInspector(WKPageRef page); +#endif + +WK_EXPORT WKStringRef WKPageCopyUserAgent(WKPageRef page); + +WK_EXPORT WKStringRef WKPageCopyApplicationNameForUserAgent(WKPageRef page); +WK_EXPORT void WKPageSetApplicationNameForUserAgent(WKPageRef page, WKStringRef applicationName); + +WK_EXPORT WKStringRef WKPageCopyCustomUserAgent(WKPageRef page); +WK_EXPORT void WKPageSetCustomUserAgent(WKPageRef page, WKStringRef userAgent); + +WK_EXPORT bool WKPageSupportsTextEncoding(WKPageRef page); +WK_EXPORT WKStringRef WKPageCopyCustomTextEncodingName(WKPageRef page); +WK_EXPORT void WKPageSetCustomTextEncodingName(WKPageRef page, WKStringRef encodingName); + +WK_EXPORT void WKPageTerminate(WKPageRef page); + +WK_EXPORT WKStringRef WKPageGetSessionHistoryURLValueType(void); + +typedef bool (*WKPageSessionStateFilterCallback)(WKPageRef page, WKStringRef valueType, WKTypeRef value, void* context); +WK_EXPORT WKDataRef WKPageCopySessionState(WKPageRef page, void* context, WKPageSessionStateFilterCallback urlAllowedCallback); +WK_EXPORT void WKPageRestoreFromSessionState(WKPageRef page, WKDataRef sessionStateData); + +WK_EXPORT bool WKPageSupportsTextZoom(WKPageRef page); +WK_EXPORT double WKPageGetTextZoomFactor(WKPageRef page); +WK_EXPORT void WKPageSetTextZoomFactor(WKPageRef page, double zoomFactor); +WK_EXPORT double WKPageGetPageZoomFactor(WKPageRef page); +WK_EXPORT void WKPageSetPageZoomFactor(WKPageRef page, double zoomFactor); +WK_EXPORT void WKPageSetPageAndTextZoomFactors(WKPageRef page, double pageZoomFactor, double textZoomFactor); + +WK_EXPORT void WKPageScaleWebView(WKPageRef page, double scale, WKPoint origin); +WK_EXPORT double WKPageGetViewScaleFactor(WKPageRef page); + +WK_EXPORT void WKPageSetUseFixedLayout(WKPageRef page, bool fixed); +WK_EXPORT void WKPageSetFixedLayoutSize(WKPageRef page, WKSize size); +WK_EXPORT bool WKPageUseFixedLayout(WKPageRef pageRef); +WK_EXPORT WKSize WKPageFixedLayoutSize(WKPageRef pageRef); + +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 WKPageSetPageContextMenuClient(WKPageRef page, const WKPageContextMenuClient* client); +WK_EXPORT void WKPageSetPageFindClient(WKPageRef page, const WKPageFindClient* 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)(WKStringRef, WKErrorRef, void*); +WK_EXPORT void WKPageRunJavaScriptInMainFrame(WKPageRef page, WKStringRef script, void* context, WKPageRunJavaScriptFunction function); +#ifdef __BLOCKS__ +typedef void (^WKPageRunJavaScriptBlock)(WKStringRef, WKErrorRef); +WK_EXPORT void WKPageRunJavaScriptInMainFrame_b(WKPageRef page, WKStringRef script, WKPageRunJavaScriptBlock block); +#endif + +typedef void (*WKPageGetSourceForFrameFunction)(WKStringRef, WKErrorRef, void*); +WK_EXPORT void WKPageGetSourceForFrame(WKPageRef page, WKFrameRef frame, void* context, WKPageGetSourceForFrameFunction function); +#ifdef __BLOCKS__ +typedef void (^WKPageGetSourceForFrameBlock)(WKStringRef, WKErrorRef); +WK_EXPORT void WKPageGetSourceForFrame_b(WKPageRef page, WKFrameRef frame, WKPageGetSourceForFrameBlock block); +#endif + +typedef void (*WKPageGetContentsAsStringFunction)(WKStringRef, WKErrorRef, void*); +WK_EXPORT void WKPageGetContentsAsString(WKPageRef page, void* context, WKPageGetContentsAsStringFunction function); +#ifdef __BLOCKS__ +typedef void (^WKPageGetContentsAsStringBlock)(WKStringRef, WKErrorRef); +WK_EXPORT void WKPageGetContentsAsString_b(WKPageRef page, WKPageGetContentsAsStringBlock block); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* WKPage_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp b/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp new file mode 100644 index 0000000..6c10014 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp @@ -0,0 +1,58 @@ +/* + * 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 "WKPageGroup.h" + +#include "WKAPICast.h" +#include "WebPageGroup.h" +#include "WebPreferences.h" + +using namespace WebKit; + +WKTypeID WKPageGroupGetTypeID() +{ + return toAPI(WebPageGroup::APIType); +} + +WKPageGroupRef WKPageGroupCreateWithIdentifier(WKStringRef identifier) +{ + RefPtr<WebPageGroup> pageGroup = WebPageGroup::create(toWTFString(identifier)); + return toAPI(pageGroup.release().leakRef()); +} + +WKStringRef WKPageGroupCopyIdentifier(WKPageGroupRef pageGroupRef) +{ + return toCopiedAPI(toImpl(pageGroupRef)->identifier()); +} + +void WKPageGroupSetPreferences(WKPageGroupRef pageGroupRef, WKPreferencesRef preferencesRef) +{ + toImpl(pageGroupRef)->setPreferences(toImpl(preferencesRef)); +} + +WKPreferencesRef WKPageGroupGetPreferences(WKPageGroupRef pageGroupRef) +{ + return toAPI(toImpl(pageGroupRef)->preferences()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKPageGroup.h b/Source/WebKit2/UIProcess/API/C/WKPageGroup.h new file mode 100644 index 0000000..705df08 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPageGroup.h @@ -0,0 +1,48 @@ +/* + * 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 WKPageGroup_h +#define WKPageGroup_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKPageGroupGetTypeID(); + +WK_EXPORT WKPageGroupRef WKPageGroupCreateWithIdentifier(WKStringRef identifier); + +WK_EXPORT WKStringRef WKPageGroupCopyIdentifier(WKPageGroupRef pageGroup); + +WK_EXPORT void WKPageGroupSetPreferences(WKPageGroupRef pageGroup, WKPreferencesRef preferences); +WK_EXPORT WKPreferencesRef WKPageGroupGetPreferences(WKPageGroupRef pageGroup); + +#ifdef __cplusplus +} +#endif + +#endif /* WKPageGroup_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h new file mode 100644 index 0000000..3bf50c3 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h @@ -0,0 +1,48 @@ +/* + * 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 WKPagePrivate_h +#define WKPagePrivate_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKPage.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*WKPageRenderTreeExternalRepresentationFunction)(WKStringRef, WKErrorRef, void*); +WK_EXPORT void WKPageRenderTreeExternalRepresentation(WKPageRef page, void *context, WKPageRenderTreeExternalRepresentationFunction function); + +#ifdef __BLOCKS__ +typedef void (^WKPageRenderTreeExternalRepresentationBlock)(WKStringRef, WKErrorRef); +WK_EXPORT void WKPageRenderTreeExternalRepresentation_b(WKPageRef page, WKPageRenderTreeExternalRepresentationBlock block); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* WKPagePrivate_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp new file mode 100644 index 0000000..379859c --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp @@ -0,0 +1,451 @@ +/* + * 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 "WKPreferences.h" +#include "WKPreferencesPrivate.h" + +#include "WKAPICast.h" +#include "WebPreferences.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +using namespace WebKit; + +WKTypeID WKPreferencesGetTypeID() +{ + return toAPI(WebPreferences::APIType); +} + +WKPreferencesRef WKPreferencesCreate() +{ + RefPtr<WebPreferences> preferences = WebPreferences::create(); + return toAPI(preferences.release().leakRef()); +} + +WKPreferencesRef WKPreferencesCreateWithIdentifier(WKStringRef identifierRef) +{ + RefPtr<WebPreferences> preferences = WebPreferences::create(toWTFString(identifierRef)); + return toAPI(preferences.release().releaseRef()); +} + +void WKPreferencesSetJavaScriptEnabled(WKPreferencesRef preferencesRef, bool javaScriptEnabled) +{ + toImpl(preferencesRef)->setJavaScriptEnabled(javaScriptEnabled); +} + +bool WKPreferencesGetJavaScriptEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->javaScriptEnabled(); +} + +void WKPreferencesSetLoadsImagesAutomatically(WKPreferencesRef preferencesRef, bool loadsImagesAutomatically) +{ + toImpl(preferencesRef)->setLoadsImagesAutomatically(loadsImagesAutomatically); +} + +bool WKPreferencesGetLoadsImagesAutomatically(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->loadsImagesAutomatically(); +} + +void WKPreferencesSetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferencesRef, bool offlineWebApplicationCacheEnabled) +{ + toImpl(preferencesRef)->setOfflineWebApplicationCacheEnabled(offlineWebApplicationCacheEnabled); +} + +bool WKPreferencesGetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->offlineWebApplicationCacheEnabled(); +} + +void WKPreferencesSetLocalStorageEnabled(WKPreferencesRef preferencesRef, bool localStorageEnabled) +{ + toImpl(preferencesRef)->setLocalStorageEnabled(localStorageEnabled); +} + +bool WKPreferencesGetLocalStorageEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->localStorageEnabled(); +} + +void WKPreferencesSetDatabasesEnabled(WKPreferencesRef preferencesRef, bool databasesEnabled) +{ + toImpl(preferencesRef)->setDatabasesEnabled(databasesEnabled); +} + +bool WKPreferencesGetDatabasesEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->databasesEnabled(); +} + +void WKPreferencesSetXSSAuditorEnabled(WKPreferencesRef preferencesRef, bool xssAuditorEnabled) +{ + toImpl(preferencesRef)->setXSSAuditorEnabled(xssAuditorEnabled); +} + +bool WKPreferencesGetXSSAuditorEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->xssAuditorEnabled(); +} + +void WKPreferencesSetFrameFlatteningEnabled(WKPreferencesRef preferencesRef, bool frameFlatteningEnabled) +{ + toImpl(preferencesRef)->setFrameFlatteningEnabled(frameFlatteningEnabled); +} + +bool WKPreferencesGetFrameFlatteningEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->frameFlatteningEnabled(); +} + +void WKPreferencesSetPluginsEnabled(WKPreferencesRef preferencesRef, bool pluginsEnabled) +{ + toImpl(preferencesRef)->setPluginsEnabled(pluginsEnabled); +} + +bool WKPreferencesGetPluginsEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->pluginsEnabled(); +} + +void WKPreferencesSetJavaEnabled(WKPreferencesRef preferencesRef, bool javaEnabled) +{ + toImpl(preferencesRef)->setJavaEnabled(javaEnabled); +} + +bool WKPreferencesGetJavaEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->javaEnabled(); +} + +void WKPreferencesSetJavaScriptCanOpenWindowsAutomatically(WKPreferencesRef preferencesRef, bool javaScriptCanOpenWindowsAutomatically) +{ + toImpl(preferencesRef)->setJavaScriptCanOpenWindowsAutomatically(javaScriptCanOpenWindowsAutomatically); +} + +bool WKPreferencesGetJavaScriptCanOpenWindowsAutomatically(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->javaScriptCanOpenWindowsAutomatically(); +} + +void WKPreferencesSetHyperlinkAuditingEnabled(WKPreferencesRef preferencesRef, bool hyperlinkAuditingEnabled) +{ + toImpl(preferencesRef)->setHyperlinkAuditingEnabled(hyperlinkAuditingEnabled); +} + +bool WKPreferencesGetHyperlinkAuditingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->hyperlinkAuditingEnabled(); +} + +void WKPreferencesSetStandardFontFamily(WKPreferencesRef preferencesRef, WKStringRef family) +{ + toImpl(preferencesRef)->setStandardFontFamily(toWTFString(family)); +} + +WKStringRef WKPreferencesCopyStandardFontFamily(WKPreferencesRef preferencesRef) +{ + return toCopiedAPI(toImpl(preferencesRef)->standardFontFamily()); +} + +void WKPreferencesSetFixedFontFamily(WKPreferencesRef preferencesRef, WKStringRef family) +{ + toImpl(preferencesRef)->setFixedFontFamily(toWTFString(family)); +} + +WKStringRef WKPreferencesCopyFixedFontFamily(WKPreferencesRef preferencesRef) +{ + return toCopiedAPI(toImpl(preferencesRef)->fixedFontFamily()); +} + +void WKPreferencesSetSerifFontFamily(WKPreferencesRef preferencesRef, WKStringRef family) +{ + toImpl(preferencesRef)->setSerifFontFamily(toWTFString(family)); +} + +WKStringRef WKPreferencesCopySerifFontFamily(WKPreferencesRef preferencesRef) +{ + return toCopiedAPI(toImpl(preferencesRef)->serifFontFamily()); +} + +void WKPreferencesSetSansSerifFontFamily(WKPreferencesRef preferencesRef, WKStringRef family) +{ + toImpl(preferencesRef)->setSansSerifFontFamily(toWTFString(family)); +} + +WKStringRef WKPreferencesCopySansSerifFontFamily(WKPreferencesRef preferencesRef) +{ + return toCopiedAPI(toImpl(preferencesRef)->sansSerifFontFamily()); +} + +void WKPreferencesSetCursiveFontFamily(WKPreferencesRef preferencesRef, WKStringRef family) +{ + toImpl(preferencesRef)->setCursiveFontFamily(toWTFString(family)); +} + +WKStringRef WKPreferencesCopyCursiveFontFamily(WKPreferencesRef preferencesRef) +{ + return toCopiedAPI(toImpl(preferencesRef)->cursiveFontFamily()); +} + +void WKPreferencesSetFantasyFontFamily(WKPreferencesRef preferencesRef, WKStringRef family) +{ + toImpl(preferencesRef)->setFantasyFontFamily(toWTFString(family)); +} + +WKStringRef WKPreferencesCopyFantasyFontFamily(WKPreferencesRef preferencesRef) +{ + return toCopiedAPI(toImpl(preferencesRef)->fantasyFontFamily()); +} + +void WKPreferencesSetDefaultFontSize(WKPreferencesRef preferencesRef, uint32_t size) +{ + toImpl(preferencesRef)->setDefaultFontSize(size); +} + +uint32_t WKPreferencesGetDefaultFontSize(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->defaultFontSize(); +} + +void WKPreferencesSetDefaultFixedFontSize(WKPreferencesRef preferencesRef, uint32_t size) +{ + toImpl(preferencesRef)->setDefaultFixedFontSize(size); +} + +uint32_t WKPreferencesGetDefaultFixedFontSize(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->defaultFixedFontSize(); +} + +void WKPreferencesSetMinimumFontSize(WKPreferencesRef preferencesRef, uint32_t size) +{ + toImpl(preferencesRef)->setMinimumFontSize(size); +} + +uint32_t WKPreferencesGetMinimumFontSize(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->minimumFontSize(); +} + +void WKPreferencesSetDefaultTextEncodingName(WKPreferencesRef preferencesRef, WKStringRef name) +{ + toImpl(preferencesRef)->setDefaultTextEncodingName(toWTFString(name)); +} + +WKStringRef WKPreferencesCopyDefaultTextEncodingName(WKPreferencesRef preferencesRef) +{ + return toCopiedAPI(toImpl(preferencesRef)->defaultTextEncodingName()); +} + +void WKPreferencesSetPrivateBrowsingEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setPrivateBrowsingEnabled(enabled); +} + +bool WKPreferencesGetPrivateBrowsingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->privateBrowsingEnabled(); +} + +void WKPreferencesSetDeveloperExtrasEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setDeveloperExtrasEnabled(enabled); +} + +bool WKPreferencesGetDeveloperExtrasEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->developerExtrasEnabled(); +} + +void WKPreferencesSetTextAreasAreResizable(WKPreferencesRef preferencesRef, bool resizable) +{ + toImpl(preferencesRef)->setTextAreasAreResizable(resizable); +} + +bool WKPreferencesGetTextAreasAreResizable(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->textAreasAreResizable(); +} + +void WKPreferencesSetFontSmoothingLevel(WKPreferencesRef preferencesRef, WKFontSmoothingLevel wkLevel) +{ + toImpl(preferencesRef)->setFontSmoothingLevel(toFontSmoothingLevel(wkLevel)); +} + +WKFontSmoothingLevel WKPreferencesGetFontSmoothingLevel(WKPreferencesRef preferencesRef) +{ + return toAPI(static_cast<FontSmoothingLevel>(toImpl(preferencesRef)->fontSmoothingLevel())); +} + +void WKPreferencesSetAcceleratedCompositingEnabled(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setAcceleratedCompositingEnabled(flag); +} + +bool WKPreferencesGetAcceleratedCompositingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->acceleratedCompositingEnabled(); +} + +void WKPreferencesSetCompositingBordersVisible(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setCompositingBordersVisible(flag); +} + +bool WKPreferencesGetCompositingBordersVisible(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->compositingBordersVisible(); +} + +void WKPreferencesSetCompositingRepaintCountersVisible(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setCompositingRepaintCountersVisible(flag); +} + +bool WKPreferencesGetCompositingRepaintCountersVisible(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->compositingRepaintCountersVisible(); +} + +void WKPreferencesSetNeedsSiteSpecificQuirks(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setNeedsSiteSpecificQuirks(flag); +} + +bool WKPreferencesGetNeedsSiteSpecificQuirks(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->needsSiteSpecificQuirks(); +} + +void WKPreferencesSetForceFTPDirectoryListings(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setForceFTPDirectoryListings(flag); +} + +bool WKPreferencesGetForceFTPDirectoryListings(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->forceFTPDirectoryListings(); +} + +void WKPreferencesSetFTPDirectoryTemplatePath(WKPreferencesRef preferencesRef, WKStringRef pathRef) +{ + toImpl(preferencesRef)->setFTPDirectoryTemplatePath(toWTFString(pathRef)); +} + +WKStringRef WKPreferencesCopyFTPDirectoryTemplatePath(WKPreferencesRef preferencesRef) +{ + return toCopiedAPI(toImpl(preferencesRef)->ftpDirectoryTemplatePath()); +} + +void WKPreferencesSetTabsToLinks(WKPreferencesRef preferencesRef, bool tabsToLinks) +{ + toImpl(preferencesRef)->setTabsToLinks(tabsToLinks); +} + +bool WKPreferencesGetTabsToLinks(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->tabsToLinks(); +} + +void WKPreferencesSetDNSPrefetchingEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setDNSPrefetchingEnabled(enabled); +} + +bool WKPreferencesGetDNSPrefetchingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->dnsPrefetchingEnabled(); +} + +void WKPreferencesSetAuthorAndUserStylesEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setAuthorAndUserStylesEnabled(enabled); +} + +bool WKPreferencesGetAuthorAndUserStylesEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->authorAndUserStylesEnabled(); +} + +void WKPreferencesSetShouldPrintBackgrounds(WKPreferencesRef preferencesRef, bool flag) +{ + toImpl(preferencesRef)->setShouldPrintBackgrounds(flag); +} + +bool WKPreferencesGetShouldPrintBackgrounds(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->shouldPrintBackgrounds(); +} + +void WKPreferencesSetWebArchiveDebugModeEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setWebArchiveDebugModeEnabled(enabled); +} + +bool WKPreferencesGetWebArchiveDebugModeEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->webArchiveDebugModeEnabled(); +} + +void WKPreferencesSetLocalFileContentSniffingEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setLocalFileContentSniffingEnabled(enabled); +} + +bool WKPreferencesGetLocalFileContentSniffingEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->localFileContentSniffingEnabled(); +} + +void WKPreferencesSetPageCacheEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setUsesPageCache(enabled); +} + +bool WKPreferencesGetPageCacheEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->usesPageCache(); +} + +void WKPreferencesSetPaginateDuringLayoutEnabled(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setPaginateDuringLayoutEnabled(enabled); +} + +bool WKPreferencesGetPaginateDuringLayoutEnabled(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->paginateDuringLayoutEnabled(); +} + +void WKPreferencesSetDOMPasteAllowed(WKPreferencesRef preferencesRef, bool enabled) +{ + toImpl(preferencesRef)->setDOMPasteAllowed(enabled); +} + +bool WKPreferencesGetDOMPasteAllowed(WKPreferencesRef preferencesRef) +{ + return toImpl(preferencesRef)->domPasteAllowed(); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.h b/Source/WebKit2/UIProcess/API/C/WKPreferences.h new file mode 100644 index 0000000..8116575 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.h @@ -0,0 +1,153 @@ +/* + * 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 WKPreferences_h +#define WKPreferences_h + +#include <WebKit2/WKBase.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKPreferencesGetTypeID(); + +WK_EXPORT WKPreferencesRef WKPreferencesCreate(); +WK_EXPORT WKPreferencesRef WKPreferencesCreateWithIdentifier(WKStringRef identifier); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetJavaScriptEnabled(WKPreferencesRef preferences, bool javaScriptEnabled); +WK_EXPORT bool WKPreferencesGetJavaScriptEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetLoadsImagesAutomatically(WKPreferencesRef preferences, bool loadsImagesAutomatically); +WK_EXPORT bool WKPreferencesGetLoadsImagesAutomatically(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferences, bool offlineWebApplicationCacheEnabled); +WK_EXPORT bool WKPreferencesGetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetLocalStorageEnabled(WKPreferencesRef preferences, bool localStorageEnabled); +WK_EXPORT bool WKPreferencesGetLocalStorageEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetDatabasesEnabled(WKPreferencesRef preferences, bool databasesEnabled); +WK_EXPORT bool WKPreferencesGetDatabasesEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetXSSAuditorEnabled(WKPreferencesRef preferences, bool xssAuditorEnabled); +WK_EXPORT bool WKPreferencesGetXSSAuditorEnabled(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetFrameFlatteningEnabled(WKPreferencesRef preferences, bool frameFlatteningEnabled); +WK_EXPORT bool WKPreferencesGetFrameFlatteningEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetPluginsEnabled(WKPreferencesRef preferences, bool pluginsEnabled); +WK_EXPORT bool WKPreferencesGetPluginsEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetJavaEnabled(WKPreferencesRef preferences, bool javaEnabled); +WK_EXPORT bool WKPreferencesGetJavaEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetJavaScriptCanOpenWindowsAutomatically(WKPreferencesRef preferences, bool javaScriptCanOpenWindowsAutomatically); +WK_EXPORT bool WKPreferencesGetJavaScriptCanOpenWindowsAutomatically(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetHyperlinkAuditingEnabled(WKPreferencesRef preferences, bool hyperlinkAuditingEnabled); +WK_EXPORT bool WKPreferencesGetHyperlinkAuditingEnabled(WKPreferencesRef preferences); + +WK_EXPORT void WKPreferencesSetStandardFontFamily(WKPreferencesRef preferencesRef, WKStringRef family); +WK_EXPORT WKStringRef WKPreferencesCopyStandardFontFamily(WKPreferencesRef preferencesRef); + +WK_EXPORT void WKPreferencesSetFixedFontFamily(WKPreferencesRef preferencesRef, WKStringRef family); +WK_EXPORT WKStringRef WKPreferencesCopyFixedFontFamily(WKPreferencesRef preferencesRef); + +WK_EXPORT void WKPreferencesSetSerifFontFamily(WKPreferencesRef preferencesRef, WKStringRef family); +WK_EXPORT WKStringRef WKPreferencesCopySerifFontFamily(WKPreferencesRef preferencesRef); + +WK_EXPORT void WKPreferencesSetSansSerifFontFamily(WKPreferencesRef preferencesRef, WKStringRef family); +WK_EXPORT WKStringRef WKPreferencesCopySansSerifFontFamily(WKPreferencesRef preferencesRef); + +WK_EXPORT void WKPreferencesSetCursiveFontFamily(WKPreferencesRef preferencesRef, WKStringRef family); +WK_EXPORT WKStringRef WKPreferencesCopyCursiveFontFamily(WKPreferencesRef preferencesRef); + +WK_EXPORT void WKPreferencesSetFantasyFontFamily(WKPreferencesRef preferencesRef, WKStringRef family); +WK_EXPORT WKStringRef WKPreferencesCopyFantasyFontFamily(WKPreferencesRef preferencesRef); + +// Defaults to 16. +WK_EXPORT void WKPreferencesSetDefaultFontSize(WKPreferencesRef preferencesRef, uint32_t); +WK_EXPORT uint32_t WKPreferencesGetDefaultFontSize(WKPreferencesRef preferencesRef); + +// Defaults to 13. +WK_EXPORT void WKPreferencesSetDefaultFixedFontSize(WKPreferencesRef preferencesRef, uint32_t); +WK_EXPORT uint32_t WKPreferencesGetDefaultFixedFontSize(WKPreferencesRef preferencesRef); + +// Defaults to 0. +WK_EXPORT void WKPreferencesSetMinimumFontSize(WKPreferencesRef preferencesRef, uint32_t); +WK_EXPORT uint32_t WKPreferencesGetMinimumFontSize(WKPreferencesRef preferencesRef); + +WK_EXPORT void WKPreferencesSetDefaultTextEncodingName(WKPreferencesRef preferencesRef, WKStringRef name); +WK_EXPORT WKStringRef WKPreferencesCopyDefaultTextEncodingName(WKPreferencesRef preferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetPrivateBrowsingEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetPrivateBrowsingEnabled(WKPreferencesRef preferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetDeveloperExtrasEnabled(WKPreferencesRef preferencesRef, bool enabled); +WK_EXPORT bool WKPreferencesGetDeveloperExtrasEnabled(WKPreferencesRef preferencesRef); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetTextAreasAreResizable(WKPreferencesRef preferencesRef, bool resizable); +WK_EXPORT bool WKPreferencesGetTextAreasAreResizable(WKPreferencesRef preferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetTabsToLinks(WKPreferencesRef preferences, bool tabsToLinks); +WK_EXPORT bool WKPreferencesGetTabsToLinks(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetDNSPrefetchingEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetDNSPrefetchingEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetAuthorAndUserStylesEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetAuthorAndUserStylesEnabled(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetShouldPrintBackgrounds(WKPreferencesRef preferences, bool shouldPrintBackgrounds); +WK_EXPORT bool WKPreferencesGetShouldPrintBackgrounds(WKPreferencesRef preferences); + +#ifdef __cplusplus +} +#endif + +#endif /* WKPreferences_h */ diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h new file mode 100644 index 0000000..7408c8e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h @@ -0,0 +1,99 @@ +/* + * 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 WKPreferencesPrivate_h +#define WKPreferencesPrivate_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum WKFontSmoothingLevel { + kWKFontSmoothingLevelNoSubpixelAntiAliasing = 0, + kWKFontSmoothingLevelLight = 1, + kWKFontSmoothingLevelMedium = 2, + kWKFontSmoothingLevelStrong = 3, +#if defined(WIN32) || defined(_WIN32) + kWKFontSmoothingLevelWindows = 4, +#endif +}; +typedef enum WKFontSmoothingLevel WKFontSmoothingLevel; + +// Defaults to kWKFontSmoothingLevelMedium. +WK_EXPORT void WKPreferencesSetFontSmoothingLevel(WKPreferencesRef, WKFontSmoothingLevel); +WK_EXPORT WKFontSmoothingLevel WKPreferencesGetFontSmoothingLevel(WKPreferencesRef); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetAcceleratedCompositingEnabled(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetAcceleratedCompositingEnabled(WKPreferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetCompositingBordersVisible(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetCompositingBordersVisible(WKPreferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetCompositingRepaintCountersVisible(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetCompositingRepaintCountersVisible(WKPreferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetNeedsSiteSpecificQuirks(WKPreferencesRef, bool); +WK_EXPORT bool WKPreferencesGetNeedsSiteSpecificQuirks(WKPreferencesRef); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetForceFTPDirectoryListings(WKPreferencesRef preferences, bool force); +WK_EXPORT bool WKPreferencesGetForceFTPDirectoryListings(WKPreferencesRef preferences); + +// Defaults to the empty string. +WK_EXPORT void WKPreferencesSetFTPDirectoryTemplatePath(WKPreferencesRef preferences, WKStringRef path); +WK_EXPORT WKStringRef WKPreferencesCopyFTPDirectoryTemplatePath(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetWebArchiveDebugModeEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetWebArchiveDebugModeEnabled(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetLocalFileContentSniffingEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetLocalFileContentSniffingEnabled(WKPreferencesRef preferences); + +// Defaults to true. +WK_EXPORT void WKPreferencesSetPageCacheEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetPageCacheEnabled(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetPaginateDuringLayoutEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetPaginateDuringLayoutEnabled(WKPreferencesRef preferences); + +// Defaults to false. +WK_EXPORT void WKPreferencesSetDOMPasteAllowed(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetDOMPasteAllowed(WKPreferencesRef preferences); + +#ifdef __cplusplus +} +#endif + +#endif /* WKPreferencesPrivate_h */ + diff --git a/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp b/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp new file mode 100644 index 0000000..c72ee98 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp @@ -0,0 +1,71 @@ +/* + * 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 "WKProtectionSpace.h" + +#include "WebProtectionSpace.h" +#include "WKAPICast.h" + +using namespace WebKit; + +WKTypeID WKProtectionSpaceGetTypeID() +{ + return toAPI(WebProtectionSpace::APIType); +} + +WKStringRef WKProtectionSpaceCopyHost(WKProtectionSpaceRef protectionSpaceRef) +{ + return toCopiedAPI(toImpl(protectionSpaceRef)->host()); +} + +int WKProtectionSpaceGetPort(WKProtectionSpaceRef protectionSpaceRef) +{ + return toImpl(protectionSpaceRef)->port(); +} + +WKStringRef WKProtectionSpaceCopyRealm(WKProtectionSpaceRef protectionSpaceRef) +{ + return toCopiedAPI(toImpl(protectionSpaceRef)->realm()); +} + +bool WKProtectionSpaceGetIsProxy(WKProtectionSpaceRef protectionSpaceRef) +{ + return toImpl(protectionSpaceRef)->isProxy(); +} + +WKProtectionSpaceServerType WKProtectionSpaceGetServerType(WKProtectionSpaceRef protectionSpaceRef) +{ + return toAPI(toImpl(protectionSpaceRef)->serverType()); +} + +bool WKProtectionSpaceGetReceivesCredentialSecurely(WKProtectionSpaceRef protectionSpaceRef) +{ + return toImpl(protectionSpaceRef)->receivesCredentialSecurely(); +} + +WKProtectionSpaceAuthenticationScheme WKProtectionSpaceGetAuthenticationScheme(WKProtectionSpaceRef protectionSpaceRef) +{ + return toAPI(toImpl(protectionSpaceRef)->authenticationScheme()); +} diff --git a/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.h b/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.h new file mode 100644 index 0000000..c77d93b --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKProtectionSpace.h @@ -0,0 +1,50 @@ +/* + * 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 WKProtectionSpace_h +#define WKProtectionSpace_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKProtectionSpaceTypes.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKProtectionSpaceGetTypeID(); + +WK_EXPORT WKStringRef WKProtectionSpaceCopyHost(WKProtectionSpaceRef); +WK_EXPORT int WKProtectionSpaceGetPort(WKProtectionSpaceRef); +WK_EXPORT WKStringRef WKProtectionSpaceCopyRealm(WKProtectionSpaceRef); +WK_EXPORT bool WKProtectionSpaceGetIsProxy(WKProtectionSpaceRef); +WK_EXPORT WKProtectionSpaceServerType WKProtectionSpaceGetServerType(WKProtectionSpaceRef); +WK_EXPORT bool WKProtectionSpaceGetReceivesCredentialSecurely(WKProtectionSpaceRef); +WK_EXPORT WKProtectionSpaceAuthenticationScheme WKProtectionSpaceGetAuthenticationScheme(WKProtectionSpaceRef); + +#ifdef __cplusplus +} +#endif + +#endif // WKProtectionSpace_h diff --git a/Source/WebKit2/UIProcess/API/C/WKProtectionSpaceTypes.h b/Source/WebKit2/UIProcess/API/C/WKProtectionSpaceTypes.h new file mode 100644 index 0000000..fd1bd09 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKProtectionSpaceTypes.h @@ -0,0 +1,64 @@ +/* + * 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 WKProtectionSpaceTypes_h +#define WKProtectionSpaceTypes_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + kWKProtectionSpaceServerTypeHTTP = 1, + kWKProtectionSpaceServerTypeHTTPS, + kWKProtectionSpaceServerTypeFTP, + kWKProtectionSpaceServerTypeFTPS, + kWKProtectionSpaceProxyTypeHTTP, + kWKProtectionSpaceProxyTypeHTTPS, + kWKProtectionSpaceProxyTypeFTP, + kWKProtectionSpaceProxyTypeSOCKS, +}; +typedef uint32_t WKProtectionSpaceServerType; + +enum { + kWKProtectionSpaceAuthenticationSchemeDefault = 1, + kWKProtectionSpaceAuthenticationSchemeHTTPBasic, + kWKProtectionSpaceAuthenticationSchemeHTTPDigest, + kWKProtectionSpaceAuthenticationSchemeHTMLForm, + kWKProtectionSpaceAuthenticationSchemeNTLM, + kWKProtectionSpaceAuthenticationSchemeNegotiate, + kWKProtectionSpaceAuthenticationSchemeClientCertificateRequested, + kWKProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested, + kWKProtectionSpaceAuthenticationSchemeUnknown = 100, +}; +typedef uint32_t WKProtectionSpaceAuthenticationScheme; + +#ifdef __cplusplus +} +#endif + +#endif // WKProtectionSpaceTypes_h diff --git a/Source/WebKit2/UIProcess/API/C/WebKit2.h b/Source/WebKit2/UIProcess/API/C/WebKit2.h new file mode 100644 index 0000000..02a339f --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WebKit2.h @@ -0,0 +1,63 @@ +/* + * 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 WebKit2_h +#define WebKit2_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKType.h> + +#include <WebKit2/WKArray.h> +#include <WebKit2/WKBackForwardList.h> +#include <WebKit2/WKBackForwardListItem.h> +#include <WebKit2/WKContext.h> +#include <WebKit2/WKData.h> +#include <WebKit2/WKDictionary.h> +#include <WebKit2/WKError.h> +#include <WebKit2/WKFormSubmissionListener.h> +#include <WebKit2/WKFrame.h> +#include <WebKit2/WKFramePolicyListener.h> +#include <WebKit2/WKGeolocationManager.h> +#include <WebKit2/WKGeolocationPermissionRequest.h> +#include <WebKit2/WKGeolocationPosition.h> +#include <WebKit2/WKMutableArray.h> +#include <WebKit2/WKMutableDictionary.h> +#include <WebKit2/WKNavigationData.h> +#include <WebKit2/WKNumber.h> +#include <WebKit2/WKOpenPanelParameters.h> +#include <WebKit2/WKOpenPanelResultListener.h> +#include <WebKit2/WKPage.h> +#include <WebKit2/WKPageGroup.h> +#include <WebKit2/WKPreferences.h> +#include <WebKit2/WKString.h> +#include <WebKit2/WKURL.h> +#include <WebKit2/WKURLRequest.h> +#include <WebKit2/WKURLResponse.h> + +#if !(defined(__APPLE__) && __APPLE__) || (defined(__OBJC__) && __OBJC__) +#include <WebKit2/WKView.h> +#endif + +#endif /* WebKit2_h */ diff --git a/Source/WebKit2/UIProcess/API/C/qt/WKNativeEvent.h b/Source/WebKit2/UIProcess/API/C/qt/WKNativeEvent.h new file mode 100644 index 0000000..78df4ac --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/qt/WKNativeEvent.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2010 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 WKNativeEvent_h +#define WKNativeEvent_h + +// a Qt specific WKNativeEvent.h file is needed because that the use of __APPLE__ +// in original WKNativeEvent.h file breaks Qt build in MacOS + +class QEvent; +typedef const QEvent* WKNativeEventPtr; + +#endif /* WKNativeEvent_h */ diff --git a/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h b/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h new file mode 100644 index 0000000..6acb1a6 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h @@ -0,0 +1,41 @@ +/* + * 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 WKAPICastWin_h +#define WKAPICastWin_h + +#ifndef WKAPICast_h +#error "Please #include \"WKAPICast.h\" instead of this file directly." +#endif + +namespace WebKit { + +class WebView; + +WK_ADD_API_MAPPING(WKViewRef, WebView) + +} + +#endif // WKAPICastWin_h diff --git a/Source/WebKit2/UIProcess/API/C/win/WKBaseWin.h b/Source/WebKit2/UIProcess/API/C/win/WKBaseWin.h new file mode 100644 index 0000000..e2ee9a7 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKBaseWin.h @@ -0,0 +1,35 @@ +/* + * 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 WKBaseWin_h +#define WKBaseWin_h + +#ifndef WKBase_h +#error "Please #include \"WKBase.h\" instead of this file directly." +#endif + +typedef const struct OpaqueWKView* WKViewRef; + +#endif /* WKBaseWin_h */ diff --git a/Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h b/Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h new file mode 100644 index 0000000..c8a9c34 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKContextPrivateWin.h @@ -0,0 +1,47 @@ +/* + * 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 WKContextPrivateWin_h +#define WKContextPrivateWin_h + +#include <WebKit2/WKBase.h> +#include <WebKit2/WKContext.h> + +#ifndef __cplusplus +#include <stdbool.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// Defaults to true. +WK_EXPORT void WKContextSetShouldPaintNativeControls(WKContextRef, bool); + +#ifdef __cplusplus +} +#endif + +#endif /* WKContextPrivateWin_h */ diff --git a/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp b/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp new file mode 100644 index 0000000..9906c81 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKContextWin.cpp @@ -0,0 +1,37 @@ +/* + * 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 "WKContext.h" +#include "WKContextPrivateWin.h" + +#include "WKAPICast.h" +#include "WebContext.h" + +using namespace WebKit; + +void WKContextSetShouldPaintNativeControls(WKContextRef contextRef, bool b) +{ + toImpl(contextRef)->setShouldPaintNativeControls(b); +} diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.cpp b/Source/WebKit2/UIProcess/API/C/win/WKView.cpp new file mode 100644 index 0000000..612661e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKView.cpp @@ -0,0 +1,72 @@ +/* + * 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 "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().releaseRef()); +} + +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) +{ + toImpl(viewRef)->setInitialFocus(forward); +} diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.h b/Source/WebKit2/UIProcess/API/C/win/WKView.h new file mode 100644 index 0000000..f4226cd --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKView.h @@ -0,0 +1,53 @@ +/* + * 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 <windows.h> + +#ifdef __cplusplus +extern "C" { +#endif + +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 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); + +#ifdef __cplusplus +} +#endif + +#endif /* WKView_h */ diff --git a/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp b/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp new file mode 100644 index 0000000..00c3595 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp @@ -0,0 +1,36 @@ +/* + * 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 "WKViewPrivate.h" + +#include "WKAPICast.h" +#include "WebView.h" + +using namespace WebKit; + +void WKViewSetOverrideCursor(WKViewRef viewRef, HCURSOR overrideCursor) +{ + toImpl(viewRef)->setOverrideCursor(overrideCursor); +} diff --git a/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.h b/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.h new file mode 100644 index 0000000..5f89fd4 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKViewPrivate.h @@ -0,0 +1,42 @@ +/* + * 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 WKViewPrivate_h +#define WKViewPrivate_h + +#include <WebKit2/WKBase.h> +#include <windows.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT void WKViewSetOverrideCursor(WKViewRef viewRef, HCURSOR overrideCursor); + +#ifdef __cplusplus +} +#endif + +#endif /* WKViewPrivate_h */ |