Commit 0664edbb authored by weinig@apple.com's avatar weinig@apple.com

Fix for https://bugs.webkit.org/show_bug.cgi?id=37347

Don't use CF types in the new C API

Reviewed by Anders Carlsson.

Replace all uses of CF types in the C API.
- Replace CFStringRef with WKStringRef.
- Replace CFURLRef with WKURLRef.

* WebKit2.xcodeproj/project.pbxproj: Add new files.

* Shared/KURLWrapper.h: Added. RefCounted wrapper around KURL.
* UIProcess/API/C/WKAPICast.h: Add new conversions.
* UIProcess/API/C/WKBase.h: Add new types.
* UIProcess/API/C/WKFrame.cpp:
* UIProcess/API/C/WKFrame.h: 
* UIProcess/API/C/WKPage.cpp:
* UIProcess/API/C/WKPage.h:
Replace uses of CF types with WK equivalents.

* UIProcess/API/C/WKString.cpp: Added.
* UIProcess/API/C/WKString.h: Added.
Represents a WebCore::StringImpl*.

* UIProcess/API/C/WKURL.cpp: Added.
* UIProcess/API/C/WKURL.h: Added.
Represents a WebKit::KURLWrapper*.

* UIProcess/API/C/cf: Added.
* UIProcess/API/C/cf/WKStringCF.cpp: Added.
* UIProcess/API/C/cf/WKStringCF.h: Added.
* UIProcess/API/C/cf/WKURLCF.cpp: Added.
* UIProcess/API/C/cf/WKURLCF.h: Added.
CoreFoundation conversion files. Allows converting
 WKStringRef <-> CFStringRef
 WKURLRef <-> CFURLRef

