WKNotification.cpp [plain text]
#include "config.h"
#include "WKNotification.h"
#include "APISecurityOrigin.h"
#include "WKAPICast.h"
#include "WKString.h"
#include "WebNotification.h"
#include <WebCore/NotificationDirection.h>
using namespace WebKit;
WKTypeID WKNotificationGetTypeID()
{
return toAPI(WebNotification::APIType);
}
WKStringRef WKNotificationCopyTitle(WKNotificationRef notification)
{
return toCopiedAPI(toImpl(notification)->title());
}
WKStringRef WKNotificationCopyBody(WKNotificationRef notification)
{
return toCopiedAPI(toImpl(notification)->body());
}
WKStringRef WKNotificationCopyIconURL(WKNotificationRef notification)
{
return toCopiedAPI(toImpl(notification)->iconURL());
}
WKStringRef WKNotificationCopyTag(WKNotificationRef notification)
{
return toCopiedAPI(toImpl(notification)->tag());
}
WKStringRef WKNotificationCopyLang(WKNotificationRef notification)
{
return toCopiedAPI(toImpl(notification)->lang());
}
WKStringRef WKNotificationCopyDir(WKNotificationRef notification)
{
switch (toImpl(notification)->dir()) {
case WebCore::NotificationDirection::Auto:
return WKStringCreateWithUTF8CString("auto");
case WebCore::NotificationDirection::Ltr:
return WKStringCreateWithUTF8CString("ltr");
case WebCore::NotificationDirection::Rtl:
return WKStringCreateWithUTF8CString("rtl");
}
RELEASE_ASSERT_NOT_REACHED();
}
WKSecurityOriginRef WKNotificationGetSecurityOrigin(WKNotificationRef notification)
{
return toAPI(toImpl(notification)->origin());
}
uint64_t WKNotificationGetID(WKNotificationRef notification)
{
return toImpl(notification)->notificationID();
}