diff options
Diffstat (limited to 'WebKit/qt/Api/qwebpage.cpp')
-rw-r--r-- | WebKit/qt/Api/qwebpage.cpp | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp index 5eee21c..ec415bb 100644 --- a/WebKit/qt/Api/qwebpage.cpp +++ b/WebKit/qt/Api/qwebpage.cpp @@ -81,6 +81,7 @@ #include "Cache.h" #include "runtime/InitializeThreading.h" #include "PageGroup.h" +#include "GeolocationPermissionClientQt.h" #include "NotificationPresenterClientQt.h" #include "PageClientQt.h" #include "WorkerThread.h" @@ -2082,30 +2083,6 @@ bool QWebPage::shouldInterruptJavaScript() #endif } -/*! - \fn bool QWebPage::allowGeolocationRequest() - \since 4.7 - - This function is called whenever a JavaScript program running inside \a frame tries to access user location through navigator.geolocation. - - If the user wants to allow access to location then it should return true; otherwise false. - - The default implementation executes the query using QMessageBox::information with QMessageBox::Yes and QMessageBox::No buttons. - - \warning Because of binary compatibility constraints, this function is not virtual. If you want to - provide your own implementation in a QWebPage subclass, reimplement the allowGeolocationRequest() - slot in your subclass instead. QtWebKit will dynamically detect the slot and call it. -*/ -bool QWebPage::allowGeolocationRequest(QWebFrame *frame) -{ -#ifdef QT_NO_MESSAGEBOX - return false; -#else - QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; - return QMessageBox::Yes == QMessageBox::information(parent, tr("Location Request by- %1").arg(frame->url().host()), tr("The page wants to access your location information. Do you want to allow the request?"), QMessageBox::Yes, QMessageBox::No); -#endif -} - void QWebPage::setUserPermission(QWebFrame* frame, PermissionDomain domain, PermissionPolicy policy) { switch (domain) { @@ -2115,6 +2092,12 @@ void QWebPage::setUserPermission(QWebFrame* frame, PermissionDomain domain, Perm NotificationPresenterClientQt::notificationPresenter()->allowNotificationForFrame(frame); #endif break; + case GeolocationPermissionDomain: +#if ENABLE(GEOLOCATION) + GeolocationPermissionClientQt::geolocationPermissionClient()->setPermission(frame, policy); +#endif + break; + default: break; } @@ -2131,7 +2114,11 @@ void QWebPage::setUserPermission(QWebFrame* frame, PermissionDomain domain, Perm If \a type is WebModalDialog, the application must call setWindowModality(Qt::ApplicationModal) on the new window. - \sa acceptNavigationRequest() + \note In the cases when the window creation is being triggered by JavaScript, apart from + reimplementing this method application must also set the JavaScriptCanOpenWindows attribute + of QWebSettings to true in order for it to get called. + + \sa acceptNavigationRequest(), QWebView::createWindow() */ QWebPage *QWebPage::createWindow(WebWindowType type) { |