* UIProcess/ScriptReturnValueCallback.cpp:
(WebKit::ScriptReturnValueCallback::performCallbackWithReturnValue):
* UIProcess/ScriptReturnValueCallback.h:
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::didStartProvisionalLoad):
(WebKit::WebFrameProxy::didCommitLoad):
* UIProcess/WebFrameProxy.h:
(WebKit::WebFrameProxy::url):
(WebKit::WebFrameProxy::provisionalURL):
* UIProcess/WebLoaderClient.cpp:
(WebKit::WebLoaderClient::didReceiveTitleForFrame):
* UIProcess/WebLoaderClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::close):
(WebKit::WebPageProxy::didReceiveTitleForFrame):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::decidePolicyForMIMEType):
(WebKit::WebPageProxy::runJavaScriptAlert):
(WebKit::WebPageProxy::didRunJavaScriptInMainFrame):
(WebKit::WebPageProxy::processDidExit):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::pageTitle):
(WebKit::WebPageProxy::urlAtProcessExit):
* UIProcess/WebPolicyClient.cpp:
(WebKit::WebPolicyClient::decidePolicyForNavigationAction):
(WebKit::WebPolicyClient::decidePolicyForNewWindowAction):
(WebKit::WebPolicyClient::decidePolicyForMIMEType):
* UIProcess/WebPolicyClient.h:
* UIProcess/WebUIClient.cpp:
(WebKit::WebUIClient::runJavaScriptAlert):
* UIProcess/WebUIClient.h:
Don't use CF types internally at all.

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::frameLoaderDestroyed):
Fix typo.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@57352 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c7878618
2010-04-09 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
Fix for https://bugs.webkit.org/show_bug.cgi?id=37347
Don't use CF types in the new C API
Replace all uses of CF types in the C API.
- Replace CFStringRef with WKStringRef.
- Replace CFURLRef with WKURLRef.
* WebKit2.xcodeproj/project.pbxproj: Add new files.
* Shared/KURLWrapper.h: Added. RefCounted wrapper around KURL.
* UIProcess/API/C/WKAPICast.h: Add new conversions.
* UIProcess/API/C/WKBase.h: Add new types.
* UIProcess/API/C/WKFrame.cpp:
* UIProcess/API/C/WKFrame.h:
* UIProcess/API/C/WKPage.cpp:
* UIProcess/API/C/WKPage.h:
Replace uses of CF types with WK equivalents.
* UIProcess/API/C/WKString.cpp: Added.
* UIProcess/API/C/WKString.h: Added.
Represents a WebCore::StringImpl*.
* UIProcess/API/C/WKURL.cpp: Added.
* UIProcess/API/C/WKURL.h: Added.
Represents a WebKit::KURLWrapper*.
* UIProcess/API/C/cf: Added.
* UIProcess/API/C/cf/WKStringCF.cpp: Added.
* UIProcess/API/C/cf/WKStringCF.h: Added.
* UIProcess/API/C/cf/WKURLCF.cpp: Added.
* UIProcess/API/C/cf/WKURLCF.h: Added.
CoreFoundation conversion files. Allows converting
WKStringRef <-> CFStringRef
WKURLRef <-> CFURLRef
* UIProcess/ScriptReturnValueCallback.cpp:
(WebKit::ScriptReturnValueCallback::performCallbackWithReturnValue):
* UIProcess/ScriptReturnValueCallback.h:
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::didStartProvisionalLoad):
(WebKit::WebFrameProxy::didCommitLoad):
* UIProcess/WebFrameProxy.h:
(WebKit::WebFrameProxy::url):
(WebKit::WebFrameProxy::provisionalURL):
* UIProcess/WebLoaderClient.cpp:
(WebKit::WebLoaderClient::didReceiveTitleForFrame):
* UIProcess/WebLoaderClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::close):
(WebKit::WebPageProxy::didReceiveTitleForFrame):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::decidePolicyForMIMEType):
(WebKit::WebPageProxy::runJavaScriptAlert):
(WebKit::WebPageProxy::didRunJavaScriptInMainFrame):
(WebKit::WebPageProxy::processDidExit):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::pageTitle):
(WebKit::WebPageProxy::urlAtProcessExit):
* UIProcess/WebPolicyClient.cpp:
(WebKit::WebPolicyClient::decidePolicyForNavigationAction):
(WebKit::WebPolicyClient::decidePolicyForNewWindowAction):
(WebKit::WebPolicyClient::decidePolicyForMIMEType):
* UIProcess/WebPolicyClient.h:
* UIProcess/WebUIClient.cpp:
(WebKit::WebUIClient::runJavaScriptAlert):
* UIProcess/WebUIClient.h:
Don't use CF types internally at all.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::frameLoaderDestroyed):
Fix typo.
2010-04-08 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
......
/*
* 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 KURLWrapper_h
#define KURLWrapper_h
#include <WebCore/KURL.h>
#include <wtf/RefCounted.h>
#include <wtf/PassRefPtr.h>
namespace WebKit {
class KURLWrapper : public RefCounted<KURLWrapper> {
public:
static PassRefPtr<KURLWrapper> create(const WebCore::KURL& url)
{
return adoptRef(new KURLWrapper(url));
}
const WebCore::KURL& url() const { return m_url; }
private:
KURLWrapper(const WebCore::KURL& url)
: m_url(url)
{
}
WebCore::KURL m_url;
};
} // namespace WebKit
#endif // KURLWrapper_h
......@@ -32,6 +32,10 @@
#include "WKAPICastWin.h"
#endif
namespace WebCore {
class StringImpl;
}
namespace WebKit {
class WebContext;
class WebFramePolicyListenerProxy;
......@@ -39,6 +43,7 @@ namespace WebKit {
class WebPageNamespace;
class WebPageProxy;
class WebPreferences;
class KURLWrapper;
}
/* Opaque typing convenience methods */
......@@ -103,4 +108,24 @@ inline WKPreferencesRef toRef(WebKit::WebPreferences* p)
return reinterpret_cast<WKPreferencesRef>(p);
}
inline WebCore::StringImpl* toWK(WKStringRef s)
{
return reinterpret_cast<WebCore::StringImpl*>(s);
}
inline WKStringRef toRef(WebCore::StringImpl* s)
{
return reinterpret_cast<WKStringRef>(s);
}
inline WebKit::KURLWrapper* toWK(WKURLRef u)
{
return reinterpret_cast<WebKit::KURLWrapper*>(u);
}
inline WKURLRef toRef(WebKit::KURLWrapper* u)
{
return reinterpret_cast<WKURLRef>(u);
}
#endif // WKAPICast_h
......@@ -36,6 +36,8 @@ typedef struct OpaqueWKContext* WKContextRef;
typedef struct OpaqueWKPageNamespace* WKPageNamespaceRef;
typedef struct OpaqueWKFramePolicyListener* WKFramePolicyListenerRef;
typedef struct OpaqueWKPreferencesRef* WKPreferencesRef;
typedef struct OpaqueWKStringRef* WKStringRef;
typedef struct OpaqueWKURLRef* WKURLRef;
#define WK_EXPORT
......
......@@ -52,16 +52,16 @@ WKFrameLoadState WKFrameGetFrameLoadState(WKFrameRef frameRef)
return kWKFrameLoadStateFinished;
}
CFURLRef WKFrameGetProvisionalURL(WKFrameRef frameRef)
WKURLRef WKFrameGetProvisionalURL(WKFrameRef frameRef)
{
WebFrameProxy* frame = toWK(frameRef);
return frame->provisionalURL();
return toRef(frame->provisionalURL());
}
CFURLRef WKFrameGetURL(WKFrameRef frameRef)
WKURLRef WKFrameGetURL(WKFrameRef frameRef)
{
WebFrameProxy* frame = toWK(frameRef);
return frame->url();
return toRef(frame->url());
}
WKFrameRef WKFrameRetain(WKFrameRef frameRef)
......
......@@ -46,8 +46,8 @@ typedef enum WKFrameLoadState WKFrameLoadState;
WK_EXPORT bool WKFrameIsMainFrame(WKFrameRef frame);
WK_EXPORT WKFrameLoadState WKFrameGetFrameLoadState(WKFrameRef frame);
WK_EXPORT CFURLRef WKFrameGetProvisionalURL(WKFrameRef frame);
WK_EXPORT CFURLRef WKFrameGetURL(WKFrameRef frame);
WK_EXPORT WKURLRef WKFrameGetProvisionalURL(WKFrameRef frame);
WK_EXPORT WKURLRef WKFrameGetURL(WKFrameRef frame);
WK_EXPORT WKFrameRef WKFrameRetain(WKFrameRef frame);
WK_EXPORT void WKFrameRelease(WKFrameRef frame);
......
......@@ -39,9 +39,9 @@ WKPageNamespaceRef WKPageGetPageNamespace(WKPageRef pageRef)
return toRef(toWK(pageRef)->pageNamespace());
}
void WKPageLoadURL(WKPageRef pageRef, CFURLRef url)
void WKPageLoadURL(WKPageRef pageRef, WKURLRef URLRef)
{
toWK(pageRef)->loadURL(url);
toWK(pageRef)->loadURL(toWK(URLRef)->url());
}
void WKPageStopLoading(WKPageRef pageRef)
......@@ -89,9 +89,9 @@ bool WKPageCanGoBack(WKPageRef pageRef)
return toWK(pageRef)->canGoBack();
}
CFStringRef WKPageGetTitle(WKPageRef pageRef)
WKStringRef WKPageGetTitle(WKPageRef pageRef)
{
return toWK(pageRef)->pageTitle();
return toRef(toWK(pageRef)->pageTitle().impl());
}
WKFrameRef WKPageGetMainFrame(WKPageRef pageRef)
......@@ -123,28 +123,28 @@ void WKPageSetPageUIClient(WKPageRef pageRef, WKPageUIClient * wkClient)
}
#if __BLOCKS__
static void callBlockAndRelease(void *context, CFStringRef resultValue)
static void callBlockAndRelease(void* context, WKStringRef resultValue)
{
void (^block)(CFStringRef) = (void (^ReturnValueBlockType)(CFStringRef))context;
void (^block)(WKStringRef) = (void (^ReturnValueBlockType)(WKStringRef))context;
block(resultValue);
Block_release(block);
}
static void disposeBlock(void *context)
static void disposeBlock(void* context)
{
void (^block)(CFStringRef) = (void (^ReturnValueBlockType)(CFStringRef))context;
void (^block)(WKStringRef) = (void (^ReturnValueBlockType)(WKStringRef))context;
Block_release(block);
}
void WKPageRunJavaScriptInMainFrame(WKPageRef pageRef, CFStringRef script, void (^returnValueBlock)(CFStringRef))
void WKPageRunJavaScriptInMainFrame(WKPageRef pageRef, WKStringRef scriptRef, void (^returnValueBlock)(WKStringRef))
{
WKPageRunJavaScriptInMainFrame_f(pageRef, script, Block_copy(returnValueBlock), callBlockAndRelease, disposeBlock);
WKPageRunJavaScriptInMainFrame_f(pageRef, scriptRef, Block_copy(returnValueBlock), callBlockAndRelease, disposeBlock);
}
#endif
void WKPageRunJavaScriptInMainFrame_f(WKPageRef pageRef, CFStringRef script, void *context, void (*returnValueCallback)(void*, CFStringRef), void (*disposeContextCallback)(void*))
void WKPageRunJavaScriptInMainFrame_f(WKPageRef pageRef, WKStringRef scriptRef, void* context, void (*returnValueCallback)(void*, WKStringRef), void (*disposeContextCallback)(void*))
{
toWK(pageRef)->runJavaScriptInMainFrame(WebCore::String(script), ScriptReturnValueCallback::create(context, returnValueCallback, disposeContextCallback));
toWK(pageRef)->runJavaScriptInMainFrame(toWK(scriptRef), ScriptReturnValueCallback::create(context, returnValueCallback, disposeContextCallback));
}
WKPageRef WKPageRetain(WKPageRef pageRef)
......
......@@ -44,7 +44,7 @@ typedef void (*WKPageDidFailProvisionalLoadWithErrorForFrameCallback)(WKPageRef
typedef void (*WKPageDidCommitLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, const void *clientInfo);
typedef void (*WKPageDidFinishLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, const void *clientInfo);
typedef void (*WKPageDidFailLoadWithErrorForFrameCallback)(WKPageRef page, WKFrameRef frame, const void *clientInfo); // FIXME: Add WKErrorRef.
typedef void (*WKPageDidReceiveTitleForFrameCallback)(WKPageRef page, CFStringRef title, WKFrameRef frame, const void *clientInfo);
typedef void (*WKPageDidReceiveTitleForFrameCallback)(WKPageRef page, WKStringRef title, WKFrameRef frame, const void *clientInfo);
typedef void (*WKPageDidFirstLayoutForFrame)(WKPageRef page, WKFrameRef frame, const void *clientInfo);
typedef void (*WKPageDidFirstVisuallyNonEmptyLayoutForFrame)(WKPageRef page, WKFrameRef frame, const void *clientInfo);
......@@ -84,9 +84,9 @@ typedef struct WKPageLoaderClient WKPageLoaderClient;
// Policy Client.
typedef void (*WKPageDecidePolicyForNavigationActionCallback)(WKPageRef page, uint32_t navigationType, CFURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo);
typedef void (*WKPageDecidePolicyForNewWindowActionCallback)(WKPageRef page, uint32_t navigationType, CFURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo);
typedef void (*WKPageDecidePolicyForMIMETypeCallback)(WKPageRef page, CFStringRef MIMEType, CFURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo);
typedef void (*WKPageDecidePolicyForNavigationActionCallback)(WKPageRef page, uint32_t navigationType, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo);
typedef void (*WKPageDecidePolicyForNewWindowActionCallback)(WKPageRef page, uint32_t navigationType, 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;
......@@ -101,7 +101,7 @@ typedef struct WKPagePolicyClient WKPagePolicyClient;
typedef WKPageRef (*WKPageCreateNewPageCallback)(WKPageRef page, const void *clientInfo);
typedef void (*WKPageShowPageCallback)(WKPageRef page, const void *clientInfo);
typedef void (*WKPageCloseCallback)(WKPageRef page, const void *clientInfo);
typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, CFStringRef alertText, WKFrameRef frame, const void *clientInfo);
typedef void (*WKPageRunJavaScriptAlertCallback)(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void *clientInfo);
struct WKPageUIClient {
int version;
......@@ -115,7 +115,7 @@ typedef struct WKPageUIClient WKPageUIClient;
WK_EXPORT WKPageNamespaceRef WKPageGetPageNamespace(WKPageRef page);
WK_EXPORT void WKPageLoadURL(WKPageRef page, CFURLRef url);
WK_EXPORT void WKPageLoadURL(WKPageRef page, WKURLRef url);
WK_EXPORT void WKPageStopLoading(WKPageRef page);
WK_EXPORT void WKPageReload(WKPageRef page);
......@@ -128,7 +128,7 @@ WK_EXPORT bool WKPageCanGoForward(WKPageRef page);
WK_EXPORT void WKPageGoBack(WKPageRef page);
WK_EXPORT bool WKPageCanGoBack(WKPageRef page);
WK_EXPORT CFStringRef WKPageGetTitle(WKPageRef page);
WK_EXPORT WKStringRef WKPageGetTitle(WKPageRef page);
WK_EXPORT WKFrameRef WKPageGetMainFrame(WKPageRef page);
......@@ -139,9 +139,9 @@ WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, WKPagePolicyClient * cl
WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, WKPageUIClient * client);
#if __BLOCKS__
WK_EXPORT void WKPageRunJavaScriptInMainFrame(WKPageRef page, CFStringRef script, void (^returnValueBlock)(CFStringRef));
WK_EXPORT void WKPageRunJavaScriptInMainFrame(WKPageRef page, WKStringRef script, void (^returnValueBlock)(WKStringRef));
#endif
WK_EXPORT void WKPageRunJavaScriptInMainFrame_f(WKPageRef page, CFStringRef script, void *context, void (*returnValueCallback)(void*, CFStringRef), void (*disposeContextCallback)(void*));
WK_EXPORT void WKPageRunJavaScriptInMainFrame_f(WKPageRef page, WKStringRef script, void *context, void (*returnValueCallback)(void*, WKStringRef), void (*disposeContextCallback)(void*));
WK_EXPORT WKPageRef WKPageRetain(WKPageRef page);
WK_EXPORT void WKPageRelease(WKPageRef page);
......
/*
* 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 "WKString.h"
#include "WKAPICast.h"
#include <WebCore/StringImpl.h>
WKStringRef WKStringRetain(WKStringRef stringRef)
{
toWK(stringRef)->ref();
return stringRef;
}
void WKStringRelease(WKStringRef stringRef)
{
toWK(stringRef)->deref();
}
/*
* 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 WKString_h
#define WKString_h
#include <WebKit2/WKBase.h>
#ifdef __cplusplus
extern "C" {
#endif
WK_EXPORT WKStringRef WKStringRetain(WKStringRef string);
WK_EXPORT void WKStringRelease(WKStringRef string);
#ifdef __cplusplus
}
#endif
#endif /* WKString_h */
/*
* 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 "WKURL.h"
#include "WKAPICast.h"
#include "KURLWrapper.h"
WKURLRef WKURLRetain(WKURLRef URLRef)
{
toWK(URLRef)->ref();
return URLRef;
}
void WKURLRelease(WKURLRef URLRef)
{
toWK(URLRef)->deref();
}
/*
* 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 WKURL_h
#define WKURL_h
#include <WebKit2/WKBase.h>
#ifdef __cplusplus
extern "C" {
#endif
WK_EXPORT WKURLRef WKURLRetain(WKURLRef URL);
WK_EXPORT void WKURLRelease(WKURLRef URL);
#ifdef __cplusplus
}
#endif
#endif /* WKURL_h */
/*
* 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 "WKStringCF.h"
#include "WKAPICast.h"
#include <WebCore/PlatformString.h>
using namespace WebCore;
WKStringRef WKStringCreateWithCFString(CFStringRef cfString)
{
String string(cfString);
StringImpl* stringImpl = string.impl();
stringImpl->ref();
return toRef(stringImpl);
}
CFStringRef WKStringCopyCFString(CFAllocatorRef /*allocatorRef*/, WKStringRef stringRef)
{
// FIXME: Honor the allocator parameter.
return toWK(stringRef)->createCFString();
}
/*
* 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 WKStringCF_h
#define WKStringCF_h
#include <CoreFoundation/CoreFoundation.h>
#include <WebKit2/WKBase.h>
#ifdef __cplusplus
extern "C" {
#endif
WK_EXPORT WKStringRef WKStringCreateWithCFString(CFStringRef string);
WK_EXPORT CFStringRef WKStringCopyCFString(CFAllocatorRef alloc, WKStringRef string);
#ifdef __cplusplus
}
#endif
#endif /* WKStringCF_h */
/*
* 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 "WKURLCF.h"
#include "KURLWrapper.h"
#include "WKAPICast.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
using namespace WebCore;
using namespace WebKit;
WKURLRef WKURKCreateWithCFURL(CFURLRef cfURL)
{
RefPtr<KURLWrapper> url = KURLWrapper::create(KURL(cfURL));
return toRef(url.release().releaseRef());
}
CFURLRef WKURLCopyCFURL(CFAllocatorRef /*allocatorRef*/, WKURLRef URLRef)
{
// FIXME: Honor the allocator parameter.
return toWK(URLRef)->url().createCFURL();
}
/*
* 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