本文整理汇总了C++中WKBundlePostMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ WKBundlePostMessage函数的具体用法?C++ WKBundlePostMessage怎么用?C++ WKBundlePostMessage使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WKBundlePostMessage函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: didReceiveMessage
virtual void didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody)
{
if (!WKStringIsEqualToUTF8CString(messageName, "RoundTrip"))
return;
WKBundlePostMessage(bundle, Util::toWK("RoundTripReturn").get(), messageBody);
}
示例2: getContextMenuFromDefaultMenu
static void getContextMenuFromDefaultMenu(WKBundlePageRef page, WKBundleHitTestResultRef hitTestResult, WKArrayRef defaultMenu, WKArrayRef* newMenu, WKTypeRef* userData, const void* clientInfo)
{
WKRetainPtr<WKBundleNodeHandleRef> nodeHandle(AdoptWK, WKBundleHitTestResultCopyNodeHandle(hitTestResult));
if (!nodeHandle)
return;
WKBundlePostMessage(InjectedBundleController::shared().bundle(), Util::toWK("HitTestResultNodeHandleTestDoneMessageName").get(), Util::toWK("HitTestResultNodeHandleTestDoneMessageBody").get());
}
示例3: willLoadURLRequest
static void willLoadURLRequest(WKBundlePageRef page, WKURLRequestRef request, WKTypeRef userData, const void *clientInfo)
{
WKRetainPtr<WKMutableDictionaryRef> messageBody = adoptWK(WKMutableDictionaryCreate());
WKDictionarySetItem(messageBody.get(), Util::toWK("URLRequestReturn").get(), request);
WKDictionarySetItem(messageBody.get(), Util::toWK("UserDataReturn").get(), userData);
WKBundlePostMessage(InjectedBundleController::singleton().bundle(), Util::toWK("WillLoadURLRequestReturn").get(), messageBody.get());
}
示例4: didAssociateFormControls
static void didAssociateFormControls(WKBundlePageRef page, WKArrayRef elementHandles, const void*)
{
WKRetainPtr<WKMutableDictionaryRef> messageBody = adoptWK(WKMutableDictionaryCreate());
WKDictionarySetItem(messageBody.get(), Util::toWK("Page").get(), page);
WKRetainPtr<WKUInt64Ref> numberOfElements = adoptWK(WKUInt64Create(WKArrayGetSize(elementHandles)));
WKDictionarySetItem(messageBody.get(), Util::toWK("NumberOfControls").get(), numberOfElements.get());
WKBundlePostMessage(InjectedBundleController::singleton().bundle(), Util::toWK("DidReceiveDidAssociateFormControls").get(), messageBody.get());
}
示例5: didFinishLoadForFrame
static void didFinishLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo)
{
if (!WKBundleFrameIsMainFrame(frame)) {
childFrame = frame;
return;
}
bool isParentFrameCheckSuccessful = childFrame ? WKBundleFrameGetParentFrame(childFrame.get()) == frame : false;
WKBundlePostMessage(testBundle.get(), Util::toWK("DidCheckParentFrame").get(), adoptWK(WKBooleanCreate(isParentFrameCheckSuccessful)).get());
}
示例6: WKBundlePageGetMainFrame
void WebArchiveTest::didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef body)
{
if (!WKStringIsEqualToUTF8CString(messageName, "GetWebArchive"))
return;
if (WKGetTypeID(body) != WKBundlePageGetTypeID())
return;
WKBundleFrameRef frame = WKBundlePageGetMainFrame(static_cast<WKBundlePageRef>(body));
if (!frame)
return;
WKBundlePostMessage(bundle, Util::toWK("DidGetWebArchive").get(), adoptWK(WKBundleFrameCopyWebArchive(frame)).get());
}
示例7: willLoadDataRequest
static void willLoadDataRequest(WKBundlePageRef page, WKURLRequestRef request, WKDataRef data, WKStringRef MIMEType, WKStringRef encodingName, WKURLRef unreachableURL, WKTypeRef userData, const void *clientInfo)
{
WKRetainPtr<WKMutableDictionaryRef> messageBody = adoptWK(WKMutableDictionaryCreate());
WKDictionarySetItem(messageBody.get(), Util::toWK("URLRequestReturn").get(), request);
WKDictionarySetItem(messageBody.get(), Util::toWK("DataReturn").get(), data);
WKDictionarySetItem(messageBody.get(), Util::toWK("MIMETypeReturn").get(), MIMEType);
WKDictionarySetItem(messageBody.get(), Util::toWK("EncodingNameReturn").get(), encodingName);
WKDictionarySetItem(messageBody.get(), Util::toWK("UnreachableURLReturn").get(), unreachableURL);
WKDictionarySetItem(messageBody.get(), Util::toWK("UserDataReturn").get(), userData);
WKBundlePostMessage(InjectedBundleController::singleton().bundle(), Util::toWK("WillLoadDataRequestReturn").get(), messageBody.get());
}
示例8: sprintf
void DOMWindowExtensionBasic::sendExtensionStateMessage()
{
char body[16384];
sprintf(body, "Extension states:\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
m_extensionRecords[0].name, stateNames[m_extensionRecords[0].state],
m_extensionRecords[1].name, stateNames[m_extensionRecords[1].state],
m_extensionRecords[2].name, stateNames[m_extensionRecords[2].state],
m_extensionRecords[3].name, stateNames[m_extensionRecords[3].state],
m_extensionRecords[4].name, stateNames[m_extensionRecords[4].state],
m_extensionRecords[5].name, stateNames[m_extensionRecords[5].state]);
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("ExtensionStates"));
WKRetainPtr<WKStringRef> messageBody = adoptWK(WKStringCreateWithUTF8CString(body));
WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
}
示例9: ASSERT
void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
{
if (WKStringIsEqualToUTF8CString(messageName, "BeginTest")) {
ASSERT(messageBody);
ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
m_dumpPixels = WKBooleanGetValue(static_cast<WKBooleanRef>(messageBody));
WKRetainPtr<WKStringRef> ackMessageName(AdoptWK, WKStringCreateWithUTF8CString("Ack"));
WKRetainPtr<WKStringRef> ackMessageBody(AdoptWK, WKStringCreateWithUTF8CString("BeginTest"));
WKBundlePostMessage(m_bundle, ackMessageName.get(), ackMessageBody.get());
beginTesting();
return;
} else if (WKStringIsEqualToUTF8CString(messageName, "Reset")) {
ASSERT(messageBody);
ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
WKRetainPtr<WKStringRef> shouldGCKey(AdoptWK, WKStringCreateWithUTF8CString("ShouldGC"));
bool shouldGC = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(messageBodyDictionary, shouldGCKey.get())));
if (shouldGC)
WKBundleGarbageCollectJavaScriptObjects(m_bundle);
m_state = Idle;
m_dumpPixels = false;
resetLocalSettings();
return;
}
WKRetainPtr<WKStringRef> errorMessageName(AdoptWK, WKStringCreateWithUTF8CString("Error"));
WKRetainPtr<WKStringRef> errorMessageBody(AdoptWK, WKStringCreateWithUTF8CString("Unknown"));
WKBundlePostMessage(m_bundle, errorMessageName.get(), errorMessageBody.get());
}
示例10: page
void InjectedBundle::done()
{
m_state = Stopping;
page()->stopLoading();
setTopLoadingFrame(0);
WKRetainPtr<WKStringRef> doneMessageName(AdoptWK, WKStringCreateWithUTF8CString("Done"));
WKRetainPtr<WKMutableDictionaryRef> doneMessageBody(AdoptWK, WKMutableDictionaryCreate());
WKRetainPtr<WKStringRef> textOutputKey(AdoptWK, WKStringCreateWithUTF8CString("TextOutput"));
WKRetainPtr<WKStringRef> textOutput(AdoptWK, WKStringCreateWithUTF8CString(m_outputStream.str().c_str()));
WKDictionaryAddItem(doneMessageBody.get(), textOutputKey.get(), textOutput.get());
WKRetainPtr<WKStringRef> pixelResultKey = adoptWK(WKStringCreateWithUTF8CString("PixelResult"));
WKDictionaryAddItem(doneMessageBody.get(), pixelResultKey.get(), m_pixelResult.get());
WKBundlePostMessage(m_bundle, doneMessageName.get(), doneMessageBody.get());
closeOtherPages();
m_state = Idle;
}
示例11: adoptWK
void DOMWindowExtensionBasic::sendBundleMessage(const char* message)
{
WKRetainPtr<WKStringRef> wkMessage = adoptWK(WKStringCreateWithUTF8CString(message));
WKBundlePostMessage(m_bundle, wkMessage.get(), wkMessage.get());
}