79 #include "WindowFeatures.h" |
79 #include "WindowFeatures.h" |
80 #include "LocalizedStrings.h" |
80 #include "LocalizedStrings.h" |
81 #include "Cache.h" |
81 #include "Cache.h" |
82 #include "runtime/InitializeThreading.h" |
82 #include "runtime/InitializeThreading.h" |
83 #include "PageGroup.h" |
83 #include "PageGroup.h" |
|
84 #include "GeolocationPermissionClientQt.h" |
84 #include "NotificationPresenterClientQt.h" |
85 #include "NotificationPresenterClientQt.h" |
85 #include "PageClientQt.h" |
86 #include "PageClientQt.h" |
86 #include "WorkerThread.h" |
87 #include "WorkerThread.h" |
87 #include "wtf/Threading.h" |
88 #include "wtf/Threading.h" |
88 |
89 |
1214 } QRepaintThrottlingPreset; |
1215 } QRepaintThrottlingPreset; |
1215 |
1216 |
1216 void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* event) |
1217 void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* event) |
1217 { |
1218 { |
1218 if (event->propertyName() == "_q_viewMode") { |
1219 if (event->propertyName() == "_q_viewMode") { |
1219 QString mode = q->property("_q_viewMode").toString(); |
1220 page->setViewMode(Page::stringToViewMode(q->property("_q_viewMode").toString())); |
1220 if (mode != viewMode) { |
|
1221 viewMode = mode; |
|
1222 WebCore::Frame* frame = QWebFramePrivate::core(q->mainFrame()); |
|
1223 WebCore::FrameView* view = frame->view(); |
|
1224 frame->document()->updateStyleSelector(); |
|
1225 view->layout(); |
|
1226 } |
|
1227 } else if (event->propertyName() == "_q_HTMLTokenizerChunkSize") { |
1221 } else if (event->propertyName() == "_q_HTMLTokenizerChunkSize") { |
1228 int chunkSize = q->property("_q_HTMLTokenizerChunkSize").toInt(); |
1222 int chunkSize = q->property("_q_HTMLTokenizerChunkSize").toInt(); |
1229 q->handle()->page->setCustomHTMLTokenizerChunkSize(chunkSize); |
1223 q->handle()->page->setCustomHTMLTokenizerChunkSize(chunkSize); |
1230 } else if (event->propertyName() == "_q_HTMLTokenizerTimeDelay") { |
1224 } else if (event->propertyName() == "_q_HTMLTokenizerTimeDelay") { |
1231 double timeDelay = q->property("_q_HTMLTokenizerTimeDelay").toDouble(); |
1225 double timeDelay = q->property("_q_HTMLTokenizerTimeDelay").toDouble(); |
2085 QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; |
2079 QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; |
2086 return QMessageBox::Yes == QMessageBox::information(parent, tr("JavaScript Problem - %1").arg(mainFrame()->url().host()), tr("The script on this page appears to have a problem. Do you want to stop the script?"), QMessageBox::Yes, QMessageBox::No); |
2080 return QMessageBox::Yes == QMessageBox::information(parent, tr("JavaScript Problem - %1").arg(mainFrame()->url().host()), tr("The script on this page appears to have a problem. Do you want to stop the script?"), QMessageBox::Yes, QMessageBox::No); |
2087 #endif |
2081 #endif |
2088 } |
2082 } |
2089 |
2083 |
2090 /*! |
|
2091 \fn bool QWebPage::allowGeolocationRequest() |
|
2092 \since 4.7 |
|
2093 |
|
2094 This function is called whenever a JavaScript program running inside \a frame tries to access user location through navigator.geolocation. |
|
2095 |
|
2096 If the user wants to allow access to location then it should return true; otherwise false. |
|
2097 |
|
2098 The default implementation executes the query using QMessageBox::information with QMessageBox::Yes and QMessageBox::No buttons. |
|
2099 |
|
2100 \warning Because of binary compatibility constraints, this function is not virtual. If you want to |
|
2101 provide your own implementation in a QWebPage subclass, reimplement the allowGeolocationRequest() |
|
2102 slot in your subclass instead. QtWebKit will dynamically detect the slot and call it. |
|
2103 */ |
|
2104 bool QWebPage::allowGeolocationRequest(QWebFrame *frame) |
|
2105 { |
|
2106 #ifdef QT_NO_MESSAGEBOX |
|
2107 return false; |
|
2108 #else |
|
2109 QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; |
|
2110 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); |
|
2111 #endif |
|
2112 } |
|
2113 |
|
2114 void QWebPage::setUserPermission(QWebFrame* frame, PermissionDomain domain, PermissionPolicy policy) |
2084 void QWebPage::setUserPermission(QWebFrame* frame, PermissionDomain domain, PermissionPolicy policy) |
2115 { |
2085 { |
2116 switch (domain) { |
2086 switch (domain) { |
2117 case NotificationsPermissionDomain: |
2087 case NotificationsPermissionDomain: |
2118 #if ENABLE(NOTIFICATIONS) |
2088 #if ENABLE(NOTIFICATIONS) |
2119 if (policy == PermissionGranted) |
2089 if (policy == PermissionGranted) |
2120 NotificationPresenterClientQt::notificationPresenter()->allowNotificationForFrame(frame); |
2090 NotificationPresenterClientQt::notificationPresenter()->allowNotificationForFrame(frame); |
2121 #endif |
2091 #endif |
2122 break; |
2092 break; |
|
2093 case GeolocationPermissionDomain: |
|
2094 #if ENABLE(GEOLOCATION) |
|
2095 GeolocationPermissionClientQt::geolocationPermissionClient()->setPermission(frame, policy); |
|
2096 #endif |
|
2097 break; |
|
2098 |
2123 default: |
2099 default: |
2124 break; |
2100 break; |
2125 } |
2101 } |
2126 } |
2102 } |
2127 |
2103 |
2134 If the view associated with the web page is a QWebView object, then the default implementation forwards |
2110 If the view associated with the web page is a QWebView object, then the default implementation forwards |
2135 the request to QWebView's createWindow() function; otherwise it returns a null pointer. |
2111 the request to QWebView's createWindow() function; otherwise it returns a null pointer. |
2136 |
2112 |
2137 If \a type is WebModalDialog, the application must call setWindowModality(Qt::ApplicationModal) on the new window. |
2113 If \a type is WebModalDialog, the application must call setWindowModality(Qt::ApplicationModal) on the new window. |
2138 |
2114 |
2139 \sa acceptNavigationRequest() |
2115 \note In the cases when the window creation is being triggered by JavaScript, apart from |
|
2116 reimplementing this method application must also set the JavaScriptCanOpenWindows attribute |
|
2117 of QWebSettings to true in order for it to get called. |
|
2118 |
|
2119 \sa acceptNavigationRequest(), QWebView::createWindow() |
2140 */ |
2120 */ |
2141 QWebPage *QWebPage::createWindow(WebWindowType type) |
2121 QWebPage *QWebPage::createWindow(WebWindowType type) |
2142 { |
2122 { |
2143 QWebView *webView = qobject_cast<QWebView*>(view()); |
2123 QWebView *webView = qobject_cast<QWebView*>(view()); |
2144 if (webView) { |
2124 if (webView) { |