summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/Shared/API/c
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/Shared/API/c')
-rw-r--r--Source/WebKit2/Shared/API/c/WKBase.h2
-rw-r--r--Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp5
-rw-r--r--Source/WebKit2/Shared/API/c/WKMutableDictionary.h1
-rw-r--r--Source/WebKit2/Shared/API/c/WKString.cpp5
-rw-r--r--Source/WebKit2/Shared/API/c/WKString.h1
-rw-r--r--Source/WebKit2/Shared/API/c/WKURL.cpp10
-rw-r--r--Source/WebKit2/Shared/API/c/WKURL.h4
-rw-r--r--Source/WebKit2/Shared/API/c/cf/WKErrorCF.cpp45
-rw-r--r--Source/WebKit2/Shared/API/c/cf/WKErrorCF.h43
-rw-r--r--Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp10
-rw-r--r--Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp12
-rw-r--r--Source/WebKit2/Shared/API/c/cg/WKImageCG.h3
-rw-r--r--Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.h1
-rw-r--r--Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.mm6
-rw-r--r--Source/WebKit2/Shared/API/c/win/WKBaseWin.h1
-rw-r--r--Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp5
-rw-r--r--Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.h1
17 files changed, 152 insertions, 3 deletions
diff --git a/Source/WebKit2/Shared/API/c/WKBase.h b/Source/WebKit2/Shared/API/c/WKBase.h
index 900cd51..1baa872 100644
--- a/Source/WebKit2/Shared/API/c/WKBase.h
+++ b/Source/WebKit2/Shared/API/c/WKBase.h
@@ -84,8 +84,10 @@ typedef const struct OpaqueWKFramePolicyListener* WKFramePolicyListenerRef;
typedef const struct OpaqueWKGeolocationManager* WKGeolocationManagerRef;
typedef const struct OpaqueWKGeolocationPermissionRequest* WKGeolocationPermissionRequestRef;
typedef const struct OpaqueWKGeolocationPosition* WKGeolocationPositionRef;
+typedef const struct OpaqueWKIconDatabase* WKIconDatabaseRef;
typedef const struct OpaqueWKInspector* WKInspectorRef;
typedef const struct OpaqueWKKeyValueStorageManager* WKKeyValueStorageManagerRef;
+typedef const struct OpaqueWKMediaCacheManager* WKMediaCacheManagerRef;
typedef const struct OpaqueWKNavigationData* WKNavigationDataRef;
typedef const struct OpaqueWKOpenPanelParameters* WKOpenPanelParametersRef;
typedef const struct OpaqueWKOpenPanelResultListener* WKOpenPanelResultListenerRef;
diff --git a/Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp b/Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp
index 0d96ca1..ecd680c 100644
--- a/Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp
+++ b/Source/WebKit2/Shared/API/c/WKMutableDictionary.cpp
@@ -51,3 +51,8 @@ bool WKDictionarySetItem(WKMutableDictionaryRef dictionaryRef, WKStringRef keyRe
{
return toImpl(dictionaryRef)->set(toImpl(keyRef)->string(), toImpl(itemRef));
}
+
+void WKDictionaryRemoveItem(WKMutableDictionaryRef dictionaryRef, WKStringRef keyRef)
+{
+ toImpl(dictionaryRef)->remove(toImpl(keyRef)->string());
+}
diff --git a/Source/WebKit2/Shared/API/c/WKMutableDictionary.h b/Source/WebKit2/Shared/API/c/WKMutableDictionary.h
index 467c1d4..2459f91 100644
--- a/Source/WebKit2/Shared/API/c/WKMutableDictionary.h
+++ b/Source/WebKit2/Shared/API/c/WKMutableDictionary.h
@@ -42,6 +42,7 @@ WK_EXPORT bool WKDictionaryIsMutable(WKDictionaryRef dictionary);
WK_EXPORT bool WKDictionaryAddItem(WKMutableDictionaryRef dictionary, WKStringRef key, WKTypeRef item);
WK_EXPORT bool WKDictionarySetItem(WKMutableDictionaryRef dictionary, WKStringRef key, WKTypeRef item);
+WK_EXPORT void WKDictionaryRemoveItem(WKMutableDictionaryRef dictionary, WKStringRef key);
#ifdef __cplusplus
}
diff --git a/Source/WebKit2/Shared/API/c/WKString.cpp b/Source/WebKit2/Shared/API/c/WKString.cpp
index 72841a4..0c388c6 100644
--- a/Source/WebKit2/Shared/API/c/WKString.cpp
+++ b/Source/WebKit2/Shared/API/c/WKString.cpp
@@ -67,6 +67,11 @@ bool WKStringIsEqualToUTF8CString(WKStringRef aRef, const char* b)
return toImpl(aRef)->equalToUTF8String(b);
}
+bool WKStringIsEqualToUTF8CStringIgnoringCase(WKStringRef aRef, const char* b)
+{
+ return toImpl(aRef)->equalToUTF8StringIgnoringCase(b);
+}
+
WKStringRef WKStringCreateWithJSString(JSStringRef jsStringRef)
{
RefPtr<WebString> webString = WebString::create(jsStringRef);
diff --git a/Source/WebKit2/Shared/API/c/WKString.h b/Source/WebKit2/Shared/API/c/WKString.h
index e79839e..dffcab2 100644
--- a/Source/WebKit2/Shared/API/c/WKString.h
+++ b/Source/WebKit2/Shared/API/c/WKString.h
@@ -47,6 +47,7 @@ WK_EXPORT size_t WKStringGetUTF8CString(WKStringRef string, char* buffer, size_t
WK_EXPORT bool WKStringIsEqual(WKStringRef a, WKStringRef b);
WK_EXPORT bool WKStringIsEqualToUTF8CString(WKStringRef a, const char* b);
+WK_EXPORT bool WKStringIsEqualToUTF8CStringIgnoringCase(WKStringRef a, const char* b);
#ifdef __cplusplus
}
diff --git a/Source/WebKit2/Shared/API/c/WKURL.cpp b/Source/WebKit2/Shared/API/c/WKURL.cpp
index 6b7e567..dacd589 100644
--- a/Source/WebKit2/Shared/API/c/WKURL.cpp
+++ b/Source/WebKit2/Shared/API/c/WKURL.cpp
@@ -49,3 +49,13 @@ bool WKURLIsEqual(WKURLRef a, WKURLRef b)
{
return toImpl(a)->string() == toImpl(b)->string();
}
+
+WKStringRef WKURLCopyHostName(WKURLRef url)
+{
+ return toCopiedAPI(toImpl(url)->host());
+}
+
+WKStringRef WKURLCopyScheme(WKURLRef url)
+{
+ return toCopiedAPI(toImpl(url)->protocol());
+}
diff --git a/Source/WebKit2/Shared/API/c/WKURL.h b/Source/WebKit2/Shared/API/c/WKURL.h
index 738bce5..f599f16 100644
--- a/Source/WebKit2/Shared/API/c/WKURL.h
+++ b/Source/WebKit2/Shared/API/c/WKURL.h
@@ -36,7 +36,9 @@ WK_EXPORT WKTypeID WKURLGetTypeID();
WK_EXPORT WKURLRef WKURLCreateWithUTF8CString(const char* string);
-WK_EXPORT WKStringRef WKURLCopyString(WKURLRef URL);
+WK_EXPORT WKStringRef WKURLCopyString(WKURLRef url);
+WK_EXPORT WKStringRef WKURLCopyHostName(WKURLRef url);
+WK_EXPORT WKStringRef WKURLCopyScheme(WKURLRef url);
WK_EXPORT bool WKURLIsEqual(WKURLRef a, WKURLRef b);
diff --git a/Source/WebKit2/Shared/API/c/cf/WKErrorCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKErrorCF.cpp
new file mode 100644
index 0000000..95a1b43
--- /dev/null
+++ b/Source/WebKit2/Shared/API/c/cf/WKErrorCF.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WKErrorCF.h"
+
+#include "WKAPICast.h"
+#include "WebError.h"
+
+using namespace WebCore;
+using namespace WebKit;
+
+WKErrorRef WKErrorCreateWithCFError(CFErrorRef cfError)
+{
+ RefPtr<WebError> error = WebError::create(ResourceError(cfError));
+ return toAPI(error.release().releaseRef());
+}
+
+CFErrorRef WKErrorCopyCFError(CFAllocatorRef alloc, WKErrorRef error)
+{
+ RetainPtr<CFErrorRef> cfError = toImpl(error)->platformError().cfError();
+ return cfError.leakRef();
+}
diff --git a/Source/WebKit2/Shared/API/c/cf/WKErrorCF.h b/Source/WebKit2/Shared/API/c/cf/WKErrorCF.h
new file mode 100644
index 0000000..298f7c2
--- /dev/null
+++ b/Source/WebKit2/Shared/API/c/cf/WKErrorCF.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 WKErrorCF_h
+#define WKErrorCF_h
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKErrorRef WKErrorCreateWithCFError(CFErrorRef error);
+WK_EXPORT CFErrorRef WKErrorCopyCFError(CFAllocatorRef alloc, WKErrorRef error);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKErrorCF_h */
diff --git a/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp
index 42473c8..10b4941 100644
--- a/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp
+++ b/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp
@@ -33,6 +33,9 @@ using namespace WebKit;
WKURLResponseRef WKURLResponseCreateWithCFURLResponse(CFURLResponseRef urlResponse)
{
+ if (!urlResponse)
+ return 0;
+
CFURLResponseRef copiedURLResponse = CFURLResponseCreateCopy(kCFAllocatorDefault, urlResponse);
RefPtr<WebURLResponse> response = WebURLResponse::create(copiedURLResponse);
return toAPI(response.release().releaseRef());
@@ -40,5 +43,12 @@ WKURLResponseRef WKURLResponseCreateWithCFURLResponse(CFURLResponseRef urlRespon
CFURLResponseRef WKURLResponseCopyCFURLResponse(CFAllocatorRef alloc, WKURLResponseRef urlResponse)
{
+ if (!urlResponse)
+ return 0;
+
+ PlatformResponse platformURLResponse = toImpl(urlResponse)->platformResponse();
+ if (!platformURLResponse)
+ return 0;
+
return CFURLResponseCreateCopy(alloc, toImpl(urlResponse)->platformResponse());
}
diff --git a/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp b/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp
index 61b5f17..7af747e 100644
--- a/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp
+++ b/Source/WebKit2/Shared/API/c/cg/WKImageCG.cpp
@@ -36,6 +36,14 @@ using namespace WebCore;
CGImageRef WKImageCreateCGImage(WKImageRef imageRef)
{
- OwnPtr<GraphicsContext> sourceContext = toImpl(imageRef)->bitmap()->createGraphicsContext();
- return CGBitmapContextCreateImage(sourceContext->platformContext());
+ return toImpl(imageRef)->bitmap()->makeCGImageCopy().leakRef();
+}
+
+WKImageRef WKImageCreateFromCGImage(CGImageRef imageRef, WKImageOptions options)
+{
+ IntSize imageSize(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef));
+ RefPtr<WebImage> webImage = WebImage::create(imageSize, toImageOptions(options));
+ OwnPtr<GraphicsContext> graphicsContext = webImage->bitmap()->createGraphicsContext();
+ CGContextDrawImage(graphicsContext->platformContext(), CGRectMake(0, 0, imageSize.width(), imageSize.height()), imageRef);
+ return toAPI(webImage.release().leakRef());
}
diff --git a/Source/WebKit2/Shared/API/c/cg/WKImageCG.h b/Source/WebKit2/Shared/API/c/cg/WKImageCG.h
index 7705c31..800b02e 100644
--- a/Source/WebKit2/Shared/API/c/cg/WKImageCG.h
+++ b/Source/WebKit2/Shared/API/c/cg/WKImageCG.h
@@ -28,6 +28,7 @@
#include <CoreGraphics/CGImage.h>
#include <WebKit2/WKBase.h>
+#include <WebKit2/WKImage.h>
#ifdef __cplusplus
extern "C" {
@@ -35,6 +36,8 @@ extern "C" {
WK_EXPORT CGImageRef WKImageCreateCGImage(WKImageRef image);
+WK_EXPORT WKImageRef WKImageCreateFromCGImage(CGImageRef imageRef, WKImageOptions options);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.h b/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.h
index 7d44478..d098f34 100644
--- a/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.h
+++ b/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.h
@@ -33,6 +33,7 @@
extern "C" {
#endif
+WK_EXPORT WKCertificateInfoRef WKCertificateInfoCreateWithCertficateChain(CFArrayRef certificateChain);
WK_EXPORT CFArrayRef WKCertificateInfoGetCertificateChain(WKCertificateInfoRef certificateInfo);
#ifdef __cplusplus
diff --git a/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.mm b/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.mm
index a2f348d..34dd431 100644
--- a/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.mm
+++ b/Source/WebKit2/Shared/API/c/mac/WKCertificateInfoMac.mm
@@ -31,6 +31,12 @@
using namespace WebKit;
+WKCertificateInfoRef WKCertificateInfoCreateWithCertficateChain(CFArrayRef certificateChain)
+{
+ RefPtr<WebCertificateInfo> certificateInfo = WebCertificateInfo::create(PlatformCertificateInfo(certificateChain));
+ return toAPI(certificateInfo.release().leakRef());
+}
+
CFArrayRef WKCertificateInfoGetCertificateChain(WKCertificateInfoRef certificateInfoRef)
{
return toImpl(certificateInfoRef)->platformCertificateInfo().certificateChain();
diff --git a/Source/WebKit2/Shared/API/c/win/WKBaseWin.h b/Source/WebKit2/Shared/API/c/win/WKBaseWin.h
index e2ee9a7..fdd4607 100644
--- a/Source/WebKit2/Shared/API/c/win/WKBaseWin.h
+++ b/Source/WebKit2/Shared/API/c/win/WKBaseWin.h
@@ -31,5 +31,6 @@
#endif
typedef const struct OpaqueWKView* WKViewRef;
+typedef const struct OpaqueWKEditCommand* WKEditCommandRef;
#endif /* WKBaseWin_h */
diff --git a/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp b/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp
index ada20ef..674f94e 100644
--- a/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp
+++ b/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.cpp
@@ -31,6 +31,11 @@
using namespace WebKit;
+WKCertificateInfoRef WKCertificateInfoCreateWithCertificate(PCCERT_CONTEXT certificate)
+{
+ return toAPI(WebCertificateInfo::create(PlatformCertificateInfo(certificate)).leakRef());
+}
+
size_t WKCertificateInfoGetCertificateChainLength(WKCertificateInfoRef certificateInfoRef)
{
return toImpl(certificateInfoRef)->platformCertificateInfo().certificateChain().size();
diff --git a/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.h b/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.h
index 0fcd818..a3ee9e5 100644
--- a/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.h
+++ b/Source/WebKit2/Shared/API/c/win/WKCertificateInfoWin.h
@@ -33,6 +33,7 @@
extern "C" {
#endif
+WK_EXPORT WKCertificateInfoRef WKCertificateInfoCreateWithCertificate(PCCERT_CONTEXT certificate);
WK_EXPORT size_t WKCertificateInfoGetCertificateChainLength(WKCertificateInfoRef certificateInfo);
WK_EXPORT PCCERT_CONTEXT WKCertificateInfoGetCertificateContextAtIndex(WKCertificateInfoRef certificateInfo, size_t index);