本文整理汇总了C++中FrameLoaderClientQt类的典型用法代码示例。如果您正苦于以下问题:C++ FrameLoaderClientQt类的具体用法?C++ FrameLoaderClientQt怎么用?C++ FrameLoaderClientQt使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FrameLoaderClientQt类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runJavaScriptPrompt
bool ChromeClientQt::runJavaScriptPrompt(Frame* f, const String& message, const String& defaultValue, String& result)
{
QString x = result;
FrameLoaderClientQt *fl = static_cast<FrameLoaderClientQt*>(f->loader()->client());
bool rc = m_webPage->javaScriptPrompt(fl->webFrame(), (QString)message, (QString)defaultValue, &x);
result = x;
return rc;
}
示例2: parentFrame
/*!
Returns a list of all frames that are direct children of this frame.
\sa parentFrame()
*/
QList<QWebFrame*> QWebFrame::childFrames() const
{
QList<QWebFrame*> rc;
if (d->frame) {
FrameTree *tree = d->frame->tree();
for (Frame *child = tree->firstChild(); child; child = child->tree()->nextSibling()) {
FrameLoader *loader = child->loader();
FrameLoaderClientQt *client = static_cast<FrameLoaderClientQt*>(loader->client());
if (client)
rc.append(client->webFrame());
}
}
return rc;
}
示例3: openFileChooser
void FileChooser::openFileChooser(Document* doc)
{
Page *page = doc->page();
Frame *frame = doc->frame();
if (!page || !frame)
return;
FrameLoaderClientQt *fl = static_cast<FrameLoaderClientQt*>(frame->loader()->client());
if (!fl)
return;
QString f = fl->chooseFile(m_filename);
if (!f.isEmpty())
chooseFile(f);
}
示例4: runJavaScriptPrompt
bool ChromeClientQt::runJavaScriptPrompt(Frame* f, const String& message, const String& defaultValue, String& result)
{
QString x = result;
FrameLoaderClientQt* fl = static_cast<FrameLoaderClientQt*>(f->loader()->client());
bool rc = m_webPage->javaScriptPrompt(fl->webFrame(), (QString)message, (QString)defaultValue, &x);
// Fix up a quirk in the QInputDialog class. If no input happened the string should be empty
// but it is null. See https://bugs.webkit.org/show_bug.cgi?id=30914.
if (rc && x.isNull())
result = String("");
else
result = x;
return rc;
}
示例5: QUrl
void MediaPlayerPrivate::load(const String& url)
{
// We are now loading
if (m_networkState != MediaPlayer::Loading) {
m_networkState = MediaPlayer::Loading;
m_player->networkStateChanged();
}
// And we don't have any data yet
if (m_readyState != MediaPlayer::HaveNothing) {
m_readyState = MediaPlayer::HaveNothing;
m_player->readyStateChanged();
}
const QUrl rUrl = QUrl(QString(url));
const QString scheme = rUrl.scheme().toLower();
// Grab the client media element
HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_player->mediaPlayerClient());
// Construct the media content with a network request if the resource is http[s]
if (scheme == "http" || scheme == "https") {
QNetworkRequest request = QNetworkRequest(rUrl);
// Grab the current document
Document* document = element->document();
if (!document)
document = element->ownerDocument();
// Grab the frame and network manager
Frame* frame = document ? document->frame() : 0;
FrameLoaderClientQt* frameLoader = frame ? static_cast<FrameLoaderClientQt*>(frame->loader()->client()) : 0;
QNetworkAccessManager* manager = frameLoader ? frameLoader->webFrame()->page()->networkAccessManager() : 0;
if (document && manager) {
// Set the cookies
QNetworkCookieJar* jar = manager->cookieJar();
QList<QNetworkCookie> cookies = jar->cookiesForUrl(rUrl);
// Don't set the header if there are no cookies.
// This prevents a warning from being emitted.
if (!cookies.isEmpty())
request.setHeader(QNetworkRequest::CookieHeader, qVariantFromValue(cookies));
// Set the refferer, but not when requesting insecure content from a secure page
QUrl documentUrl = QUrl(QString(document->documentURI()));
if (documentUrl.scheme().toLower() == "http" || scheme == "https")
request.setRawHeader("Referer", documentUrl.toEncoded());
// Set the user agent
request.setRawHeader("User-Agent", frameLoader->userAgent(rUrl).utf8().data());
}
m_mediaPlayer->setMedia(QMediaContent(request));
} else {
// Otherwise, just use the URL
m_mediaPlayer->setMedia(QMediaContent(rUrl));
}
// Set the current volume and mute status
// We get these from the element, rather than the player, in case we have
// transitioned from a media engine which doesn't support muting, to a media
// engine which does.
m_mediaPlayer->setMuted(element->muted());
m_mediaPlayer->setVolume(static_cast<int>(element->volume() * 100.0));
}
示例6: runJavaScriptConfirm
bool ChromeClientQt::runJavaScriptConfirm(Frame* f, const String& msg)
{
QString x = msg;
FrameLoaderClientQt *fl = static_cast<FrameLoaderClientQt*>(f->loader()->client());
return m_webPage->javaScriptConfirm(fl->webFrame(), x);
}
示例7: runJavaScriptAlert
void ChromeClientQt::runJavaScriptAlert(Frame* f, const String& msg)
{
QString x = msg;
FrameLoaderClientQt *fl = static_cast<FrameLoaderClientQt*>(f->loader()->client());
m_webPage->javaScriptAlert(fl->webFrame(), x);
}