本文整理汇总了C++中WebPage::sendSync方法的典型用法代码示例。如果您正苦于以下问题:C++ WebPage::sendSync方法的具体用法?C++ WebPage::sendSync怎么用?C++ WebPage::sendSync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebPage
的用法示例。
在下文中一共展示了WebPage::sendSync方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dispatchDecidePolicyForResponse
void WebFrameLoaderClient::dispatchDecidePolicyForResponse(FramePolicyFunction function, const ResourceResponse& response, const ResourceRequest& request)
{
WebPage* webPage = m_frame->page();
if (!webPage)
return;
if (!request.url().string()) {
(m_frame->coreFrame()->loader()->policyChecker()->*function)(PolicyUse);
return;
}
RefPtr<APIObject> userData;
// Notify the bundle client.
WKBundlePagePolicyAction policy = webPage->injectedBundlePolicyClient().decidePolicyForResponse(webPage, m_frame, response, request, userData);
if (policy == WKBundlePagePolicyActionUse) {
(m_frame->coreFrame()->loader()->policyChecker()->*function)(PolicyUse);
return;
}
uint64_t listenerID = m_frame->setUpPolicyListener(function);
bool receivedPolicyAction;
uint64_t policyAction;
uint64_t downloadID;
// Notify the UIProcess.
if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForResponse(m_frame->frameID(), response, request, listenerID, InjectedBundleUserMessageEncoder(userData.get())), Messages::WebPageProxy::DecidePolicyForResponse::Reply(receivedPolicyAction, policyAction, downloadID)))
return;
// We call this synchronously because CFNetwork can only convert a loading connection to a download from its didReceiveResponse callback.
if (receivedPolicyAction)
m_frame->didReceivePolicyDecision(listenerID, static_cast<PolicyAction>(policyAction), downloadID);
}
示例2: establishConnection
void CompositingManager::establishConnection(WebPage& webPage)
{
IPC::Attachment connectionHandle;
webPage.sendSync(Messages::CompositingManagerProxy::EstablishConnection(),
Messages::CompositingManagerProxy::EstablishConnection::Reply(connectionHandle));
m_connectionFd = connectionHandle.releaseFileDescriptor();
}
示例3: establishConnection
void CompositingManager::establishConnection(WebPage& webPage, WTF::RunLoop& runLoop)
{
IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection();
IPC::Connection::Identifier connectionIdentifier(socketPair.server);
IPC::Attachment connectionClientPort(socketPair.client);
m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this, runLoop);
m_connection->open();
webPage.sendSync(Messages::CompositingManagerProxy::EstablishConnection(connectionClientPort),
Messages::CompositingManagerProxy::EstablishConnection::Reply(), webPage.pageID());
}
示例4: canAuthenticateAgainstProtectionSpace
bool WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long, const ProtectionSpace& protectionSpace)
{
// FIXME: Authentication is a per-resource concept, but we don't do per-resource handling in the UIProcess at the API level quite yet.
// Once we do, we might need to make sure authentication fits with our solution.
WebPage* webPage = m_frame->page();
if (!webPage)
return false;
bool canAuthenticate;
if (!webPage->sendSync(Messages::WebPageProxy::CanAuthenticateAgainstProtectionSpaceInFrame(m_frame->frameID(), protectionSpace), Messages::WebPageProxy::CanAuthenticateAgainstProtectionSpaceInFrame::Reply(canAuthenticate)))
return false;
return canAuthenticate;
}
示例5: shouldGoToHistoryItem
bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem* item) const
{
WebPage* webPage = m_frame->page();
if (!webPage)
return false;
uint64_t itemID = WebBackForwardListProxy::idForItem(item);
if (!itemID) {
// We should never be considering navigating to an item that is not actually in the back/forward list.
ASSERT_NOT_REACHED();
return false;
}
bool shouldGoToBackForwardListItem;
if (!webPage->sendSync(Messages::WebPageProxy::ShouldGoToBackForwardListItem(itemID), Messages::WebPageProxy::ShouldGoToBackForwardListItem::Reply(shouldGoToBackForwardListItem)))
return false;
return shouldGoToBackForwardListItem;
}
示例6: onSslErrors
void QtNetworkAccessManager::onSslErrors(QNetworkReply* reply, const QList<QSslError>& qSslErrors)
{
#ifndef QT_NO_SSL
WebPage* webPage = obtainOriginatingWebPage(reply->request());
// FIXME: This check can go away once our Qt version is up-to-date. See: QTBUG-23512.
if (!webPage)
return;
String hostname = reply->url().host();
bool ignoreErrors = false;
if (webPage->sendSync(
Messages::WebPageProxy::CertificateVerificationRequest(hostname),
Messages::WebPageProxy::CertificateVerificationRequest::Reply(ignoreErrors))) {
if (ignoreErrors)
reply->ignoreSslErrors(qSslErrors);
}
#endif
}
示例7: onAuthenticationRequired
void QtNetworkAccessManager::onAuthenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator)
{
WebPage* webPage = obtainOriginatingWebPage(reply->request());
// FIXME: This check can go away once our Qt version is up-to-date. See: QTBUG-23512.
if (!webPage)
return;
String hostname = reply->url().toString(QUrl::RemovePath | QUrl::RemoveQuery | QUrl::RemoveFragment | QUrl::StripTrailingSlash);
String realm = authenticator->realm();
String prefilledUsername = authenticator->user();
String username;
String password;
if (webPage->sendSync(
Messages::WebPageProxy::AuthenticationRequiredRequest(hostname, realm, prefilledUsername),
Messages::WebPageProxy::AuthenticationRequiredRequest::Reply(username, password))) {
if (!username.isEmpty())
authenticator->setUser(username);
if (!password.isEmpty())
authenticator->setPassword(password);
}
}
示例8: onProxyAuthenticationRequired
void QtNetworkAccessManager::onProxyAuthenticationRequired(const QNetworkProxy& proxy, QAuthenticator* authenticator)
{
// FIXME: Check if there is a better way to get a reference to the page.
WebPage* webPage = m_webProcess->focusedWebPage();
if (!webPage)
return;
String hostname = proxy.hostName();
uint16_t port = static_cast<uint16_t>(proxy.port());
String prefilledUsername = authenticator->user();
String username;
String password;
if (webPage->sendSync(
Messages::WebPageProxy::ProxyAuthenticationRequiredRequest(hostname, port, prefilledUsername),
Messages::WebPageProxy::ProxyAuthenticationRequiredRequest::Reply(username, password))) {
if (!username.isEmpty())
authenticator->setUser(username);
if (!password.isEmpty())
authenticator->setPassword(password);
}
}
示例9: dispatchDecidePolicyForNavigationAction
void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& navigationAction, const ResourceRequest& request, PassRefPtr<FormState> formState)
{
WebPage* webPage = m_frame->page();
if (!webPage)
return;
// Always ignore requests with empty URLs.
if (request.isEmpty()) {
(m_frame->coreFrame()->loader()->policyChecker()->*function)(PolicyIgnore);
return;
}
RefPtr<APIObject> userData;
RefPtr<InjectedBundleNavigationAction> action = InjectedBundleNavigationAction::create(m_frame, navigationAction, formState);
// Notify the bundle client.
WKBundlePagePolicyAction policy = webPage->injectedBundlePolicyClient().decidePolicyForNavigationAction(webPage, m_frame, action.get(), request, userData);
if (policy == WKBundlePagePolicyActionUse) {
(m_frame->coreFrame()->loader()->policyChecker()->*function)(PolicyUse);
return;
}
uint64_t listenerID = m_frame->setUpPolicyListener(function);
bool receivedPolicyAction;
uint64_t policyAction;
uint64_t downloadID;
// Notify the UIProcess.
if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForNavigationAction(m_frame->frameID(), action->navigationType(), action->modifiers(), action->mouseButton(), request, listenerID, InjectedBundleUserMessageEncoder(userData.get())), Messages::WebPageProxy::DecidePolicyForNavigationAction::Reply(receivedPolicyAction, policyAction, downloadID)))
return;
// We call this synchronously because WebCore cannot gracefully handle a frame load without a synchronous navigation policy reply.
if (receivedPolicyAction)
m_frame->didReceivePolicyDecision(listenerID, static_cast<PolicyAction>(policyAction), downloadID);
}