本文整理汇总了C++中WKBundlePageGetMainFrame函数的典型用法代码示例。如果您正苦于以下问题:C++ WKBundlePageGetMainFrame函数的具体用法?C++ WKBundlePageGetMainFrame怎么用?C++ WKBundlePageGetMainFrame使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WKBundlePageGetMainFrame函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WKBundlePageGetMainFrame
void TestRunner::simulateWebNotificationClick(JSValueRef notification)
{
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
uint64_t notificationID = WKBundleGetWebNotificationID(InjectedBundle::shared().bundle(), context, notification);
InjectedBundle::shared().postSimulateWebNotificationClick(notificationID);
}
示例2: WKBundlePageGetMainFrame
void EventSendingController::keyDown(JSStringRef key, JSValueRef modifierArray, int location)
{
WKBundlePageRef page = InjectedBundle::shared().page()->page();
WKBundleFrameRef frame = WKBundlePageGetMainFrame(page);
JSContextRef context = WKBundleFrameGetJavaScriptContext(frame);
WKEventModifiers modifiers = parseModifierArray(context, modifierArray);
WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("KeyDown"));
WKDictionaryAddItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
WKRetainPtr<WKStringRef> keyKey(AdoptWK, WKStringCreateWithUTF8CString("Key"));
WKDictionaryAddItem(EventSenderMessageBody.get(), keyKey.get(), toWK(key).get());
WKRetainPtr<WKStringRef> modifiersKey(AdoptWK, WKStringCreateWithUTF8CString("Modifiers"));
WKRetainPtr<WKUInt64Ref> modifiersRef(AdoptWK, WKUInt64Create(modifiers));
WKDictionaryAddItem(EventSenderMessageBody.get(), modifiersKey.get(), modifiersRef.get());
WKRetainPtr<WKStringRef> locationKey(AdoptWK, WKStringCreateWithUTF8CString("Location"));
WKRetainPtr<WKUInt64Ref> locationRef(AdoptWK, WKUInt64Create(location));
WKDictionaryAddItem(EventSenderMessageBody.get(), locationKey.get(), locationRef.get());
WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
示例3: WKBundlePageGetMainFrame
void TestRunner::simulateWebNotificationClick(JSValueRef notification)
{
auto& injectedBundle = InjectedBundle::singleton();
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(injectedBundle.page()->page());
JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
uint64_t notificationID = WKBundleGetWebNotificationID(injectedBundle.bundle(), context, notification);
injectedBundle.postSimulateWebNotificationClick(notificationID);
}
示例4: baseURLWK
void TestRunner::queueLoad(JSStringRef url, JSStringRef target)
{
WKRetainPtr<WKURLRef> baseURLWK(AdoptWK, WKBundleFrameCopyURL(WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page())));
WKRetainPtr<WKURLRef> urlWK(AdoptWK, WKURLCreateWithBaseURL(baseURLWK.get(), toWTFString(toWK(url)).utf8().data()));
WKRetainPtr<WKStringRef> urlStringWK(AdoptWK, WKURLCopyString(urlWK.get()));
InjectedBundle::shared().queueLoad(urlStringWK.get(), toWK(target).get());
}
示例5: baseURLWK
void TestRunner::queueLoad(JSStringRef url, JSStringRef target, bool shouldOpenExternalURLs)
{
auto& injectedBundle = InjectedBundle::singleton();
WKRetainPtr<WKURLRef> baseURLWK(AdoptWK, WKBundleFrameCopyURL(WKBundlePageGetMainFrame(injectedBundle.page()->page())));
WKRetainPtr<WKURLRef> urlWK(AdoptWK, WKURLCreateWithBaseURL(baseURLWK.get(), toWTFString(toWK(url)).utf8().data()));
WKRetainPtr<WKStringRef> urlStringWK(AdoptWK, WKURLCopyString(urlWK.get()));
injectedBundle.queueLoad(urlStringWK.get(), toWK(target).get(), shouldOpenExternalURLs);
}
示例6: origins
JSValueRef TestRunner::originsWithApplicationCache()
{
WKRetainPtr<WKArrayRef> origins(AdoptWK, WKBundleCopyOriginsWithApplicationCache(InjectedBundle::shared().bundle()));
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
return stringArrayToJS(context, origins.get());
}
示例7: 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());
}
示例8: callOnMessage
static void callOnMessage(JSObjectRef object, WKStringRef contents, WKBundlePageRef page)
{
static JSStringRef onmessageName = JSStringCreateWithUTF8CString("onmessage");
if (!object)
return;
WKBundleFrameRef frame = WKBundlePageGetMainFrame(page);
JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame);
JSValueRef onmessageValue = JSObjectGetProperty(context, object, onmessageName, 0);
if (!JSValueIsObject(context, onmessageValue))
return;
JSObjectRef onmessageFunction = JSValueToObject(context, onmessageValue, 0);
if (!JSObjectIsFunction(context, onmessageFunction))
return;
JSObjectRef wrappedMessage = createWrappedMessage(context, contents);
JSObjectCallAsFunction(context, onmessageFunction, 0, 1, &wrappedMessage, 0);
}
示例9: WKBundlePageGetMainFrame
QtBuiltinBundlePage::~QtBuiltinBundlePage()
{
if (!m_navigatorQtObject
#ifdef HAVE_WEBCHANNEL
&& !m_navigatorQtWebChannelTransportObject
#endif
)
{
return;
}
WKBundleFrameRef frame = WKBundlePageGetMainFrame(m_page);
JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame);
if (m_navigatorQtObject)
JSValueUnprotect(context, m_navigatorQtObject);
#ifdef HAVE_WEBCHANNEL
if (m_navigatorQtWebChannelTransportObject)
JSValueUnprotect(context, m_navigatorQtWebChannelTransportObject);
#endif
}
示例10: removeAccessibilityNotificationHandler
void AccessibilityNotificationHandler::setNotificationFunctionCallback(JSValueRef notificationFunctionCallback)
{
if (!notificationFunctionCallback) {
removeAccessibilityNotificationHandler();
disconnectAccessibilityCallbacks();
return;
}
m_notificationFunctionCallback = notificationFunctionCallback;
#if PLATFORM(GTK) || PLATFORM(EFL)
WKBundlePageRef page = InjectedBundle::singleton().page()->page();
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page);
JSContextRef jsContext = WKBundleFrameGetJavaScriptContext(mainFrame);
#else
JSContextRef jsContext = nullptr;
#endif
if (!jsContext)
return;
connectAccessibilityCallbacks();
JSValueProtect(jsContext, m_notificationFunctionCallback);
// Check if this notification handler is related to a specific element.
if (m_platformElement) {
NotificationHandlersMap::iterator currentNotificationHandler = notificationHandlers.find(m_platformElement.get());
if (currentNotificationHandler != notificationHandlers.end()) {
ASSERT(currentNotificationHandler->value->platformElement());
JSValueUnprotect(jsContext, currentNotificationHandler->value->notificationFunctionCallback());
notificationHandlers.remove(currentNotificationHandler->value->platformElement().get());
}
notificationHandlers.add(m_platformElement.get(), this);
} else {
if (globalNotificationHandler)
JSValueUnprotect(jsContext, globalNotificationHandler->notificationFunctionCallback());
globalNotificationHandler = this;
}
}
示例11: PLATFORM
void AccessibilityNotificationHandler::removeAccessibilityNotificationHandler()
{
#if PLATFORM(GTK) || PLATFORM(EFL)
WKBundlePageRef page = InjectedBundle::singleton().page()->page();
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page);
JSContextRef jsContext = WKBundleFrameGetJavaScriptContext(mainFrame);
#else
JSContextRef jsContext = nullptr;
#endif
if (!jsContext)
return;
if (globalNotificationHandler == this) {
JSValueUnprotect(jsContext, globalNotificationHandler->notificationFunctionCallback());
globalNotificationHandler = nullptr;
} else if (m_platformElement.get()) {
NotificationHandlersMap::iterator removeNotificationHandler = notificationHandlers.find(m_platformElement.get());
if (removeNotificationHandler != notificationHandlers.end()) {
JSValueUnprotect(jsContext, removeNotificationHandler->value->notificationFunctionCallback());
notificationHandlers.remove(removeNotificationHandler);
}
}
}