QWebPage* QWebFrameProto::page() const { scriptDeprecated("QWebFrame will not be available in future versions"); QWebFrame *item = qscriptvalue_cast<QWebFrame*>(thisObject()); if (item) return item->page(); return 0; }
static QNetworkCookieJar* cookieJar(QObject* originatingFrame) { if (!originatingFrame) return 0; QWebFrame* frame = qobject_cast<QWebFrame*>(originatingFrame); if (!frame) return 0; QNetworkAccessManager* manager = frame->page()->networkAccessManager(); QNetworkCookieJar* jar = manager->cookieJar(); return jar; }
static QNetworkCookieJar *cookieJar(const Document *document) { Frame *frame = document->frame(); if (!frame) return 0; FrameLoader *loader = frame->loader(); if (!loader) return 0; QWebFrame* webFrame = static_cast<FrameLoaderClientQt*>(loader->client())->webFrame(); QWebPage* page = webFrame->page(); QNetworkAccessManager* manager = page->networkAccessManager(); QNetworkCookieJar* jar = manager->cookieJar(); return jar; }
// Compare with WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.mm static QString drtDescriptionSuitableForTestResult(WebCore::Frame* _frame) { QWebFrame* frame = QWebFramePrivate::kit(_frame); QString name = frame->frameName(); bool isMainFrame = frame == frame->page()->mainFrame(); if (isMainFrame) { if (!name.isEmpty()) return QString::fromLatin1("main frame \"%1\"").arg(name); return QLatin1String("main frame"); } else { if (!name.isEmpty()) return QString::fromLatin1("frame \"%1\"").arg(name); return QLatin1String("frame (anonymous)"); } }
void KWebKitPart::slotMainFrameLoadFinished (bool ok) { if (!ok || !m_doLoadFinishedActions) return; m_doLoadFinishedActions = false; if (!m_emitOpenUrlNotify) { m_emitOpenUrlNotify = true; // Save history once page loading is done. } // If the document contains no <title> tag, then set it to the current url. if (m_webView->title().trimmed().isEmpty()) { // If the document title is empty, then set it to the current url const QUrl url (m_webView->url()); const QString caption (url.toString((QUrl::RemoveQuery|QUrl::RemoveFragment))); emit setWindowCaption(caption); // The urlChanged signal is emitted if and only if the main frame // receives the title of the page so we manually invoke the slot as a // work around here for pages that do not contain it, such as text // documents... slotUrlChanged(url); } QWebFrame* frame = page()->mainFrame(); if (!frame || frame->url() == *globalBlankUrl) return; // Set the favicon specified through the <link> tag... if (WebKitSettings::self()->favIconsEnabled() && !frame->page()->settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) { const QWebElement element = frame->findFirstElement(QL1S("head>link[rel=icon], " "head>link[rel=\"shortcut icon\"]")); QUrl shortcutIconUrl; if (!element.isNull()) { shortcutIconUrl = frame->baseUrl().resolved(QUrl(element.attribute("href"))); //kDebug() << "setting favicon to" << shortcutIconUrl; m_browserExtension->setIconUrl(shortcutIconUrl); } } slotFrameLoadFinished(ok); }
bool PropertyChanger::set_repaint_throttle(QString value) { QWebFrame* pFrame = static_cast < QWebFrame* > ( this->parent() ); QWebPage* pPage = NULL; if ( pFrame != NULL ) pPage = pFrame->page(); else return false; if ( pPage == NULL ) return false; //TODO: check values pPage->setProperty("_q_RepaintThrottlingPreset", value); return true; }
void KWebKitPart::slotLoadFinished(bool ok) { bool pending = false; if (m_doLoadFinishedActions) { updateActions(); QWebFrame* frame = (page() ? page()->currentFrame() : 0); if (ok && frame == page()->mainFrame() && !frame->findFirstElement(QL1S("head>meta[http-equiv=refresh]")).isNull()) { if (WebKitSettings::self()->autoPageRefresh()) { pending = true; } else { frame->page()->triggerAction(QWebPage::StopScheduledPageRefresh); } } } emit completed ((ok && pending)); }
void NotificationPresenterClientQt::cancelRequestsForPermission(ScriptExecutionContext* context) { m_cachedPermissions.remove(context); QHash<ScriptExecutionContext*, CallbacksInfo >::iterator iter = m_pendingPermissionRequests.find(context); if (iter == m_pendingPermissionRequests.end()) return; QWebFrame* frame = iter.value().m_frame; if (!frame) return; QWebPage* page = frame->page(); m_pendingPermissionRequests.erase(iter); if (!page) return; if (dumpNotification) printf("DESKTOP NOTIFICATION PERMISSION REQUEST CANCELLED: %s\n", QString(context->securityOrigin()->toString()).toUtf8().constData()); emit page->featurePermissionRequestCanceled(frame, QWebPage::Notifications); }