本文整理汇总了C++中WebPage类的典型用法代码示例。如果您正苦于以下问题:C++ WebPage类的具体用法?C++ WebPage怎么用?C++ WebPage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WebPage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ENABLE
bool WebInspectorClient::sendMessageToFrontend(const String& message)
{
WebInspector* inspector = m_page->inspector();
if (!inspector)
return false;
#if ENABLE(INSPECTOR_SERVER)
if (inspector->hasRemoteFrontendConnected()) {
inspector->sendMessageToRemoteFrontend(message);
return true;
}
#endif
WebPage* inspectorPage = inspector->inspectorPage();
if (inspectorPage)
return doDispatchMessageOnFrontendPage(inspectorPage->corePage(), message);
return false;
}
开发者ID:CannedFish,项目名称:webkitgtk,代码行数:19,代码来源:WebInspectorClient.cpp
示例2: setTextCheckerState
void WebProcess::setTextCheckerState(const TextCheckerState& textCheckerState)
{
bool continuousSpellCheckingTurnedOff = !textCheckerState.isContinuousSpellCheckingEnabled && m_textCheckerState.isContinuousSpellCheckingEnabled;
bool grammarCheckingTurnedOff = !textCheckerState.isGrammarCheckingEnabled && m_textCheckerState.isGrammarCheckingEnabled;
m_textCheckerState = textCheckerState;
if (!continuousSpellCheckingTurnedOff && !grammarCheckingTurnedOff)
return;
HashMap<uint64_t, RefPtr<WebPage> >::iterator end = m_pageMap.end();
for (HashMap<uint64_t, RefPtr<WebPage> >::iterator it = m_pageMap.begin(); it != end; ++it) {
WebPage* page = (*it).value.get();
if (continuousSpellCheckingTurnedOff)
page->unmarkAllMisspellings();
if (grammarCheckingTurnedOff)
page->unmarkAllBadGrammar();
}
}
开发者ID:,项目名称:,代码行数:19,代码来源:
示例3: QWebView
WebView::WebView(QWidget *parent, CookieJar *cookieJar) :
QWebView(parent),
cookieJar(cookieJar)
{
WebPage *page = new WebPage();
page->setView(this);
this->setPage(page);
settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true);
settings()->setAttribute(QWebSettings::JavascriptCanCloseWindows, true);
settings()->setAttribute(QWebSettings::NotificationsEnabled, true);
settings()->setThirdPartyCookiePolicy(QWebSettings::ThirdPartyCookiePolicy::AlwaysAllowThirdPartyCookies);
settings()->setFontFamily(QWebSettings::StandardFont, "Segoe UI");
settings()->setFontSize(QWebSettings::DefaultFontSize, 16);
setContextMenuPolicy(Qt::ContextMenuPolicy::PreventContextMenu);
setStoragePath();
setCookies();
}
开发者ID:navrocky,项目名称:TeamWords,代码行数:19,代码来源:webview.cpp
示例4: ASSERT_NOT_REACHED
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;
}
开发者ID:,项目名称:,代码行数:19,代码来源:
示例5: block
QNetworkReply* AdBlockManager::block(const QNetworkRequest &request)
{
#ifdef ADBLOCK_DEBUG
QElapsedTimer timer;
timer.start();
#endif
const QString urlString = request.url().toEncoded().toLower();
const QString urlDomain = request.url().host().toLower();
const QString urlScheme = request.url().scheme().toLower();
if (!isEnabled() || !canRunOnScheme(urlScheme))
return 0;
const AdBlockRule* blockedRule = m_matcher->match(request, urlDomain, urlString);
if (blockedRule) {
QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
WebPage* webPage = static_cast<WebPage*>(v.value<void*>());
if (webPage) {
if (!canBeBlocked(webPage->url())) {
return 0;
}
webPage->addAdBlockRule(blockedRule, request.url());
}
AdBlockBlockedNetworkReply* reply = new AdBlockBlockedNetworkReply(blockedRule, this);
reply->setRequest(request);
#ifdef ADBLOCK_DEBUG
qDebug() << "BLOCKED: " << timer.elapsed() << blockedRule->filter() << request.url();
#endif
return reply;
}
#ifdef ADBLOCK_DEBUG
qDebug() << timer.elapsed() << request.url();
#endif
return 0;
}
开发者ID:schorij23,项目名称:qupzilla,代码行数:42,代码来源:adblockmanager.cpp
示例6: obtainOriginatingWebPage
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
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:20,代码来源:QtNetworkAccessManager.cpp
示例7: while
void WebPageManager::reset() {
m_timeout = -1;
m_cookieJar->clearCookies();
m_networkAccessManager->reset();
m_customHeadersRequestHandler->reset();
m_currentPage->resetLocalStorage();
m_blacklistedRequestHandler->reset();
m_unknownUrlHandler->reset();
while (!m_pages.isEmpty()) {
WebPage *page = m_pages.takeFirst();
page->deleteLater();
}
qint64 size = QWebSettings::offlineWebApplicationCacheQuota();
// No public function was found to wrap the empty() call to
// WebCore::cacheStorage().empty()
QWebSettings::setOfflineWebApplicationCacheQuota(size);
createPage()->setFocus();
}
开发者ID:acl-services,项目名称:capybara-webkit,代码行数:20,代码来源:WebPageManager.cpp
示例8: addVisitedLink
void VisitedLinkTableController::addVisitedLink(Page& page, LinkHash linkHash)
{
if (m_visitedLinkTable.isLinkVisited(linkHash))
return;
WebPage* webPage = WebPage::fromCorePage(&page);
if (!webPage)
return;
WebProcess::singleton().parentProcessConnection()->send(Messages::VisitedLinkProvider::AddVisitedLinkHashFromPage(webPage->pageID(), linkHash), m_identifier);
}
开发者ID:,项目名称:,代码行数:11,代码来源:
示例9: InjectedBundleUserMessageEncoder
void WebFrameLoaderClient::dispatchDidFailProvisionalLoad(const ResourceError& error)
{
WebPage* webPage = m_frame->page();
if (!webPage)
return;
RefPtr<APIObject> userData;
// Notify the bundle client.
webPage->injectedBundleLoaderClient().didFailProvisionalLoadWithErrorForFrame(webPage, m_frame, error, userData);
webPage->sandboxExtensionTracker().didFailProvisionalLoad(m_frame);
// Notify the UIProcess.
webPage->send(Messages::WebPageProxy::DidFailProvisionalLoadForFrame(m_frame->frameID(), error, InjectedBundleUserMessageEncoder(userData.get())));
// If we have a load listener, notify it.
if (WebFrame::LoadListener* loadListener = m_frame->loadListener())
loadListener->didFailLoad(m_frame, error.isCancellation());
}
开发者ID:,项目名称:,代码行数:20,代码来源:
示例10: setSSLConfiguration
void NetworkManager::setSSLConfiguration(QNetworkReply* reply)
{
if (!reply->sslConfiguration().isNull()) {
QSslCertificate cert = reply->sslConfiguration().peerCertificate();
if (!cert.isValid() || reply->property("downReply").toBool()) {
return;
}
QNetworkRequest request = reply->request();
QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
WebPage* webPage = static_cast<WebPage*>(v.value<void*>());
if (!webPage) {
return;
}
if (webPage->url().host() == reply->url().host()) {
webPage->setSSLCertificate(cert);
}
}
}
开发者ID:Shadowmeph,项目名称:QupZilla,代码行数:20,代码来源:networkmanager.cpp
示例11: createPingHandle
void WebLoaderStrategy::createPingHandle(NetworkingContext* networkingContext, ResourceRequest& request, bool shouldUseCredentialStorage)
{
// It's possible that call to createPingHandle might be made during initial empty Document creation before a NetworkingContext exists.
// It is not clear that we should send ping loads during that process anyways.
if (!networkingContext)
return;
WebFrameNetworkingContext* webContext = static_cast<WebFrameNetworkingContext*>(networkingContext);
WebFrameLoaderClient* webFrameLoaderClient = webContext->webFrameLoaderClient();
WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : nullptr;
WebPage* webPage = webFrame ? webFrame->page() : nullptr;
NetworkResourceLoadParameters loadParameters;
loadParameters.request = request;
loadParameters.sessionID = webPage ? webPage->sessionID() : SessionID::defaultSessionID();
loadParameters.allowStoredCredentials = shouldUseCredentialStorage ? AllowStoredCredentials : DoNotAllowStoredCredentials;
loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = networkingContext->shouldClearReferrerOnHTTPSToHTTPRedirect();
WebProcess::singleton().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::LoadPing(loadParameters), 0);
}
开发者ID:josedealcala,项目名称:webkit,代码行数:20,代码来源:WebLoaderStrategy.cpp
示例12:
WebPage
WebPage::operator< (const WebPage & w)
{
if (filename () < w.filename ()) //compare webpages by their filenames
return *this;
else
return w;
}
开发者ID:elifnaz,项目名称:BookSearch,代码行数:11,代码来源:web.cpp
示例13: updateGlobalHistoryRedirectLinks
void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks()
{
WebPage* webPage = m_frame->page();
if (!webPage || !webPage->pageGroup()->isVisibleToHistoryClient())
return;
DocumentLoader* loader = m_frame->coreFrame()->loader()->documentLoader();
ASSERT(loader->unreachableURL().isEmpty());
// Client redirect
if (!loader->clientRedirectSourceForHistory().isNull()) {
WebProcess::shared().connection()->send(Messages::WebContext::DidPerformClientRedirect(webPage->pageID(),
loader->clientRedirectSourceForHistory(), loader->clientRedirectDestinationForHistory(), m_frame->frameID()), 0);
}
// Server redirect
if (!loader->serverRedirectSourceForHistory().isNull()) {
WebProcess::shared().connection()->send(Messages::WebContext::DidPerformServerRedirect(webPage->pageID(),
loader->serverRedirectSourceForHistory(), loader->serverRedirectDestinationForHistory(), m_frame->frameID()), 0);
}
}
开发者ID:,项目名称:,代码行数:21,代码来源:
示例14:
PassRefPtr<Frame> WebFrameLoaderClient::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight)
{
WebPage* webPage = m_frame->page();
RefPtr<WebFrame> subframe = WebFrame::createSubframe(webPage, name, ownerElement);
// Notify the UI process that subframe has been added.
WebProcess::shared().connection()->send(WebPageProxyMessage::DidCreateSubFrame, webPage->pageID(), CoreIPC::In(subframe->frameID()));
Frame* coreSubframe = subframe->coreFrame();
// The creation of the frame may have run arbitrary JavaScript that removed it from the page already.
m_frame->coreFrame()->loader()->loadURLIntoChildFrame(url, referrer, coreSubframe);
// The frame's onload handler may have removed it from the document.
if (!coreSubframe->tree()->parent())
return 0;
return coreSubframe;
}
开发者ID:,项目名称:,代码行数:21,代码来源:
示例15: dispatchWillSubmitForm
void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState> prpFormState)
{
WebPage* webPage = m_frame->page();
if (!webPage)
return;
// FIXME: Pass more of the form state.
RefPtr<FormState> formState = prpFormState;
HTMLFormElement* form = formState->form();
WebFrame* sourceFrame = static_cast<WebFrameLoaderClient*>(formState->sourceFrame()->loader()->client())->webFrame();
const Vector<std::pair<String, String> >& values = formState->textFieldValues();
RefPtr<APIObject> userData;
webPage->injectedBundleFormClient().willSubmitForm(webPage, form, m_frame, sourceFrame, values, userData);
uint64_t listenerID = m_frame->setUpPolicyListener(function);
WebProcess::shared().connection()->send(WebPageProxyMessage::WillSubmitForm, webPage->pageID(),
CoreIPC::In(m_frame->frameID(), sourceFrame->frameID(), values, listenerID, InjectedBundleUserMessageEncoder(userData.get())));
}
开发者ID:,项目名称:,代码行数:22,代码来源:
示例16: defined
void DisplayWindow::clear_display()
{
if (progress_bar)
{
mainwindow->remove_widget_from_layout(progress_bar);
delete progress_bar;
progress_bar = NULL;
}
if (web_view)
{
mainwindow->remove_widget_from_layout(web_view);
#if defined(WEB_MACHINE_ENGINE)
WebPage* page = (WebPage*)web_view->page();
QWebChannel *channel = page ? page->webChannel() : NULL;
if (channel)
channel->deregisterObject(page);
#endif
delete web_view;
web_view = NULL;
}
}
开发者ID:ablwr,项目名称:MediaConch_SourceCode,代码行数:22,代码来源:displaywindow.cpp
示例17: closeDownloadTab
void DownloadManager::closeDownloadTab(const QUrl &url) const
{
// Attempt to close empty tab that was opened only for loading the download url
auto testWebView = [](TabbedWebView *view, const QUrl &url) {
if (view->browserWindow()->tabWidget()->tabBar()->normalTabsCount() < 2) {
return false;
}
WebPage *page = view->page();
if (page->history()->count() != 0) {
return false;
}
if (page->url() != QUrl()) {
return false;
}
QUrl tabUrl = page->requestedUrl();
if (tabUrl.isEmpty()) {
tabUrl = QUrl(view->webTab()->locationBar()->text());
}
return tabUrl.host() == url.host();
};
if (testWebView(mApp->getWindow()->weView(), url)) {
mApp->getWindow()->weView()->closeView();
return;
}
const auto windows = mApp->windows();
for (auto *window : windows) {
const auto tabs = window->tabWidget()->allTabs();
for (auto *tab : tabs) {
auto *view = tab->webView();
if (testWebView(view, url)) {
view->closeView();
return;
}
}
}
}
开发者ID:Martii,项目名称:qupzilla,代码行数:38,代码来源:downloadmanager.cpp
示例18: obtainOriginatingWebPage
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);
}
}
开发者ID:Moondee,项目名称:Artemis,代码行数:23,代码来源:QtNetworkAccessManager.cpp
示例19: committedLoad
void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader)
{
if (!m_pluginView) {
committedLoad(loader, 0, 0);
if (m_frameHasCustomRepresentation) {
WebPage* webPage = m_frame->page();
if (!webPage)
return;
RefPtr<SharedBuffer> mainResourceData = loader->mainResourceData();
CoreIPC::DataReference dataReference(reinterpret_cast<const uint8_t*>(mainResourceData ? mainResourceData->data() : 0), mainResourceData ? mainResourceData->size() : 0);
webPage->send(Messages::WebPageProxy::DidFinishLoadingDataForCustomRepresentation(loader->response().suggestedFilename(), dataReference));
}
return;
}
m_pluginView->manualLoadDidFinishLoading();
m_pluginView = 0;
m_hasSentResponseToPluginView = false;
}
开发者ID:,项目名称:,代码行数:23,代码来源:
示例20: block
QNetworkReply* AdBlockNetwork::block(const QNetworkRequest &request)
{
const QString &urlString = request.url().toEncoded();
const QString &urlScheme = request.url().scheme();
if (urlScheme == "data" || urlScheme == "qrc" || urlScheme == "file" || urlScheme == "qupzilla") {
return 0;
}
AdBlockManager* manager = AdBlockManager::instance();
if (!manager->isEnabled()) {
return 0;
}
const AdBlockRule* blockedRule = 0;
AdBlockSubscription* subscription = manager->subscription();
if (subscription->allow(urlString)) {
return 0;
}
if (const AdBlockRule* rule = subscription->block(urlString)) {
blockedRule = rule;
}
if (blockedRule) {
QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
WebPage* webPage = static_cast<WebPage*>(v.value<void*>());
if (WebPage::isPointerSafeToUse(webPage)) {
webPage->addAdBlockRule(blockedRule->filter(), request.url());
}
AdBlockBlockedNetworkReply* reply = new AdBlockBlockedNetworkReply(request, blockedRule, this);
return reply;
}
return 0;
}
开发者ID:jaitrum,项目名称:QupZilla,代码行数:37,代码来源:adblocknetwork.cpp
注:本文中的WebPage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论