Commit 438853f8 authored by weinig@apple.com's avatar weinig@apple.com

Patch for https://bugs.webkit.org/show_bug.cgi?id=43163

Add a CF-style base type (WKTypeRef) as a base for polymorphic functions.

Reviewed by Darin Adler.

- Add first polymorphic function, WKGetTypeID.
- Add functions to each WK type to get their respective TypeIDs.
- Adds WebURL to complement WebString.

* Shared/APIObject.h:
(WebKit::APIObject::):
(WebKit::APIObject::~APIObject):
* Shared/ImmutableArray.h:
(WebKit::ImmutableArray::type):
* Shared/WebString.h:
(WebKit::WebString::type):
* Shared/WebURL.h: Added.
(WebKit::WebURL::create):
(WebKit::WebURL::type):
(WebKit::WebURL::isNull):
(WebKit::WebURL::isEmpty):
(WebKit::WebURL::string):
(WebKit::WebURL::WebURL):
* UIProcess/API/C/WKAPICast.h:
(WebKit::ProxyingRefPtr::ProxyingRefPtr):
(WebKit::ProxyingRefPtr::operator APIType):
(toRef):
(toURLRef):
(toCopiedURLRef):
* UIProcess/API/C/WKArray.cpp:
(WKArrayGetTypeID):
* UIProcess/API/C/WKArray.h:
* UIProcess/API/C/WKBackForwardList.cpp:
(WKBackForwardListGetTypeID):
* UIProcess/API/C/WKBackForwardList.h:
* UIProcess/API/C/WKBackForwardListItem.cpp:
(WKBackForwardListItemGetTypeID):
* UIProcess/API/C/WKBackForwardListItem.h:
* UIProcess/API/C/WKBase.h:
* UIProcess/API/C/WKContext.cpp:
(WKContextGetTypeID):
* UIProcess/API/C/WKContext.h:
* UIProcess/API/C/WKFrame.cpp:
(WKFrameGetTypeID):
* UIProcess/API/C/WKFrame.h:
* UIProcess/API/C/WKFramePolicyListener.cpp:
(WKFramePolicyListenerGetTypeID):
* UIProcess/API/C/WKFramePolicyListener.h:
* UIProcess/API/C/WKNavigationData.cpp:
(WKNavigationDataGetTypeID):
* UIProcess/API/C/WKNavigationData.h:
* UIProcess/API/C/WKPage.cpp:
(WKPageGetTypeID):
* UIProcess/API/C/WKPage.h:
* UIProcess/API/C/WKPageNamespace.cpp:
(WKPageNamespaceGetTypeID):
* UIProcess/API/C/WKPageNamespace.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesGetTypeID):
* UIProcess/API/C/WKPreferences.h:
* UIProcess/API/C/WKString.cpp:
(WKStringGetTypeID):
* UIProcess/API/C/WKString.h:
* UIProcess/API/C/WKType.cpp: Added.
(WKGetTypeID):
* UIProcess/API/C/WKType.h: Added.
* UIProcess/API/C/WKURL.cpp:
(WKURLGetTypeID):
* UIProcess/API/C/WKURL.h:
* UIProcess/API/win/WKView.cpp:
(WKViewGetTypeID):
* UIProcess/API/win/WKView.h:
* UIProcess/WebBackForwardList.h:
(WebKit::WebBackForwardList::type):
* UIProcess/WebBackForwardListItem.h:
(WebKit::WebBackForwardListItem::type):
* UIProcess/WebContext.h:
(WebKit::WebContext::type):
* UIProcess/WebFramePolicyListenerProxy.h:
(WebKit::WebFramePolicyListenerProxy::type):
* UIProcess/WebFrameProxy.h:
(WebKit::WebFrameProxy::type):
* UIProcess/WebNavigationData.h:
(WebKit::WebNavigationData::type):
* UIProcess/WebPageNamespace.h:
(WebKit::WebPageNamespace::type):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::type):
* UIProcess/WebPreferences.h:
(WebKit::WebPreferences::type):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleGetTypeID):
* WebProcess/InjectedBundle/API/c/WKBundle.h:
* WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
(WKBundleFrameGetTypeID):
* WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageGetTypeID):
(WKBundlePageSetEditorClient):
(WKBundlePageSetLoaderClient):
(WKBundlePageSetUIClient):
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/WebPage/WebFrame.h:
(WebKit::WebFrame::type):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::type):
* win/WebKit2.vcproj:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6134e994
2010-07-28 Sam Weinig <sam@webkit.org>
Reviewed by Darin Adler.
Patch for https://bugs.webkit.org/show_bug.cgi?id=43163
Add a CF-style base type (WKTypeRef) as a base for polymorphic functions.
- Add first polymorphic function, WKGetTypeID.
- Add functions to each WK type to get their respective TypeIDs.
- Adds WebURL to complement WebString.
* Shared/APIObject.h:
(WebKit::APIObject::):
(WebKit::APIObject::~APIObject):
* Shared/ImmutableArray.h:
(WebKit::ImmutableArray::type):
* Shared/WebString.h:
(WebKit::WebString::type):
* Shared/WebURL.h: Added.
(WebKit::WebURL::create):
(WebKit::WebURL::type):
(WebKit::WebURL::isNull):
(WebKit::WebURL::isEmpty):
(WebKit::WebURL::string):
(WebKit::WebURL::WebURL):
* UIProcess/API/C/WKAPICast.h:
(WebKit::ProxyingRefPtr::ProxyingRefPtr):
(WebKit::ProxyingRefPtr::operator APIType):
(toRef):
(toURLRef):
(toCopiedURLRef):
* UIProcess/API/C/WKArray.cpp:
(WKArrayGetTypeID):
* UIProcess/API/C/WKArray.h:
* UIProcess/API/C/WKBackForwardList.cpp:
(WKBackForwardListGetTypeID):
* UIProcess/API/C/WKBackForwardList.h:
* UIProcess/API/C/WKBackForwardListItem.cpp:
(WKBackForwardListItemGetTypeID):
* UIProcess/API/C/WKBackForwardListItem.h:
* UIProcess/API/C/WKBase.h:
* UIProcess/API/C/WKContext.cpp:
(WKContextGetTypeID):
* UIProcess/API/C/WKContext.h:
* UIProcess/API/C/WKFrame.cpp:
(WKFrameGetTypeID):
* UIProcess/API/C/WKFrame.h:
* UIProcess/API/C/WKFramePolicyListener.cpp:
(WKFramePolicyListenerGetTypeID):
* UIProcess/API/C/WKFramePolicyListener.h:
* UIProcess/API/C/WKNavigationData.cpp:
(WKNavigationDataGetTypeID):
* UIProcess/API/C/WKNavigationData.h:
* UIProcess/API/C/WKPage.cpp:
(WKPageGetTypeID):
* UIProcess/API/C/WKPage.h:
* UIProcess/API/C/WKPageNamespace.cpp:
(WKPageNamespaceGetTypeID):
* UIProcess/API/C/WKPageNamespace.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesGetTypeID):
* UIProcess/API/C/WKPreferences.h:
* UIProcess/API/C/WKString.cpp:
(WKStringGetTypeID):
* UIProcess/API/C/WKString.h:
* UIProcess/API/C/WKType.cpp: Added.
(WKGetTypeID):
* UIProcess/API/C/WKType.h: Added.
* UIProcess/API/C/WKURL.cpp:
(WKURLGetTypeID):
* UIProcess/API/C/WKURL.h:
* UIProcess/API/win/WKView.cpp:
(WKViewGetTypeID):
* UIProcess/API/win/WKView.h:
* UIProcess/WebBackForwardList.h:
(WebKit::WebBackForwardList::type):
* UIProcess/WebBackForwardListItem.h:
(WebKit::WebBackForwardListItem::type):
* UIProcess/WebContext.h:
(WebKit::WebContext::type):
* UIProcess/WebFramePolicyListenerProxy.h:
(WebKit::WebFramePolicyListenerProxy::type):
* UIProcess/WebFrameProxy.h:
(WebKit::WebFrameProxy::type):
* UIProcess/WebNavigationData.h:
(WebKit::WebNavigationData::type):
* UIProcess/WebPageNamespace.h:
(WebKit::WebPageNamespace::type):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::type):
* UIProcess/WebPreferences.h:
(WebKit::WebPreferences::type):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleGetTypeID):
* WebProcess/InjectedBundle/API/c/WKBundle.h:
* WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
(WKBundleFrameGetTypeID):
* WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageGetTypeID):
(WKBundlePageSetEditorClient):
(WKBundlePageSetLoaderClient):
(WKBundlePageSetUIClient):
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/WebPage/WebFrame.h:
(WebKit::WebFrame::type):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::type):
* win/WebKit2.vcproj:
2010-07-28 Darin Adler <darin@apple.com>
Reviewed by Sam Weinig.
......@@ -194,10 +305,10 @@
Patch for https://bugs.webkit.org/show_bug.cgi?id=43097
Make all objects in the WebKit2 API inherit from a single base class
- Adds an APIObject base class for all objects which can get vender through
- Adds an APIObject base class for all objects which one can get through
the C API to inherit from.
- Adds a WebString class which wraps WebCore::String for now. I am not too fond of
this solution, so we continue should iterate on it.
this solution, so we should continue to iterate on it.
- This is a first step toward make a CF-style base type (eg. CFTypeRef) for the C-API.
* Shared/APIObject.h: Added.
......
......@@ -31,6 +31,39 @@
namespace WebKit {
class APIObject : public RefCounted<APIObject> {
public:
enum Type {
// Base types
TypeArray,
TypeString,
TypeURL,
// UIProcess types
TypeBackForwardList,
TypeBackForwardListItem,
TypeContext,
TypeFrame,
TypeFramePolicyListener,
TypeNavigationData,
TypePage,
TypePageNamespace,
TypePreferences,
// Bundle types
TypeBundle,
TypeBundleFrame,
TypeBundlePage,
// Platform specific
TypeView
};
virtual ~APIObject()
{
}
virtual Type type() const = 0;
protected:
APIObject()
{
......
......@@ -65,6 +65,8 @@ private:
enum AdoptTag { Adopt };
ImmutableArray(void** entries, size_t size, const ImmutableArrayCallbacks*, AdoptTag);
virtual Type type() const { return TypeArray; }
void** m_entries;
size_t m_size;
ImmutableArrayCallbacks m_callbacks;
......
......@@ -52,6 +52,8 @@ private:
{
}
virtual Type type() const { return TypeString; }
WebCore::String m_string;
};
......
/*
* 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 WebURL_h
#define WebURL_h
#include "APIObject.h"
#include <WebCore/PlatformString.h>
#include <wtf/PassRefPtr.h>
namespace WebKit {
// WebURL - An string array type suitable for vending to an API.
class WebURL : public APIObject {
public:
static PassRefPtr<WebURL> create(const WebCore::String& string)
{
return adoptRef(new WebURL(string));
}
bool isNull() const { return m_string.isNull(); }
bool isEmpty() const { return m_string.isEmpty(); }
const WebCore::String& string() const { return m_string; }
private:
WebURL(const WebCore::String& string)
: m_string(string)
{
}
virtual Type type() const { return TypeURL; }
WebCore::String m_string;
};
} // namespace WebKit
#endif // WebURL_h
......@@ -29,6 +29,7 @@
#include "WKBase.h"
#include "WKPage.h"
#include "WebString.h"
#include "WebURL.h"
#include <WebCore/FrameLoaderTypes.h>
#if defined(WIN32) || defined(_WIN32)
......@@ -50,20 +51,22 @@ class WebPreferences;
class WebString;
template<typename APIType> struct APITypeInfo { };
template<> struct APITypeInfo<WKTypeRef> { typedef APIObject* ImplType; };
template<> struct APITypeInfo<WKFrameRef> { typedef WebFrameProxy* ImplType; };
template<> struct APITypeInfo<WKPageRef> { typedef WebPageProxy* ImplType; };
template<> struct APITypeInfo<WKContextRef> { typedef WebContext* ImplType; };
template<> struct APITypeInfo<WKPageNamespaceRef> { typedef WebPageNamespace* ImplType; };
template<> struct APITypeInfo<WKFramePolicyListenerRef> { typedef WebFramePolicyListenerProxy* ImplType; };
template<> struct APITypeInfo<WKPreferencesRef> { typedef WebPreferences* ImplType; };
template<> struct APITypeInfo<WKStringRef> { typedef WebKit::WebString* ImplType; };
template<> struct APITypeInfo<WKURLRef> { typedef WebKit::WebString* ImplType; };
template<> struct APITypeInfo<WKStringRef> { typedef WebString* ImplType; };
template<> struct APITypeInfo<WKURLRef> { typedef WebURL* ImplType; };
template<> struct APITypeInfo<WKNavigationDataRef> { typedef WebNavigationData* ImplType; };
template<> struct APITypeInfo<WKArrayRef> { typedef ImmutableArray* ImplType; };
template<> struct APITypeInfo<WKBackForwardListItemRef> { typedef WebBackForwardListItem* ImplType; };
template<> struct APITypeInfo<WKBackForwardListRef> { typedef WebBackForwardList* ImplType; };
template<typename ImplType> struct ImplTypeInfo { };
template<> struct ImplTypeInfo<APIObject*> { typedef WKTypeRef APIType; };
template<> struct ImplTypeInfo<WebFrameProxy*> { typedef WKFrameRef APIType; };
template<> struct ImplTypeInfo<WebPageProxy*> { typedef WKPageRef APIType; };
template<> struct ImplTypeInfo<WebContext*> { typedef WKContextRef APIType; };
......@@ -71,23 +74,24 @@ template<> struct ImplTypeInfo<WebPageNamespace*> { typedef WKPage
template<> struct ImplTypeInfo<WebFramePolicyListenerProxy*> { typedef WKFramePolicyListenerRef APIType; };
template<> struct ImplTypeInfo<WebPreferences*> { typedef WKPreferencesRef APIType; };
template<> struct ImplTypeInfo<WebString*> { typedef WKStringRef APIType; };
template<> struct ImplTypeInfo<WebURL*> { typedef WKURLRef APIType; };
template<> struct ImplTypeInfo<WebNavigationData*> { typedef WKNavigationDataRef APIType; };
template<> struct ImplTypeInfo<ImmutableArray*> { typedef WKArrayRef APIType; };
template<> struct ImplTypeInfo<WebBackForwardListItem*> { typedef WKBackForwardListItemRef APIType; };
template<> struct ImplTypeInfo<WebBackForwardList*> { typedef WKBackForwardListRef APIType; };
class WebStringAdaptor {
template<typename ImplType, typename APIType = typename ImplTypeInfo<ImplType*>::APIType>
class ProxyingRefPtr {
public:
WebStringAdaptor(PassRefPtr<WebString> impl)
ProxyingRefPtr(PassRefPtr<ImplType> impl)
: m_impl(impl)
{
}
operator WKStringRef() { return reinterpret_cast<WKStringRef>(m_impl.get()); }
operator WKURLRef() { return reinterpret_cast<WKURLRef>(m_impl.get()); }
operator APIType() { return reinterpret_cast<APIType>(m_impl.get()); }
private:
RefPtr<WebString> m_impl;
RefPtr<ImplType> m_impl;
};
} // namespace WebKit
......@@ -108,16 +112,16 @@ inline typename WebKit::ImplTypeInfo<T>::APIType toRef(T t)
/* Special cases. */
inline WebKit::WebStringAdaptor toRef(WebCore::StringImpl* string)
inline WebKit::ProxyingRefPtr<WebKit::WebString> toRef(WebCore::StringImpl* string)
{
WebCore::StringImpl* impl = string ? string : WebCore::StringImpl::empty();
return WebKit::WebStringAdaptor(WebKit::WebString::create(WebCore::String(impl)));
return WebKit::ProxyingRefPtr<WebKit::WebString>(WebKit::WebString::create(WebCore::String(impl)));
}
inline WebKit::WebStringAdaptor toURLRef(WebCore::StringImpl* string)
inline WebKit::ProxyingRefPtr<WebKit::WebURL> toURLRef(WebCore::StringImpl* string)
{
WebCore::StringImpl* impl = string ? string : WebCore::StringImpl::empty();
return WebKit::WebStringAdaptor(WebKit::WebString::create(WebCore::String(impl))) ;
return WebKit::ProxyingRefPtr<WebKit::WebURL>(WebKit::WebURL::create(WebCore::String(impl))) ;
}
inline WKStringRef toCopiedRef(const WebCore::String& string)
......@@ -130,8 +134,13 @@ inline WKStringRef toCopiedRef(const WebCore::String& string)
inline WKURLRef toCopiedURLRef(const WebCore::String& string)
{
WebCore::StringImpl* impl = string.impl() ? string.impl() : WebCore::StringImpl::empty();
RefPtr<WebKit::WebString> webString = WebKit::WebString::create(WebCore::String(impl));
return reinterpret_cast<WKURLRef>(webString.release().releaseRef());
RefPtr<WebKit::WebURL> webURL = WebKit::WebURL::create(WebCore::String(impl));
return reinterpret_cast<WKURLRef>(webURL.release().releaseRef());
}
inline WKTypeID toRef(WebKit::APIObject::Type type)
{
return static_cast<WKTypeID>(type);
}
inline WKFrameNavigationType toWK(WebCore::NavigationType type)
......
......@@ -30,6 +30,11 @@
using namespace WebKit;
WKTypeID WKArrayGetTypeID()
{
return toRef(APIObject::TypeArray);
}
const void* WKArrayGetItemAtIndex(WKArrayRef arrayRef, size_t index)
{
return toWK(arrayRef)->at(index);
......
......@@ -32,6 +32,8 @@
extern "C" {
#endif
WK_EXPORT WKTypeID WKArrayGetTypeID();
WK_EXPORT const void* WKArrayGetItemAtIndex(WKArrayRef array, size_t index);
WK_EXPORT size_t WKArrayGetSize(WKArrayRef array);
......
......@@ -30,6 +30,11 @@
using namespace WebKit;
WKTypeID WKBackForwardListGetTypeID()
{
return toRef(APIObject::TypeBackForwardList);
}
WKBackForwardListItemRef WKBackForwardListGetCurrentItem(WKBackForwardListRef listRef)
{
return toRef(toWK(listRef)->currentItem());
......
......@@ -32,6 +32,8 @@
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);
......
......@@ -30,6 +30,11 @@
using namespace WebKit;
WKTypeID WKBackForwardListItemGetTypeID()
{
return toRef(APIObject::TypeBackForwardListItem);
}
WKURLRef WKBackForwardListItemCopyOriginalURL(WKBackForwardListItemRef itemRef)
{
return toCopiedURLRef(toWK(itemRef)->originalURL());
......
......@@ -32,6 +32,8 @@
extern "C" {
#endif
WK_EXPORT WKTypeID WKBackForwardListItemGetTypeID();
WK_EXPORT WKURLRef WKBackForwardListItemCopyOriginalURL(WKBackForwardListItemRef item);
WK_EXPORT WKURLRef WKBackForwardListItemCopyURL(WKBackForwardListItemRef item);
WK_EXPORT WKStringRef WKBackForwardListItemCopyTitle(WKBackForwardListItemRef item);
......
......@@ -30,6 +30,9 @@
#include <WebKit2/WKBaseWin.h>
#endif
typedef uint32_t WKTypeID;
typedef struct OpaqueWKTypeRef* WKTypeRef;
typedef struct OpaqueWKArrayRef* WKArrayRef;
typedef struct OpaqueWKBackForwardListItemRef* WKBackForwardListItemRef;
typedef struct OpaqueWKBackForwardListRef* WKBackForwardListRef;
......
......@@ -35,6 +35,11 @@
using namespace WebKit;
WKTypeID WKContextGetTypeID()
{
return toRef(APIObject::TypeContext);
}
WKContextRef WKContextCreate()
{
RefPtr<WebContext> context = WebContext::create(WebCore::String());
......
......@@ -32,7 +32,7 @@
extern "C" {
#endif
// Policy Client.
// Injected Bundle Client
typedef void (*WKContextDidReceiveMessageFromInjectedBundleCallback)(WKContextRef page, WKStringRef message, const void *clientInfo);
struct WKContextInjectedBundleClient {
......@@ -60,6 +60,8 @@ struct WKContextHistoryClient {
};
typedef struct WKContextHistoryClient WKContextHistoryClient;
WK_EXPORT WKTypeID WKContextGetTypeID();
WK_EXPORT WKContextRef WKContextCreate();
WK_EXPORT WKContextRef WKContextCreateWithInjectedBundlePath(WKStringRef path);
WK_EXPORT WKContextRef WKContextGetSharedProcessContext();
......
......@@ -30,6 +30,11 @@
using namespace WebKit;
WKTypeID WKFrameGetTypeID()
{
return toRef(APIObject::TypeFrame);
}
bool WKFrameIsMainFrame(WKFrameRef frameRef)
{
return toWK(frameRef)->isMainFrame();
......
......@@ -43,6 +43,8 @@ enum WKFrameLoadState {
};
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);
......
......@@ -31,6 +31,11 @@
using namespace WebKit;
WKTypeID WKFramePolicyListenerGetTypeID()
{
return toRef(APIObject::TypeFramePolicyListener);
}
void WKFramePolicyListenerUse(WKFramePolicyListenerRef policyListenerRef)
{
toWK(policyListenerRef)->use();
......
......@@ -32,6 +32,8 @@
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);
......
......@@ -30,6 +30,11 @@
using namespace WebKit;
WKTypeID WKNavigationDataGetTypeID()
{
return toRef(APIObject::TypeNavigationData);
}
WKStringRef WKNavigationDataCopyTitle(WKNavigationDataRef navigationDataRef)
{
return toCopiedRef(toWK(navigationDataRef)->title());
......
......@@ -32,6 +32,8 @@
extern "C" {
#endif
WK_EXPORT WKTypeID WKNavigationDataGetTypeID();
WK_EXPORT WKStringRef WKNavigationDataCopyTitle(WKNavigationDataRef navigationData);
WK_EXPORT WKURLRef WKNavigationDataCopyURL(WKNavigationDataRef navigationData);
......
......@@ -36,6 +36,11 @@
using namespace WebKit;
WKTypeID WKPageGetTypeID()
{
return toRef(APIObject::TypePage);
}
WKPageNamespaceRef WKPageGetPageNamespace(WKPageRef pageRef)
{
return toRef(toWK(pageRef)->pageNamespace());
......
......@@ -133,6 +133,8 @@ struct WKPageUIClient {
};
typedef struct WKPageUIClient WKPageUIClient;
WK_EXPORT WKTypeID WKPageGetTypeID();
WK_EXPORT WKPageNamespaceRef WKPageGetPageNamespace(WKPageRef page);
WK_EXPORT void WKPageLoadURL(WKPageRef page, WKURLRef url);
......
......@@ -32,6 +32,11 @@
using namespace WebKit;
WKTypeID WKPageNamespaceGetTypeID()
{
return toRef(APIObject::TypePageNamespace);
}
WKPageNamespaceRef WKPageNamespaceCreate(WKContextRef ownerContextRef)
{
return toRef(toWK(ownerContextRef)->createPageNamespace());
......
......@@ -32,6 +32,8 @@
extern "C" {
#endif
WK_EXPORT WKTypeID WKPageNamespaceGetTypeID();
WK_EXPORT WKPageNamespaceRef WKPageNamespaceCreate(WKContextRef ownerContext);
WK_EXPORT WKContextRef WKPageNamespaceGetContext(WKPageNamespaceRef pageNamespace);
......
......@@ -32,6 +32,11 @@
using namespace WebKit;
WKTypeID WKPreferencesGetTypeID()
{
return toRef(APIObject::TypePreferences);
}
WKPreferencesRef WKPreferencesCreate()
{
RefPtr<WebPreferences> preferences = WebPreferences::create();
......
......@@ -36,6 +36,8 @@
extern "C" {
#endif
WK_EXPORT WKTypeID WKPreferencesGetTypeID();
WK_EXPORT WKPreferencesRef WKPreferencesCreate();
WK_EXPORT WKPreferencesRef WKPreferencesCreateCopy(WKPreferencesRef);
......
......@@ -27,6 +27,13 @@
#include "WKAPICast.h"
using namespace WebKit;
WKTypeID WKStringGetTypeID()
{
return toRef(APIObject::TypeString);
}
WKStringRef WKStringRetain(WKStringRef stringRef)
{
toWK(stringRef)->ref();
......
......@@ -36,6 +36,8 @@
extern "C" {
#endif
WK_EXPORT WKTypeID WKStringGetTypeID();
WK_EXPORT WKStringRef WKStringRetain(WKStringRef string);
WK_EXPORT void WKStringRelease(WKStringRef string);
......
/*
* 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 "WKType.h"
#include "APIObject.h"
#include "WKAPICast.h"
using namespace WebKit;
WKTypeID WKGetTypeID(WKTypeRef typeRef)
{
return toRef(toWK(typeRef)->type());
}
/*
* 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.
*