From e561b9a645a7f9f67f1c2cf3d267b27d66529eb9 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 14 Sep 2015 17:17:47 +0200 Subject: Signal that no positioning backend is available So far we didn't gave any hint that no positioning backend is available. This patch adds a qWarning(), and also signals the JS side that no positioning data is available. While at it, the unused bool return value of start() is removed. Change-Id: I9e3c21a9ea5c6ab94d230507fe7418fb01c7b86c Reviewed-by: Allan Sandfeld Jensen --- src/core/location_provider_qt.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/core/location_provider_qt.cpp b/src/core/location_provider_qt.cpp index d17fc3d21..e3be01b36 100644 --- a/src/core/location_provider_qt.cpp +++ b/src/core/location_provider_qt.cpp @@ -60,7 +60,7 @@ public: QtPositioningHelper(LocationProviderQt *provider); ~QtPositioningHelper(); - bool start(bool highAccuracy); + void start(bool highAccuracy); void stop(); void refresh(); @@ -88,15 +88,20 @@ QtPositioningHelper::~QtPositioningHelper() m_locationProvider->m_positioningHelper = 0; } -bool QtPositioningHelper::start(bool highAccuracy) +void QtPositioningHelper::start(bool highAccuracy) { DCHECK_CURRENTLY_ON(BrowserThread::UI); Q_UNUSED(highAccuracy); // FIXME: go through availableSources until one supports QGeoPositionInfoSource::SatellitePositioningMethods // for the highAccuracy case. m_positionInfoSource = QGeoPositionInfoSource::createDefaultSource(this); - if (!m_positionInfoSource) - return false; + if (!m_positionInfoSource) { + qWarning("Failed to initialize location provider: The system either has no default " + "position source, no valid plugins could be found or the user does not have " + "the right permissions."); + error(QGeoPositionInfoSource::UnknownSourceError); + return; + } connect(m_positionInfoSource, &QGeoPositionInfoSource::positionUpdated, this, &QtPositioningHelper::updatePosition); // disambiguate the error getter and the signal in QGeoPositionInfoSource. @@ -105,7 +110,7 @@ bool QtPositioningHelper::start(bool highAccuracy) connect(m_positionInfoSource, &QGeoPositionInfoSource::updateTimeout, this, &QtPositioningHelper::timeout); m_positionInfoSource->startUpdates(); - return true; + return; } void QtPositioningHelper::stop() @@ -208,7 +213,7 @@ bool LocationProviderQt::StartProvider(bool highAccuracy) m_positioningHelper = new QtPositioningHelper(this); m_positioningHelper->moveToThread(guiThread); } - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(base::IgnoreResult(&QtPositioningHelper::start) + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(&QtPositioningHelper::start , base::Unretained(m_positioningHelper), highAccuracy)); return true; } -- cgit v1.2.3 From 2080ac3ad0878dc04865bf957c84f8f0b5b551ac Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Thu, 24 Sep 2015 06:20:22 -0700 Subject: Implement unload dialogs This fixes the assertion that occurs when the application should show "Are you sure you want to leave this page?" dialog. We can reuse the already existing confirm dialog implementations. Change-Id: I22466d450f39b54d9becbb69e1ecadb3b98697b0 Reviewed-by: Joerg Bornemann --- src/core/javascript_dialog_manager_qt.cpp | 6 ++++++ src/core/javascript_dialog_manager_qt.h | 2 +- src/core/web_contents_adapter_client.h | 1 + src/webengine/ui_delegates_manager.cpp | 4 ++++ src/webenginewidgets/api/qwebenginepage.cpp | 3 +++ 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/core/javascript_dialog_manager_qt.cpp b/src/core/javascript_dialog_manager_qt.cpp index fdcd7bdbc..24d426098 100644 --- a/src/core/javascript_dialog_manager_qt.cpp +++ b/src/core/javascript_dialog_manager_qt.cpp @@ -67,6 +67,12 @@ void JavaScriptDialogManagerQt::RunJavaScriptDialog(content::WebContents *webCon runDialogForContents(webContents, dialogType, toQt(messageText).toHtmlEscaped(), toQt(defaultPromptText).toHtmlEscaped(), toQt(originUrl), callback); } +void JavaScriptDialogManagerQt::RunBeforeUnloadDialog(content::WebContents *webContents, const base::string16 &messageText, + bool isReload, const content::JavaScriptDialogManager::DialogClosedCallback &callback) { + Q_UNUSED(isReload); + runDialogForContents(webContents, WebContentsAdapterClient::UnloadDialog, toQt(messageText).toHtmlEscaped(), QString() , QUrl(), callback); +} + bool JavaScriptDialogManagerQt::HandleJavaScriptDialog(content::WebContents *contents, bool accept, const base::string16 *promptOverride) { QSharedPointer dialog = m_activeDialogs.value(contents); diff --git a/src/core/javascript_dialog_manager_qt.h b/src/core/javascript_dialog_manager_qt.h index 8bf7ac6b9..fb47166c1 100644 --- a/src/core/javascript_dialog_manager_qt.h +++ b/src/core/javascript_dialog_manager_qt.h @@ -63,7 +63,7 @@ public: const content::JavaScriptDialogManager::DialogClosedCallback &callback, bool *didSuppressMessage) Q_DECL_OVERRIDE; virtual void RunBeforeUnloadDialog(content::WebContents *, const base::string16 &messageText, bool isReload, - const content::JavaScriptDialogManager::DialogClosedCallback &callback) Q_DECL_OVERRIDE { Q_UNUSED(messageText); Q_UNUSED(isReload); Q_UNUSED(callback); } + const content::JavaScriptDialogManager::DialogClosedCallback &callback) Q_DECL_OVERRIDE; virtual bool HandleJavaScriptDialog(content::WebContents *, bool accept, const base::string16 *promptOverride) Q_DECL_OVERRIDE; virtual void CancelActiveAndPendingDialogs(content::WebContents *contents) Q_DECL_OVERRIDE { takeDialogForContents(contents); } virtual void ResetDialogState(content::WebContents *contents) Q_DECL_OVERRIDE { takeDialogForContents(contents); } diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h index 3ae84f9c8..2b9b62229 100644 --- a/src/core/web_contents_adapter_client.h +++ b/src/core/web_contents_adapter_client.h @@ -147,6 +147,7 @@ public: AlertDialog, ConfirmDialog, PromptDialog, + UnloadDialog, // Leave room for potential new specs InternalAuthorizationDialog = 0x10, }; diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp index 5a5c261b4..4cc64c8c7 100644 --- a/src/webengine/ui_delegates_manager.cpp +++ b/src/webengine/ui_delegates_manager.cpp @@ -259,6 +259,10 @@ void UIDelegatesManager::showDialog(QSharedPointer d dialogComponentType = PromptDialog; title = QCoreApplication::translate("UIDelegatesManager", "Javascript Prompt - %1").arg(m_view->url().toString()); break; + case WebContentsAdapterClient::UnloadDialog: + dialogComponentType = ConfirmDialog; + title = QCoreApplication::translate("UIDelegatesManager", "Are you sure you want to leave this page?"); + break; case WebContentsAdapterClient::InternalAuthorizationDialog: dialogComponentType = ConfirmDialog; title = dialogController->title(); diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 677f67cbe..5d91b3b7f 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -904,6 +904,9 @@ void QWebEnginePagePrivate::javascriptDialog(QSharedPointertextProvided(promptResult); break; + case UnloadDialog: + accepted = (QMessageBox::information(view, QCoreApplication::translate("QWebEnginePage", "Are you sure you want to leave this page?"), controller->message(), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes); + break; case InternalAuthorizationDialog: accepted = (QMessageBox::question(view, controller->title(), controller->message(), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes); break; -- cgit v1.2.3 From 708b852a1b587e68e0ccc6999d4e04fa830689e3 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 22 Sep 2015 16:14:58 +0200 Subject: External URL support Support for launching external URLs such as mailto: They are also routed through navigationRequested like they would have been in QtWebKit. [ChangeLog][QtWebEngineCore] External links such as mailto: are now handled. By default they launch using QDesktopServices. Change-Id: I83ed96e2330d54cae57f03648d471a8da9a82a30 Task-number: QTBUG-47143 Reviewed-by: Kai Koehne --- src/core/network_delegate_qt.cpp | 2 +- src/core/resource_dispatcher_host_delegate_qt.cpp | 29 +++++++++++++++++++++++ src/core/resource_dispatcher_host_delegate_qt.h | 3 +++ src/core/web_contents_delegate_qt.cpp | 15 ++++++++++++ src/core/web_contents_delegate_qt.h | 1 + 5 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/core/network_delegate_qt.cpp b/src/core/network_delegate_qt.cpp index 38fd3c710..b8f1b68d0 100644 --- a/src/core/network_delegate_qt.cpp +++ b/src/core/network_delegate_qt.cpp @@ -55,7 +55,7 @@ namespace QtWebEngineCore { -static int pageTransitionToNavigationType(ui::PageTransition transition) +int pageTransitionToNavigationType(ui::PageTransition transition) { int32 qualifier = ui::PageTransitionGetQualifier(transition); diff --git a/src/core/resource_dispatcher_host_delegate_qt.cpp b/src/core/resource_dispatcher_host_delegate_qt.cpp index b63ecd5c7..e6c513bf6 100644 --- a/src/core/resource_dispatcher_host_delegate_qt.cpp +++ b/src/core/resource_dispatcher_host_delegate_qt.cpp @@ -130,6 +130,35 @@ void ResourceDispatcherHostLoginDelegateQt::destroy() m_request = 0; } +static void LaunchURL(const GURL& url, int render_process_id, int render_view_id, + ui::PageTransition page_transition, bool is_main_frame) +{ + Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + content::RenderViewHost *render_view_host = content::RenderViewHost::FromID(render_process_id, render_view_id); + if (!render_view_host) + return; + content::WebContents* webContents = content::WebContents::FromRenderViewHost(render_view_host); + if (!webContents) + return; + WebContentsDelegateQt *contentsDelegate = static_cast(webContents->GetDelegate()); + contentsDelegate->launchExternalURL(toQt(url), page_transition, is_main_frame); +} + +bool ResourceDispatcherHostDelegateQt::HandleExternalProtocol(const GURL& url, int child_id, int route_id, + bool is_main_frame, ui::PageTransition page_transition, bool has_user_gesture) +{ + Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); + // We don't want to launch external applications unless it is based on a user action + if (!has_user_gesture) + return false; + + content::BrowserThread::PostTask( + content::BrowserThread::UI, + FROM_HERE, + base::Bind(&LaunchURL, url, child_id, route_id, page_transition, is_main_frame)); + return true; +} + content::ResourceDispatcherHostLoginDelegate *ResourceDispatcherHostDelegateQt::CreateLoginDelegate(net::AuthChallengeInfo *authInfo, net::URLRequest *request) { // ResourceDispatcherHostLoginDelegateQt is ref-counted and will be released after we called ClearLoginDelegateForRequest. diff --git a/src/core/resource_dispatcher_host_delegate_qt.h b/src/core/resource_dispatcher_host_delegate_qt.h index d62292995..57eaa3bc5 100644 --- a/src/core/resource_dispatcher_host_delegate_qt.h +++ b/src/core/resource_dispatcher_host_delegate_qt.h @@ -86,6 +86,9 @@ private: class ResourceDispatcherHostDelegateQt : public content::ResourceDispatcherHostDelegate { public: + virtual bool HandleExternalProtocol(const GURL& url, int child_id, int route_id, + bool is_main_frame, ui::PageTransition page_transition, bool has_user_gesture) Q_DECL_OVERRIDE; + virtual content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate(net::AuthChallengeInfo *authInfo, net::URLRequest *request) Q_DECL_OVERRIDE; }; diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index eb9c42edc..1c37f62df 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -43,6 +43,7 @@ #include "browser_context_adapter.h" #include "file_picker_controller.h" #include "media_capture_devices_dispatcher.h" +#include "network_delegate_qt.h" #include "type_conversion.h" #include "web_contents_adapter_client.h" #include "web_contents_adapter_p.h" @@ -64,6 +65,8 @@ #include "content/public/common/web_preferences.h" #include "ui/events/latency_info.h" +#include + namespace QtWebEngineCore { // Maps the LogSeverity defines in base/logging.h to the web engines message levels. @@ -357,6 +360,18 @@ void WebContentsDelegateQt::requestGeolocationPermission(const QUrl &requestingO m_viewClient->runGeolocationPermissionRequest(requestingOrigin); } +extern int pageTransitionToNavigationType(ui::PageTransition transition); + +void WebContentsDelegateQt::launchExternalURL(const QUrl &url, ui::PageTransition page_transition, bool is_main_frame) +{ + int navigationRequestAction = WebContentsAdapterClient::AcceptRequest; + m_viewClient->navigationRequested(pageTransitionToNavigationType(page_transition), url, navigationRequestAction, is_main_frame); +#ifndef QT_NO_DESKTOPSERVICES + if (navigationRequestAction == WebContentsAdapterClient::AcceptRequest) + QDesktopServices::openUrl(url); +#endif +} + void WebContentsDelegateQt::ShowValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view, const base::string16 &main_text, const base::string16 &sub_text) { Q_UNUSED(web_contents); diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 3fda96113..14421d060 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -107,6 +107,7 @@ public: void overrideWebPreferences(content::WebContents *, content::WebPreferences*); void allowCertificateError(const QSharedPointer &) ; void requestGeolocationPermission(const QUrl &requestingOrigin); + void launchExternalURL(const QUrl &url, ui::PageTransition page_transition, bool is_main_frame); private: WebContentsAdapter *createWindow(content::WebContents *new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture); -- cgit v1.2.3 From 961ecdd3456629bc40fd0a659c4dcf81521fc072 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 28 Sep 2015 16:04:17 +0200 Subject: Fix QT_NO_ASCII_CAST build Use QStringLiteral for string literals. Change-Id: Ie5c105fac5e23bb323da5e0407874d25154ebe58 Reviewed-by: Joerg Bornemann --- src/core/cookie_monster_delegate_qt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/cookie_monster_delegate_qt.cpp b/src/core/cookie_monster_delegate_qt.cpp index 7838617ba..7622614ca 100644 --- a/src/core/cookie_monster_delegate_qt.cpp +++ b/src/core/cookie_monster_delegate_qt.cpp @@ -49,7 +49,7 @@ namespace QtWebEngineCore { static GURL sourceUrlForCookie(const QNetworkCookie &cookie) { - QString urlFragment = QString("%1%2").arg(cookie.domain()).arg(cookie.path()); + QString urlFragment = QStringLiteral("%1%2").arg(cookie.domain()).arg(cookie.path()); return net::cookie_util::CookieOriginToURL(urlFragment.toStdString(), /* is_https */ cookie.isSecure()); } -- cgit v1.2.3 From c88eb853ab41003242053ded4ad5636722b03393 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 28 Sep 2015 13:38:20 +0200 Subject: Correct demobrowser target on OS X We were still using Browser as target on OS X Change-Id: I0b526ad772651a3a54913e0830fc2f92fe2648c4 Reviewed-by: Joerg Bornemann --- examples/webenginewidgets/demobrowser/demobrowser.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/webenginewidgets/demobrowser/demobrowser.pro b/examples/webenginewidgets/demobrowser/demobrowser.pro index 0893fe649..14347de71 100644 --- a/examples/webenginewidgets/demobrowser/demobrowser.pro +++ b/examples/webenginewidgets/demobrowser/demobrowser.pro @@ -75,7 +75,7 @@ win32 { mac { ICON = demobrowser.icns QMAKE_INFO_PLIST = Info_mac.plist - TARGET = Browser + TARGET = Demobrowser } EXAMPLE_FILES = Info_mac.plist demobrowser.icns demobrowser.ico demobrowser.rc -- cgit v1.2.3 From 0169592b56efe17709db93f8fa02274b3774277a Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 9 Sep 2015 10:03:41 +0200 Subject: update tst_publicapi Added QQuickWebEngineSingleton and updated the expected API list. Change-Id: If91aadd2353b94732da18734bdfe68fbf3245d53 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/quick/publicapi/tst_publicapi.cpp | 211 +++++++++++++++++---------- 1 file changed, 132 insertions(+), 79 deletions(-) diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index 8f0c2f6ec..bf0192e42 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -56,6 +56,7 @@ #include #include #include +#include class tst_publicapi : public QObject { Q_OBJECT @@ -76,6 +77,7 @@ static QList typesToCheck = QList() << &QQuickWebEngineScript::staticMetaObject << &QQuickWebEngineSettings::staticMetaObject << &QQuickWebEngineFullScreenRequest::staticMetaObject + << &QQuickWebEngineSingleton::staticMetaObject ; static QList knownEnumNames = QList(); @@ -87,28 +89,22 @@ static QStringList hardcodedTypes = QStringList() // Ignore the testSupport types without making a fuss. << "QQuickWebEngineTestSupport*" << "QQuickWebEngineErrorPage*" + << "QWebEngineCookieStoreClient*" ; static QStringList expectedAPI = QStringList() << "QQuickWebEngineView.AcceptRequest --> NavigationRequestAction" << "QQuickWebEngineView.IgnoreRequest --> NavigationRequestAction" + << "QQuickWebEngineView.LinkClickedNavigation --> NavigationType" + << "QQuickWebEngineView.TypedNavigation --> NavigationType" + << "QQuickWebEngineView.FormSubmittedNavigation --> NavigationType" + << "QQuickWebEngineView.BackForwardNavigation --> NavigationType" + << "QQuickWebEngineView.ReloadNavigation --> NavigationType" + << "QQuickWebEngineView.OtherNavigation --> NavigationType" << "QQuickWebEngineView.LoadStartedStatus --> LoadStatus" << "QQuickWebEngineView.LoadStoppedStatus --> LoadStatus" << "QQuickWebEngineView.LoadSucceededStatus --> LoadStatus" << "QQuickWebEngineView.LoadFailedStatus --> LoadStatus" - << "QQuickWebEngineCertificateError.SslPinnedKeyNotInCertificateChain --> Error" - << "QQuickWebEngineCertificateError.CertificateCommonNameInvalid --> Error" - << "QQuickWebEngineCertificateError.CertificateDateInvalid --> Error" - << "QQuickWebEngineCertificateError.CertificateAuthorityInvalid --> Error" - << "QQuickWebEngineCertificateError.CertificateContainsErrors --> Error" - << "QQuickWebEngineCertificateError.CertificateNoRevocationMechanism --> Error" - << "QQuickWebEngineCertificateError.CertificateUnableToCheckRevocation --> Error" - << "QQuickWebEngineCertificateError.CertificateRevoked --> Error" - << "QQuickWebEngineCertificateError.CertificateInvalid --> Error" - << "QQuickWebEngineCertificateError.CertificateWeakSignatureAlgorithm --> Error" - << "QQuickWebEngineCertificateError.CertificateNonUniqueName --> Error" - << "QQuickWebEngineCertificateError.CertificateWeakKey --> Error" - << "QQuickWebEngineCertificateError.CertificateNameConstraintViolation --> Error" << "QQuickWebEngineView.NoErrorDomain --> ErrorDomain" << "QQuickWebEngineView.InternalErrorDomain --> ErrorDomain" << "QQuickWebEngineView.ConnectionErrorDomain --> ErrorDomain" @@ -116,14 +112,6 @@ static QStringList expectedAPI = QStringList() << "QQuickWebEngineView.HttpErrorDomain --> ErrorDomain" << "QQuickWebEngineView.FtpErrorDomain --> ErrorDomain" << "QQuickWebEngineView.DnsErrorDomain --> ErrorDomain" - << "QQuickWebEngineView.FindBackward --> FindFlags" - << "QQuickWebEngineView.FindCaseSensitively --> FindFlags" - << "QQuickWebEngineView.LinkClickedNavigation --> NavigationType" - << "QQuickWebEngineView.TypedNavigation --> NavigationType" - << "QQuickWebEngineView.FormSubmittedNavigation --> NavigationType" - << "QQuickWebEngineView.BackForwardNavigation --> NavigationType" - << "QQuickWebEngineView.ReloadNavigation --> NavigationType" - << "QQuickWebEngineView.OtherNavigation --> NavigationType" << "QQuickWebEngineView.NewViewInWindow --> NewViewDestination" << "QQuickWebEngineView.NewViewInTab --> NewViewDestination" << "QQuickWebEngineView.NewViewInDialog --> NewViewDestination" @@ -132,31 +120,81 @@ static QStringList expectedAPI = QStringList() << "QQuickWebEngineView.MediaVideoCapture --> Feature" << "QQuickWebEngineView.MediaAudioVideoCapture --> Feature" << "QQuickWebEngineView.Geolocation --> Feature" + << "QQuickWebEngineView.NoWebAction --> WebAction" + << "QQuickWebEngineView.Back --> WebAction" + << "QQuickWebEngineView.Forward --> WebAction" + << "QQuickWebEngineView.Stop --> WebAction" + << "QQuickWebEngineView.Reload --> WebAction" + << "QQuickWebEngineView.Cut --> WebAction" + << "QQuickWebEngineView.Copy --> WebAction" + << "QQuickWebEngineView.Paste --> WebAction" + << "QQuickWebEngineView.Undo --> WebAction" + << "QQuickWebEngineView.Redo --> WebAction" + << "QQuickWebEngineView.SelectAll --> WebAction" + << "QQuickWebEngineView.ReloadAndBypassCache --> WebAction" + << "QQuickWebEngineView.PasteAndMatchStyle --> WebAction" + << "QQuickWebEngineView.OpenLinkInThisWindow --> WebAction" + << "QQuickWebEngineView.OpenLinkInNewWindow --> WebAction" + << "QQuickWebEngineView.OpenLinkInNewTab --> WebAction" + << "QQuickWebEngineView.CopyLinkToClipboard --> WebAction" + << "QQuickWebEngineView.DownloadLinkToDisk --> WebAction" + << "QQuickWebEngineView.CopyImageToClipboard --> WebAction" + << "QQuickWebEngineView.CopyImageUrlToClipboard --> WebAction" + << "QQuickWebEngineView.DownloadImageToDisk --> WebAction" + << "QQuickWebEngineView.CopyMediaUrlToClipboard --> WebAction" + << "QQuickWebEngineView.ToggleMediaControls --> WebAction" + << "QQuickWebEngineView.ToggleMediaLoop --> WebAction" + << "QQuickWebEngineView.ToggleMediaPlayPause --> WebAction" + << "QQuickWebEngineView.ToggleMediaMute --> WebAction" + << "QQuickWebEngineView.DownloadMediaToDisk --> WebAction" + << "QQuickWebEngineView.InspectElement --> WebAction" + << "QQuickWebEngineView.ExitFullScreen --> WebAction" + << "QQuickWebEngineView.WebActionCount --> WebAction" << "QQuickWebEngineView.InfoMessageLevel --> JavaScriptConsoleMessageLevel" << "QQuickWebEngineView.WarningMessageLevel --> JavaScriptConsoleMessageLevel" << "QQuickWebEngineView.ErrorMessageLevel --> JavaScriptConsoleMessageLevel" - << "QQuickWebEngineView.title --> QString" + << "QQuickWebEngineView.NormalTerminationStatus --> RenderProcessTerminationStatus" + << "QQuickWebEngineView.AbnormalTerminationStatus --> RenderProcessTerminationStatus" + << "QQuickWebEngineView.CrashedTerminationStatus --> RenderProcessTerminationStatus" + << "QQuickWebEngineView.KilledTerminationStatus --> RenderProcessTerminationStatus" + << "QQuickWebEngineView.FindBackward --> FindFlags" + << "QQuickWebEngineView.FindCaseSensitively --> FindFlags" << "QQuickWebEngineView.url --> QUrl" << "QQuickWebEngineView.icon --> QUrl" + << "QQuickWebEngineView.loading --> bool" + << "QQuickWebEngineView.loadProgress --> int" + << "QQuickWebEngineView.title --> QString" << "QQuickWebEngineView.canGoBack --> bool" << "QQuickWebEngineView.canGoForward --> bool" << "QQuickWebEngineView.isFullScreen --> bool" - << "QQuickWebEngineView.loading --> bool" - << "QQuickWebEngineView.loadProgress --> int" + << "QQuickWebEngineView.zoomFactor --> double" + << "QQuickWebEngineView.profile --> QQuickWebEngineProfile*" + << "QQuickWebEngineView.settings --> QQuickWebEngineSettings*" + << "QQuickWebEngineView.navigationHistory --> QQuickWebEngineHistory*" + << "QQuickWebEngineView.webChannel --> QQmlWebChannel*" + << "QQuickWebEngineView.userScripts --> QQmlListProperty" + << "QQuickWebEngineView.activeFocusOnPress --> bool" + << "QQuickWebEngineView.backgroundColor --> QColor" + << "QQuickWebEngineView.testSupport --> QQuickWebEngineTestSupport*" << "QQuickWebEngineView.titleChanged() --> void" - << "QQuickWebEngineView.loadingChanged(QQuickWebEngineLoadRequest*) --> void" - << "QQuickWebEngineView.certificateError(QQuickWebEngineCertificateError*) --> void" - << "QQuickWebEngineView.loadProgressChanged() --> void" - << "QQuickWebEngineView.javaScriptConsoleMessage(JavaScriptConsoleMessageLevel,QString,int,QString) --> void" << "QQuickWebEngineView.urlChanged() --> void" << "QQuickWebEngineView.iconChanged() --> void" + << "QQuickWebEngineView.loadingChanged(QQuickWebEngineLoadRequest*) --> void" + << "QQuickWebEngineView.loadProgressChanged() --> void" << "QQuickWebEngineView.linkHovered(QUrl) --> void" << "QQuickWebEngineView.navigationRequested(QQuickWebEngineNavigationRequest*) --> void" + << "QQuickWebEngineView.javaScriptConsoleMessage(JavaScriptConsoleMessageLevel,QString,int,QString) --> void" + << "QQuickWebEngineView.certificateError(QQuickWebEngineCertificateError*) --> void" << "QQuickWebEngineView.fullScreenRequested(QQuickWebEngineFullScreenRequest) --> void" << "QQuickWebEngineView.isFullScreenChanged() --> void" - << "QQuickWebEngineView.fullScreenCancelled() --> void" << "QQuickWebEngineView.featurePermissionRequested(QUrl,Feature) --> void" - << "QQuickWebEngineView.grantFeaturePermission(QUrl,Feature,bool) --> void" + << "QQuickWebEngineView.newViewRequested(QQuickWebEngineNewViewRequest*) --> void" + << "QQuickWebEngineView.zoomFactorChanged(double) --> void" + << "QQuickWebEngineView.profileChanged() --> void" + << "QQuickWebEngineView.webChannelChanged() --> void" + << "QQuickWebEngineView.activeFocusOnPressChanged(bool) --> void" + << "QQuickWebEngineView.backgroundColorChanged() --> void" + << "QQuickWebEngineView.renderProcessTerminated(RenderProcessTerminationStatus,int) --> void" << "QQuickWebEngineView.runJavaScript(QString,QJSValue) --> void" << "QQuickWebEngineView.runJavaScript(QString) --> void" << "QQuickWebEngineView.loadHtml(QString,QUrl) --> void" @@ -164,37 +202,50 @@ static QStringList expectedAPI = QStringList() << "QQuickWebEngineView.goBack() --> void" << "QQuickWebEngineView.goForward() --> void" << "QQuickWebEngineView.goBackOrForward(int) --> void" - << "QQuickWebEngineView.stop() --> void" << "QQuickWebEngineView.reload() --> void" - << "QQuickWebEngineView.zoomFactor --> double" - << "QQuickWebEngineView.zoomFactorChanged(double) --> void" - << "QQuickWebEngineView.profile --> QQuickWebEngineProfile*" - << "QQuickWebEngineView.profileChanged() --> void" - << "QQuickWebEngineView.navigationHistory --> QQuickWebEngineHistory*" - << "QQuickWebEngineView.newViewRequested(QQuickWebEngineNewViewRequest*) --> void" - << "QQuickWebEngineView.userScripts --> QQmlListProperty" - << "QQuickWebEngineView.settings --> QQuickWebEngineSettings*" - << "QQuickWebEngineView.testSupport --> QQuickWebEngineTestSupport*" - << "QQuickWebEngineView.webChannel --> QQmlWebChannel*" - << "QQuickWebEngineView.webChannelChanged() --> void" << "QQuickWebEngineView.reloadAndBypassCache() --> void" + << "QQuickWebEngineView.stop() --> void" << "QQuickWebEngineView.findText(QString,FindFlags,QJSValue) --> void" << "QQuickWebEngineView.findText(QString,FindFlags) --> void" << "QQuickWebEngineView.findText(QString) --> void" - << "QQuickWebEngineDownloadItem.id --> uint" - << "QQuickWebEngineDownloadItem.state --> DownloadState" - << "QQuickWebEngineDownloadItem.path --> QString" - << "QQuickWebEngineDownloadItem.totalBytes --> qlonglong" - << "QQuickWebEngineDownloadItem.receivedBytes --> qlonglong" + << "QQuickWebEngineView.fullScreenCancelled() --> void" + << "QQuickWebEngineView.grantFeaturePermission(QUrl,Feature,bool) --> void" + << "QQuickWebEngineView.setActiveFocusOnPress(bool) --> void" + << "QQuickWebEngineView.triggerWebAction(WebAction) --> void" + << "QQuickWebEngineCertificateError.SslPinnedKeyNotInCertificateChain --> Error" + << "QQuickWebEngineCertificateError.CertificateCommonNameInvalid --> Error" + << "QQuickWebEngineCertificateError.CertificateDateInvalid --> Error" + << "QQuickWebEngineCertificateError.CertificateAuthorityInvalid --> Error" + << "QQuickWebEngineCertificateError.CertificateContainsErrors --> Error" + << "QQuickWebEngineCertificateError.CertificateNoRevocationMechanism --> Error" + << "QQuickWebEngineCertificateError.CertificateUnableToCheckRevocation --> Error" + << "QQuickWebEngineCertificateError.CertificateRevoked --> Error" + << "QQuickWebEngineCertificateError.CertificateInvalid --> Error" + << "QQuickWebEngineCertificateError.CertificateWeakSignatureAlgorithm --> Error" + << "QQuickWebEngineCertificateError.CertificateNonUniqueName --> Error" + << "QQuickWebEngineCertificateError.CertificateWeakKey --> Error" + << "QQuickWebEngineCertificateError.CertificateNameConstraintViolation --> Error" + << "QQuickWebEngineCertificateError.url --> QUrl" + << "QQuickWebEngineCertificateError.error --> Error" + << "QQuickWebEngineCertificateError.description --> QString" + << "QQuickWebEngineCertificateError.overridable --> bool" + << "QQuickWebEngineCertificateError.defer() --> void" + << "QQuickWebEngineCertificateError.ignoreCertificateError() --> void" + << "QQuickWebEngineCertificateError.rejectCertificate() --> void" << "QQuickWebEngineDownloadItem.DownloadRequested --> DownloadState" << "QQuickWebEngineDownloadItem.DownloadInProgress --> DownloadState" << "QQuickWebEngineDownloadItem.DownloadCompleted --> DownloadState" << "QQuickWebEngineDownloadItem.DownloadCancelled --> DownloadState" << "QQuickWebEngineDownloadItem.DownloadInterrupted --> DownloadState" + << "QQuickWebEngineDownloadItem.id --> uint" + << "QQuickWebEngineDownloadItem.state --> DownloadState" + << "QQuickWebEngineDownloadItem.totalBytes --> qlonglong" + << "QQuickWebEngineDownloadItem.receivedBytes --> qlonglong" + << "QQuickWebEngineDownloadItem.path --> QString" << "QQuickWebEngineDownloadItem.stateChanged() --> void" - << "QQuickWebEngineDownloadItem.pathChanged() --> void" << "QQuickWebEngineDownloadItem.receivedBytesChanged() --> void" << "QQuickWebEngineDownloadItem.totalBytesChanged() --> void" + << "QQuickWebEngineDownloadItem.pathChanged() --> void" << "QQuickWebEngineDownloadItem.accept() --> void" << "QQuickWebEngineDownloadItem.cancel() --> void" << "QQuickWebEngineHistory.items --> QQuickWebEngineHistoryListModel*" @@ -224,6 +275,7 @@ static QStringList expectedAPI = QStringList() << "QQuickWebEngineProfile.cachePath --> QString" << "QQuickWebEngineProfile.httpUserAgent --> QString" << "QQuickWebEngineProfile.httpCacheType --> HttpCacheType" + << "QQuickWebEngineProfile.httpAcceptLanguage --> QString" << "QQuickWebEngineProfile.persistentCookiesPolicy --> PersistentCookiesPolicy" << "QQuickWebEngineProfile.httpCacheMaximumSize --> int" << "QQuickWebEngineProfile.storageNameChanged() --> void" @@ -234,39 +286,10 @@ static QStringList expectedAPI = QStringList() << "QQuickWebEngineProfile.httpCacheTypeChanged() --> void" << "QQuickWebEngineProfile.persistentCookiesPolicyChanged() --> void" << "QQuickWebEngineProfile.httpCacheMaximumSizeChanged() --> void" + << "QQuickWebEngineProfile.httpAcceptLanguageChanged() --> void" << "QQuickWebEngineProfile.downloadRequested(QQuickWebEngineDownloadItem*) --> void" << "QQuickWebEngineProfile.downloadFinished(QQuickWebEngineDownloadItem*) --> void" - << "QQuickWebEngineSettings.autoLoadImages --> bool" - << "QQuickWebEngineSettings.javascriptEnabled --> bool" - << "QQuickWebEngineSettings.javascriptCanOpenWindows --> bool" - << "QQuickWebEngineSettings.javascriptCanAccessClipboard --> bool" - << "QQuickWebEngineSettings.linksIncludedInFocusChain --> bool" - << "QQuickWebEngineSettings.localStorageEnabled --> bool" - << "QQuickWebEngineSettings.localContentCanAccessRemoteUrls --> bool" - << "QQuickWebEngineSettings.spatialNavigationEnabled --> bool" - << "QQuickWebEngineSettings.localContentCanAccessFileUrls --> bool" - << "QQuickWebEngineSettings.hyperlinkAuditingEnabled --> bool" - << "QQuickWebEngineSettings.errorPageEnabled --> bool" - << "QQuickWebEngineSettings.defaultTextEncoding --> QString" - << "QQuickWebEngineSettings.autoLoadImagesChanged() --> void" - << "QQuickWebEngineSettings.javascriptEnabledChanged() --> void" - << "QQuickWebEngineSettings.javascriptCanOpenWindowsChanged() --> void" - << "QQuickWebEngineSettings.javascriptCanAccessClipboardChanged() --> void" - << "QQuickWebEngineSettings.linksIncludedInFocusChainChanged() --> void" - << "QQuickWebEngineSettings.localStorageEnabledChanged() --> void" - << "QQuickWebEngineSettings.localContentCanAccessRemoteUrlsChanged() --> void" - << "QQuickWebEngineSettings.spatialNavigationEnabledChanged() --> void" - << "QQuickWebEngineSettings.localContentCanAccessFileUrlsChanged() --> void" - << "QQuickWebEngineSettings.hyperlinkAuditingEnabledChanged() --> void" - << "QQuickWebEngineSettings.errorPageEnabledChanged() --> void" - << "QQuickWebEngineSettings.defaultTextEncodingChanged() --> void" - << "QQuickWebEngineCertificateError.ignoreCertificateError() --> void" - << "QQuickWebEngineCertificateError.rejectCertificate() --> void" - << "QQuickWebEngineCertificateError.defer() --> void" - << "QQuickWebEngineCertificateError.url --> QUrl" - << "QQuickWebEngineCertificateError.error --> Error" - << "QQuickWebEngineCertificateError.description --> QString" - << "QQuickWebEngineCertificateError.overridable --> bool" + << "QQuickWebEngineProfile.setCookieStoreClient(QWebEngineCookieStoreClient*) --> void" << "QQuickWebEngineScript.Deferred --> InjectionPoint" << "QQuickWebEngineScript.DocumentReady --> InjectionPoint" << "QQuickWebEngineScript.DocumentCreation --> InjectionPoint" @@ -292,8 +315,38 @@ static QStringList expectedAPI = QStringList() << "QQuickWebEngineScript.setWorldId(ScriptWorldId) --> void" << "QQuickWebEngineScript.setRunOnSubframes(bool) --> void" << "QQuickWebEngineScript.toString() --> QString" + << "QQuickWebEngineSettings.autoLoadImages --> bool" + << "QQuickWebEngineSettings.javascriptEnabled --> bool" + << "QQuickWebEngineSettings.javascriptCanOpenWindows --> bool" + << "QQuickWebEngineSettings.javascriptCanAccessClipboard --> bool" + << "QQuickWebEngineSettings.linksIncludedInFocusChain --> bool" + << "QQuickWebEngineSettings.localStorageEnabled --> bool" + << "QQuickWebEngineSettings.localContentCanAccessRemoteUrls --> bool" + << "QQuickWebEngineSettings.spatialNavigationEnabled --> bool" + << "QQuickWebEngineSettings.localContentCanAccessFileUrls --> bool" + << "QQuickWebEngineSettings.hyperlinkAuditingEnabled --> bool" + << "QQuickWebEngineSettings.errorPageEnabled --> bool" + << "QQuickWebEngineSettings.pluginsEnabled --> bool" + << "QQuickWebEngineSettings.fullScreenSupportEnabled --> bool" + << "QQuickWebEngineSettings.defaultTextEncoding --> QString" + << "QQuickWebEngineSettings.autoLoadImagesChanged() --> void" + << "QQuickWebEngineSettings.javascriptEnabledChanged() --> void" + << "QQuickWebEngineSettings.javascriptCanOpenWindowsChanged() --> void" + << "QQuickWebEngineSettings.javascriptCanAccessClipboardChanged() --> void" + << "QQuickWebEngineSettings.linksIncludedInFocusChainChanged() --> void" + << "QQuickWebEngineSettings.localStorageEnabledChanged() --> void" + << "QQuickWebEngineSettings.localContentCanAccessRemoteUrlsChanged() --> void" + << "QQuickWebEngineSettings.spatialNavigationEnabledChanged() --> void" + << "QQuickWebEngineSettings.localContentCanAccessFileUrlsChanged() --> void" + << "QQuickWebEngineSettings.hyperlinkAuditingEnabledChanged() --> void" + << "QQuickWebEngineSettings.errorPageEnabledChanged() --> void" + << "QQuickWebEngineSettings.pluginsEnabledChanged() --> void" + << "QQuickWebEngineSettings.fullScreenSupportEnabledChanged() --> void" + << "QQuickWebEngineSettings.defaultTextEncodingChanged() --> void" << "QQuickWebEngineFullScreenRequest.toggleOn --> bool" << "QQuickWebEngineFullScreenRequest.accept() --> void" + << "QQuickWebEngineSingleton.settings --> QQuickWebEngineSettings*" + << "QQuickWebEngineSingleton.defaultProfile --> QQuickWebEngineProfile*" ; static bool isCheckedEnum(const QByteArray &typeName) -- cgit v1.2.3 From 3cb42b14f69ca07a95733cfcc8f6e1a22a544c07 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Mon, 28 Sep 2015 16:41:03 +0200 Subject: Doc: edit WebEngineView docs - Edit for grammar and style. - Use QDoc commands consistently. Change-Id: Iecfeaa17307befee73057f1f7760d6e10ae79e77 Reviewed-by: Joerg Bornemann --- src/webengine/doc/src/webengineview.qdoc | 152 +++++++++++++------------------ 1 file changed, 63 insertions(+), 89 deletions(-) diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc index f763227e4..67239edc9 100644 --- a/src/webengine/doc/src/webengineview.qdoc +++ b/src/webengine/doc/src/webengineview.qdoc @@ -84,7 +84,7 @@ /*! \qmlproperty url WebEngineView::url - The location of the currently displaying HTML page. This writable + The location of the currently displayed HTML page. This writable property offers the main interface to load a page into a web view. It functions the same as the \c{window.location} DOM property. @@ -95,7 +95,7 @@ \qmlproperty url WebEngineView::icon \readonly - This property holds the location of the currently displaying web site icon, + The location of the currently displayed web site icon, also known as favicon or shortcut icon. This read-only URL corresponds to the image used within a mobile browser application to represent a bookmarked page on the device's home screen. @@ -116,7 +116,7 @@ \qmlproperty int WebEngineView::loadProgress \readonly - This property holds the amount of the page that has been loaded, expressed + The amount of data from the page that has been loaded, expressed as an integer percentage in the range from \c{0} to \c{100}. */ @@ -147,7 +147,7 @@ \qmlproperty string WebEngineView::title \readonly - This property holds the title of the currently displaying HTML page, a + The title of the currently displayed HTML page. This is a read-only value that reflects the contents of the \c{} tag. */ @@ -221,15 +221,15 @@ /*! \qmlmethod void WebEngineView::loadHtml(string html, url baseUrl) - \brief Loads the specified \a html as the content of the web view. + Loads the specified \a html as the content of the web view. This method offers a lower-level alternative to the \c{url} property, which references HTML pages via URL. - External objects such as stylesheets or images referenced in the HTML - document should be located relative to \a baseUrl. For example, if \a html + External objects, such as stylesheets or images referenced in the HTML + document, should be located relative to \a baseUrl. For example, if \a html is retrieved from \c http://www.example.com/documents/overview.html, which - is the base url, then an image referenced with the relative url, \c diagram.png, + is the base URL, then an image referenced with the relative URL, \c diagram.png, should be at \c{http://www.example.com/documents/diagram.png}. \sa url @@ -237,10 +237,10 @@ /*! \qmlmethod void WebEngineView::runJavaScript(string script, variant callback) - \brief Runs the specified \a script in the content of the web view. + Runs the specified \a script in the content of the web view. - In case a callback function is provided it will be invoked after the script - finished running. + In case a callback function is provided, it will be invoked after the script + finishes running. \code runJavaScript("document.title", function(result) { console.log(result); }); @@ -335,9 +335,9 @@ \qmlsignal WebEngineView::loadingChanged(loadRequest) This signal is emitted when a page load begins, ends, or fails. - The corresponding handler is onLoadingChanged. + The corresponding handler is \c onLoadingChanged. - When handling the signal with onLoadingChanged, various read-only + When handling the signal with \c onLoadingChanged, various read-only parameters are available on the \a loadRequest: \table @@ -349,10 +349,7 @@ \li The location of the resource that is loading. \row \li status - \li Reflects one of four load states: - \c{WebEngineView::LoadStartedStatus}, \c{WebEngineView::LoadStoppedStatus}, - \c{WebEngineView::LoadSucceededStatus}, or \c{WebEngineView::LoadFailedStatus}. - See WebEngineLoadRequest::status and WebEngineView::LoadStatus. + \li The \l{LoadStatus}{load status} of the page. \row \li errorString \li The description of load error. @@ -361,13 +358,10 @@ \li The HTTP error code. \row \li errorDomain - \li The high-level error types, one of - \c{WebEngineView::ConnectionErrorDomain}, \c{WebEngineView::HttpErrorDomain}, \c{WebEngineView::InternalErrorDomain}, - \c{WebEngineView::DownloadErrorDomain}, or \c{WebEngineView::NoErrorDomain}. See - \l{WebEngineView::ErrorDomain} for the full list. + \li The high-level \l{ErrorDomain}{error type}. \endtable - \sa loading + \sa loading, LoadStatus, ErrorDomain */ /*! @@ -379,14 +373,14 @@ The certificate error can be rejected by calling WebEngineCertificateError::rejectCertificate, which will stop loading the request. - The certificate error can be ignored by calling WebEngineCertificateError::ignoreCertificateError - which will resume loading the request. + The certificate error can be ignored by calling + WebEngineCertificateError::ignoreCertificateError, which will resume loading the request. It is possible to defer the decision of rejecting the given certificate by calling WebEngineCertificateError::defer, which is useful when waiting for user input. - By default the invalid certificate will be automatically rejected. + By default, the invalid certificate will be automatically rejected. - The corresponding handler is onCertificateError. + The corresponding handler is \c onCertificateError. \sa WebEngineCertificateError */ @@ -400,19 +394,20 @@ events that are not cancelled with \c{preventDefault()}. \a{hoveredUrl} provides the link's location. - The corresponding handler is onLinkHovered. + The corresponding handler is \c onLinkHovered. */ /*! \qmlsignal WebEngineView::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, message, lineNumber, sourceID) This signal is emitted when a JavaScript program tries to print a \a message to the web browser's console. - For example in case of evaluation errors the source URL may be provided in \a sourceID as well as the \a lineNumber. + For example, in case of evaluation errors the source URL may be provided in \a sourceID as well + as the \a lineNumber. - \a level indicates the severity of the event that triggered the message, i.e. if it + \a level indicates the severity of the event that triggered the message, that is, whether it was triggered by an error or a less severe event. - The corresponding handler is onJavaScriptConsoleMessage. + The corresponding handler is \c onJavaScriptConsoleMessage. */ /*! @@ -420,18 +415,18 @@ \since QtWebEngine 1.1 This signal is emitted when a page load is requested to happen in a separate - WebEngineView. This can either be because the current page requested it explicitly - through a JavaScript call to window.open, or because the user clicked on a link - while holding Shift, Ctrl or a built-in combination that triggers the page to open + web engine view. This can either be because the current page requested it explicitly + through a JavaScript call to \c window.open, or because the user clicked on a link + while holding Shift, Ctrl, or a built-in combination that triggers the page to open in a new window. - If this signal isn't handled the requested load will fail. + If this signal is not handled, the requested load will fail. An example implementation: \snippet snippets/qtwebengine_webengineview_newviewrequested.qml 0 - The corresponding handler is onNewViewRequested. + The corresponding handler is \c onNewViewRequested. \sa WebEngineNewViewRequest, NewViewDestination, {WebEngine Quick Nano Browser} */ @@ -443,7 +438,7 @@ This signal is emitted when the web page requests fullscreen mode through the JavaScript API. - The corresponding handler is onFullScreenRequested. + The corresponding handler is \c onFullScreenRequested. \sa WebEngineFullScreenRequest, isFullScreen */ @@ -451,7 +446,7 @@ /*! \qmlproperty enumeration WebEngineView::ErrorDomain - This enumeration details various high-level error types. + Describes various high-level error types: \value WebEngineView::NoErrorDomain \value WebEngineView::InternalErrorDomain @@ -471,68 +466,42 @@ /*! \qmlproperty enumeration WebEngineView::JavaScriptConsoleMessageLevel - Indicates the severity of a JavaScript console message. + Indicates the severity of a JavaScript console message: - \table - - \header - \li Constant - \li Description - - \row - \li InfoMessageLevel - \li Message is purely informative and should be safe to ignore. - - \row - \li WarningMessageLevel - \li Message indicates there might be a problem that may need attention. - - \row - \li ErrorMessageLevel - \li Message indicates there has been an error. - - \endtable + \value InfoMessageLevel + Message is purely informative and can safely be ignored. + \value WarningMessageLevel + Message indicates there might be a problem that may need attention. + \value ErrorMessageLevel + Message indicates there has been an error. */ /*! \qmlproperty enumeration WebEngineView::LoadStatus - Reflects a page's load status. + Reflects a page's load status: - \table - - \header - \li Constant - \li Description - - \row - \li LoadStartedStatus - \li Page is currently loading. - - \row - \li LoadSucceededStatus - \li Page has successfully loaded, and is not currently loading. - - \row - \li LoadFailedStatus - \li Page has failed to load, and is not currently loading. - - \endtable + \value LoadStartedStatus + Page is currently loading. + \value LoadSucceededStatus + Page has successfully loaded, and is not currently loading. + \value LoadFailedStatus + Page has failed to load, and is not currently loading. */ /*! \qmlproperty enumeration WebEngineView::NewViewDestination - This enumeration details the format in which a new view request should be opened. + Describes how to open a new view: \value WebEngineView::NewViewInWindow - The page expects to be opened in a separate Window. + In a separate Window. \value WebEngineView::NewViewInTab - The page expects to be opened in a tab of the same window. + In a tab of the same window. \value WebEngineView::NewViewInDialog - The page expects to be opened in a Window without any tab, tool or URL bar. + In a Window without a tab bar, toolbar, or URL bar. \value WebEngineView::NewViewInBackgroundTab - The page expects to be opened in a tab of the same window, without hiding the currently visible WebEngineView. + In a tab of the same window, without hiding the currently visible web engine view. \sa WebEngineNewViewRequest::destination */ @@ -540,7 +509,7 @@ /*! \qmlproperty enumeration WebEngineView::FindFlags - This enum describes the options available to the findText() function. The options + Describes the options available to the findText() function. The options can be OR-ed together from the following list: \value FindBackward Searches backwards instead of forwards. @@ -553,12 +522,17 @@ /*! \qmlproperty enumeration WebEngineView::Feature - This enum describes the platform feature access categories that the user may be asked to grant or deny access to. + Describes the platform feature access categories that the user may be asked to grant or deny + access to: - \value Geolocation Access to location hardware or service - \value MediaAudioCapture Audio capture devices such a microphones - \value MediaVideoCapture Video devices, e.g. cameras - \value MediaAudioVideoCapture Both Audio and Video capture devices. + \value Geolocation + Location hardware or service. + \value MediaAudioCapture + Audio capture devices, such as microphones. + \value MediaVideoCapture + Video devices, such as cameras. + \value MediaAudioVideoCapture + Both audio and video capture devices. \sa featurePermissionRequested(), grantFeaturePermission() */ @@ -569,7 +543,7 @@ \inqmlmodule QtWebEngine 1.1 \since QtWebEngine 1.1 - \brief A utility class for the WebEngineView::fullScreenRequested() signal. + \brief A utility type for the WebEngineView::fullScreenRequested() signal. \sa WebEngineView::fullScreenRequested() */ -- cgit v1.2.3 From 8b1dc2b5c4c73cfb98d14f9abf2afaacb2494925 Mon Sep 17 00:00:00 2001 From: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Date: Mon, 28 Sep 2015 13:41:28 +0200 Subject: Doc: add requirements for building Qt WebEngine Task-number: QTBUG-48097 Change-Id: I81665b615c6bb2a21d355fa1310ff8c1fae7e0b2 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> --- src/webengine/doc/src/qtwebengine-index.qdoc | 1 + .../doc/src/qtwebengine-platform-notes.qdoc | 52 ++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 src/webengine/doc/src/qtwebengine-platform-notes.qdoc diff --git a/src/webengine/doc/src/qtwebengine-index.qdoc b/src/webengine/doc/src/qtwebengine-index.qdoc index 20d2de48c..2c3737b7d 100644 --- a/src/webengine/doc/src/qtwebengine-index.qdoc +++ b/src/webengine/doc/src/qtwebengine-index.qdoc @@ -69,6 +69,7 @@ \list \li \l{Qt WebEngine Overview} + \li \l{Qt WebEngine Platform Notes} \li \l{Qt WebEngine Web Developer Tools} \li \l{Porting from Qt WebKit to Qt WebEngine} \endlist diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc new file mode 100644 index 000000000..86cccfa3c --- /dev/null +++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qtwebengine-platform-notes.html + \title Qt WebEngine Platform Notes + + \brief Contains information about issues that are specific to the Qt WebEngine module. + + \section1 Building Qt WebEngine from Source + + The requirements for building Qt 5 modules from source are listed separately for each supported + platform: + + \list + \li \l{Qt for Windows - Requirements} + \li \l{Qt for X11 Requirements} + \li \l{Qt for OS X - Requirements} + \endlist + + In addition, the following tools are required for building the \l {Qt WebEngine} module: + + \list + \li Windows: Visual Studio 2013 or Visual Studio 2013 Express + \li Linux: Clang or GCC version 4.7 or later + \li OS X: Xcode version 5.1 or later + \endlist +*/ -- cgit v1.2.3 From 117d70f5c719cc6775eb5a653c887e68037b9a93 Mon Sep 17 00:00:00 2001 From: Szabolcs David <davidsz@inf.u-szeged.hu> Date: Mon, 28 Sep 2015 05:54:37 -0700 Subject: Remove whitespaces from custom HTTP user agents This prevents adding additional headers to the outgoing HTTP request through overridden user agent and unskips userAgentNewlineStripping API test. Change-Id: If9b3a88b0346058a7dc462471637d9777683fe82 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> --- src/core/browser_context_adapter.cpp | 4 +-- .../widgets/qwebenginepage/tst_qwebenginepage.cpp | 29 +++++++--------------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp index 660c6ffb2..02fa207c9 100644 --- a/src/core/browser_context_adapter.cpp +++ b/src/core/browser_context_adapter.cpp @@ -255,12 +255,12 @@ void BrowserContextAdapter::setHttpUserAgent(const QString &userAgent) { if (m_httpUserAgent == userAgent) return; - m_httpUserAgent = userAgent; + m_httpUserAgent = userAgent.simplified(); std::vector<content::WebContentsImpl *> list = content::WebContentsImpl::GetAllWebContents(); Q_FOREACH (content::WebContentsImpl *web_contents, list) if (web_contents->GetBrowserContext() == m_browserContext.data()) - web_contents->SetUserAgentOverride(userAgent.toStdString()); + web_contents->SetUserAgentOverride(m_httpUserAgent.toStdString()); if (m_browserContext->url_request_getter_.get()) m_browserContext->url_request_getter_->updateUserAgent(); diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 6e3976766..9559f3cf5 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -40,6 +40,7 @@ #include <qpa/qplatforminputcontext.h> #include <qwebenginehistory.h> #include <qwebenginepage.h> +#include <qwebengineprofile.h> #include <qwebenginesettings.h> #include <qwebengineview.h> #include <qimagewriter.h> @@ -2810,28 +2811,16 @@ void tst_QWebEnginePage::userAgentApplicationName() #endif } -class CustomUserAgentWebPage : public QWebEnginePage -{ -public: - static const QLatin1String filteredUserAgent; -protected: - virtual QString userAgentForUrl(const QUrl& url) const - { - Q_UNUSED(url); - return QString("My User Agent\nX-New-Http-Header: Oh Noes!"); - } -}; -const QLatin1String CustomUserAgentWebPage::filteredUserAgent("My User AgentX-New-Http-Header: Oh Noes!"); - void tst_QWebEnginePage::userAgentNewlineStripping() { -#if !defined(QWEBENGINEPAGE_USERAGENTFORURL) - QSKIP("QWEBENGINEPAGE_USERAGENTFORURL"); -#else - CustomUserAgentWebPage page; - page.setHtml("<html><body></body></html>"); - QCOMPARE(evaluateJavaScriptSync(&page, "navigator.userAgent").toString(), CustomUserAgentWebPage::filteredUserAgent); -#endif + QWebEngineProfile profile; + QWebEnginePage page(&profile); + + profile.setHttpUserAgent(QStringLiteral("My User Agent\nX-New-Http-Header: Oh Noes!")); + // The user agent will be updated after a page load. + page.load(QUrl("about:blank")); + + QCOMPARE(evaluateJavaScriptSync(&page, "navigator.userAgent").toString(), QStringLiteral("My User Agent X-New-Http-Header: Oh Noes!")); } void tst_QWebEnginePage::crashTests_LazyInitializationOfMainFrame() -- cgit v1.2.3 From 6a45d22a1f93b8ae6e1ce3fb000f620fa1907e7b Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Date: Tue, 29 Sep 2015 10:05:19 +0200 Subject: Update to Chromium 45.0.2454.101 Change-Id: Ifda982e1bcfc2a0655e65a71321b137a348be865 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> --- src/3rdparty | 2 +- tools/scripts/take_snapshot.py | 1 + tools/scripts/version_resolver.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/3rdparty b/src/3rdparty index 2ac2926e6..6c28e9497 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 2ac2926e6c73bbb9b9897ed6d7a472031a0a8c65 +Subproject commit 6c28e9497f45870d1d6db37f54a67fb597f9592a diff --git a/tools/scripts/take_snapshot.py b/tools/scripts/take_snapshot.py index e5df2d80b..5f911f36f 100755 --- a/tools/scripts/take_snapshot.py +++ b/tools/scripts/take_snapshot.py @@ -123,6 +123,7 @@ def isInChromiumBlacklist(file_path): not file_path.startswith('components/strings') and not file_path.startswith('components/tracing') and not file_path.startswith('components/visitedlink') and + not file_path.startswith('components/web_cache') and not file_path.startswith('components/webcrypto') and not file_path.endswith('.grdp') and not 'components_strings' in file_path) diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py index f6aaedf64..baa4a468a 100644 --- a/tools/scripts/version_resolver.py +++ b/tools/scripts/version_resolver.py @@ -51,7 +51,7 @@ import json import urllib2 import git_submodule as GitSubmodule -chromium_version = '45.0.2454.79' +chromium_version = '45.0.2454.101' chromium_branch = '2454' ninja_version = 'v1.5.3' -- cgit v1.2.3 From 6f92911e10fe4417c83af4ee356fd89549db29c6 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Date: Fri, 18 Sep 2015 17:43:43 +0200 Subject: Parse suggested filename from content-disposition Chromium hasn't parsed content-disposition by the time we get the download item, so we need to call the parsing manually. Change-Id: I105d0c6904dd764b368cb774e377a6028c082513 Task-number: QTBUG-48206 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com> --- src/core/download_manager_delegate_qt.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index c01dcf63d..e9af98fd8 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -40,6 +40,7 @@ #include "content/public/browser/download_item.h" #include "content/public/browser/save_page_type.h" #include "content/public/browser/web_contents.h" +#include "net/http/http_content_disposition.h" #include <QDir> #include <QFile> @@ -103,6 +104,9 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* i std::string suggestedFilename = item->GetSuggestedFilename(); + if (suggestedFilename.empty()) + suggestedFilename = net::HttpContentDisposition(item->GetContentDisposition(), std::string()).filename(); + if (suggestedFilename.empty()) suggestedFilename = item->GetTargetFilePath().AsUTF8Unsafe(); -- cgit v1.2.3 From 2a972c4046bbee49ec9c770f2c1e12fb95500240 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Date: Tue, 29 Sep 2015 15:41:46 +0200 Subject: Fix assert on deleting installed custom URL scheme handler When the QObject::destroyed signal is emitted the inherited class parts have already been destroyed and thus it is no longer a QWebEngineUrlSchemeHandler and qobject_cast will return 0, which is asserted against. Change-Id: I7130c60a26088067930499a30e0081ed297a92d9 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> --- src/core/api/qwebengineurlschemehandler.cpp | 1 + src/core/api/qwebengineurlschemehandler.h | 3 +++ src/webenginewidgets/api/qwebengineprofile.cpp | 8 ++++---- src/webenginewidgets/api/qwebengineprofile.h | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/core/api/qwebengineurlschemehandler.cpp b/src/core/api/qwebengineurlschemehandler.cpp index 330648893..e14da6fb5 100644 --- a/src/core/api/qwebengineurlschemehandler.cpp +++ b/src/core/api/qwebengineurlschemehandler.cpp @@ -84,6 +84,7 @@ QWebEngineUrlSchemeHandler::QWebEngineUrlSchemeHandler(const QByteArray &scheme, QWebEngineUrlSchemeHandler::~QWebEngineUrlSchemeHandler() { + Q_EMIT destroyed(this); delete d_ptr; } diff --git a/src/core/api/qwebengineurlschemehandler.h b/src/core/api/qwebengineurlschemehandler.h index b6f6a69f0..1ec32e46c 100644 --- a/src/core/api/qwebengineurlschemehandler.h +++ b/src/core/api/qwebengineurlschemehandler.h @@ -57,6 +57,9 @@ public: virtual void requestStarted(QWebEngineUrlRequestJob*) = 0; +Q_SIGNALS: + void destroyed(QWebEngineUrlSchemeHandler*); + private: Q_DISABLE_COPY(QWebEngineUrlSchemeHandler) Q_DECLARE_PRIVATE(QWebEngineUrlSchemeHandler) diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index 323659827..66cba9bc3 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -582,7 +582,7 @@ void QWebEngineProfile::installUrlSchemeHandler(QWebEngineUrlSchemeHandler *hand d->m_urlSchemeHandlers.insert(scheme, handler); d->browserContext()->customUrlSchemeHandlers().append(handler->d_func()); d->browserContext()->updateCustomUrlSchemeHandlers(); - connect(handler, SIGNAL(destroyed(QObject*)), this, SLOT(destroyedUrlSchemeHandler(QObject*))); + connect(handler, SIGNAL(destroyed(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*))); } /*! @@ -599,7 +599,7 @@ void QWebEngineProfile::removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *handl int count = d->m_urlSchemeHandlers.remove(handler->scheme()); if (!count) return; - disconnect(handler, SIGNAL(destroyed(QObject*)), this, SLOT(destroyedUrlSchemeHandler(QObject*))); + disconnect(handler, SIGNAL(destroyed(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*))); d->browserContext()->removeCustomUrlSchemeHandler(handler->d_func()); d->browserContext()->updateCustomUrlSchemeHandlers(); } @@ -617,9 +617,9 @@ void QWebEngineProfile::clearUrlSchemeHandlers() d->browserContext()->updateCustomUrlSchemeHandlers(); } -void QWebEngineProfile::destroyedUrlSchemeHandler(QObject *obj) +void QWebEngineProfile::destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler *obj) { - removeUrlSchemeHandler(qobject_cast<QWebEngineUrlSchemeHandler*>(obj)); + removeUrlSchemeHandler(obj); } QT_END_NAMESPACE diff --git a/src/webenginewidgets/api/qwebengineprofile.h b/src/webenginewidgets/api/qwebengineprofile.h index 5532f12ee..82946a223 100644 --- a/src/webenginewidgets/api/qwebengineprofile.h +++ b/src/webenginewidgets/api/qwebengineprofile.h @@ -121,7 +121,7 @@ Q_SIGNALS: void downloadRequested(QWebEngineDownloadItem *download); private Q_SLOTS: - void destroyedUrlSchemeHandler(QObject *obj); + void destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler *obj); private: Q_DISABLE_COPY(QWebEngineProfile) -- cgit v1.2.3 From a907edc50641ddc634934747ad3c158d05dc7361 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann <joerg.bornemann@theqtcompany.com> Date: Wed, 30 Sep 2015 10:52:05 +0200 Subject: fix python version check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The python code that is used to determine the version number did not work with python3. In python3 print is a real function and must be called as such. Use positional accessors to be compatible with python < 2.6. Also extend the error message for users that attempt the build with python3. Task-number: QTBUG-48507 Change-Id: I49e1fb77c2cc421ac1faed8d8143bf605fbde700 Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org> Reviewed-by: Michael Brüning <michael.bruning@theqtcompany.com> --- tools/qmake/mkspecs/features/functions.prf | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf index 69d3fd3b2..64064bddb 100644 --- a/tools/qmake/mkspecs/features/functions.prf +++ b/tools/qmake/mkspecs/features/functions.prf @@ -22,11 +22,18 @@ defineTest(isPlatformSupported) { } defineTest(isPythonVersionSupported) { - python_major_version = $$system('python -c "import sys; print sys.version_info.major"') - python_minor_version = $$system('python -c "import sys; print sys.version_info.minor"') - lessThan(python_major_version, 3): greaterThan(python_major_version, 1): greaterThan(python_minor_version, 6): return(true) - skipBuild("Using Python version "$$python_major_version"."$$python_minor_version", but Python version 2 (2.7 or later) is required to build Qt WebEngine.") - return(false) + python_error_msg = "Python version 2 (2.7 or later) is required to build Qt WebEngine." + python_major_version = $$system('python -c "import sys; print(sys.version_info[0])"') + greaterThan(python_major_version, 2) { + skipBuild("Python version 3 is not supported by Chromium.") + skipBuild($$python_error_msg) + return(false) + } + python_minor_version = $$system('python -c "import sys; print(sys.version_info[1])"') + greaterThan(python_major_version, 1): greaterThan(python_minor_version, 6): return(true) + skipBuild("Using Python version "$$python_major_version"."$$python_minor_version".") + skipBuild($$python_error_msg) + return(false) } defineTest(isGCCVersionSupported) { -- cgit v1.2.3 From 295a915b5ae66ad9485b38e7d05040cf0321cd4e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann <joerg.bornemann@theqtcompany.com> Date: Tue, 6 Oct 2015 09:39:40 +0200 Subject: fix link error with MSVC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since qtbase/e88334e0 we must not put MSVC linker flags into LIBS or LIBS_PRIVATE. QMAKE_LFLAGS is the right place. This fixes a build error with MSVC: LINK : fatal error LNK1181: cannot open input file '\OPT:REF.obj' Change-Id: I2971e412dd8d5cfe8b7aca218d679dd136019dd8 Reviewed-by: Michael Brüning <michael.bruning@theqtcompany.com> --- src/core/core_module.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/core_module.pro b/src/core/core_module.pro index cf253a735..68d46cd5a 100644 --- a/src/core/core_module.pro +++ b/src/core/core_module.pro @@ -22,7 +22,7 @@ osx { } else:msvc { # Simulate -whole-archive by passing the list of object files that belong to the public # API library as response file to the linker. - LIBS_PRIVATE += /OPT:REF + QMAKE_LFLAGS += /OPT:REF QMAKE_LFLAGS += @$${api_library_path}$${QMAKE_DIR_SEP}$${api_library_name}.lib.objects } else { LIBS_PRIVATE += -Wl,-whole-archive -l$$api_library_name -Wl,-no-whole-archive -- cgit v1.2.3 From 442ad85ee3f40a981fa721673dd6c7344d1daece Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Date: Wed, 30 Sep 2015 13:59:22 +0200 Subject: Remove unnecessay delegation over CustomUrlSchemeHandler With QWebEngineSchemeHandler in QtWebEngineCore, we do not need the indirection and delegation CustomUrlSchemeHandler provided. This means the class can be removed and we can also store the handlers directly in BrowserContextAdapter and save a copy of the installed handlers in the QWebEngineProfile. Change-Id: Iabb5cc9d364c2f2a879bc77bfb2ff14b3c2ff640 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> --- src/core/api/qwebengineurlrequestjob.h | 3 +- src/core/api/qwebengineurlschemehandler.cpp | 18 ++----- src/core/api/qwebengineurlschemehandler.h | 6 ++- src/core/api/qwebengineurlschemehandler_p.h | 19 ++----- src/core/browser_context_adapter.cpp | 7 ++- src/core/browser_context_adapter.h | 8 +-- src/core/core_gyp_generator.pro | 2 - src/core/custom_protocol_handler.cpp | 2 +- src/core/custom_protocol_handler.h | 6 +-- src/core/custom_url_scheme_handler.cpp | 63 ----------------------- src/core/custom_url_scheme_handler.h | 71 -------------------------- src/core/url_request_context_getter_qt.cpp | 6 +-- src/core/url_request_custom_job.cpp | 8 +-- src/core/url_request_custom_job.h | 6 +-- src/webenginewidgets/api/qwebengineprofile.cpp | 14 ++--- src/webenginewidgets/api/qwebengineprofile_p.h | 2 - 16 files changed, 41 insertions(+), 200 deletions(-) delete mode 100644 src/core/custom_url_scheme_handler.cpp delete mode 100644 src/core/custom_url_scheme_handler.h diff --git a/src/core/api/qwebengineurlrequestjob.h b/src/core/api/qwebengineurlrequestjob.h index 098d46c93..76e9b2c39 100644 --- a/src/core/api/qwebengineurlrequestjob.h +++ b/src/core/api/qwebengineurlrequestjob.h @@ -55,6 +55,7 @@ #include <QtCore/qurl.h> namespace QtWebEngineCore { +class URLRequestCustomJob; class URLRequestCustomJobDelegate; } // namespace @@ -86,7 +87,7 @@ public: private: QWebEngineUrlRequestJob(QtWebEngineCore::URLRequestCustomJobDelegate *); - friend class QWebEngineUrlSchemeHandlerPrivate; + friend class QtWebEngineCore::URLRequestCustomJob; QtWebEngineCore::URLRequestCustomJobDelegate* d_ptr; }; diff --git a/src/core/api/qwebengineurlschemehandler.cpp b/src/core/api/qwebengineurlschemehandler.cpp index e14da6fb5..b2994847b 100644 --- a/src/core/api/qwebengineurlschemehandler.cpp +++ b/src/core/api/qwebengineurlschemehandler.cpp @@ -53,23 +53,11 @@ QT_BEGIN_NAMESPACE */ -QWebEngineUrlSchemeHandlerPrivate::QWebEngineUrlSchemeHandlerPrivate(const QByteArray &scheme, QWebEngineUrlSchemeHandler *q) - : CustomUrlSchemeHandler(scheme) - , q_ptr(q) +QWebEngineUrlSchemeHandlerPrivate::QWebEngineUrlSchemeHandlerPrivate(const QByteArray &scheme) + : m_scheme(scheme) { } -QWebEngineUrlSchemeHandlerPrivate::~QWebEngineUrlSchemeHandlerPrivate() -{ -} - -bool QWebEngineUrlSchemeHandlerPrivate::handleJob(QtWebEngineCore::URLRequestCustomJobDelegate *job) -{ - QWebEngineUrlRequestJob *requestJob = new QWebEngineUrlRequestJob(job); - q_ptr->requestStarted(requestJob); - return true; -} - /*! Constructs a new URL scheme handler. @@ -78,7 +66,7 @@ bool QWebEngineUrlSchemeHandlerPrivate::handleJob(QtWebEngineCore::URLRequestCus */ QWebEngineUrlSchemeHandler::QWebEngineUrlSchemeHandler(const QByteArray &scheme, QObject *parent) : QObject(parent) - , d_ptr(new QWebEngineUrlSchemeHandlerPrivate(scheme, this)) + , d_ptr(new QWebEngineUrlSchemeHandlerPrivate(scheme)) { } diff --git a/src/core/api/qwebengineurlschemehandler.h b/src/core/api/qwebengineurlschemehandler.h index 1ec32e46c..1b6a66706 100644 --- a/src/core/api/qwebengineurlschemehandler.h +++ b/src/core/api/qwebengineurlschemehandler.h @@ -42,6 +42,10 @@ #include <QtCore/qbytearray.h> #include <QtCore/qobject.h> +namespace QtWebEngineCore { +class URLRequestContextGetterQt; +} + QT_BEGIN_NAMESPACE class QWebEngineUrlRequestJob; @@ -63,8 +67,6 @@ Q_SIGNALS: private: Q_DISABLE_COPY(QWebEngineUrlSchemeHandler) Q_DECLARE_PRIVATE(QWebEngineUrlSchemeHandler) - friend class QWebEngineProfile; - friend class QQuickWebEngineProfile; QWebEngineUrlSchemeHandlerPrivate *d_ptr; }; diff --git a/src/core/api/qwebengineurlschemehandler_p.h b/src/core/api/qwebengineurlschemehandler_p.h index dc4b272b3..d63666326 100644 --- a/src/core/api/qwebengineurlschemehandler_p.h +++ b/src/core/api/qwebengineurlschemehandler_p.h @@ -48,27 +48,18 @@ // We mean it. // -#include "qwebengineurlschemehandler.h" - -#include "custom_url_scheme_handler.h" +#include <QtCore/qbytearray.h> QT_BEGIN_NAMESPACE -class QWebEngineProfile; -class QWebEngineUrlRequestJob; -class QWebEngineUrlSchemeHandler; - -class QWEBENGINE_EXPORT QWebEngineUrlSchemeHandlerPrivate : public QtWebEngineCore::CustomUrlSchemeHandler { +class QWEBENGINE_EXPORT QWebEngineUrlSchemeHandlerPrivate { public: - Q_DECLARE_PUBLIC(QWebEngineUrlSchemeHandler) - - QWebEngineUrlSchemeHandlerPrivate(const QByteArray &, QWebEngineUrlSchemeHandler *); - virtual ~QWebEngineUrlSchemeHandlerPrivate(); + QWebEngineUrlSchemeHandlerPrivate(const QByteArray &); - virtual bool handleJob(QtWebEngineCore::URLRequestCustomJobDelegate*) Q_DECL_OVERRIDE; + const QByteArray &scheme() const { return m_scheme; } private: - QWebEngineUrlSchemeHandler *q_ptr; + QByteArray m_scheme; }; QT_END_NAMESPACE diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp index 02fa207c9..345741847 100644 --- a/src/core/browser_context_adapter.cpp +++ b/src/core/browser_context_adapter.cpp @@ -354,7 +354,7 @@ void BrowserContextAdapter::setHttpCacheMaxSize(int maxSize) m_browserContext->url_request_getter_->updateHttpCache(); } -QVector<CustomUrlSchemeHandler*> &BrowserContextAdapter::customUrlSchemeHandlers() +QHash<QByteArray, QWebEngineUrlSchemeHandler *> &BrowserContextAdapter::customUrlSchemeHandlers() { return m_customUrlSchemeHandlers; } @@ -365,10 +365,9 @@ void BrowserContextAdapter::updateCustomUrlSchemeHandlers() m_browserContext->url_request_getter_->updateStorageSettings(); } -void BrowserContextAdapter::removeCustomUrlSchemeHandler(CustomUrlSchemeHandler *handler) +void BrowserContextAdapter::removeCustomUrlSchemeHandler(QWebEngineUrlSchemeHandler *handler) { - m_customUrlSchemeHandlers.removeOne(handler); - Q_ASSERT(!m_customUrlSchemeHandlers.contains(handler)); + m_customUrlSchemeHandlers.remove(handler->scheme()); } UserScriptControllerHost *BrowserContextAdapter::userScriptController() diff --git a/src/core/browser_context_adapter.h b/src/core/browser_context_adapter.h index 0bca1bf8b..5272268f7 100644 --- a/src/core/browser_context_adapter.h +++ b/src/core/browser_context_adapter.h @@ -48,6 +48,7 @@ #include "api/qwebenginecookiestoreclient.h" #include "api/qwebengineurlrequestinterceptor.h" +#include "api/qwebengineurlschemehandler.h" QT_FORWARD_DECLARE_CLASS(QObject) @@ -55,7 +56,6 @@ namespace QtWebEngineCore { class BrowserContextAdapterClient; class BrowserContextQt; -class CustomUrlSchemeHandler; class DownloadManagerDelegateQt; class UserScriptControllerHost; class WebEngineVisitedLinksManager; @@ -145,9 +145,9 @@ public: bool trackVisitedLinks() const; bool persistVisitedLinks() const; - QVector<CustomUrlSchemeHandler*> &customUrlSchemeHandlers(); + QHash<QByteArray, QWebEngineUrlSchemeHandler *> &customUrlSchemeHandlers(); void updateCustomUrlSchemeHandlers(); - void removeCustomUrlSchemeHandler(CustomUrlSchemeHandler*); + void removeCustomUrlSchemeHandler(QWebEngineUrlSchemeHandler *); UserScriptControllerHost *userScriptController(); void permissionRequestReply(const QUrl &origin, PermissionType type, bool reply); @@ -173,7 +173,7 @@ private: QString m_httpAcceptLanguage; PersistentCookiesPolicy m_persistentCookiesPolicy; VisitedLinksPolicy m_visitedLinksPolicy; - QVector<CustomUrlSchemeHandler*> m_customUrlSchemeHandlers; + QHash<QByteArray, QWebEngineUrlSchemeHandler *> m_customUrlSchemeHandlers; QList<BrowserContextAdapterClient*> m_clients; int m_httpCacheMaxSize; diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro index c1b8179e0..813626dc3 100644 --- a/src/core/core_gyp_generator.pro +++ b/src/core/core_gyp_generator.pro @@ -45,7 +45,6 @@ SOURCES = \ content_main_delegate_qt.cpp \ cookie_monster_delegate_qt.cpp \ custom_protocol_handler.cpp \ - custom_url_scheme_handler.cpp \ delegated_frame_node.cpp \ desktop_screen_qt.cpp \ dev_tools_http_handler_delegate_qt.cpp \ @@ -117,7 +116,6 @@ HEADERS = \ content_main_delegate_qt.h \ cookie_monster_delegate_qt.h \ custom_protocol_handler.h \ - custom_url_scheme_handler.h \ delegated_frame_node.h \ desktop_screen_qt.h \ dev_tools_http_handler_delegate_qt.h \ diff --git a/src/core/custom_protocol_handler.cpp b/src/core/custom_protocol_handler.cpp index f140f98cf..fd1a4de41 100644 --- a/src/core/custom_protocol_handler.cpp +++ b/src/core/custom_protocol_handler.cpp @@ -43,7 +43,7 @@ namespace QtWebEngineCore { -CustomProtocolHandler::CustomProtocolHandler(CustomUrlSchemeHandler *schemeHandler) +CustomProtocolHandler::CustomProtocolHandler(QWebEngineUrlSchemeHandler *schemeHandler) : m_schemeHandler(schemeHandler) { } diff --git a/src/core/custom_protocol_handler.h b/src/core/custom_protocol_handler.h index 225bb0567..94da28673 100644 --- a/src/core/custom_protocol_handler.h +++ b/src/core/custom_protocol_handler.h @@ -45,6 +45,7 @@ #include <QtCore/qcompilerdetection.h> // Needed for Q_DECL_OVERRIDE QT_FORWARD_DECLARE_CLASS(QIODevice) +QT_FORWARD_DECLARE_CLASS(QWebEngineUrlSchemeHandler) namespace net { class NetworkDelegate; @@ -54,20 +55,19 @@ class URLRequestJob; namespace QtWebEngineCore { class BrowserContextAdapter; -class CustomUrlSchemeHandler; // Implements a ProtocolHandler for custom URL schemes. // If |network_delegate_| is NULL then all file requests will fail with ERR_ACCESS_DENIED. class QWEBENGINE_EXPORT CustomProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { public: - CustomProtocolHandler(CustomUrlSchemeHandler *); + CustomProtocolHandler(QWebEngineUrlSchemeHandler *); virtual net::URLRequestJob *MaybeCreateJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate) const Q_DECL_OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(CustomProtocolHandler); - CustomUrlSchemeHandler *m_schemeHandler; + QWebEngineUrlSchemeHandler *m_schemeHandler; }; } // namespace diff --git a/src/core/custom_url_scheme_handler.cpp b/src/core/custom_url_scheme_handler.cpp deleted file mode 100644 index 29791b555..000000000 --- a/src/core/custom_url_scheme_handler.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "custom_url_scheme_handler.h" -#include "custom_protocol_handler.h" - -namespace QtWebEngineCore { - -CustomUrlSchemeHandler::CustomUrlSchemeHandler(const QByteArray &scheme) - : m_scheme(scheme) -{ -} - -QByteArray CustomUrlSchemeHandler::scheme() const -{ - return m_scheme; -} - -void CustomUrlSchemeHandler::setScheme(const QByteArray &scheme) -{ - m_scheme = scheme; -} - -CustomProtocolHandler *CustomUrlSchemeHandler::createProtocolHandler() -{ - // Will be owned by the JobFactory. - return new CustomProtocolHandler(this); -} - -} // namespace diff --git a/src/core/custom_url_scheme_handler.h b/src/core/custom_url_scheme_handler.h deleted file mode 100644 index d866628de..000000000 --- a/src/core/custom_url_scheme_handler.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CUSTOM_URL_SCHEME_HANDLER_H_ -#define CUSTOM_URL_SCHEME_HANDLER_H_ - -#include "qtwebenginecoreglobal.h" - -#include <QtCore/QByteArray> -#include <QtCore/QScopedPointer> - -QT_FORWARD_DECLARE_CLASS(QIODevice) - -namespace QtWebEngineCore { - -class BrowserContextAdapter; -class CustomProtocolHandler; -class URLRequestCustomJobDelegate; - -class QWEBENGINE_EXPORT CustomUrlSchemeHandler { -public: - explicit CustomUrlSchemeHandler(const QByteArray &); - virtual ~CustomUrlSchemeHandler() { } - - QByteArray scheme() const; - void setScheme(const QByteArray &); - CustomProtocolHandler *createProtocolHandler(); - - virtual bool handleJob(URLRequestCustomJobDelegate*) = 0; - -private: - QByteArray m_scheme; -}; - - -} // namespace - -#endif // CUSTOM_URL_SCHEME_HANDLER_H_ diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp index c9ebf7f3b..771a662b9 100644 --- a/src/core/url_request_context_getter_qt.cpp +++ b/src/core/url_request_context_getter_qt.cpp @@ -66,9 +66,9 @@ #include "net/url_request/ftp_protocol_handler.h" #include "net/ftp/ftp_network_layer.h" +#include "api/qwebengineurlschemehandler.h" #include "browser_context_adapter.h" #include "custom_protocol_handler.h" -#include "custom_url_scheme_handler.h" #include "cookie_monster_delegate_qt.h" #include "content_client_qt.h" #include "network_delegate_qt.h" @@ -350,8 +350,8 @@ void URLRequestContextGetterQt::generateJobFactory() m_jobFactory->SetProtocolHandler(url::kFtpScheme, new net::FtpProtocolHandler(new net::FtpNetworkLayer(m_urlRequestContext->host_resolver()))); - Q_FOREACH (CustomUrlSchemeHandler* handler, m_browserContext->customUrlSchemeHandlers()) { - m_jobFactory->SetProtocolHandler(handler->scheme().toStdString(), handler->createProtocolHandler()); + Q_FOREACH (QWebEngineUrlSchemeHandler *handler, m_browserContext->customUrlSchemeHandlers()) { + m_jobFactory->SetProtocolHandler(handler->scheme().toStdString(), new CustomProtocolHandler(handler)); } m_urlRequestContext->set_job_factory(m_jobFactory.get()); diff --git a/src/core/url_request_custom_job.cpp b/src/core/url_request_custom_job.cpp index afdcecdfe..0a81d04a1 100644 --- a/src/core/url_request_custom_job.cpp +++ b/src/core/url_request_custom_job.cpp @@ -37,7 +37,8 @@ #include "url_request_custom_job.h" #include "url_request_custom_job_delegate.h" -#include "custom_url_scheme_handler.h" +#include "api/qwebengineurlrequestjob.h" +#include "api/qwebengineurlschemehandler.h" #include "type_conversion.h" #include "content/public/browser/browser_thread.h" @@ -53,7 +54,7 @@ using namespace net; namespace QtWebEngineCore { -URLRequestCustomJob::URLRequestCustomJob(URLRequest *request, NetworkDelegate *networkDelegate, CustomUrlSchemeHandler *schemeHandler) +URLRequestCustomJob::URLRequestCustomJob(URLRequest *request, NetworkDelegate *networkDelegate, QWebEngineUrlSchemeHandler *schemeHandler) : URLRequestJob(request, networkDelegate) , m_device(0) , m_schemeHandler(schemeHandler) @@ -236,7 +237,8 @@ void URLRequestCustomJob::startAsync() QMutexLocker lock(&m_mutex); m_delegate = new URLRequestCustomJobDelegate(this); lock.unlock(); - m_schemeHandler->handleJob(m_delegate); + QWebEngineUrlRequestJob *requestJob = new QWebEngineUrlRequestJob(m_delegate); + m_schemeHandler->requestStarted(requestJob); } } // namespace diff --git a/src/core/url_request_custom_job.h b/src/core/url_request_custom_job.h index 60a1d60b9..a994c467a 100644 --- a/src/core/url_request_custom_job.h +++ b/src/core/url_request_custom_job.h @@ -45,16 +45,16 @@ #include <QtCore/QPointer> QT_FORWARD_DECLARE_CLASS(QIODevice) +QT_FORWARD_DECLARE_CLASS(QWebEngineUrlSchemeHandler) namespace QtWebEngineCore { -class CustomUrlSchemeHandler; class URLRequestCustomJobDelegate; // A request job that handles reading custom URL schemes class URLRequestCustomJob : public net::URLRequestJob { public: - URLRequestCustomJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate, CustomUrlSchemeHandler *schemeHandler); + URLRequestCustomJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate, QWebEngineUrlSchemeHandler *schemeHandler); virtual void Start() Q_DECL_OVERRIDE; virtual void Kill() Q_DECL_OVERRIDE; virtual bool ReadRawData(net::IOBuffer *buf, int bufSize, int *bytesRead) Q_DECL_OVERRIDE; @@ -81,7 +81,7 @@ private: QMutex m_mutex; QPointer<QIODevice> m_device; QPointer<URLRequestCustomJobDelegate> m_delegate; - CustomUrlSchemeHandler *m_schemeHandler; + QWebEngineUrlSchemeHandler *m_schemeHandler; std::string m_mimeType; std::string m_charset; int m_error; diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index 66cba9bc3..934084b6e 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -42,7 +42,6 @@ #include "qwebenginepage.h" #include "qwebengineprofile_p.h" #include "qwebenginesettings.h" -#include "qwebengineurlschemehandler_p.h" #include "qwebenginescriptcollection_p.h" #include "browser_context_adapter.h" @@ -545,8 +544,8 @@ QWebEngineSettings *QWebEngineProfile::settings() const const QWebEngineUrlSchemeHandler *QWebEngineProfile::urlSchemeHandler(const QByteArray &scheme) const { const Q_D(QWebEngineProfile); - if (d->m_urlSchemeHandlers.contains(scheme)) - return d->m_urlSchemeHandlers.value(scheme); + if (d->browserContext()->customUrlSchemeHandlers().contains(scheme)) + return d->browserContext()->customUrlSchemeHandlers().value(scheme); return 0; } @@ -575,12 +574,11 @@ void QWebEngineProfile::installUrlSchemeHandler(QWebEngineUrlSchemeHandler *hand return; } - if (d->m_urlSchemeHandlers.contains(scheme)) { + if (d->browserContext()->customUrlSchemeHandlers().contains(scheme)) { qWarning() << "URL scheme handler already installed for the scheme: " << scheme; return; } - d->m_urlSchemeHandlers.insert(scheme, handler); - d->browserContext()->customUrlSchemeHandlers().append(handler->d_func()); + d->browserContext()->customUrlSchemeHandlers().insert(scheme, handler); d->browserContext()->updateCustomUrlSchemeHandlers(); connect(handler, SIGNAL(destroyed(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*))); } @@ -596,11 +594,10 @@ void QWebEngineProfile::removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *handl Q_ASSERT(handler); if (!handler) return; - int count = d->m_urlSchemeHandlers.remove(handler->scheme()); + int count = d->browserContext()->customUrlSchemeHandlers().remove(handler->scheme()); if (!count) return; disconnect(handler, SIGNAL(destroyed(QWebEngineUrlSchemeHandler*)), this, SLOT(destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler*))); - d->browserContext()->removeCustomUrlSchemeHandler(handler->d_func()); d->browserContext()->updateCustomUrlSchemeHandlers(); } @@ -612,7 +609,6 @@ void QWebEngineProfile::removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *handl void QWebEngineProfile::clearUrlSchemeHandlers() { Q_D(QWebEngineProfile); - d->m_urlSchemeHandlers.clear(); d->browserContext()->customUrlSchemeHandlers().clear(); d->browserContext()->updateCustomUrlSchemeHandlers(); } diff --git a/src/webenginewidgets/api/qwebengineprofile_p.h b/src/webenginewidgets/api/qwebengineprofile_p.h index 8ba64c438..7dcc76598 100644 --- a/src/webenginewidgets/api/qwebengineprofile_p.h +++ b/src/webenginewidgets/api/qwebengineprofile_p.h @@ -50,7 +50,6 @@ #include "browser_context_adapter_client.h" #include "qwebengineprofile.h" -#include "qwebengineurlschemehandler_p.h" #include "qwebenginescriptcollection.h" #include <QMap> #include <QPointer> @@ -85,7 +84,6 @@ private: QScopedPointer<QWebEngineScriptCollection> m_scriptCollection; QExplicitlySharedDataPointer<QtWebEngineCore::BrowserContextAdapter> m_browserContextRef; QMap<quint32, QPointer<QWebEngineDownloadItem> > m_ongoingDownloads; - QMap<QByteArray, QWebEngineUrlSchemeHandler *> m_urlSchemeHandlers; }; QT_END_NAMESPACE -- cgit v1.2.3 From 560f934ff534fda276faba9ce232c5f70cc166a6 Mon Sep 17 00:00:00 2001 From: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Date: Thu, 1 Oct 2015 11:31:49 +0200 Subject: Doc: add docs for uncreatable WebEngineHistory type Accessible by using the WebEngineView.navigationHistory property. Task-number: QTBUG-47908 Change-Id: Ib1baaa7690b0ca16ee67e76bc9ea2ece3d254f55 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> --- src/webengine/api/qquickwebenginehistory.cpp | 80 ++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/src/webengine/api/qquickwebenginehistory.cpp b/src/webengine/api/qquickwebenginehistory.cpp index 9a737fbbe..27081703b 100644 --- a/src/webengine/api/qquickwebenginehistory.cpp +++ b/src/webengine/api/qquickwebenginehistory.cpp @@ -185,6 +185,65 @@ QQuickWebEngineHistoryPrivate::~QQuickWebEngineHistoryPrivate() { } +/*! + \qmltype WebEngineHistory + \instantiates QQuickWebEngineHistory + \inqmlmodule QtWebEngine 1.1 + \since QtWebEngine 1.1 + + \brief Data models that represent the history of a web engine page. + + The uncreatable WebEngineHistory type can be accessed by using the + \l{WebEngineView::navigationHistory}{WebEngineView.navigationHistory} property. + + The WebEngineHistory type provides the following data models: + + \list + \li \c backItems, which contains the URLs of visited pages. + \li \c forwardItems, which contains the URLs of the pages that were visited after visiting + the current page. + \li \c items, which contains the URLs of the back and forward items, as well as the URL of + the current page. + \endlist + + The easiest way to use these models is to use them in a ListView as illustrated by the + following code snippet: + + \code + ListView { + id: historyItemsList + anchors.fill: parent + model: webEngineView.navigationHistory.items + delegate: + Text { + color: "black" + text: model.title + " - " + model.url + " (" + model.offset + ")" + } + } + \endcode + + The ListView shows the content of the corresponding model. The delegate is responsible for the + format of the list items. The appearance of each item of the list in the delegate can be defined + separately (it is not web engine specific). + + The model roles \c title and \c url specify the title and URL of the visited page. The \c offset + role specifies the position of the page in respect to the current page (0). A positive number + indicates that the page was visited after the current page, whereas a negative number indicates + that the page was visited before the current page. + + The data models can also be used to create a menu, as illustrated by the following code + snippet: + + \quotefromfile quicknanobrowser/browserwindow.qml + \skipto ToolBar + \printuntil onObjectRemoved + \printuntil } + \printuntil } + \printuntil } + + For the complete example, see \l{WebEngine Quick Nano Browser}. +*/ + QQuickWebEngineHistory::QQuickWebEngineHistory(QQuickWebEngineViewPrivate *view) : d_ptr(new QQuickWebEngineHistoryPrivate(view)) { @@ -194,6 +253,13 @@ QQuickWebEngineHistory::~QQuickWebEngineHistory() { } +/*! + \qmlproperty QQuickWebEngineHistoryListModel WebEngineHistory::items + \readonly + \since QtWebEngine 1.1 + + URLs of back items, forward items, and the current item in the history. +*/ QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::items() const { Q_D(const QQuickWebEngineHistory); @@ -202,6 +268,13 @@ QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::items() const return d->m_navigationModel.data(); } +/*! + \qmlproperty QQuickWebEngineHistoryListModel WebEngineHistory::backItems + \readonly + \since QtWebEngine 1.1 + + URLs of visited pages. +*/ QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::backItems() const { Q_D(const QQuickWebEngineHistory); @@ -210,6 +283,13 @@ QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::backItems() const return d->m_backNavigationModel.data(); } +/*! + \qmlproperty QQuickWebEngineHistoryListModel WebEngineHistory::forwardItems + \readonly + \since QtWebEngine 1.1 + + URLs of the pages that were visited after visiting the current page. +*/ QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::forwardItems() const { Q_D(const QQuickWebEngineHistory); -- cgit v1.2.3 From 32424c285915b4b5d550d0980e8c33c7f5c53312 Mon Sep 17 00:00:00 2001 From: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Date: Thu, 1 Oct 2015 11:03:01 +0200 Subject: Doc: add docs for WebEngineSingleton type Task-number: QTBUG-47912 Change-Id: Iabc06b4ce78eb81955d60cdebccef40fef9a21b3 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> --- src/webengine/api/qquickwebenginesingleton.cpp | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/webengine/api/qquickwebenginesingleton.cpp b/src/webengine/api/qquickwebenginesingleton.cpp index 3f0c8cb65..7ff974eb4 100644 --- a/src/webengine/api/qquickwebenginesingleton.cpp +++ b/src/webengine/api/qquickwebenginesingleton.cpp @@ -41,11 +41,47 @@ QT_BEGIN_NAMESPACE +/*! + \qmltype WebEngine + \instantiates QQuickWebEngineSingleton + \inqmlmodule QtWebEngine 1.1 + \since QtWebEngine 1.1 + \brief Provides access to the default settings and profiles shared by all web engine views. + + The WebEngine singleton type provides access to the default profile and the default settings + shared by all web engine views. It can be used to change settings globally, as illustrated by + the following code snippet: + + \code + Component.onCompleted: { + WebEngine.settings.javaScriptEnabled = true; + } + \endcode +*/ + +/*! + \qmlproperty WebEngineSettings WebEngine::settings + \readonly + \since QtWebEngine 1.1 + + Default settings for all web engine views. + + \sa WebEngineSettings +*/ QQuickWebEngineSettings *QQuickWebEngineSingleton::settings() const { return defaultProfile()->settings(); } +/*! + \qmlproperty WebEngineProfile WebEngine::defaultProfile + \readonly + \since QtWebEngine 1.1 + + Default profile for all web engine views. + + \sa WebEngineProfile +*/ QQuickWebEngineProfile *QQuickWebEngineSingleton::defaultProfile() const { return QQuickWebEngineProfile::defaultProfile(); -- cgit v1.2.3 From 49b796818d84ace5f20098dfe1257957b7fe5fd7 Mon Sep 17 00:00:00 2001 From: Kai Koehne <kai.koehne@theqtcompany.com> Date: Thu, 1 Oct 2015 08:34:06 +0200 Subject: Document WebEnginePage API only available in WebEngine 1.1 Task-number: QTBUG-47907 Change-Id: Ib66038fa61e091cafc7c27a87ca59c4d68b48b48 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> --- src/webengine/doc/src/webengineview.qdoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc index 67239edc9..06514a885 100644 --- a/src/webengine/doc/src/webengineview.qdoc +++ b/src/webengine/doc/src/webengineview.qdoc @@ -75,6 +75,7 @@ /*! \qmlmethod void WebEngineView::reloadAndBypassCache() + \since QtWebEngine 1.1 Reloads the current page, ignoring any cached content. @@ -207,6 +208,7 @@ /*! \qmlproperty list<WebEngineScript> WebEngineView::userScripts \readonly + \since QtWebEngine 1.1 List of script objects attached to the view. */ @@ -324,6 +326,7 @@ /*! \qmlsignal WebEngineView::featurePermissionRequested(url securityOrigin, Feature feature) + \since QtWebEngine 1.1 This signal is emitted when the web site identified by \a securityOrigin requests to make use of the resource or device identified by \a feature. -- cgit v1.2.3 From 508998addcb4e83b38cd23bbfde72250b77db11c Mon Sep 17 00:00:00 2001 From: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Date: Tue, 6 Oct 2015 12:30:45 +0200 Subject: Doc: WebEngineSettings as uncreatable type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-47911 Change-Id: Icea7a63e7d84ec23c98a6bcef4a8bdc624473572 Reviewed-by: Michael Brüning <michael.bruning@theqtcompany.com> --- src/webengine/api/qquickwebenginesettings.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp index 539f211b0..407f2a49f 100644 --- a/src/webengine/api/qquickwebenginesettings.cpp +++ b/src/webengine/api/qquickwebenginesettings.cpp @@ -54,13 +54,15 @@ QQuickWebEngineSettings::QQuickWebEngineSettings(QQuickWebEngineSettings *parent \instantiates QQuickWebEngineSettings \inqmlmodule QtWebEngine \since QtWebEngine 1.1 - \brief WebEngineSettings allows configuration of browser properties and attributes. + \brief Allows configuration of browser properties and attributes. - WebEngineSettings allows configuration of browser properties and generic attributes, such as - JavaScript support, focus behavior, and access to remote content. - - Each WebEngineView can have individual settings. + The WebEngineSettings type can be used to configure browser properties and generic + attributes, such as JavaScript support, focus behavior, and access to remote content. This type + is uncreatable, but the default settings for all web engine views can be accessed by using + the \l{WebEngine::settings}{WebEngine.settings} property. + Each web engine view can have individual settings that can be accessed by using the + \l{WebEngineView::settings}{WebEngineView.settings} property. */ -- cgit v1.2.3 From e0f8746d7da0d8c26e84472da03399ea337fc5af Mon Sep 17 00:00:00 2001 From: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Date: Tue, 6 Oct 2015 12:35:35 +0200 Subject: Doc: add docs for WebEngineView 1.2 API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-48560 Change-Id: I65349be1696b75dc303ae15c81f57094eea0ede4 Reviewed-by: Michael Brüning <michael.bruning@theqtcompany.com> --- src/webengine/doc/src/webengineview.qdoc | 136 +++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc index 06514a885..fd7733d13 100644 --- a/src/webengine/doc/src/webengineview.qdoc +++ b/src/webengine/doc/src/webengineview.qdoc @@ -324,6 +324,26 @@ \sa isFullScreen, fullScreenRequested() */ +/*! + \qmlmethod void WebEngineView::setActiveFocusOnPress(bool arg) + \since QtWebEngine 1.2 + + Sets active focus to a clicked web engine view if \a arg is \c true. By setting it to \c false, + a web engine view can be used to create a UI element that should not get focus. This can be + useful in a hybrid UI. + + \sa activeFocusOnPressChanged() +*/ + +/*! + \qmlmethod void WebEngineView::triggerWebAction(WebAction action) + \since QtWebEngine 1.2 + + Triggers the web action \a action. + + \sa WebAction +*/ + /*! \qmlsignal WebEngineView::featurePermissionRequested(url securityOrigin, Feature feature) \since QtWebEngine 1.1 @@ -446,6 +466,35 @@ \sa WebEngineFullScreenRequest, isFullScreen */ +/*! + \qmlsignal WebEngineView::activeFocusOnPressChanged(bool) + \since QtWebEngine 1.2 + + This signal is emitted when the ability of the web engine view to get focus when clicked + changes. + + \sa setActiveFocusOnPress() +*/ + +/*! + \qmlsignal WebEngineView::backgroundColorChanged() + \since QtWebEngine 1.2 + + This signal is emitted when the web engine view background color changes. +*/ + +/*! + \qmlsignal WebEngineView::renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode) + + \since QtWebEngine 1.2 + + This signal is emitted when the render process is terminated with a non-zero exit status. + \a terminationStatus is the termination status of the process and \a exitCode is the status code + with which the process terminated. + + \sa RenderProcessTerminationStatus +*/ + /*! \qmlproperty enumeration WebEngineView::ErrorDomain @@ -522,6 +571,93 @@ \sa findText() */ +/*! + \qmlproperty enumeration WebEngineView::RenderProcessTerminationStatus + \since QtWebEngine 1.2 + + Describes the status with which the render process terminated: + + \value NormalTerminationStatus + The render process terminated normally. + \value AbnormalTerminationStatus + The render process terminated with a non-zero exit status. + \value CrashedTerminationStatus + The render process crashed, for example because of a segmentation fault. + \value KilledTerminationStatus + The render process was killed, for example by \c SIGKILL or task manager kill. +*/ + +/*! + \qmlproperty enumeration WebEngineView::WebAction + \since QtWebEngine 1.2 + + Describes the types of action that can be performed on a web page: + + \value NoWebAction + No action is triggered. + \value Back + Navigate back in the history of navigated links. + \value Forward + Navigate forward in the history of navigated links. + \value Stop + Stop loading the current page. + \value Reload + Reload the current page. + \value ReloadAndBypassCache + Reload the current page, but do not use any local cache. + \value Cut + Cut the content currently selected into the clipboard. + \value Copy + Copy the content currently selected into the clipboard. + \value Paste + Paste content from the clipboard. + \value Undo + Undo the last editing action. + \value Redo + Redo the last editing action. + \value SelectAll + Select all content. + \value PasteAndMatchStyle + Paste content from the clipboard with current style. + \value OpenLinkInThisWindow + Open the current link in the current window. (Added in Qt 5.6) + \value OpenLinkInNewWindow + Open the current link in a new window. (Added in Qt 5.6) + \value OpenLinkInNewTab + Open the current link in a new tab. (Added in Qt 5.6) + \value CopyLinkToClipboard + Copy the current link to the clipboard. (Added in Qt 5.6) + \value CopyImageToClipboard + Copy the clicked image to the clipboard. (Added in Qt 5.6) + \value CopyImageUrlToClipboard + Copy the clicked image's URL to the clipboard. (Added in Qt 5.6) + \value CopyMediaUrlToClipboard + Copy the hovered audio or video's URL to the clipboard. (Added in Qt 5.6) + \value ToggleMediaControls + Toggle between showing and hiding the controls for the hovered audio or video element. + (Added in Qt 5.6) + \value ToggleMediaLoop + Toggle whether the hovered audio or video should loop on completetion or not. + (Added in Qt 5.6) + \value ToggleMediaPlayPause + Toggle the play/pause state of the hovered audio or video element. (Added in Qt 5.6) + \value ToggleMediaMute + Mute or unmute the hovered audio or video element. (Added in Qt 5.6) + \value DownloadLinkToDisk + Download the current link to the disk. (Added in Qt 5.6) + \value DownloadImageToDisk + Download the highlighted image to the disk. (Added in Qt 5.6) + \value DownloadMediaToDisk + Download the hovered audio or video to the disk. (Added in Qt 5.6) + \value InspectElement + Trigger any attached Web Inspector to inspect the highlighed element. + (Added in Qt 5.6) + \value ExitFullScreen + Exit the fullscreen mode. (Added in Qt 5.6) + + \omitvalue WebActionCount +*/ + /*! \qmlproperty enumeration WebEngineView::Feature -- cgit v1.2.3 From a81a3f4d06b48e5dbe56ba8f3db48d5ed4fab7c7 Mon Sep 17 00:00:00 2001 From: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Date: Tue, 6 Oct 2015 13:49:09 +0200 Subject: Doc: edit QWebEngineView docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix grammar, style, and punctuation. Change-Id: I0d6a8f9ccda16c81f7bc32194d09c5ca0e8761ce Reviewed-by: Michael Brüning <michael.bruning@theqtcompany.com> --- .../doc/src/qwebengineview_lgpl.qdoc | 105 ++++++++++----------- 1 file changed, 48 insertions(+), 57 deletions(-) diff --git a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc index 76878e077..9d03527e1 100644 --- a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc @@ -33,57 +33,48 @@ \inmodule QtWebEngineWidgets - QWebEngineView is the main widget component of the Qt WebEngine web browsing module. + A \e {web view} is the main widget component of the Qt WebEngine web browsing module. It can be used in various applications to display web content live from the Internet. - A web site can be loaded onto QWebEngineView with the load() function. Like all + A \e {web site} can be loaded to a web view with the load() function. Like all Qt widgets, the show() function must be invoked in order to display - QWebEngineView. The snippet below illustrates this: + the web view. The snippet below illustrates this: \snippet simple/main.cpp Using QWebEngineView - Alternatively, setUrl() can also be used to load a web site. If you have + Alternatively, setUrl() can be used to load a web site. If you have the HTML content readily available, you can use setHtml() instead. - The loadStarted() signal is emitted when the view begins loading. The - loadProgress() signal, on the other hand, is emitted whenever an element of - the web view completes loading, such as an embedded image, a script, etc. - Finally, the loadFinished() signal is emitted when the view has loaded - completely. It's argument - either \c true or \c false - indicates - load success or failure. + The loadStarted() signal is emitted when the view begins loading and the loadProgress() + signal is emitted whenever an element of the web view completes loading, such as an embedded + image or a script. The loadFinished() signal is emitted when the view has been loaded + completely. Its argument, either \c true or \c false, indicates whether loading was + successful or failed. - The page() function returns a pointer to the web page object. See - \l{Elements of QWebEngineView} for an explanation of how the web page - is related to the view. + The page() function returns a pointer to a \e {web page} object. A QWebEngineView contains a + QWebEnginePage, which in turn allows access to the QWebEngineHistory in the page's context. The title of an HTML document can be accessed with the title() property. - Additionally, a web site may also specify an icon, which can be accessed + Additionally, a web site may specify an icon, which can be accessed using the iconUrl() property. If the title or the icon changes, the corresponding titleChanged() and iconUrlChanged() signals will be emitted. The - textSizeMultiplier() property can be used to change the overall size of - the text displayed in the web view. + zoomFactor() property can be used to change the overall size of the contents of the web view. If you require a custom context menu, you can implement it by reimplementing \l{QWidget::}{contextMenuEvent()} and populating your QMenu with the actions - obtained from pageAction(). More functionality such as reloading the view, - copying selected text to the clipboard, or pasting into the view, is also + obtained from pageAction(). Additional functionality, such as reloading the view, + copying selected text to the clipboard, or pasting into the view, is encapsulated within the QAction objects returned by pageAction(). These actions can be programmatically triggered using triggerPageAction(). Alternatively, the actions can be added to a toolbar or a menu directly. - QWebEngineView maintains the state of the returned actions but allows + The web view maintains the state of the returned actions but allows modification of action properties such as \l{QAction::}{text} or \l{QAction::}{icon}. If you want to provide support for web sites that allow the user to open new windows, such as pop-up windows, you can subclass QWebEngineView and reimplement the createWindow() function. - - \section1 Elements of QWebEngineView - - QWebEngineView contains a QWebEnginePage, which in turn allows access to the - QWebEngineHistory in the page's context. - */ // FIXME: reintroduce the following when we have proper names for the examples. // \sa {WebEngine Tab Browser Example}, {WebEngine Fancy Browser Example} @@ -91,7 +82,7 @@ /*! \fn QWebEngineView::QWebEngineView(QWidget *parent) - Constructs an empty QWebEngineView with parent \a parent. + Constructs an empty web view with the parent \a parent. \sa load() */ @@ -123,29 +114,29 @@ \fn void QWebEngineView::load(const QUrl &url) Loads the specified \a url and displays it. - \note The view remains the same until enough data has arrived to display the new \a url. + \note The view remains the same until enough data has arrived to display the new URL. \sa setUrl(), url(), urlChanged(), QUrl::fromUserInput() */ /*! \fn void QWebEngineView::setHtml(const QString &html, const QUrl &baseUrl) - Sets the content of the web view to the specified \a html. + Sets the content of the web view to the specified \a html content. - External objects such as stylesheets or images referenced in the HTML - document are located relative to \a baseUrl. + External objects, such as stylesheets or images referenced in the HTML + document, are located relative to \a baseUrl. - The \a html is loaded immediately; external objects are loaded asynchronously. + The HTML document is loaded immediately, whereas external objects are loaded asynchronously. - When using this method, Qt WebEngine assumes that external resources such as - JavaScript programs or style sheets are encoded in UTF-8 unless otherwise + When using this method, Qt WebEngine assumes that external resources, such as + JavaScript programs or style sheets, are encoded in UTF-8 unless otherwise specified. For example, the encoding of an external script can be specified - through the charset attribute of the HTML script tag. Alternatively, the - encoding can also be specified by the web server. + through the \c charset attribute of the HTML script tag. Alternatively, the + encoding can be specified by the web server. This is a convenience function equivalent to setContent(html, "text/html", baseUrl). - \warning This function works only for HTML, for other mime types (i.e. XHTML, SVG) + \warning This function works only for HTML. For other MIME types (such as XHTML or SVG), setContent() should be used instead. \sa load(), setContent(), QWebEnginePage::toHtml(), QWebEnginePage::setContent() @@ -154,12 +145,12 @@ /*! \fn void QWebEngineView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) Sets the content of the web view to the specified content \a data. If the \a mimeType argument - is empty it is currently assumed that the content is HTML but in future versions we may introduce - auto-detection. + is empty, it is currently assumed that the content is HTML but in future versions we may + introduce auto-detection. External objects referenced in the content are located relative to \a baseUrl. - The \a data is loaded immediately; external objects are loaded asynchronously. + The data is loaded immediately; external objects are loaded asynchronously. \sa load(), setHtml(), QWebEnginePage::toHtml() */ @@ -168,7 +159,7 @@ \fn QWebEngineHistory *QWebEngineView::history() const Returns a pointer to the view's history of navigated web pages. - It is equivalent to + It is equivalent to: \snippet qtwebengine_qwebengineview_snippet.cpp 0 */ @@ -184,7 +175,7 @@ /*! \property QWebEngineView::url - \brief the url of the web page currently viewed + \brief the URL of the web page currently viewed Setting this property clears the view and loads the URL. @@ -195,7 +186,7 @@ /*! \property QWebEngineView::iconUrl - \brief the url of the icon associated with the web page currently viewed + \brief the URL of the icon associated with the web page currently viewed \sa iconUrlChanged() */ @@ -204,7 +195,7 @@ \property QWebEngineView::hasSelection \brief whether this page contains selected content or not. - By default, this property is false. + By default, this property is \c false. \sa selectionChanged() */ @@ -225,7 +216,7 @@ /*! \fn void QWebEngineView::triggerPageAction(QWebEnginePage::WebAction action, bool checked) - Triggers the specified \a action. If it is a checkable action the specified + Triggers the specified \a action. If it is a checkable action, the specified \a checked state is assumed. The following example triggers the copy action and therefore copies any @@ -256,8 +247,8 @@ To clear the selection, just pass an empty string. - The \a resultCallback must take a boolean parameter. It will be called with a value of true if the \a subString - was found; otherwise the callback value will be false. + \a resultCallback must take a boolean parameter. It will be called with a value of \c true + if \a subString was found; otherwise the callback value will be \c false. \sa selectedText(), selectionChanged() */ @@ -266,7 +257,7 @@ \fn void QWebEngineView::stop() Convenience slot that stops loading the document. - It is equivalent to + It is equivalent to: \snippet qtwebengine_qwebengineview_snippet.cpp 3 @@ -278,7 +269,7 @@ Convenience slot that loads the previous document in the list of documents built by navigating links. Does nothing if there is no previous document. - It is equivalent to + It is equivalent to: \snippet qtwebengine_qwebengineview_snippet.cpp 4 @@ -290,7 +281,7 @@ Convenience slot that loads the next document in the list of documents built by navigating links. Does nothing if there is no next document. - It is equivalent to + It is equivalent to: \snippet qtwebengine_qwebengineview_snippet.cpp 5 @@ -306,11 +297,11 @@ /*! \fn QWebEngineView *QWebEngineView::createWindow(QWebEnginePage::WebWindowType type) - This function is called from the createWindow() method of the associated QWebEnginePage, - each time the page wants to create a new window of the given \a type. This might - be the result, for example, of a JavaScript request to open a document in a new window. + This function is called from the \l{QWebEnginePage::}{createWindow()} method of the associated + QWebEnginePage each time the page wants to create a new window of the given \a type. For + example, when a JavaScript request to open a document in a new window is issued. - \note If the createWindow() method of the associated page is reimplemented, this + \note If the \c createWindow() method of the associated page is reimplemented, this method is not called, unless explicitly done so in the reimplementation. \sa QWebEnginePage::createWindow() @@ -351,8 +342,8 @@ /*! \fn void QWebEngineView::loadFinished(bool ok) - This signal is emitted when a load of the page is finished. - \a ok will indicate whether the load was successful or any error occurred. + This signal is emitted when a load of the page has finished. + \a ok will indicate whether the load was successful or an error occurred. \sa loadStarted() */ @@ -382,9 +373,9 @@ /*! \fn QWebEngineSettings *QWebEngineView::settings() const - Returns a pointer to the view/page specific settings object. + Returns a pointer to the view or page specific settings object. - It is equivalent to + It is equivalent to: \snippet qtwebengine_qwebengineview_snippet.cpp 6 -- cgit v1.2.3 From 8229f7d0e841dc996f74978336a8d6ef851fc3ad Mon Sep 17 00:00:00 2001 From: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Date: Tue, 6 Oct 2015 14:06:40 +0200 Subject: Doc: edit QWebEngineUrlRequestJob docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add docs for the Error enum - Fix incorrect argument name - Edit for grammar Change-Id: I6c4364eb0a4dd52e38eaf1cde46aec4ddff99532 Reviewed-by: Michael Brüning <michael.bruning@theqtcompany.com> --- src/core/api/qwebengineurlrequestjob.cpp | 38 ++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/src/core/api/qwebengineurlrequestjob.cpp b/src/core/api/qwebengineurlrequestjob.cpp index d9f3833b9..0e56ba5b3 100644 --- a/src/core/api/qwebengineurlrequestjob.cpp +++ b/src/core/api/qwebengineurlrequestjob.cpp @@ -48,17 +48,35 @@ QT_BEGIN_NAMESPACE \since 5.6 A QWebEngineUrlRequestJob is given to QWebEngineUrlSchemeHandler::requestStarted() and must - be handled by the derived implementations of the class. + be handled by the derived implementations of the class. The job can be handled by calling + either reply(), redirect(), or fail(). - A job can be handled by calling either reply(), redirect() or fail(). - - The class is owned by QtWebEngine and does not need to be deleted. Note QtWebEngine may delete - the job when it is no longer needed, so the signal QObject::destroyed() must be monitored if - a pointer to the object is stored. + The class is owned by the web engine and does not need to be deleted. However, the web engine + may delete the job when it is no longer needed, and therefore the signal QObject::destroyed() + must be monitored if a pointer to the object is stored. \inmodule QtWebEngineCore */ +/*! + \enum QWebEngineUrlRequestJob::Error + + This enum type holds the type of the error that occurred: + + \value NoError + The request was successful. + \value UrlNotFound + The requested URL was not found. + \value UrlInvalid + The requested URL is invalid. + \value RequestAborted + The request was canceled. + \value RequestDenied + The request was denied. + \value RequestFailed + The request failed. +*/ + /*! \internal */ @@ -92,7 +110,7 @@ QByteArray QWebEngineUrlRequestJob::requestMethod() const } /*! - Replies the request with \a device with the mime-type \a contentType. + Replies to the request with \a device and the MIME type \a contentType. */ void QWebEngineUrlRequestJob::reply(const QByteArray &contentType, QIODevice *device) { @@ -100,7 +118,9 @@ void QWebEngineUrlRequestJob::reply(const QByteArray &contentType, QIODevice *de } /*! - Fails the request with error \a error. + Fails the request with the error \a r. + + \sa Error */ void QWebEngineUrlRequestJob::fail(Error r) { @@ -108,7 +128,7 @@ void QWebEngineUrlRequestJob::fail(Error r) } /*! - Tell the request is redirected to \a url. + Redirects the request to \a url. */ void QWebEngineUrlRequestJob::redirect(const QUrl &url) { -- cgit v1.2.3 From dfebd43f600e4ffd16975a0c5d401740e45fee54 Mon Sep 17 00:00:00 2001 From: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Date: Mon, 5 Oct 2015 15:20:24 +0200 Subject: Doc: edit QWebEngineUrlSchemeHandler docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add missing docs - Edit for grammar Change-Id: I407818d66f17a354cf3f5051bed5a648bc807424 Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org> Reviewed-by: Michael Brüning <michael.bruning@theqtcompany.com> --- src/core/api/qwebengineurlschemehandler.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/core/api/qwebengineurlschemehandler.cpp b/src/core/api/qwebengineurlschemehandler.cpp index b2994847b..8b3327805 100644 --- a/src/core/api/qwebengineurlschemehandler.cpp +++ b/src/core/api/qwebengineurlschemehandler.cpp @@ -43,16 +43,22 @@ QT_BEGIN_NAMESPACE /*! \class QWebEngineUrlSchemeHandler - \brief The QWebEngineUrlSchemeHandler base class for handling custom URL schemes. + \brief The QWebEngineUrlSchemeHandler is a base class for handling custom URL schemes. \since 5.6 - To implement a custom URL scheme for QtWebEngine you must write a class derived from this class, + To implement a custom URL scheme for QtWebEngine, you must write a class derived from this class, and reimplement requestStarted(). \inmodule QtWebEngineCore */ +/*! + \fn QWebEngineUrlSchemeHandler::destroyed(QWebEngineUrlSchemeHandler*) + + This signal is emitted when a custom URL scheme handler is deleted. +*/ + QWebEngineUrlSchemeHandlerPrivate::QWebEngineUrlSchemeHandlerPrivate(const QByteArray &scheme) : m_scheme(scheme) { @@ -70,6 +76,9 @@ QWebEngineUrlSchemeHandler::QWebEngineUrlSchemeHandler(const QByteArray &scheme, { } +/*! + Deletes a custom URL scheme handler. +*/ QWebEngineUrlSchemeHandler::~QWebEngineUrlSchemeHandler() { Q_EMIT destroyed(this); -- cgit v1.2.3 From 8318548b32134203a6a74029312da5cdff484a35 Mon Sep 17 00:00:00 2001 From: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Date: Tue, 6 Oct 2015 17:07:08 +0200 Subject: Doc: remove doc config file from Qt WebEngineWidgets submodule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This helps maintaining the doc dependencies. All Qt WebEngine module docs are now generated in the /qtbase/doc/qtwebengine/ folder. Note that you must run qmake -r for the docs to be generated correctly after applying this patch. Add Qt WebEngine C++ Classes page that lists the C++ classes for the submodules. Modify snippet and example paths accordingly. Change-Id: I59431c5f766f30b59654ca4e2219b76c79137225 Reviewed-by: Topi Reiniö <topi.reinio@digia.com> --- .../quicknanobrowser/doc/src/quicknanobrowser.qdoc | 2 +- .../demobrowser/doc/src/demobrowser.qdoc | 6 +-- .../fancybrowser/doc/src/fancybrowser.qdoc | 22 +++++------ src/webengine/api/qquickwebenginehistory.cpp | 2 +- src/webengine/doc/qtwebengine.qdocconf | 25 +++++++------ src/webengine/doc/src/qtwebengine-index.qdoc | 3 +- src/webengine/doc/src/qtwebengine-modules.qdoc | 42 +++++++++++++++++++++ .../doc/qtwebenginewidgets.qdocconf | 43 ---------------------- .../doc/src/qtwebenginewidgets-module.qdoc | 5 +++ src/webenginewidgets/webenginewidgets.pro | 2 - 10 files changed, 78 insertions(+), 74 deletions(-) create mode 100644 src/webengine/doc/src/qtwebengine-modules.qdoc delete mode 100644 src/webenginewidgets/doc/qtwebenginewidgets.qdocconf diff --git a/examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc b/examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc index 4fac9fe09..211951929 100644 --- a/examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc +++ b/examples/webengine/quicknanobrowser/doc/src/quicknanobrowser.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example quicknanobrowser + \example webengine/quicknanobrowser \title WebEngine Quick Nano Browser \ingroup webengine-examples \brief A web browser implemented using the WebEngineView QML type. diff --git a/examples/webenginewidgets/demobrowser/doc/src/demobrowser.qdoc b/examples/webenginewidgets/demobrowser/doc/src/demobrowser.qdoc index 1264606db..ba61dd79d 100644 --- a/examples/webenginewidgets/demobrowser/doc/src/demobrowser.qdoc +++ b/examples/webenginewidgets/demobrowser/doc/src/demobrowser.qdoc @@ -26,13 +26,13 @@ ****************************************************************************/ /*! - \example demobrowser + \example webenginewidgets/demobrowser \title WebEngine Demo Browser Example \ingroup webengine-widgetexamples \brief A demo browser based on Qt WebEngine Widgets - The Demo Browser example shows the \l{Qt WebEngine Widgets} module in action, - providing a little Web browser application with support for tabs. + \e {Demo Browser} demonstrates how to use the \l{Qt WebEngine Widgets C++ Classes} + {Qt WebEngine C++ classes} to develop a small Web browser application with support for tabs. \image browser-demo.png diff --git a/examples/webenginewidgets/fancybrowser/doc/src/fancybrowser.qdoc b/examples/webenginewidgets/fancybrowser/doc/src/fancybrowser.qdoc index e6c6ada34..b798e4832 100644 --- a/examples/webenginewidgets/fancybrowser/doc/src/fancybrowser.qdoc +++ b/examples/webenginewidgets/fancybrowser/doc/src/fancybrowser.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example fancybrowser + \example webenginewidgets/fancybrowser \title WebEngine Fancy Browser Example \ingroup webengine-widgetexamples \brief Demonstrates how to use browse web and manipulate content @@ -48,7 +48,7 @@ The \c MainWindow class inherits QMainWindow. It implements a number of slots to perform actions on both the application and on the web content. - \snippet fancybrowser/mainwindow.h 1 + \snippet webenginewidgets/fancybrowser/mainwindow.h 1 We also declare a QString that contains the jQuery, a QWebView that displays the web content, and a QLineEdit that acts as the @@ -58,7 +58,7 @@ We start by implementing the constructor. - \snippet fancybrowser/mainwindow.cpp 1 + \snippet webenginewidgets/fancybrowser/mainwindow.cpp 1 The first part of the constructor sets the value of \c progress to 0. This value will be used later in the code to visualize the @@ -68,7 +68,7 @@ content. The jQuery library is a JavaScript library that provides different functions for manipulating HTML. - \snippet fancybrowser/mainwindow.cpp 2 + \snippet webenginewidgets/fancybrowser/mainwindow.cpp 2 The second part of the constructor creates a QWebView and connects slots to the views signals. Furthermore, we create a QLineEdit as @@ -77,13 +77,13 @@ QLineEdit to a QToolbar together with a set of navigation actions from QWebView::pageAction. - \snippet fancybrowser/mainwindow.cpp 3 + \snippet webenginewidgets/fancybrowser/mainwindow.cpp 3 The third and last part of the constructor implements two QMenus and assigns a set of actions to them. The last line sets the QWebView as the central widget in the QMainWindow. - \snippet fancybrowser/mainwindow.cpp 4 + \snippet webenginewidgets/fancybrowser/mainwindow.cpp 4 When the page is loaded, \c adjustLocation() updates the address bar; \c adjustLocation() is triggered by the \c loadFinished() @@ -92,13 +92,13 @@ the new web page has finished loading, \c adjustLocation() will be run once more to update the address bar. - \snippet fancybrowser/mainwindow.cpp 5 + \snippet webenginewidgets/fancybrowser/mainwindow.cpp 5 \c adjustTitle() sets the window title and displays the loading progress. This slot is triggered by the \c titleChanged() signal in QWebView. - \snippet fancybrowser/mainwindow.cpp 6 + \snippet webenginewidgets/fancybrowser/mainwindow.cpp 6 When a web page has loaded, \c finishLoading() is triggered by the \c loadFinished() signal in QWebView. \c finishLoading() then updates the @@ -113,7 +113,7 @@ that the images of the newly loaded page respect the state of the toggle action. - \snippet fancybrowser/mainwindow.cpp 7 + \snippet webenginewidgets/fancybrowser/mainwindow.cpp 7 The first jQuery-based function, \c highlightAllLinks(), is designed to highlight all links in the current webpage. The JavaScript code looks @@ -121,14 +121,14 @@ For each such element, the background color is set to be yellow by using CSS. - \snippet fancybrowser/mainwindow.cpp 8 + \snippet webenginewidgets/fancybrowser/mainwindow.cpp 8 The \c rotateImages() function rotates the images on the current web page. This JavaScript code relies on CSS transforms and looks up all \e {img} elements and rotates the images 180 degrees and then back again. - \snippet fancybrowser/mainwindow.cpp 9 + \snippet webenginewidgets/fancybrowser/mainwindow.cpp 9 The remaining four methods remove different elements from the current web page. \c removeGifImages() removes all GIF images on the page by looking up diff --git a/src/webengine/api/qquickwebenginehistory.cpp b/src/webengine/api/qquickwebenginehistory.cpp index 27081703b..483fa86f9 100644 --- a/src/webengine/api/qquickwebenginehistory.cpp +++ b/src/webengine/api/qquickwebenginehistory.cpp @@ -234,7 +234,7 @@ QQuickWebEngineHistoryPrivate::~QQuickWebEngineHistoryPrivate() The data models can also be used to create a menu, as illustrated by the following code snippet: - \quotefromfile quicknanobrowser/browserwindow.qml + \quotefromfile webengine/quicknanobrowser/browserwindow.qml \skipto ToolBar \printuntil onObjectRemoved \printuntil } diff --git a/src/webengine/doc/qtwebengine.qdocconf b/src/webengine/doc/qtwebengine.qdocconf index f833cf0d2..e277f4190 100644 --- a/src/webengine/doc/qtwebengine.qdocconf +++ b/src/webengine/doc/qtwebengine.qdocconf @@ -4,7 +4,7 @@ project = QtWebEngine description = Qt WebEngine Reference Documentation version = $QT_VERSION -examplesinstallpath = webengine +examplesinstallpath = qhp.projects = QtWebEngine @@ -44,21 +44,24 @@ depends += qtcore \ qtquickcontrols \ qtdoc \ qtwebchannel \ - qtwebenginewidgets + qtwidgets -headerdirs += . \ - ../api \ - ../../core/api +headerdirs += .. \ + ../../core \ + ../../webenginewidgets -sourcedirs += . \ - ../api \ - ../../core/api \ - ../../core/doc/src +sourcedirs += .. \ + ../../core/ \ + ../../webenginewidgets \ exampledirs += . \ - ../../../examples/webengine \ + ../../../examples \ snippets \ - ../../core/doc/snippets + ../../core/doc/snippets \ + ../../webenginewidgets/doc/snippets + + +imagedirs += images navigation.landingpage = "Qt WebEngine" navigation.cppclassespage = "Qt WebEngine C++ Classes" diff --git a/src/webengine/doc/src/qtwebengine-index.qdoc b/src/webengine/doc/src/qtwebengine-index.qdoc index 2c3737b7d..e67bd43fd 100644 --- a/src/webengine/doc/src/qtwebengine-index.qdoc +++ b/src/webengine/doc/src/qtwebengine-index.qdoc @@ -84,8 +84,7 @@ \section1 API References \list - \li \l{Qt WebEngine Core C++ Classes} - \li \l{Qt WebEngine Widgets C++ Classes} + \li \l{Qt WebEngine C++ Classes} \li \l{Qt WebEngine QML Types} \endlist */ diff --git a/src/webengine/doc/src/qtwebengine-modules.qdoc b/src/webengine/doc/src/qtwebengine-modules.qdoc new file mode 100644 index 000000000..2e1b4c947 --- /dev/null +++ b/src/webengine/doc/src/qtwebengine-modules.qdoc @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qtwebengine-modules.html + \title Qt WebEngine C++ Classes + \brief Provides functionality for rendering regions of dynamic web content. + + \e {Qt WebEngine} provides functionality for rendering regions of dynamic web content. + + \section1 Classes + + \section2 Qt WebEngineCore Module + \generatelist {classesbymodule QtWebEngineCore} + + \section2 Qt WebEngineWidgets Module + \generatelist {classesbymodule QtWebEngineWidgets} +*/ diff --git a/src/webenginewidgets/doc/qtwebenginewidgets.qdocconf b/src/webenginewidgets/doc/qtwebenginewidgets.qdocconf deleted file mode 100644 index 7b48b7a14..000000000 --- a/src/webenginewidgets/doc/qtwebenginewidgets.qdocconf +++ /dev/null @@ -1,43 +0,0 @@ -include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) - -project = QtWebEngineWidgets -description = Qt WebEngineWidgets Reference Documentation -version = $QT_VERSION - -examplesinstallpath = webenginewidgets - -qhp.projects = QtWebEngineWidgets - -qhp.QtWebEngineWidgets.file = qtwebenginewidgets.qhp -qhp.QtWebEngineWidgets.namespace = org.qt-project.qtwebenginewidgets.$QT_VERSION_TAG -qhp.QtWebEngineWidgets.virtualFolder = qtwebenginewidgets -qhp.QtWebEngineWidgets.indexTitle = Qt WebEngine Widgets -qhp.QtWebEngineWidgets.indexRoot = - -qhp.QtWebEngineWidgets.filterAttributes = qtwebenginewidgets $QT_VERSION qtrefdoc -qhp.QtWebEngineWidgets.customFilters.Qt.name = QtWebEngineWidgets $QT_VERSION -qhp.QtWebEngineWidgets.customFilters.Qt.filterAttributes = qtwebenginewidgets $QT_VERSION -qhp.QtWebEngineWidgets.subprojects = classes examples -qhp.QtWebEngineWidgets.subprojects.classes.title = C++ Classes -qhp.QtWebEngineWidgets.subprojects.classes.indexTitle = Qt WebEngine Widgets C++ Classes -qhp.QtWebEngineWidgets.subprojects.classes.selectors = class fake:headerfile -qhp.QtWebEngineWidgets.subprojects.classes.sortPages = true -qhp.QtWebEngineWidgets.subprojects.examples.title = Examples -qhp.QtWebEngineWidgets.subprojects.examples.indexTitle = Qt WebEngine Widgets Examples -qhp.QtWebEngineWidgets.subprojects.examples.selectors = fake:example -qhp.QtWebEngineWidgets.subprojects.examples.sortPages = true - -tagfile = ../../../doc/qtwebenginewidgets/qtwebenginewidgets.tags - -depends += qtwebengine qtcore qtnetwork qtgui qtwidgets qtwebkit qtdoc qtwebchannel - -headerdirs += ../api -sourcedirs += ../api src - -exampledirs += ../../../examples/webenginewidgets \ - snippets - -navigation.landingpage = "Qt WebEngine Widgets" -navigation.cppclassespage = "Qt WebEngine Widgets C++ Classes" - -Cpp.ignoretokens += QWEBENGINEWIDGETS_EXPORT diff --git a/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc b/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc index 6373389f3..a9ef6ad8c 100644 --- a/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc +++ b/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc @@ -30,7 +30,12 @@ \title Qt WebEngine Widgets C++ Classes \brief Provides a web browser engine as well as C++ classes to render and interact with web content + \ingroup modules \ingroup qtwebengine-modules + \qtvariable webenginewidgets + + The Qt WebEngineWidgets module provides a web browser engine as well as C++ classes to render + and interact with web content. To include the definitions of the module's classes, use the following directive: diff --git a/src/webenginewidgets/webenginewidgets.pro b/src/webenginewidgets/webenginewidgets.pro index c32185563..17a0a3dbb 100644 --- a/src/webenginewidgets/webenginewidgets.pro +++ b/src/webenginewidgets/webenginewidgets.pro @@ -6,8 +6,6 @@ DEFINES += QT_BUILD_WEBENGINEWIDGETS_LIB QT += webengine webenginecore widgets network quick QT_PRIVATE += quick-private gui-private core-private -QMAKE_DOCS = $$PWD/doc/qtwebenginewidgets.qdocconf - INCLUDEPATH += $$PWD api ../core ../core/api ../webengine/api SOURCES = \ -- cgit v1.2.3 From 62766a37505629c78917ad2bb9431f7051cbf0af Mon Sep 17 00:00:00 2001 From: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Date: Wed, 7 Oct 2015 12:37:54 +0200 Subject: Doc: add docs for WebEngineHistoryListModel type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-48596 Change-Id: Icda2dd21a198ba409e3cf8c53d9ff449f4675902 Reviewed-by: Michael Brüning <michael.bruning@theqtcompany.com> --- src/webengine/api/qquickwebenginehistory.cpp | 30 ++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/webengine/api/qquickwebenginehistory.cpp b/src/webengine/api/qquickwebenginehistory.cpp index 483fa86f9..175b52248 100644 --- a/src/webengine/api/qquickwebenginehistory.cpp +++ b/src/webengine/api/qquickwebenginehistory.cpp @@ -118,6 +118,26 @@ int QQuickWebEngineForwardHistoryListModelPrivate::offsetForIndex(int index) con return index + 1; } +/*! + \qmltype WebEngineHistoryListModel + \instantiates QQuickWebEngineHistoryListModel + \inqmlmodule QtWebEngine 1.1 + \since QtWebEngine 1.1 + + \brief A data model that represents the history of a web engine page. + + The WebEngineHistoryListModel type exposes the \e title, \e url, and \e offset roles. The + \e title and \e url specify the title and URL of the visited page. The \e offset specifies + the position of the page in respect to the current page (0). A positive number indicates that + the page was visited after the current page, whereas a negative number indicates that the page + was visited before the current page. + + This type is uncreatable, but it can be accessed by using the + \l{WebEngineView::navigationHistory}{WebEngineView.navigationHistory} property. + + \sa WebEngineHistory +*/ + QQuickWebEngineHistoryListModel::QQuickWebEngineHistoryListModel() : QAbstractListModel() { @@ -191,12 +211,12 @@ QQuickWebEngineHistoryPrivate::~QQuickWebEngineHistoryPrivate() \inqmlmodule QtWebEngine 1.1 \since QtWebEngine 1.1 - \brief Data models that represent the history of a web engine page. + \brief Provides data models that represent the history of a web engine page. - The uncreatable WebEngineHistory type can be accessed by using the + The WebEngineHistory type can be accessed by using the \l{WebEngineView::navigationHistory}{WebEngineView.navigationHistory} property. - The WebEngineHistory type provides the following data models: + The WebEngineHistory type providess the following WebEngineHistoryListModel data model objects: \list \li \c backItems, which contains the URLs of visited pages. @@ -226,7 +246,7 @@ QQuickWebEngineHistoryPrivate::~QQuickWebEngineHistoryPrivate() format of the list items. The appearance of each item of the list in the delegate can be defined separately (it is not web engine specific). - The model roles \c title and \c url specify the title and URL of the visited page. The \c offset + The model roles \e title and \e url specify the title and URL of the visited page. The \e offset role specifies the position of the page in respect to the current page (0). A positive number indicates that the page was visited after the current page, whereas a negative number indicates that the page was visited before the current page. @@ -242,6 +262,8 @@ QQuickWebEngineHistoryPrivate::~QQuickWebEngineHistoryPrivate() \printuntil } For the complete example, see \l{WebEngine Quick Nano Browser}. + + \sa WebEngineHistoryListModel */ QQuickWebEngineHistory::QQuickWebEngineHistory(QQuickWebEngineViewPrivate *view) -- cgit v1.2.3 From e4a3ca84fdfd854e1df157697f4c9ba05ded982a Mon Sep 17 00:00:00 2001 From: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Date: Wed, 7 Oct 2015 12:27:04 +0200 Subject: Doc: add docs for QWebEngineView::renderProcessTerminated() Change-Id: I055467595e6c922bc95fabf63555c7225de6d626 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com> --- src/webenginewidgets/api/qwebengineview.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp index ddd1e4cbf..9baa8e34a 100644 --- a/src/webenginewidgets/api/qwebengineview.cpp +++ b/src/webenginewidgets/api/qwebengineview.cpp @@ -108,6 +108,14 @@ QWebEngineViewPrivate::QWebEngineViewPrivate() #endif // QT_NO_ACCESSIBILITY } +/*! + \fn QWebEngineView::renderProcessTerminated(QWebEnginePage::RenderProcessTerminationStatus terminationStatus, int exitCode) + + This signal is emitted when the render process is terminated with a non-zero exit status. + \a terminationStatus is the termination status of the process and \a exitCode is the status code + with which the process terminated. +*/ + QWebEngineView::QWebEngineView(QWidget *parent) : QWidget(parent) , d_ptr(new QWebEngineViewPrivate) -- cgit v1.2.3 From 3483e35635d24e8373ecb86114c9820093041df3 Mon Sep 17 00:00:00 2001 From: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Date: Wed, 7 Oct 2015 14:24:58 +0200 Subject: Doc: edit link to Qt WebKit docs to point to archive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Qt WebKit docs are not part of Qt 5.6 documentation. Change-Id: Iac913b2b94f899b0c14398c5a864b647c56995c5 Reviewed-by: Topi Reiniö <topi.reinio@digia.com> --- src/webengine/doc/src/qtwebengine-overview.qdoc | 3 ++- src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc index 656dd13f1..fb2db9501 100644 --- a/src/webengine/doc/src/qtwebengine-overview.qdoc +++ b/src/webengine/doc/src/qtwebengine-overview.qdoc @@ -39,7 +39,8 @@ made fully editable by the user through the use of the \c{contenteditable} attribute on HTML elements. - Qt WebEngine supercedes the \l{Qt WebKit Widgets}{Qt WebKit} module, which is based on the + Qt WebEngine supercedes the \l{http://doc.qt.io/archives/qt-5.3/qtwebkit-index.html}{Qt WebKit} + module, which is based on the WebKit project, but has not been actively synchronized with the upstream WebKit code since Qt 5.2 and has been deprecated in Qt 5.5. For tips on how to change a Qt WebKit widgets application to use Qt WebEngine widgets, see \l{Porting from Qt WebKit to Qt WebEngine}. For new diff --git a/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc b/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc index 174f59d83..927b08cb5 100644 --- a/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc +++ b/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc @@ -31,8 +31,10 @@ \brief This guide gives an overview of the differences between the Qt WebKit and Qt WebEngine APIs in applications. - This provides rough steps to follow when porting an application using - Qt WebKit's QWebView API to use Qt WebEngine's QWebEngineView. + This guide provides rough steps to follow when porting an application that uses the + \l{http://doc.qt.io/archives/qt-5.3/qtwebkit-index.html}{Qt WebKit} + \l{http://doc.qt.io/archives/qt-5.3/qml-qtwebkit-webview.html}{QWebView API} to use the + \l{Qt WebEngine} QWebEngineView. \section1 Class Names -- cgit v1.2.3 From 38c756929033c57f0ce22611ef5218fd13bf158c Mon Sep 17 00:00:00 2001 From: Kai Koehne <kai.koehne@theqtcompany.com> Date: Fri, 2 Oct 2015 16:59:04 +0200 Subject: Update .qmltypes file Change-Id: I492d225b8b217e7cef4548d31d96c351a6fa2407 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com> --- src/webengine/plugin/plugins.qmltypes | 99 ++++++++++++++++++++++++++++++++--- 1 file changed, 92 insertions(+), 7 deletions(-) diff --git a/src/webengine/plugin/plugins.qmltypes b/src/webengine/plugin/plugins.qmltypes index 9dcded7b0..1e577bf51 100644 --- a/src/webengine/plugin/plugins.qmltypes +++ b/src/webengine/plugin/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable QtWebEngine 1.1' +// 'qmlplugindump -nonrelocatable QtWebEngine 1.2' Module { dependencies: [] @@ -571,8 +571,11 @@ Module { Component { name: "QQuickWebEngineProfile" prototype: "QObject" - exports: ["QtWebEngine/WebEngineProfile 1.1"] - exportMetaObjectRevisions: [0] + exports: [ + "QtWebEngine/WebEngineProfile 1.1", + "QtWebEngine/WebEngineProfile 1.2" + ] + exportMetaObjectRevisions: [0, 1] Enum { name: "HttpCacheType" values: { @@ -594,8 +597,10 @@ Module { Property { name: "cachePath"; type: "string" } Property { name: "httpUserAgent"; type: "string" } Property { name: "httpCacheType"; type: "HttpCacheType" } + Property { name: "httpAcceptLanguage"; type: "string" } Property { name: "persistentCookiesPolicy"; type: "PersistentCookiesPolicy" } Property { name: "httpCacheMaximumSize"; type: "int" } + Signal { name: "httpAcceptLanguageChanged"; revision: 1 } Signal { name: "downloadRequested" Parameter { name: "download"; type: "QQuickWebEngineDownloadItem"; isPointer: true } @@ -604,6 +609,11 @@ Module { name: "downloadFinished" Parameter { name: "download"; type: "QQuickWebEngineDownloadItem"; isPointer: true } } + Method { + name: "setCookieStoreClient" + revision: 1 + Parameter { name: "client"; type: "QWebEngineCookieStoreClient"; isPointer: true } + } } Component { name: "QQuickWebEngineScript" @@ -685,9 +695,12 @@ Module { Component { name: "QQuickWebEngineSettings" prototype: "QObject" - exports: ["QtWebEngine/WebEngineSettings 1.1"] + exports: [ + "QtWebEngine/WebEngineSettings 1.1", + "QtWebEngine/WebEngineSettings 1.2" + ] isCreatable: false - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [0, 1] Property { name: "autoLoadImages"; type: "bool" } Property { name: "javascriptEnabled"; type: "bool" } Property { name: "javascriptCanOpenWindows"; type: "bool" } @@ -699,7 +712,10 @@ Module { Property { name: "localContentCanAccessFileUrls"; type: "bool" } Property { name: "hyperlinkAuditingEnabled"; type: "bool" } Property { name: "errorPageEnabled"; type: "bool" } + Property { name: "pluginsEnabled"; type: "bool" } + Property { name: "fullScreenSupportEnabled"; revision: 1; type: "bool" } Property { name: "defaultTextEncoding"; type: "string" } + Signal { name: "fullScreenSupportEnabledChanged"; revision: 1 } } Component { name: "QQuickWebEngineSingleton" @@ -723,9 +739,10 @@ Module { prototype: "QQuickItem" exports: [ "QtWebEngine/WebEngineView 1.0", - "QtWebEngine/WebEngineView 1.1" + "QtWebEngine/WebEngineView 1.1", + "QtWebEngine/WebEngineView 1.2" ] - exportMetaObjectRevisions: [0, 1] + exportMetaObjectRevisions: [0, 1, 2] Enum { name: "NavigationRequestAction" values: { @@ -783,6 +800,41 @@ Module { "Geolocation": 3 } } + Enum { + name: "WebAction" + values: { + "NoWebAction": -1, + "Back": 0, + "Forward": 1, + "Stop": 2, + "Reload": 3, + "Cut": 4, + "Copy": 5, + "Paste": 6, + "Undo": 7, + "Redo": 8, + "SelectAll": 9, + "ReloadAndBypassCache": 10, + "PasteAndMatchStyle": 11, + "OpenLinkInThisWindow": 12, + "OpenLinkInNewWindow": 13, + "OpenLinkInNewTab": 14, + "CopyLinkToClipboard": 15, + "DownloadLinkToDisk": 16, + "CopyImageToClipboard": 17, + "CopyImageUrlToClipboard": 18, + "DownloadImageToDisk": 19, + "CopyMediaUrlToClipboard": 20, + "ToggleMediaControls": 21, + "ToggleMediaLoop": 22, + "ToggleMediaPlayPause": 23, + "ToggleMediaMute": 24, + "DownloadMediaToDisk": 25, + "InspectElement": 26, + "ExitFullScreen": 27, + "WebActionCount": 28 + } + } Enum { name: "JavaScriptConsoleMessageLevel" values: { @@ -791,6 +843,15 @@ Module { "ErrorMessageLevel": 2 } } + Enum { + name: "RenderProcessTerminationStatus" + values: { + "NormalTerminationStatus": 0, + "AbnormalTerminationStatus": 1, + "CrashedTerminationStatus": 2, + "KilledTerminationStatus": 3 + } + } Enum { name: "FindFlags" values: { @@ -830,6 +891,8 @@ Module { isList: true isReadonly: true } + Property { name: "activeFocusOnPress"; revision: 2; type: "bool" } + Property { name: "backgroundColor"; revision: 2; type: "QColor" } Signal { name: "loadingChanged" Parameter { name: "loadRequest"; type: "QQuickWebEngineLoadRequest"; isPointer: true } @@ -878,6 +941,18 @@ Module { } Signal { name: "profileChanged"; revision: 1 } Signal { name: "webChannelChanged"; revision: 1 } + Signal { + name: "activeFocusOnPressChanged" + revision: 2 + Parameter { type: "bool" } + } + Signal { name: "backgroundColorChanged"; revision: 2 } + Signal { + name: "renderProcessTerminated" + revision: 2 + Parameter { name: "terminationStatus"; type: "RenderProcessTerminationStatus" } + Parameter { name: "exitCode"; type: "int" } + } Method { name: "runJavaScript" Parameter { type: "string" } @@ -932,5 +1007,15 @@ Module { Parameter { type: "Feature" } Parameter { name: "granted"; type: "bool" } } + Method { + name: "setActiveFocusOnPress" + revision: 2 + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "triggerWebAction" + revision: 2 + Parameter { name: "action"; type: "WebAction" } + } } } -- cgit v1.2.3 From f681793c6895d390fe7a5f57718e25a4fcd10ed0 Mon Sep 17 00:00:00 2001 From: Kai Koehne <kai.koehne@theqtcompany.com> Date: Thu, 8 Oct 2015 11:51:51 +0200 Subject: Fix compilation with latest qtbase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I1040dab62b7c795dbaf3899304501917993b06d6 Reviewed-by: Michael Brüning <michael.bruning@theqtcompany.com> --- src/webenginewidgets/api/qwebengineprofile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index 934084b6e..b98aa3a61 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -570,12 +570,12 @@ void QWebEngineProfile::installUrlSchemeHandler(QWebEngineUrlSchemeHandler *hand Q_ASSERT(handler); QByteArray scheme = handler->scheme(); if (checkInternalScheme(scheme)) { - qWarning() << "Can not install a URL scheme handler overriding internal scheme: " << scheme; + qWarning("Can not install a URL scheme handler overriding internal scheme: %s", scheme.constData()); return; } if (d->browserContext()->customUrlSchemeHandlers().contains(scheme)) { - qWarning() << "URL scheme handler already installed for the scheme: " << scheme; + qWarning("URL scheme handler already installed for the scheme: %s", scheme.constData()); return; } d->browserContext()->customUrlSchemeHandlers().insert(scheme, handler); -- cgit v1.2.3 From a45f6fc3e1016a223a4b235cc61b033f8665c853 Mon Sep 17 00:00:00 2001 From: Kai Koehne <kai.koehne@theqtcompany.com> Date: Fri, 25 Sep 2015 15:39:12 +0200 Subject: Keep order of scripts added to QWebEngineScriptCollection Use a QList instead of a QSet to store the scripts in the collection. This avoids situations where two scripts injected depend on each other, and fail or succeed depending on the semi-random order that QSet imposes. Change-Id: I44d5d89866ff2431544cc91afb1c102d93daa5da Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> --- src/core/user_script.cpp | 11 ----------- src/core/user_script.h | 4 ---- src/core/user_script_controller_host.cpp | 31 ++++++++++++++++++------------- src/core/user_script_controller_host.h | 6 +++--- 4 files changed, 21 insertions(+), 31 deletions(-) diff --git a/src/core/user_script.cpp b/src/core/user_script.cpp index fb293c56a..179febc48 100644 --- a/src/core/user_script.cpp +++ b/src/core/user_script.cpp @@ -168,14 +168,3 @@ UserScriptData &UserScript::data() const } } // namespace QtWebEngineCore - -QT_BEGIN_NAMESPACE -uint qHash(const QtWebEngineCore::UserScript &script, uint seed) -{ - if (script.isNull()) - return 0; - return qHash(script.sourceCode(), seed) ^ qHash(script.name(), seed) - ^ (script.injectionPoint() | (script.runsOnSubFrames() << 4)) - ^ script.worldId(); -} -QT_END_NAMESPACE diff --git a/src/core/user_script.h b/src/core/user_script.h index 7aeba9131..69c32c7ba 100644 --- a/src/core/user_script.h +++ b/src/core/user_script.h @@ -93,8 +93,4 @@ private: } // namespace QtWebEngineCore -QT_BEGIN_NAMESPACE -uint qHash(const QtWebEngineCore::UserScript &, uint seed = 0); -QT_END_NAMESPACE - #endif // USER_SCRIPT_H diff --git a/src/core/user_script_controller_host.cpp b/src/core/user_script_controller_host.cpp index d57518275..a0d3f6fed 100644 --- a/src/core/user_script_controller_host.cpp +++ b/src/core/user_script_controller_host.cpp @@ -116,9 +116,11 @@ void UserScriptControllerHost::addUserScript(const UserScript &script, WebConten return; // Global scripts should be dispatched to all our render processes. if (!adapter) { - m_profileWideScripts.insert(script); - Q_FOREACH (content::RenderProcessHost *renderer, m_observedProcesses) - renderer->Send(new UserScriptController_AddScript(script.data())); + if (!m_profileWideScripts.contains(script)) { + m_profileWideScripts.append(script); + Q_FOREACH (content::RenderProcessHost *renderer, m_observedProcesses) + renderer->Send(new UserScriptController_AddScript(script.data())); + } } else { content::WebContents *contents = adapter->webContents(); ContentsScriptsMap::iterator it = m_perContentsScripts.find(contents); @@ -126,11 +128,13 @@ void UserScriptControllerHost::addUserScript(const UserScript &script, WebConten // We need to keep track of RenderView/RenderViewHost changes for a given contents // in order to make sure the scripts stay in sync new WebContentsObserverHelper(this, contents); - it = m_perContentsScripts.insert(contents, (QSet<UserScript>() << script)); + it = m_perContentsScripts.insert(contents, (QList<UserScript>() << script)); } else { - QSet<UserScript> currentScripts = it.value(); - currentScripts.insert(script); - m_perContentsScripts.insert(contents, currentScripts); + QList<UserScript> currentScripts = it.value(); + if (!currentScripts.contains(script)) { + currentScripts.append(script); + m_perContentsScripts.insert(contents, currentScripts); + } } contents->Send(new RenderViewObserverHelper_AddScript(contents->GetRoutingID(), script.data())); } @@ -151,7 +155,8 @@ bool UserScriptControllerHost::removeUserScript(const UserScript &script, WebCon if (script.isNull()) return false; if (!adapter) { - QSet<UserScript>::iterator it = m_profileWideScripts.find(script); + QList<UserScript>::iterator it + = std::find(m_profileWideScripts.begin(), m_profileWideScripts.end(), script); if (it == m_profileWideScripts.end()) return false; Q_FOREACH (content::RenderProcessHost *renderer, m_observedProcesses) @@ -161,12 +166,12 @@ bool UserScriptControllerHost::removeUserScript(const UserScript &script, WebCon content::WebContents *contents = adapter->webContents(); if (!m_perContentsScripts.contains(contents)) return false; - QSet<UserScript> &set(m_perContentsScripts[contents]); - QSet<UserScript>::iterator it = set.find(script); - if (it == set.end()) + QList<UserScript> &list(m_perContentsScripts[contents]); + QList<UserScript>::iterator it = std::find(list.begin(), list.end(), script); + if (it == list.end()) return false; contents->Send(new RenderViewObserverHelper_RemoveScript(contents->GetRoutingID(), (*it).data())); - set.erase(it); + list.erase(it); } return true; } @@ -184,7 +189,7 @@ void UserScriptControllerHost::clearAllScripts(WebContentsAdapter *adapter) } } -const QSet<UserScript> UserScriptControllerHost::registeredScripts(WebContentsAdapter *adapter) const +const QList<UserScript> UserScriptControllerHost::registeredScripts(WebContentsAdapter *adapter) const { if (!adapter) return m_profileWideScripts; diff --git a/src/core/user_script_controller_host.h b/src/core/user_script_controller_host.h index 49c96b333..3884fb3b9 100644 --- a/src/core/user_script_controller_host.h +++ b/src/core/user_script_controller_host.h @@ -64,7 +64,7 @@ public: bool removeUserScript(const UserScript &script, WebContentsAdapter *adapter); void clearAllScripts(WebContentsAdapter *adapter); void reserve(WebContentsAdapter *adapter, int count); - const QSet<UserScript> registeredScripts(WebContentsAdapter *adapter) const; + const QList<UserScript> registeredScripts(WebContentsAdapter *adapter) const; void renderProcessStartedWithHost(content::RenderProcessHost *renderer); @@ -75,8 +75,8 @@ private: void webContentsDestroyed(content::WebContents *); - QSet<UserScript> m_profileWideScripts; - typedef QHash<content::WebContents *, QSet<UserScript>> ContentsScriptsMap; + QList<UserScript> m_profileWideScripts; + typedef QHash<content::WebContents *, QList<UserScript>> ContentsScriptsMap; ContentsScriptsMap m_perContentsScripts; QSet<content::RenderProcessHost *> m_observedProcesses; QScopedPointer<RenderProcessObserverHelper> m_renderProcessObserver; -- cgit v1.2.3 From 6df94b3cfd7eab7222542237a219144615bd434b Mon Sep 17 00:00:00 2001 From: Kai Koehne <kai.koehne@theqtcompany.com> Date: Thu, 10 Sep 2015 16:08:21 +0200 Subject: Improve runJavaScript documentation Mention that the script will run in the same JavaScript world as scripts that are part of the page. Also link to new scripts API. Change-Id: I4dd80fdd84644b1fa4ce6c63ab07c1dbba855389 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> --- src/webengine/doc/src/webengineview.qdoc | 4 ++++ src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc index fd7733d13..b734413ea 100644 --- a/src/webengine/doc/src/webengineview.qdoc +++ b/src/webengine/doc/src/webengineview.qdoc @@ -248,6 +248,10 @@ runJavaScript("document.title", function(result) { console.log(result); }); \endcode + The script will run in the same \e world as other scripts that are + part of the loaded site. + + See WebEngineView::userScripts for an alternative API to inject scripts. */ /*! diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc index 794cb56d2..173611165 100644 --- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc @@ -596,16 +596,27 @@ /*! \fn void QWebEnginePage::runJavaScript(const QString& scriptSource) - Runs the JavaScript code contained in \a scriptSource. + \overload runJavaScript() + + This convenience function runs the JavaScript code contained in \a scriptSource. */ /*! \fn void QWebEnginePage::runJavaScript(const QString& scriptSource, FunctorOrLambda resultCallback) + Runs the JavaScript code contained in \a scriptSource. + The script will run in the same \e world as other scripts that are part of the loaded site. + When the script has been executed, \a resultCallback is called with the result of the last executed statement. + \a resultCallback can be any of a function pointer, a functor or a lambda, and it is expected to take a + QVariant parameter. For example: + + \code + page.runJavaScript("document.title", [](const QVariant &v) { qDebug() << v.toString(); }); + \endcode - \note \a resultCallback can be any of a function pointer, a functor or a lambda, and it is expected to take a QVariant parameter. + See scripts() for an alternative API to inject scripts. */ /*! -- cgit v1.2.3 From 4b299c0706d16be5c2deb610a4e3cacd79d8eecc Mon Sep 17 00:00:00 2001 From: Kai Koehne <kai.koehne@theqtcompany.com> Date: Fri, 11 Sep 2015 13:15:57 +0200 Subject: Improve documentation of QWebEnginePage::acceptNavigationRequest Change-Id: Ic4f91fa7927c18b53c6b0a0f69ee38905715eb10 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> --- src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc index 173611165..4a7545c14 100644 --- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc @@ -264,11 +264,11 @@ /*! \fn bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) + \since 5.5 This function is called upon receiving a request to navigate to the specified \a url by means of the specified navigation type \a type. \a isMainFrame indicates whether the request corresponds to the main frame or a sub frame. If the function returns \c true, the navigation request is - accepted and Chromium continues to load the page. Otherwise, the request is ignored. The default - implementation accepts the navigation request. + accepted and \c url is loaded. The default implementation accepts all navigation requests. */ -- cgit v1.2.3 From 96c80416cf685f9eb7765d1befff93d85606fe2a Mon Sep 17 00:00:00 2001 From: Topi Reinio <topi.reinio@digia.com> Date: Thu, 8 Oct 2015 12:25:10 +0200 Subject: Doc: Use \qml for code snippets where possible QDoc's QML parser works OK for code snippets that include a full type declaration; use \qml for these snippets to get autolinking to QML types working. Use \badcode for codeblocks that are not code or have nothing to link to. Change-Id: Iffd2f356bf0b3efc854a3755873e66f8c9478cac Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> --- src/webengine/doc/src/qtwebengine-devtools.qdoc | 4 +++- src/webengine/doc/src/qtwebengine-overview.qdoc | 4 ++-- src/webengine/doc/src/qtwebengine-qmlmodule.qdoc | 2 +- src/webengine/doc/src/webengineview.qdoc | 16 ++++++++-------- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/webengine/doc/src/qtwebengine-devtools.qdoc b/src/webengine/doc/src/qtwebengine-devtools.qdoc index 008fa925b..8d12e0eb0 100644 --- a/src/webengine/doc/src/qtwebengine-devtools.qdoc +++ b/src/webengine/doc/src/qtwebengine-devtools.qdoc @@ -37,9 +37,11 @@ To activate the developer tools, start an application that uses Qt WebEngine with the command-line arguments: - \code + + \badcode --remote-debugging-port=<port_number> \endcode + Where \c <port_number> refers to a local network port. The web developer tools can then be accessed by launching a browser at the address \c http://localhost:<port_number>. diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc index fb2db9501..11d939cf8 100644 --- a/src/webengine/doc/src/qtwebengine-overview.qdoc +++ b/src/webengine/doc/src/qtwebengine-overview.qdoc @@ -104,7 +104,7 @@ The following sample QML application loads a web page and responds to session history context: - \code + \qml import QtQuick 2.1 import QtQuick.Controls 1.1 import QtWebEngine 1.1 @@ -119,7 +119,7 @@ anchors.fill: parent } } - \endcode + \endqml \section1 Using WebEngine Core diff --git a/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc b/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc index 6d3d71896..e098071b3 100644 --- a/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc +++ b/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc @@ -32,7 +32,7 @@ The QML types can be imported into your application using the following import statements in your .qml file: - \code + \badcode import QtQuick 2.0 import QtWebEngine 1.1 \endcode diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc index b734413ea..99bec5350 100644 --- a/src/webengine/doc/src/webengineview.qdoc +++ b/src/webengine/doc/src/webengineview.qdoc @@ -104,13 +104,13 @@ The following snippet uses the \c{icon} property to build an \c{Image} component: - \code + \qml Image { id: appIcon source: webView.icon != "" ? webView.icon : "fallbackFavIcon.png"; - ... + // ... } - \endcode + \endqml */ /*! @@ -311,7 +311,7 @@ Immediately sets \c{isFullScreen} property to \c{false}. It can be used to notify the browser engine when the windowing system forces the application to leave fullscreen mode. - \code + \qml ApplicationWindow { onVisibilityChanged: { if (webEngineView.isFullScreen && visibility != Window.FullScreen) @@ -320,10 +320,10 @@ WebEngineView { id: webEngineView - ... + // ... } } - \endcode + \endqml \sa isFullScreen, fullScreenRequested() */ @@ -708,7 +708,7 @@ Call this method to accept the fullscreen request. It sets the WebEngineView::isFullScreen property to be equal to toggleOn. - \code + \qml ApplicationWindow { id: window WebEngineView { @@ -721,7 +721,7 @@ } } } - \endcode + \endqml \sa toggleOn */ -- cgit v1.2.3 From 0228a5bd581ae6d672ce5f39f11d6205a8bd8aaf Mon Sep 17 00:00:00 2001 From: Topi Reinio <topi.reinio@digia.com> Date: Thu, 8 Oct 2015 12:45:48 +0200 Subject: Doc: Collect external links into a single file Move external links to a dedicated .qdoc file for maintainability. Add an \externalpage that's marked internal to work around the issue of each occurrence of 'WebEngine' being autolinked to the WebEngine QML type, which is typically not desired. Change-Id: Icfdbefac7372866f5258378aa59daba1a97cc776 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> --- src/webengine/api/qquickwebenginesettings.cpp | 2 +- src/webengine/doc/src/external-resources.qdoc | 48 +++++++++++++++++++++++++ src/webengine/doc/src/qtwebengine-devtools.qdoc | 2 +- src/webengine/doc/src/qtwebengine-overview.qdoc | 10 +++--- 4 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 src/webengine/doc/src/external-resources.qdoc diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp index 407f2a49f..8f2e1bcf2 100644 --- a/src/webengine/api/qquickwebenginesettings.cpp +++ b/src/webengine/api/qquickwebenginesettings.cpp @@ -59,7 +59,7 @@ QQuickWebEngineSettings::QQuickWebEngineSettings(QQuickWebEngineSettings *parent The WebEngineSettings type can be used to configure browser properties and generic attributes, such as JavaScript support, focus behavior, and access to remote content. This type is uncreatable, but the default settings for all web engine views can be accessed by using - the \l{WebEngine::settings}{WebEngine.settings} property. + the \l [QML] {WebEngine::settings}{WebEngine.settings} property. Each web engine view can have individual settings that can be accessed by using the \l{WebEngineView::settings}{WebEngineView.settings} property. diff --git a/src/webengine/doc/src/external-resources.qdoc b/src/webengine/doc/src/external-resources.qdoc new file mode 100644 index 000000000..34a66291e --- /dev/null +++ b/src/webengine/doc/src/external-resources.qdoc @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \externalpage http://www.chromium.org + \title Chromium Project +*/ + +/*! + \externalpage https://developers.google.com/web/tools/chrome-devtools + \title Chrome DevTools +*/ + +/* + This prevents autolinking of each occurrence of 'WebEngine' + To link to the WebEngine QML type, use explicit linking: + \l [QML] WebEngine + \sa {QtWebEngine::}{WebEngine} +*/ +/*! + \externalpage nolink + \title WebEngine + \internal +*/ diff --git a/src/webengine/doc/src/qtwebengine-devtools.qdoc b/src/webengine/doc/src/qtwebengine-devtools.qdoc index 8d12e0eb0..ee87214e1 100644 --- a/src/webengine/doc/src/qtwebengine-devtools.qdoc +++ b/src/webengine/doc/src/qtwebengine-devtools.qdoc @@ -54,5 +54,5 @@ device. For a detailed explanation of the capabilities of developer tools, see the - \l{https://developers.google.com/web/tools/chrome-devtools}{Chrome DevTools page}. + \l {Chrome DevTools} page. */ diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc index 11d939cf8..15052f6e8 100644 --- a/src/webengine/doc/src/qtwebengine-overview.qdoc +++ b/src/webengine/doc/src/qtwebengine-overview.qdoc @@ -61,11 +61,11 @@ Qt WebEngine Widgets \endlist - The Qt WebEngine core is based on the \l{http://www.chromium.org}{Chromium Project}. Chromium - provides its own network and painting engines and is developed tightly together with its - dependent modules, and therefore Qt WebEngine provides better and more reliable support for the - latest HTML5 specification than Qt WebKit. However, Qt WebEngine is thus heavier than Qt WebKit - and does not provide direct access to the network stack and the HTML document through C++ APIs. + The Qt WebEngine core is based on the \l {Chromium Project}. Chromium provides its own network + and painting engines and is developed tightly together with its dependent modules, and + therefore Qt WebEngine provides better and more reliable support for the latest HTML5 + specification than Qt WebKit. However, Qt WebEngine is thus heavier than Qt WebKit and does + not provide direct access to the network stack and the HTML document through C++ APIs. Chromium is tightly integrated to the \l{Qt Quick Scene Graph}{Qt Quick scene graph}, which is based on OpenGL ES 2.0 or OpenGL 2.0 for its rendering. This provides you with one-pass -- cgit v1.2.3 From de36c91bbb710f130713e2e0c589d454364ea0a8 Mon Sep 17 00:00:00 2001 From: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Date: Wed, 7 Oct 2015 15:06:30 +0200 Subject: Doc: add missing parameter name to function signature in docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...to fix a QDoc error. Change-Id: Id074b1e43fd1739a6dddd77b922b2483d0879727 Reviewed-by: Topi Reiniö <topi.reinio@digia.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> --- src/core/api/qwebengineurlschemehandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/api/qwebengineurlschemehandler.cpp b/src/core/api/qwebengineurlschemehandler.cpp index 8b3327805..e6c20dbca 100644 --- a/src/core/api/qwebengineurlschemehandler.cpp +++ b/src/core/api/qwebengineurlschemehandler.cpp @@ -54,9 +54,9 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QWebEngineUrlSchemeHandler::destroyed(QWebEngineUrlSchemeHandler*) + \fn QWebEngineUrlSchemeHandler::destroyed(QWebEngineUrlSchemeHandler *handler) - This signal is emitted when a custom URL scheme handler is deleted. + This signal is emitted when the custom URL scheme handler \a handler is deleted. */ QWebEngineUrlSchemeHandlerPrivate::QWebEngineUrlSchemeHandlerPrivate(const QByteArray &scheme) -- cgit v1.2.3 From f144dbb39bead4cd9ae1e1971e8d904f13675560 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann <joerg.bornemann@theqtcompany.com> Date: Thu, 1 Oct 2015 17:06:26 +0200 Subject: add signal WebEngineView.windowCloseRequested Change-Id: I47919cb21e084eaafc39411c634850c2845f5acc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> --- src/webengine/api/qquickwebengineview.cpp | 3 ++- src/webengine/api/qquickwebengineview_p.h | 1 + src/webengine/doc/src/webengineview.qdoc | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index b22b2798e..96a80a940 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -504,7 +504,8 @@ void QQuickWebEngineViewPrivate::adoptNewWindow(WebContentsAdapter *newWebConten void QQuickWebEngineViewPrivate::close() { - // Not implemented yet. + Q_Q(QQuickWebEngineView); + emit q->windowCloseRequested(); } void QQuickWebEngineViewPrivate::requestFullScreen(bool fullScreen) diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h index 22cca3277..6efb2b6f9 100644 --- a/src/webengine/api/qquickwebengineview_p.h +++ b/src/webengine/api/qquickwebengineview_p.h @@ -305,6 +305,7 @@ Q_SIGNALS: Q_REVISION(2) void activeFocusOnPressChanged(bool); Q_REVISION(2) void backgroundColorChanged(); Q_REVISION(2) void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode); + Q_REVISION(2) void windowCloseRequested(); protected: void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc index 99bec5350..f230ba261 100644 --- a/src/webengine/doc/src/webengineview.qdoc +++ b/src/webengine/doc/src/webengineview.qdoc @@ -499,6 +499,16 @@ \sa RenderProcessTerminationStatus */ +/*! + \qmlsignal WebEngineView::windowCloseRequested() + \since QtWebEngine 1.2 + + This signal is emitted whenever the page requests the web browser window to be closed, + for example through the JavaScript \c{window.close()} call. + + The corresponding handler is \c onWindowCloseRequested. +*/ + /*! \qmlproperty enumeration WebEngineView::ErrorDomain -- cgit v1.2.3 From 84ae0d9c56e9638e5dcf676e1b3fd95571ad1973 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann <joerg.bornemann@theqtcompany.com> Date: Fri, 9 Oct 2015 11:34:56 +0200 Subject: remove unused code from demobrowser Remove QWEBENGINEPAGE_ISMODIFIED block from demobrowser. This feature is not implemented. It is questionable whether it should be re-introduced in its old form. Checking whether the user should think twice about leaving the current page is usually implemented by the HTML page itself. Change-Id: I51544129b26f3e0c132e2c983c2ce1744cc19123 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> --- examples/webenginewidgets/demobrowser/tabwidget.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/examples/webenginewidgets/demobrowser/tabwidget.cpp b/examples/webenginewidgets/demobrowser/tabwidget.cpp index 4532683b5..9210e3147 100644 --- a/examples/webenginewidgets/demobrowser/tabwidget.cpp +++ b/examples/webenginewidgets/demobrowser/tabwidget.cpp @@ -591,21 +591,6 @@ void TabWidget::closeTab(int index) bool hasFocus = false; if (WebView *tab = webView(index)) { -#if defined(QWEBENGINEPAGE_ISMODIFIED) - if (tab->isModified()) { - QMessageBox closeConfirmation(tab); - closeConfirmation.setWindowFlags(Qt::Sheet); - closeConfirmation.setWindowTitle(tr("Do you really want to close this page?")); - closeConfirmation.setInformativeText(tr("You have modified this page and when closing it you would lose the modification.\n" - "Do you really want to close this page?\n")); - closeConfirmation.setIcon(QMessageBox::Question); - closeConfirmation.addButton(QMessageBox::Yes); - closeConfirmation.addButton(QMessageBox::No); - closeConfirmation.setEscapeButton(QMessageBox::No); - if (closeConfirmation.exec() == QMessageBox::No) - return; - } -#endif hasFocus = tab->hasFocus(); if (m_profile == QWebEngineProfile::defaultProfile()) { -- cgit v1.2.3 From 2e9c6cd0bd6789a4f46fe0bcfbd522f0dd3eb4cb Mon Sep 17 00:00:00 2001 From: Joerg Bornemann <joerg.bornemann@theqtcompany.com> Date: Fri, 9 Oct 2015 10:50:56 +0200 Subject: add RequestClose web action Web pages can set the onbeforeunload handler to let the user confirm whether to leave the page or not. Until now, only when leaving the page via a link, a confirmation was shown. Before actually closing a web page, applications can now trigger the RequestClose web action. This will give the use the chance to confirm or deny the close request. If the request is confirmed, the signal windowCloseRequested is emitted. Task-number: QTBUG-36155 Change-Id: Icc1fabc37a2ac537f674c2f00bc8966e4dc4e610 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> --- .../webengine/quicknanobrowser/BrowserWindow.qml | 12 +++++--- .../webenginewidgets/demobrowser/tabwidget.cpp | 24 ++++++++++------ examples/webenginewidgets/demobrowser/tabwidget.h | 3 +- src/core/web_contents_adapter.cpp | 6 ++++ src/core/web_contents_adapter.h | 1 + src/core/web_contents_adapter_client.h | 1 + src/core/web_contents_delegate_qt.cpp | 9 ++++++ src/core/web_contents_delegate_qt.h | 1 + src/webengine/api/qquickwebenginetestsupport_p.h | 1 + src/webengine/api/qquickwebengineview.cpp | 11 ++++++++ src/webengine/api/qquickwebengineview_p.h | 1 + src/webengine/api/qquickwebengineview_p_p.h | 1 + src/webenginewidgets/api/qwebenginepage.cpp | 11 ++++++++ src/webenginewidgets/api/qwebenginepage.h | 1 + src/webenginewidgets/api/qwebenginepage_p.h | 1 + .../doc/src/qwebenginepage_lgpl.qdoc | 5 ++++ .../auto/quick/qmltests/data/TestWebEngineView.qml | 7 +++++ tests/auto/quick/qmltests/data/confirmclose.html | 5 ++++ .../quick/qmltests/data/tst_javaScriptDialogs.qml | 33 ++++++++++++++++++++++ tests/auto/quick/qmltests/qmltests.pro | 1 + 20 files changed, 121 insertions(+), 14 deletions(-) create mode 100644 tests/auto/quick/qmltests/data/confirmclose.html diff --git a/examples/webengine/quicknanobrowser/BrowserWindow.qml b/examples/webengine/quicknanobrowser/BrowserWindow.qml index 4d7513fae..123a7cc8d 100644 --- a/examples/webengine/quicknanobrowser/BrowserWindow.qml +++ b/examples/webengine/quicknanobrowser/BrowserWindow.qml @@ -118,10 +118,7 @@ ApplicationWindow { Action { shortcut: StandardKey.Close onTriggered: { - if (tabs.count == 1) - browserWindow.close() - else - tabs.removeTab(tabs.currentIndex) + currentWebView.triggerWebAction(WebEngineView.RequestClose); } } Action { @@ -415,6 +412,13 @@ ApplicationWindow { reloadTimer.running = true } + onWindowCloseRequested: { + if (tabs.count == 1) + browserWindow.close() + else + tabs.removeTab(tabs.currentIndex) + } + Timer { id: reloadTimer interval: 0 diff --git a/examples/webenginewidgets/demobrowser/tabwidget.cpp b/examples/webenginewidgets/demobrowser/tabwidget.cpp index 9210e3147..9e08426f1 100644 --- a/examples/webenginewidgets/demobrowser/tabwidget.cpp +++ b/examples/webenginewidgets/demobrowser/tabwidget.cpp @@ -223,7 +223,7 @@ TabWidget::TabWidget(QWidget *parent) setElideMode(Qt::ElideRight); connect(m_tabBar, SIGNAL(newTab()), this, SLOT(newTab())); - connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int))); + connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(requestCloseTab(int))); connect(m_tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int))); connect(m_tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int))); connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int))); @@ -241,7 +241,7 @@ TabWidget::TabWidget(QWidget *parent) m_closeTabAction = new QAction(QIcon(QLatin1String(":closetab.png")), tr("&Close Tab"), this); m_closeTabAction->setShortcuts(QKeySequence::Close); m_closeTabAction->setIconVisibleInMenu(false); - connect(m_closeTabAction, SIGNAL(triggered()), this, SLOT(closeTab())); + connect(m_closeTabAction, SIGNAL(triggered()), this, SLOT(requestCloseTab())); m_nextTabAction = new QAction(tr("Show Next Tab"), this); QList<QKeySequence> shortcuts; @@ -552,12 +552,8 @@ void TabWidget::windowCloseRequested() WebPage *webPage = qobject_cast<WebPage*>(sender()); WebView *webView = qobject_cast<WebView*>(webPage->view()); int index = webViewIndex(webView); - if (index >= 0) { - if (count() == 1) - webView->webPage()->mainWindow()->close(); - else - closeTab(index); - } + if (index >= 0) + closeTab(index); } void TabWidget::closeOtherTabs(int index) @@ -582,12 +578,22 @@ void TabWidget::cloneTab(int index) } // When index is -1 index chooses the current tab -void TabWidget::closeTab(int index) +void TabWidget::requestCloseTab(int index) { if (index < 0) index = currentIndex(); if (index < 0 || index >= count()) return; + WebView *tab = webView(index); + if (!tab) + return; + tab->page()->triggerAction(QWebEnginePage::RequestClose); +} + +void TabWidget::closeTab(int index) +{ + if (index < 0 || index >= count()) + return; bool hasFocus = false; if (WebView *tab = webView(index)) { diff --git a/examples/webenginewidgets/demobrowser/tabwidget.h b/examples/webenginewidgets/demobrowser/tabwidget.h index f6c4edba2..0f2a20c34 100644 --- a/examples/webenginewidgets/demobrowser/tabwidget.h +++ b/examples/webenginewidgets/demobrowser/tabwidget.h @@ -196,7 +196,8 @@ public slots: void loadUrlInCurrentTab(const QUrl &url); WebView *newTab(bool makeCurrent = true); void cloneTab(int index = -1); - void closeTab(int index = -1); + void requestCloseTab(int index = -1); + void closeTab(int index); void closeOtherTabs(int index); void reloadTab(int index = -1); void reloadAllTabs(); diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 2b2512fc3..92c831f94 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -576,6 +576,12 @@ void WebContentsAdapter::selectAll() d->webContents->SelectAll(); } +void WebContentsAdapter::requestClose() +{ + Q_D(WebContentsAdapter); + d->webContents->DispatchBeforeUnload(false); +} + void WebContentsAdapter::navigateToIndex(int offset) { Q_D(WebContentsAdapter); diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h index ecb084e56..54bec9adf 100644 --- a/src/core/web_contents_adapter.h +++ b/src/core/web_contents_adapter.h @@ -128,6 +128,7 @@ public: void inspectElementAt(const QPoint &location); bool hasInspector() const; void exitFullScreen(); + void requestClose(); void wasShown(); void wasHidden(); diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h index 2b9b62229..6b203fc90 100644 --- a/src/core/web_contents_adapter_client.h +++ b/src/core/web_contents_adapter_client.h @@ -208,6 +208,7 @@ public: virtual void unhandledKeyEvent(QKeyEvent *event) = 0; virtual void adoptNewWindow(WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect & initialGeometry) = 0; virtual void close() = 0; + virtual void windowCloseRejected() = 0; virtual bool contextMenuRequested(const WebEngineContextMenuData&) = 0; virtual void navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame) = 0; virtual void requestFullScreen(bool) = 0; diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 1c37f62df..497910a9c 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -390,4 +390,13 @@ void WebContentsDelegateQt::MoveValidationMessage(content::WebContents *web_cont m_viewClient->moveValidationMessage(toQt(anchor_in_root_view)); } +void WebContentsDelegateQt::BeforeUnloadFired(content::WebContents *tab, bool proceed, bool *proceed_to_fire_unload) +{ + Q_UNUSED(tab); + Q_ASSERT(proceed_to_fire_unload); + *proceed_to_fire_unload = proceed; + if (!proceed) + m_viewClient->windowCloseRejected(); +} + } // namespace QtWebEngineCore diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 14421d060..abdf75fe5 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -91,6 +91,7 @@ public: virtual void ShowValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view, const base::string16 &main_text, const base::string16 &sub_text) Q_DECL_OVERRIDE; virtual void HideValidationMessage(content::WebContents *web_contents) Q_DECL_OVERRIDE; virtual void MoveValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view) Q_DECL_OVERRIDE; + void BeforeUnloadFired(content::WebContents* tab, bool proceed, bool* proceed_to_fire_unload) Q_DECL_OVERRIDE; // WebContentsObserver overrides virtual void RenderFrameDeleted(content::RenderFrameHost *render_frame_host) Q_DECL_OVERRIDE; diff --git a/src/webengine/api/qquickwebenginetestsupport_p.h b/src/webengine/api/qquickwebenginetestsupport_p.h index 9690e538d..d4b50ac2d 100644 --- a/src/webengine/api/qquickwebenginetestsupport_p.h +++ b/src/webengine/api/qquickwebenginetestsupport_p.h @@ -80,6 +80,7 @@ public: Q_SIGNALS: void validationMessageShown(const QString &mainText, const QString &subText); + void windowCloseRejected(); private: QScopedPointer<QQuickWebEngineErrorPage> m_errorPage; diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 96a80a940..3a05477a1 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -508,6 +508,14 @@ void QQuickWebEngineViewPrivate::close() emit q->windowCloseRequested(); } +void QQuickWebEngineViewPrivate::windowCloseRejected() +{ +#ifdef ENABLE_QML_TESTSUPPORT_API + if (m_testSupport) + Q_EMIT m_testSupport->windowCloseRejected(); +#endif +} + void QQuickWebEngineViewPrivate::requestFullScreen(bool fullScreen) { Q_Q(QQuickWebEngineView); @@ -1298,6 +1306,9 @@ void QQuickWebEngineView::triggerWebAction(WebAction action) case ExitFullScreen: d->adapter->exitFullScreen(); break; + case RequestClose: + d->adapter->requestClose(); + break; default: Q_UNREACHABLE(); } diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h index 6efb2b6f9..d1d8dacbb 100644 --- a/src/webengine/api/qquickwebengineview_p.h +++ b/src/webengine/api/qquickwebengineview_p.h @@ -226,6 +226,7 @@ public: InspectElement, ExitFullScreen, + RequestClose, WebActionCount }; diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index 0140111b9..271ab63be 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -143,6 +143,7 @@ public: virtual void unhandledKeyEvent(QKeyEvent *event) Q_DECL_OVERRIDE; virtual void adoptNewWindow(QtWebEngineCore::WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &) Q_DECL_OVERRIDE; virtual void close() Q_DECL_OVERRIDE; + virtual void windowCloseRejected() Q_DECL_OVERRIDE; virtual void requestFullScreen(bool) Q_DECL_OVERRIDE; virtual bool isFullScreen() const Q_DECL_OVERRIDE; virtual bool contextMenuRequested(const QtWebEngineCore::WebEngineContextMenuData &) Q_DECL_OVERRIDE; diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 5d91b3b7f..bb0917918 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -224,6 +224,11 @@ void QWebEnginePagePrivate::close() Q_EMIT q->windowCloseRequested(); } +void QWebEnginePagePrivate::windowCloseRejected() +{ + // Do nothing for now. +} + void QWebEnginePagePrivate::didRunJavaScript(quint64 requestId, const QVariant& result) { m_callbacks.invoke(requestId, result); @@ -639,6 +644,9 @@ QAction *QWebEnginePage::action(WebAction action) const case ExitFullScreen: text = tr("Exit Full Screen Mode"); break; + case RequestClose: + text = tr("Close Page"); + break; default: break; } @@ -809,6 +817,9 @@ void QWebEnginePage::triggerAction(WebAction action, bool) case ExitFullScreen: d->adapter->exitFullScreen(); break; + case RequestClose: + d->adapter->requestClose(); + break; default: Q_UNREACHABLE(); } diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h index 90fa62f97..4b5e6456d 100644 --- a/src/webenginewidgets/api/qwebenginepage.h +++ b/src/webenginewidgets/api/qwebenginepage.h @@ -108,6 +108,7 @@ public: InspectElement, ExitFullScreen, + RequestClose, WebActionCount }; diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h index 8d9bc2517..f5c01ce1b 100644 --- a/src/webenginewidgets/api/qwebenginepage_p.h +++ b/src/webenginewidgets/api/qwebenginepage_p.h @@ -95,6 +95,7 @@ public: virtual void unhandledKeyEvent(QKeyEvent *event) Q_DECL_OVERRIDE; virtual void adoptNewWindow(QtWebEngineCore::WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &initialGeometry) Q_DECL_OVERRIDE; virtual void close() Q_DECL_OVERRIDE; + virtual void windowCloseRejected() Q_DECL_OVERRIDE; virtual bool contextMenuRequested(const QtWebEngineCore::WebEngineContextMenuData &data) Q_DECL_OVERRIDE; virtual void navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame) Q_DECL_OVERRIDE; virtual void requestFullScreen(bool) Q_DECL_OVERRIDE; diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc index 4a7545c14..b7b3bf022 100644 --- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc @@ -119,6 +119,9 @@ \value InspectElement Trigger any attached Web Inspector to inspect the highlighed element. (Added in Qt 5.6) \value ExitFullScreen Exit the fullscreen mode. (Added in Qt 5.6) + \value RequestClose Request to close the web page. If defined, the \c{window.onbeforeunload} + handler is run, and the user can confirm or reject to close the page. If the close + request is confirmed, \c windowCloseRequested is emitted. (Added in Qt 5.6) \omitvalue WebActionCount @@ -482,6 +485,8 @@ This signal is emitted whenever the page requests the web browser window to be closed, for example through the JavaScript \c{window.close()} call. + + \sa QWebEnginePage::RequestClose */ /*! diff --git a/tests/auto/quick/qmltests/data/TestWebEngineView.qml b/tests/auto/quick/qmltests/data/TestWebEngineView.qml index 8a01dfa09..e2c5c9009 100644 --- a/tests/auto/quick/qmltests/data/TestWebEngineView.qml +++ b/tests/auto/quick/qmltests/data/TestWebEngineView.qml @@ -47,6 +47,7 @@ import QtWebEngine.experimental 1.0 WebEngineView { property var loadStatus: null property var viewportReady: false + property bool windowCloseRequestedSignalEmitted: false function waitForLoadSucceeded() { var success = _waitFor(function() { return loadStatus == WebEngineView.LoadSucceededStatus }) @@ -69,6 +70,9 @@ WebEngineView { loadStatus = null return stop } + function waitForWindowCloseRequested() { + return _waitFor(function() { return windowCloseRequestedSignalEmitted; }); + } function _waitFor(predicate) { var timeout = 5000 var i = 0 @@ -87,5 +91,8 @@ WebEngineView { viewportReady = false } + onWindowCloseRequested: { + windowCloseRequestedSignalEmitted = true; + } } diff --git a/tests/auto/quick/qmltests/data/confirmclose.html b/tests/auto/quick/qmltests/data/confirmclose.html new file mode 100644 index 000000000..ba11da7a4 --- /dev/null +++ b/tests/auto/quick/qmltests/data/confirmclose.html @@ -0,0 +1,5 @@ +<html> +<body onbeforeunload="return 'You are about to miss out on some awesome content.';"> + Be greeted, precious viewer! +</body> +</html> diff --git a/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml b/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml index 75b45bfac..4294c5ba3 100644 --- a/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml +++ b/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml @@ -42,11 +42,26 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebEngine 1.2 +import QtWebEngine.testsupport 1.0 import "../mock-delegates/TestParams" 1.0 TestWebEngineView { id: webEngineView + testSupport: WebEngineTestSupport { + property bool windowCloseRejectedSignalEmitted: false + + function waitForWindowCloseRejected() { + return _waitFor(function () { + return testSupport.windowCloseRejectedSignalEmitted; + }); + } + + onWindowCloseRejected: { + windowCloseRejectedSignalEmitted = true; + } + } + TestCase { id: test name: "WebEngineViewJavaScriptDialogs" @@ -80,6 +95,24 @@ TestWebEngineView { } + function test_confirmClose() { + webEngineView.url = Qt.resolvedUrl("confirmclose.html"); + verify(webEngineView.waitForLoadSucceeded()); + webEngineView.windowCloseRequestedSignalEmitted = false; + JSDialogParams.shouldAcceptDialog = true; + webEngineView.triggerWebAction(WebEngineView.RequestClose); + verify(webEngineView.waitForWindowCloseRequested()); + } + + function test_rejectClose() { + webEngineView.url = Qt.resolvedUrl("confirmclose.html"); + verify(webEngineView.waitForLoadSucceeded()); + webEngineView.testSupport.windowCloseRejectedSignalEmitted = false; + JSDialogParams.shouldAcceptDialog = false; + webEngineView.triggerWebAction(WebEngineView.RequestClose); + verify(webEngineView.testSupport.waitForWindowCloseRejected()); + } + function test_prompt() { JSDialogParams.inputForPrompt = "tQ olleH" webEngineView.url = Qt.resolvedUrl("prompt.html") diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro index 01517af47..57649384d 100644 --- a/tests/auto/quick/qmltests/qmltests.pro +++ b/tests/auto/quick/qmltests/qmltests.pro @@ -12,6 +12,7 @@ OTHER_FILES += \ $$PWD/data/change-document-title.js \ $$PWD/data/download.zip \ $$PWD/data/confirm.html \ + $$PWD/data/confirmclose.html \ $$PWD/data/directoryupload.html \ $$PWD/data/favicon.html \ $$PWD/data/favicon.png \ -- cgit v1.2.3 From effa889ba7b7a10b3648a9ded55a5bcd4bae993a Mon Sep 17 00:00:00 2001 From: David Rosca <nowrep@gmail.com> Date: Thu, 8 Oct 2015 17:28:19 +0200 Subject: Add firstPartyUrl to QWebEngineUrlRequestInfo Add firstPartyUrl that can be used to identify third-party requests. Change-Id: I2b8e48ff0a1a4402af224c80f91d4e599a61a89c Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> --- src/core/api/qwebengineurlrequestinfo.cpp | 14 +++++++++++++- src/core/api/qwebengineurlrequestinfo.h | 1 + src/core/api/qwebengineurlrequestinfo_p.h | 2 ++ src/core/network_delegate_qt.cpp | 1 + .../resources/firstparty.html | 5 +++++ .../tst_qwebengineurlrequestinterceptor.cpp | 20 ++++++++++++++++++++ .../tst_qwebengineurlrequestinterceptor.qrc | 1 + 7 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 tests/auto/core/qwebengineurlrequestinterceptor/resources/firstparty.html diff --git a/src/core/api/qwebengineurlrequestinfo.cpp b/src/core/api/qwebengineurlrequestinfo.cpp index b769081f8..e8ce65be3 100644 --- a/src/core/api/qwebengineurlrequestinfo.cpp +++ b/src/core/api/qwebengineurlrequestinfo.cpp @@ -119,11 +119,12 @@ ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::OtherNavigation, Q */ -QWebEngineUrlRequestInfoPrivate::QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRequestInfo::ResourceType resource, QWebEngineUrlRequestInfo::NavigationType navigation, const QUrl &u, const QByteArray &m) +QWebEngineUrlRequestInfoPrivate::QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRequestInfo::ResourceType resource, QWebEngineUrlRequestInfo::NavigationType navigation, const QUrl &u, const QUrl &fpu, const QByteArray &m) : resourceType(resource) , navigationType(navigation) , shouldBlockRequest(false) , url(u) + , firstPartyUrl(fpu) , method(m) { } @@ -218,6 +219,17 @@ QUrl QWebEngineUrlRequestInfo::requestUrl() const return d->url; } +/*! + Returns the first party URL of the request. + The first party URL is the URL of the page that issued the request. +*/ + +QUrl QWebEngineUrlRequestInfo::firstPartyUrl() const +{ + Q_D(const QWebEngineUrlRequestInfo); + return d->firstPartyUrl; +} + /*! Returns the HTTP method of the request (for example, GET or POST). diff --git a/src/core/api/qwebengineurlrequestinfo.h b/src/core/api/qwebengineurlrequestinfo.h index 7c016d20d..e6e225051 100644 --- a/src/core/api/qwebengineurlrequestinfo.h +++ b/src/core/api/qwebengineurlrequestinfo.h @@ -86,6 +86,7 @@ public: NavigationType navigationType() const; QUrl requestUrl() const; + QUrl firstPartyUrl() const; QByteArray requestMethod() const; void block(bool shouldBlock); diff --git a/src/core/api/qwebengineurlrequestinfo_p.h b/src/core/api/qwebengineurlrequestinfo_p.h index b6a304a03..1b1279d27 100644 --- a/src/core/api/qwebengineurlrequestinfo_p.h +++ b/src/core/api/qwebengineurlrequestinfo_p.h @@ -58,6 +58,7 @@ public: QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRequestInfo::ResourceType resource , QWebEngineUrlRequestInfo::NavigationType navigation , const QUrl &u + , const QUrl &fpu , const QByteArray &m); QWebEngineUrlRequestInfo::ResourceType resourceType; @@ -65,6 +66,7 @@ public: bool shouldBlockRequest; QUrl url; + QUrl firstPartyUrl; const QByteArray method; QHash<QByteArray, QByteArray> extraHeaders; diff --git a/src/core/network_delegate_qt.cpp b/src/core/network_delegate_qt.cpp index b8f1b68d0..3f67e7c0d 100644 --- a/src/core/network_delegate_qt.cpp +++ b/src/core/network_delegate_qt.cpp @@ -106,6 +106,7 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, const net::C QWebEngineUrlRequestInfoPrivate *infoPrivate = new QWebEngineUrlRequestInfoPrivate(static_cast<QWebEngineUrlRequestInfo::ResourceType>(resourceType) , static_cast<QWebEngineUrlRequestInfo::NavigationType>(navigationType) , qUrl + , toQt(request->first_party_for_cookies()) , QByteArray::fromStdString(request->method())); QWebEngineUrlRequestInfo requestInfo(infoPrivate); if (interceptor->interceptRequest(requestInfo)) { diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/resources/firstparty.html b/tests/auto/core/qwebengineurlrequestinterceptor/resources/firstparty.html new file mode 100644 index 000000000..8bc540c08 --- /dev/null +++ b/tests/auto/core/qwebengineurlrequestinterceptor/resources/firstparty.html @@ -0,0 +1,5 @@ +<html> +<body> +<iframe src="qrc:///resources/content.html"></iframe> +</body> +</html> diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp index a2f9e0c37..4891cafd0 100644 --- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp +++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp @@ -66,6 +66,7 @@ private Q_SLOTS: void ipv6HostEncoding(); void requestedUrl(); void setUrlSameUrl(); + void firstPartyUrl(); }; tst_QWebEngineUrlRequestInterceptor::tst_QWebEngineUrlRequestInterceptor() @@ -96,6 +97,7 @@ class TestRequestInterceptor : public QWebEngineUrlRequestInterceptor { public: QList<QUrl> observedUrls; + QList<QUrl> firstPartyUrls; bool shouldIntercept; bool interceptRequest(QWebEngineUrlRequestInfo &info) override @@ -105,6 +107,7 @@ public: info.redirect(QUrl("qrc:///resources/content.html")); observedUrls.append(info.requestUrl()); + firstPartyUrls.append(info.firstPartyUrl()); return shouldIntercept; } TestRequestInterceptor(bool intercept) @@ -253,5 +256,22 @@ void tst_QWebEngineUrlRequestInterceptor::setUrlSameUrl() QCOMPARE(spy.count(), 4); } +void tst_QWebEngineUrlRequestInterceptor::firstPartyUrl() +{ + QWebEnginePage page; + TestRequestInterceptor interceptor(/* intercept */ false); + page.profile()->setRequestInterceptor(&interceptor); + + QSignalSpy spy(&page, SIGNAL(loadFinished(bool))); + + page.setUrl(QUrl("qrc:///resources/firstparty.html")); + waitForSignal(&page, SIGNAL(loadFinished(bool))); + QCOMPARE(interceptor.observedUrls.at(0), QUrl("qrc:///resources/firstparty.html")); + QCOMPARE(interceptor.observedUrls.at(1), QUrl("qrc:///resources/content.html")); + QCOMPARE(interceptor.firstPartyUrls.at(0), QUrl("qrc:///resources/firstparty.html")); + QCOMPARE(interceptor.firstPartyUrls.at(1), QUrl("qrc:///resources/firstparty.html")); + QCOMPARE(spy.count(), 1); +} + QTEST_MAIN(tst_QWebEngineUrlRequestInterceptor) #include "tst_qwebengineurlrequestinterceptor.moc" diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.qrc b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.qrc index afeae268b..ca045e7fc 100644 --- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.qrc +++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.qrc @@ -2,5 +2,6 @@ <qresource> <file>resources/index.html</file> <file>resources/content.html</file> + <file>resources/firstparty.html</file> </qresource> </RCC> -- cgit v1.2.3 From 5cf7d25e40220bd96799406293d1267532721712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= <michael.bruning@theqtcompany.com> Date: Mon, 12 Oct 2015 13:41:19 +0200 Subject: Remove hard dependency on libjpeg on Linux. It made the build fail on systems that use libjpeg-turbo. Task-number: QTBUG-48606 Change-Id: I1aa6acab1627d3f4613b4ca39837b6deb25d3cc0 Reviewed-by: Milian Wolff <milian.wolff@kdab.com> --- tools/qmake/mkspecs/features/configure.prf | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/qmake/mkspecs/features/configure.prf b/tools/qmake/mkspecs/features/configure.prf index 321e67e92..8c6876857 100644 --- a/tools/qmake/mkspecs/features/configure.prf +++ b/tools/qmake/mkspecs/features/configure.prf @@ -29,7 +29,6 @@ defineTest(runConfigure) { contains(QT_CONFIG, xcb): REQUIRED_PACKAGES += libdrm xcomposite xcursor xi xrandr xscrnsaver xtst contains(QT_CONFIG, pulseaudio): REQUIRED_PACKAGES += libpulse contains(QT_CONFIG, system-png): REQUIRED_PACKAGES += libpng - contains(QT_CONFIG, system-jpeg): REQUIRED_PACKAGES += libjpeg contains(QT_CONFIG, system-harfbuzz): REQUIRED_PACKAGES += harfbuzz !cross_compile: REQUIRED_PACKAGES += libpci nss -- cgit v1.2.3 From 3b1faa91c3e8ee4b7fb602b0b476d4deda235378 Mon Sep 17 00:00:00 2001 From: Kai Koehne <kai.koehne@theqtcompany.com> Date: Mon, 12 Oct 2015 13:34:17 +0200 Subject: Remove private API warning from qwebengineurlrequestjob.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie2c9e3ac60790e49a449c473cd9fb60ef698b6de Reviewed-by: Michael Brüning <michael.bruning@theqtcompany.com> --- src/core/api/qwebengineurlrequestjob.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/core/api/qwebengineurlrequestjob.h b/src/core/api/qwebengineurlrequestjob.h index 76e9b2c39..fc9f4d911 100644 --- a/src/core/api/qwebengineurlrequestjob.h +++ b/src/core/api/qwebengineurlrequestjob.h @@ -37,17 +37,6 @@ #ifndef QWEBENGINEURLREQUESTJOB_H #define QWEBENGINEURLREQUESTJOB_H -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - #include "qtwebenginecoreglobal.h" #include <QtCore/qbytearray.h> -- cgit v1.2.3 From 4654fd86fb5de097a8ad271c2f53e99e19c36c93 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Date: Wed, 16 Sep 2015 12:04:52 +0200 Subject: Make NSS vs BoringSSL choice more flexible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make the NSS library optional on Linux to reduce the hard coded difference between embedded and desktop builds. Change-Id: I3d7f703ead0ff325ffd2ae272e7e4c2d5258fc25 Reviewed-by: Michael Brüning <michael.bruning@theqtcompany.com> --- src/core/config/embedded_linux.pri | 3 --- src/core/config/linux.pri | 6 ++++++ tools/qmake/mkspecs/features/configure.prf | 17 +++++++++++++++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/core/config/embedded_linux.pri b/src/core/config/embedded_linux.pri index cd12204f9..50f94147e 100644 --- a/src/core/config/embedded_linux.pri +++ b/src/core/config/embedded_linux.pri @@ -33,9 +33,6 @@ GYP_CONFIG += \ toolkit_views=1 \ use_custom_freetype=0 \ use_libpci=0 \ - use_nss_certs=0 \ - use_openssl=1 \ - use_openssl_certs=1 \ use_ozone=1 \ use_system_fontconfig=1 \ icu_use_data_file_flag=0 \ diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index 4c2e70daf..803043c50 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -18,6 +18,12 @@ GYP_CONFIG += \ use_kerberos=0 \ use_pango=0 +!config_system_nss { + GYP_CONFIG += use_nss_certs=0 \ + use_openssl=1 \ + use_openssl_certs=1 +} + contains(QT_CONFIG, system-zlib): config_system_minizip: GYP_CONFIG += use_system_zlib=1 contains(QT_CONFIG, system-png): GYP_CONFIG += use_system_libpng=1 contains(QT_CONFIG, system-jpeg): GYP_CONFIG += use_system_libjpeg=1 diff --git a/tools/qmake/mkspecs/features/configure.prf b/tools/qmake/mkspecs/features/configure.prf index 8c6876857..90966151d 100644 --- a/tools/qmake/mkspecs/features/configure.prf +++ b/tools/qmake/mkspecs/features/configure.prf @@ -30,7 +30,7 @@ defineTest(runConfigure) { contains(QT_CONFIG, pulseaudio): REQUIRED_PACKAGES += libpulse contains(QT_CONFIG, system-png): REQUIRED_PACKAGES += libpng contains(QT_CONFIG, system-harfbuzz): REQUIRED_PACKAGES += harfbuzz - !cross_compile: REQUIRED_PACKAGES += libpci nss + !cross_compile: REQUIRED_PACKAGES += libpci for(package, $$list($$REQUIRED_PACKAGES)) { !packagesExist($$package):skipBuild("Unmet dependency: $$package") @@ -51,18 +51,31 @@ defineTest(runConfigure) { else: log("System libsrtp not found. Using Chromium's copy.$${EOL}") config_snappy: WEBENGINE_CONFIG += config_system_snappy else: log("System snappy not found. Using Chromium's copy.$${EOL}") + + # Optional dependencies + packagesExist(nss): WEBENGINE_CONFIG += config_system_nss + else: log("System NSS not found, BoringSSL will be used.$${EOL}") } isEmpty(skipBuildReason): { cache(CONFIG, add, $$list(webengine_successfully_configured)) - !isEmpty(WEBENGINE_CONFIG): cache(CONFIG, add, $$list($$WEBENGINE_CONFIG)) + !isEmpty(WEBENGINE_CONFIG) { + CONFIG += $$WEBENGINE_CONFIG + cache(CONFIG, add, $$list($$WEBENGINE_CONFIG)) + } } + export(CONFIG) } # This is called from default_post, at which point we've also parsed # command line options defineTest(finalizeConfigure) { linux { + config_system_nss { + log("SSL............................... Using system NSS$${EOL}") + } else { + log("SSL............................... Using bundled BoringSSL$${EOL}") + } contains(WEBENGINE_CONFIG, use_system_icu) { packagesExist("icu-uc icu-i18n") { log("ICU............................... Using system version$${EOL}") -- cgit v1.2.3 From e0dd0c4e02efc3897c4c1f814ee89963849ffd50 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Date: Mon, 12 Oct 2015 15:59:17 +0200 Subject: Clean up configure syntax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Imports use? qmake macro from QtWebKit and use it to make checks simpler and keep the webengine config in WEBENGINE_CONFIG. Change-Id: Ic0f1fca45ebc292d8146107697f9d3ca3764dfb4 Reviewed-by: Michael Brüning <michael.bruning@theqtcompany.com> --- src/core/config/linux.pri | 29 ++++++++++++++--------------- tools/qmake/mkspecs/features/configure.prf | 29 ++++++++++++++--------------- tools/qmake/mkspecs/features/functions.prf | 5 +++++ 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index 803043c50..8d736d0c1 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -18,29 +18,28 @@ GYP_CONFIG += \ use_kerberos=0 \ use_pango=0 -!config_system_nss { +!use?(nss) { GYP_CONFIG += use_nss_certs=0 \ use_openssl=1 \ use_openssl_certs=1 } -contains(QT_CONFIG, system-zlib): config_system_minizip: GYP_CONFIG += use_system_zlib=1 +contains(QT_CONFIG, system-zlib): use?(system_minizip): GYP_CONFIG += use_system_zlib=1 contains(QT_CONFIG, system-png): GYP_CONFIG += use_system_libpng=1 contains(QT_CONFIG, system-jpeg): GYP_CONFIG += use_system_libjpeg=1 contains(QT_CONFIG, system-harfbuzz): GYP_CONFIG += use_system_harfbuzz=1 !contains(QT_CONFIG, pulseaudio): GYP_CONFIG += use_pulseaudio=0 -config_system_libevent: GYP_CONFIG += use_system_libevent=1 -config_system_libwebp: GYP_CONFIG += use_system_libwebp=1 -config_system_libsrtp: GYP_CONFIG += use_system_libsrtp=1 -config_system_libxslt: GYP_CONFIG += use_system_libxml=1 -config_system_flac: GYP_CONFIG += use_system_flac=1 -config_system_jsoncpp: GYP_CONFIG += use_system_jsoncpp=1 -config_system_opus: GYP_CONFIG += use_system_opus=1 -config_system_snappy: GYP_CONFIG += use_system_snappy=1 -config_system_speex: GYP_CONFIG += use_system_speex=1 -config_system_vpx: GYP_CONFIG += use_system_libvpx=1 - -contains(WEBENGINE_CONFIG, use_system_icu): GYP_CONFIG += use_system_icu=1 -contains(WEBENGINE_CONFIG, use_system_ffmpeg): GYP_CONFIG += use_system_ffmpeg=1 +use?(system_libevent): GYP_CONFIG += use_system_libevent=1 +use?(system_libwebp): GYP_CONFIG += use_system_libwebp=1 +use?(system_libsrtp): GYP_CONFIG += use_system_libsrtp=1 +use?(system_libxslt): GYP_CONFIG += use_system_libxml=1 +use?(system_flac): GYP_CONFIG += use_system_flac=1 +use?(system_jsoncpp): GYP_CONFIG += use_system_jsoncpp=1 +use?(system_opus): GYP_CONFIG += use_system_opus=1 +use?(system_snappy): GYP_CONFIG += use_system_snappy=1 +use?(system_speex): GYP_CONFIG += use_system_speex=1 +use?(system_vpx): GYP_CONFIG += use_system_libvpx=1 +use?(system_icu): GYP_CONFIG += use_system_icu=1 +use?(system_ffmpeg): GYP_CONFIG += use_system_ffmpeg=1 diff --git a/tools/qmake/mkspecs/features/configure.prf b/tools/qmake/mkspecs/features/configure.prf index 90966151d..f117e214d 100644 --- a/tools/qmake/mkspecs/features/configure.prf +++ b/tools/qmake/mkspecs/features/configure.prf @@ -35,48 +35,47 @@ defineTest(runConfigure) { for(package, $$list($$REQUIRED_PACKAGES)) { !packagesExist($$package):skipBuild("Unmet dependency: $$package") } - packagesExist(minizip, zlib): WEBENGINE_CONFIG += config_system_minizip + packagesExist(minizip, zlib): WEBENGINE_CONFIG += use_system_minizip else: log("System zlib or minizip not found. Using Chromium's copies.$${EOL}") - packagesExist(libwebp,libwebpdemux): WEBENGINE_CONFIG += config_system_libwebp + packagesExist(libwebp,libwebpdemux): WEBENGINE_CONFIG += use_system_libwebp else: log("System libwebp or libwebpdemux not found. Using Chromium's copies.$${EOL}") - packagesExist(libxml-2.0,libxslt): WEBENGINE_CONFIG += config_system_libxslt + packagesExist(libxml-2.0,libxslt): WEBENGINE_CONFIG += use_system_libxslt else: log("System libxml2 or libxslt not found. Using Chromium's copies.$${EOL}") for(package, $$list("libevent flac jsoncpp opus speex")) { - packagesExist($$package): WEBENGINE_CONFIG += config_system_$$package + packagesExist($$package): WEBENGINE_CONFIG += use_system_$$package else: log("System $$package not found. Using Chromium's copy.$${EOL}") } - packagesExist("\'vpx >= 1.4\'"): WEBENGINE_CONFIG += config_system_vpx + packagesExist("\'vpx >= 1.4\'"): WEBENGINE_CONFIG += use_system_vpx else: log("System vpx >= 1.4 not found. Using Chromium's copy.$${EOL}") - config_srtp: WEBENGINE_CONFIG += config_system_libsrtp + config_srtp: WEBENGINE_CONFIG += use_system_libsrtp else: log("System libsrtp not found. Using Chromium's copy.$${EOL}") - config_snappy: WEBENGINE_CONFIG += config_system_snappy + config_snappy: WEBENGINE_CONFIG += use_system_snappy else: log("System snappy not found. Using Chromium's copy.$${EOL}") # Optional dependencies - packagesExist(nss): WEBENGINE_CONFIG += config_system_nss + packagesExist(nss): WEBENGINE_CONFIG += use_nss else: log("System NSS not found, BoringSSL will be used.$${EOL}") } isEmpty(skipBuildReason): { cache(CONFIG, add, $$list(webengine_successfully_configured)) !isEmpty(WEBENGINE_CONFIG) { - CONFIG += $$WEBENGINE_CONFIG - cache(CONFIG, add, $$list($$WEBENGINE_CONFIG)) + cache(WEBENGINE_CONFIG, add, $$list($$WEBENGINE_CONFIG)) + export(WEBENGINE_CONFIG) } } - export(CONFIG) } # This is called from default_post, at which point we've also parsed # command line options defineTest(finalizeConfigure) { linux { - config_system_nss { + use?(nss) { log("SSL............................... Using system NSS$${EOL}") } else { log("SSL............................... Using bundled BoringSSL$${EOL}") } - contains(WEBENGINE_CONFIG, use_system_icu) { + use?(system_icu) { packagesExist("icu-uc icu-i18n") { log("ICU............................... Using system version$${EOL}") } else { @@ -86,7 +85,7 @@ defineTest(finalizeConfigure) { } else { log("ICU............................... Using internal copy (Default, force system ICU with WEBENGINE_CONFIG += use_system_icu)$${EOL}") } - contains(WEBENGINE_CONFIG, use_system_ffmpeg) { + use?(system_ffmpeg) { packagesExist("libavcodec libavformat libavutil") { packagesExist("libwebp, libwebpdemux, opus, \'vpx >= 1.4\'"){ log("FFMPEG............................ Using system version$${EOL}") @@ -102,7 +101,7 @@ defineTest(finalizeConfigure) { log("FFMPEG............................ Using internal copy (Default, force system FFMPEG with WEBENGINE_CONFIG += use_system_ffmpeg)$${EOL}") } } - contains(WEBENGINE_CONFIG, use_proprietary_codecs) { + use?(proprietary_codecs) { log("Proprietary codecs (H264, MP3).... Enabled$${EOL}") } else { log("Proprietary codecs (H264, MP3).... Not enabled (Default, enable with WEBENGINE_CONFIG += use_proprietary_codecs)$${EOL}") diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf index 421513727..99f60d0e5 100644 --- a/tools/qmake/mkspecs/features/functions.prf +++ b/tools/qmake/mkspecs/features/functions.prf @@ -149,6 +149,11 @@ defineReplace(which) { return($$out) } +defineTest(use?) { + contains(WEBENGINE_CONFIG, use_$$lower($$1)): return(true) + return(false) +} + defineReplace(findOrBuildNinja) { # If NINJA_PATH env var is set, prefer that. # Fallback to locating our own bootstrapped ninja. -- cgit v1.2.3 From 981e38d2dc82c047c6ad8ec19427d3ac7434dc3c Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Date: Mon, 12 Oct 2015 16:10:47 +0200 Subject: Fix build with freetype2 depending on harfbuzz MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Chromium uses system freetype2 by default but not harfbuzz by default, since some newer versions of freetype2 depends on harfbuzz, we need to configure Chromium to use system harfbuzz in those cases. Change-Id: Ic15abe85c5b7e5ef1c3d82420efbc8605c2fe1ae Reviewed-by: Michael Brüning <michael.bruning@theqtcompany.com> --- src/core/config/linux.pri | 2 +- tools/qmake/mkspecs/features/configure.prf | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index 8d736d0c1..7f269245e 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -27,9 +27,9 @@ GYP_CONFIG += \ contains(QT_CONFIG, system-zlib): use?(system_minizip): GYP_CONFIG += use_system_zlib=1 contains(QT_CONFIG, system-png): GYP_CONFIG += use_system_libpng=1 contains(QT_CONFIG, system-jpeg): GYP_CONFIG += use_system_libjpeg=1 -contains(QT_CONFIG, system-harfbuzz): GYP_CONFIG += use_system_harfbuzz=1 !contains(QT_CONFIG, pulseaudio): GYP_CONFIG += use_pulseaudio=0 +use?(system_harfbuzz): GYP_CONFIG += use_system_harfbuzz=1 use?(system_libevent): GYP_CONFIG += use_system_libevent=1 use?(system_libwebp): GYP_CONFIG += use_system_libwebp=1 use?(system_libsrtp): GYP_CONFIG += use_system_libsrtp=1 diff --git a/tools/qmake/mkspecs/features/configure.prf b/tools/qmake/mkspecs/features/configure.prf index f117e214d..758cd9fde 100644 --- a/tools/qmake/mkspecs/features/configure.prf +++ b/tools/qmake/mkspecs/features/configure.prf @@ -25,11 +25,14 @@ defineTest(runConfigure) { !config_libcap:skipBuild("libcap development package appears to be missing") !config_khr:skipBuild("khronos development headers appear to be missing (mesa/libegl1-mesa-dev)") - REQUIRED_PACKAGES = dbus-1 fontconfig + REQUIRED_PACKAGES = dbus-1 fontconfig freetype2 contains(QT_CONFIG, xcb): REQUIRED_PACKAGES += libdrm xcomposite xcursor xi xrandr xscrnsaver xtst contains(QT_CONFIG, pulseaudio): REQUIRED_PACKAGES += libpulse contains(QT_CONFIG, system-png): REQUIRED_PACKAGES += libpng - contains(QT_CONFIG, system-harfbuzz): REQUIRED_PACKAGES += harfbuzz + contains(QT_CONFIG, system-harfbuzz)|packagesExist("\'freetype2 >= 2.5.3\'"): { + WEBENGINE_CONFIG += use_system_harfbuzz + REQUIRED_PACKAGES += harfbuzz + } !cross_compile: REQUIRED_PACKAGES += libpci for(package, $$list($$REQUIRED_PACKAGES)) { -- cgit v1.2.3