WKUserContentControllerRef.cpp [plain text]
#include "config.h"
#include "WKUserContentControllerRef.h"
#include "APIArray.h"
#include "APIContentRuleList.h"
#include "APIUserScript.h"
#include "WKAPICast.h"
#include "WebUserContentControllerProxy.h"
using namespace WebKit;
WKTypeID WKUserContentControllerGetTypeID()
{
return toAPI(WebUserContentControllerProxy::APIType);
}
WKUserContentControllerRef WKUserContentControllerCreate()
{
return toAPI(&WebUserContentControllerProxy::create().leakRef());
}
WKArrayRef WKUserContentControllerCopyUserScripts(WKUserContentControllerRef userContentControllerRef)
{
Ref<API::Array> userScripts = toImpl(userContentControllerRef)->userScripts().copy();
return toAPI(&userScripts.leakRef());
}
void WKUserContentControllerAddUserScript(WKUserContentControllerRef userContentControllerRef, WKUserScriptRef userScriptRef)
{
toImpl(userContentControllerRef)->addUserScript(*toImpl(userScriptRef));
}
void WKUserContentControllerRemoveAllUserScripts(WKUserContentControllerRef userContentControllerRef)
{
toImpl(userContentControllerRef)->removeAllUserScripts();
}
void WKUserContentControllerAddUserContentFilter(WKUserContentControllerRef userContentControllerRef, WKUserContentFilterRef userContentFilterRef)
{
#if ENABLE(CONTENT_EXTENSIONS)
toImpl(userContentControllerRef)->addContentRuleList(*toImpl(userContentFilterRef));
#endif
}
void WKUserContentControllerRemoveAllUserContentFilters(WKUserContentControllerRef userContentControllerRef)
{
#if ENABLE(CONTENT_EXTENSIONS)
toImpl(userContentControllerRef)->removeAllContentRuleLists();
#endif
}