From 07468b60dd917c647b279125915cc5b925fbb07a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Thu, 9 Oct 2014 12:14:24 +0200 Subject: Doc: Correct snippets for QWebEngineView API doc. Those were using wrong action names and also the wrong trigger methods in the wrong context. Change-Id: If124bf7836a553dc4a632db208cee41fb998c622 Reviewed-by: Jocelyn Turcotte --- .../doc/snippets/qtwebengine_qwebengineview_snippet.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/webenginewidgets/doc/snippets/qtwebengine_qwebengineview_snippet.cpp b/src/webenginewidgets/doc/snippets/qtwebengine_qwebengineview_snippet.cpp index 20edd73c6..57e4a7047 100644 --- a/src/webenginewidgets/doc/snippets/qtwebengine_qwebengineview_snippet.cpp +++ b/src/webenginewidgets/doc/snippets/qtwebengine_qwebengineview_snippet.cpp @@ -36,22 +36,22 @@ void wrapInFunction() //! [2] - view->triggerAction(QWebPage::Copy); + view->triggerPageAction(QWebEnginePage::Copy); //! [2] //! [3] - view->page()->triggerPageAction(QWebPage::Stop); + view->page()->triggerAction(QWebEnginePage::Stop); //! [3] //! [4] - view->page()->triggerPageAction(QWebPage::GoBack); + view->page()->triggerAction(QWebEnginePage::Back); //! [4] //! [5] - view->page()->triggerPageAction(QWebPage::GoForward); + view->page()->triggerAction(QWebEnginePage::Forward); //! [5] //! [6] -- cgit v1.2.3 From 2cc9a92ad3796e6ec1e4cdfb3fe68eddc86ad4ac Mon Sep 17 00:00:00 2001 From: Jarred Nicholls Date: Thu, 9 Oct 2014 08:25:08 -0400 Subject: Notify canGoBack/canGoForward on urlChanged instead of loadingChanged. In order to support Fragment (#) based routing and history navigation together, canGoBack/canGoForward properties should be notified when the url is changed instead of when the page is loading. Task-number: QTBUG-41849 Change-Id: Ic995fffa5c683dade88fbd98ffea90527a77261b Reviewed-by: Michael Bruning Reviewed-by: Jocelyn Turcotte Reviewed-by: Jarred Nicholls --- src/webengine/api/qquickwebengineview_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h index 402c2ce65..22713ee22 100644 --- a/src/webengine/api/qquickwebengineview_p.h +++ b/src/webengine/api/qquickwebengineview_p.h @@ -54,8 +54,8 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem { Q_PROPERTY(bool loading READ isLoading NOTIFY loadingChanged) Q_PROPERTY(int loadProgress READ loadProgress NOTIFY loadProgressChanged) Q_PROPERTY(QString title READ title NOTIFY titleChanged) - Q_PROPERTY(bool canGoBack READ canGoBack NOTIFY loadingChanged) - Q_PROPERTY(bool canGoForward READ canGoForward NOTIFY loadingChanged) + Q_PROPERTY(bool canGoBack READ canGoBack NOTIFY urlChanged) + Q_PROPERTY(bool canGoForward READ canGoForward NOTIFY urlChanged) Q_ENUMS(NavigationRequestAction); Q_ENUMS(NavigationType); Q_ENUMS(LoadStatus); -- cgit v1.2.3 From 739bfbb55df666c7fb975fb847bbd3f129b88eba Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Fri, 10 Oct 2014 17:26:27 +0200 Subject: Bounds check the zoom factor before we pass it along. As it turns out failing to do so can mess up the page state. Change-Id: I8cc785b01c73bde5443bdb78554d7b3809d96afe Reviewed-by: Andras Becsi --- src/core/web_contents_adapter.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 3533c0743..4129e8c33 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -612,6 +612,8 @@ void WebContentsAdapter::serializeNavigationHistory(QDataStream &output) void WebContentsAdapter::setZoomFactor(qreal factor) { Q_D(WebContentsAdapter); + if (factor < content::kMinimumZoomFactor || factor > content::kMaximumZoomFactor) + return; content::HostZoomMap::SetZoomLevel(d->webContents.get(), content::ZoomFactorToZoomLevel(static_cast(factor))); } -- cgit v1.2.3 From d44b90f9fd7efada0153fbdb0433454e63167b82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Fri, 10 Oct 2014 17:38:33 +0200 Subject: Do not run Callback for already canceled URLRequests. Doing so causes a check to fail in URLRequest::BeforeRequestComplete. Change-Id: I487042b922b3f357bd8d9579167d9b372963ff29 Reviewed-by: Andras Becsi --- src/core/network_delegate_qt.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/core/network_delegate_qt.cpp b/src/core/network_delegate_qt.cpp index 81ab4b6bc..f14d2cb39 100644 --- a/src/core/network_delegate_qt.cpp +++ b/src/core/network_delegate_qt.cpp @@ -130,6 +130,9 @@ void NetworkDelegateQt::CompleteURLRequestOnIOThread(net::URLRequest *request, if (!m_activeRequests.contains(request)) return; + if (request->status().status() == net::URLRequestStatus::CANCELED) + return; + int error = net::OK; switch (navigationRequestAction) { case WebContentsAdapterClient::AcceptRequest: -- cgit v1.2.3 From 9861e57ecb97519d53f27f77784942964dcb2bf3 Mon Sep 17 00:00:00 2001 From: Andras Becsi Date: Fri, 10 Oct 2014 18:31:53 +0200 Subject: Fix localization on OS X We did not load any localization data on OS X until now, so the error page did not have any strings, and some tests asserted because of missing localization. Change-Id: Icb6de1f7e3aaa6815483d379efaf00e8ed6a1dbf Reviewed-by: Michael Bruning --- src/3rdparty | 2 +- src/core/resource_bundle_qt.cpp | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) (limited to 'src') diff --git a/src/3rdparty b/src/3rdparty index 2c3ccc799..1c64c9878 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 2c3ccc7994980d954ec0188ea3fa3d27424ef32e +Subproject commit 1c64c9878f36c83b18c2e81aafe6eedc2a67488b diff --git a/src/core/resource_bundle_qt.cpp b/src/core/resource_bundle_qt.cpp index 2487cdbd1..d69ae05e1 100644 --- a/src/core/resource_bundle_qt.cpp +++ b/src/core/resource_bundle_qt.cpp @@ -47,15 +47,6 @@ void ResourceBundle::LoadCommonResources() AddDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_PAK), SCALE_FACTOR_100P); } -// As GetLocaleFilePath is excluded for Mac in resource_bundle.cc, -// we have to add a replacement for it using the inverted logic. -#if defined(OS_MACOSX) -base::FilePath ResourceBundle::GetLocaleFilePath(const std::string& /*app_locale*/, bool /*test_file_exists*/) -{ - return base::FilePath(); -} -#endif - gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { LOG(WARNING) << "Unable to load image with id " << resource_id; -- cgit v1.2.3 From 38e68ab97b6de2f66bd367785d71831d9a154687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Mon, 13 Oct 2014 16:30:54 +0200 Subject: Disable Desktop Notifications. This should be removed once desktop notifications have been implemented. Task-number: QTBUG-41893 Change-Id: Ia004ee8946ae4441027161f5dddf05d304df8b1b Reviewed-by: Andras Becsi --- src/core/web_engine_context.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 13daef5f6..20bf3e051 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -138,6 +138,7 @@ WebEngineContext::WebEngineContext() parsedCommandLine->AppendSwitch(switches::kEnableDelegatedRenderer); parsedCommandLine->AppendSwitch(switches::kEnableThreadedCompositing); parsedCommandLine->AppendSwitch(switches::kInProcessGPU); + parsedCommandLine->AppendSwitch(switches::kDisableDesktopNotifications); #if defined(OS_WIN) parsedCommandLine->AppendSwitch(switches::kDisableD3D11); -- cgit v1.2.3 From f1e16024b7d608e5d4dc2144d2c97eca73c951ef Mon Sep 17 00:00:00 2001 From: Andras Becsi Date: Fri, 10 Oct 2014 18:29:27 +0200 Subject: Add setting ErrorPageEnabled This is required so that embedders can implement custom error pages, and is also needed for tests, where error-page loading has side-effects on subsequent page loads. Change-Id: I5ae276a58864a2fa9d7b608bea3340b482a92f4e Reviewed-by: Peter Varga --- src/3rdparty | 2 +- src/core/renderer/content_renderer_client_qt.cpp | 7 +++++++ src/core/renderer/content_renderer_client_qt.h | 2 +- src/core/web_engine_settings.cpp | 2 ++ src/core/web_engine_settings.h | 1 + src/webengine/api/qquickwebenginesettings.cpp | 15 +++++++++++++++ src/webengine/api/qquickwebenginesettings_p.h | 4 ++++ src/webenginewidgets/api/qwebenginesettings.cpp | 2 ++ src/webenginewidgets/api/qwebenginesettings.h | 3 ++- src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc | 1 + 10 files changed, 36 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/3rdparty b/src/3rdparty index 1c64c9878..ec43e18d0 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 1c64c9878f36c83b18c2e81aafe6eedc2a67488b +Subproject commit ec43e18d084a44ed6bb4378f05f5523606316c5a diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 6d4315b64..451aaac4b 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -39,6 +39,7 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/common/localized_error.h" #include "components/visitedlink/renderer/visitedlink_slave.h" +#include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_thread.h" #include "content/public/renderer/render_view.h" #include "net/base/net_errors.h" @@ -46,6 +47,7 @@ #include "third_party/WebKit/public/platform/WebURLRequest.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/webui/jstemplate_builder.h" +#include "webkit/common/webpreferences.h" #include "renderer/qt_render_view_observer.h" @@ -84,6 +86,11 @@ bool ContentRendererClientQt::HasErrorPage(int httpStatusCode, std::string *erro return true; } +bool ContentRendererClientQt::ShouldSuppressErrorPage(content::RenderFrame *frame, const GURL &) +{ + return !(frame->GetWebkitPreferences().enable_error_page); +} + // To tap into the chromium localized strings. Ripped from the chrome layer (highly simplified). void ContentRendererClientQt::GetNavigationErrorStrings(content::RenderView* render_view, blink::WebFrame *frame, const blink::WebURLRequest &failed_request, const blink::WebURLError &error, std::string *error_html, base::string16 *error_description) { diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h index 386495e20..505262fc8 100644 --- a/src/core/renderer/content_renderer_client_qt.h +++ b/src/core/renderer/content_renderer_client_qt.h @@ -50,7 +50,7 @@ public: virtual void RenderThreadStarted() Q_DECL_OVERRIDE; virtual void RenderViewCreated(content::RenderView *render_view) Q_DECL_OVERRIDE; - virtual bool ShouldSuppressErrorPage(content::RenderFrame *, const GURL &) Q_DECL_OVERRIDE { return false; } + virtual bool ShouldSuppressErrorPage(content::RenderFrame *, const GURL &) Q_DECL_OVERRIDE; virtual bool HasErrorPage(int httpStatusCode, std::string *errorDomain) Q_DECL_OVERRIDE; virtual void GetNavigationErrorStrings(content::RenderView* render_view, blink::WebFrame* frame, const blink::WebURLRequest& failed_request , const blink::WebURLError& error, std::string* error_html, base::string16* error_description) Q_DECL_OVERRIDE; diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp index 03f746f41..9b070d3b2 100644 --- a/src/core/web_engine_settings.cpp +++ b/src/core/web_engine_settings.cpp @@ -213,6 +213,7 @@ void WebEngineSettings::initDefaults() m_attributes.insert(LocalContentCanAccessFileUrls, true); m_attributes.insert(HyperlinkAuditingEnabled, false); m_attributes.insert(ScrollAnimatorEnabled, false); + m_attributes.insert(ErrorPageEnabled, true); // Default fonts QFont defaultFont; @@ -276,6 +277,7 @@ void WebEngineSettings::applySettingsToWebPreferences(WebPreferences *prefs) prefs->allow_file_access_from_file_urls = testAttribute(LocalContentCanAccessFileUrls); prefs->hyperlink_auditing_enabled = testAttribute(HyperlinkAuditingEnabled); prefs->enable_scroll_animator = testAttribute(ScrollAnimatorEnabled); + prefs->enable_error_page = testAttribute(ErrorPageEnabled); // Fonts settings. prefs->standard_font_family_map[webkit_glue::kCommonScript] = toString16(fontFamily(StandardFont)); diff --git a/src/core/web_engine_settings.h b/src/core/web_engine_settings.h index b8d661fcc..c098f8ef4 100644 --- a/src/core/web_engine_settings.h +++ b/src/core/web_engine_settings.h @@ -74,6 +74,7 @@ public: LocalContentCanAccessFileUrls, HyperlinkAuditingEnabled, ScrollAnimatorEnabled, + ErrorPageEnabled, }; // Must match the values from the public API in qwebenginesettings.h. diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp index aa6290aa8..7f36bad5e 100644 --- a/src/webengine/api/qquickwebenginesettings.cpp +++ b/src/webengine/api/qquickwebenginesettings.cpp @@ -140,6 +140,12 @@ bool QQuickWebEngineSettings::hyperlinkAuditingEnabled() const return d->coreSettings->testAttribute(WebEngineSettings::HyperlinkAuditingEnabled); } +bool QQuickWebEngineSettings::errorPageEnabled() const +{ + Q_D(const QQuickWebEngineSettings); + return d->coreSettings->testAttribute(WebEngineSettings::ErrorPageEnabled); +} + QString QQuickWebEngineSettings::defaultTextEncoding() const { Q_D(const QQuickWebEngineSettings); @@ -239,6 +245,15 @@ void QQuickWebEngineSettings::setHyperlinkAuditingEnabled(bool on) Q_EMIT hyperlinkAuditingEnabledChanged(on); } +void QQuickWebEngineSettings::setErrorPageEnabled(bool on) +{ + Q_D(QQuickWebEngineSettings); + bool wasOn = d->coreSettings->testAttribute(WebEngineSettings::ErrorPageEnabled); + d->coreSettings->setAttribute(WebEngineSettings::ErrorPageEnabled, on); + if (wasOn ^ on) + Q_EMIT errorPageEnabledChanged(on); +} + void QQuickWebEngineSettings::setDefaultTextEncoding(QString encoding) { Q_D(QQuickWebEngineSettings); diff --git a/src/webengine/api/qquickwebenginesettings_p.h b/src/webengine/api/qquickwebenginesettings_p.h index 0fa44ef44..4a7c2f834 100644 --- a/src/webengine/api/qquickwebenginesettings_p.h +++ b/src/webengine/api/qquickwebenginesettings_p.h @@ -57,6 +57,7 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineSettings : public QObject { Q_PROPERTY(bool spatialNavigationEnabled READ spatialNavigationEnabled WRITE setSpatialNavigationEnabled NOTIFY spatialNavigationEnabledChanged) Q_PROPERTY(bool localContentCanAccessFileUrls READ localContentCanAccessFileUrls WRITE setLocalContentCanAccessFileUrls NOTIFY localContentCanAccessFileUrlsChanged) Q_PROPERTY(bool hyperlinkAuditingEnabled READ hyperlinkAuditingEnabled WRITE setHyperlinkAuditingEnabled NOTIFY hyperlinkAuditingEnabledChanged) + Q_PROPERTY(bool errorPageEnabled READ errorPageEnabled WRITE setErrorPageEnabled NOTIFY errorPageEnabledChanged) Q_PROPERTY(QString defaultTextEncoding READ defaultTextEncoding WRITE setDefaultTextEncoding NOTIFY defaultTextEncodingChanged) public: @@ -74,6 +75,7 @@ public: bool spatialNavigationEnabled() const; bool localContentCanAccessFileUrls() const; bool hyperlinkAuditingEnabled() const; + bool errorPageEnabled() const; QString defaultTextEncoding() const; void setAutoLoadImages(bool on); @@ -86,6 +88,7 @@ public: void setSpatialNavigationEnabled(bool on); void setLocalContentCanAccessFileUrls(bool on); void setHyperlinkAuditingEnabled(bool on); + void setErrorPageEnabled(bool on); void setDefaultTextEncoding(QString encoding); signals: @@ -99,6 +102,7 @@ signals: void spatialNavigationEnabledChanged(bool on); void localContentCanAccessFileUrlsChanged(bool on); void hyperlinkAuditingEnabledChanged(bool on); + void errorPageEnabledChanged(bool on); void defaultTextEncodingChanged(QString encoding); private: diff --git a/src/webenginewidgets/api/qwebenginesettings.cpp b/src/webenginewidgets/api/qwebenginesettings.cpp index 9ade311fc..729a09f56 100644 --- a/src/webenginewidgets/api/qwebenginesettings.cpp +++ b/src/webenginewidgets/api/qwebenginesettings.cpp @@ -67,6 +67,8 @@ static WebEngineSettings::Attribute toWebEngineAttribute(QWebEngineSettings::Web return WebEngineSettings::HyperlinkAuditingEnabled; case QWebEngineSettings::ScrollAnimatorEnabled: return WebEngineSettings::ScrollAnimatorEnabled; + case QWebEngineSettings::ErrorPageEnabled: + return WebEngineSettings::ErrorPageEnabled; default: return WebEngineSettings::UnsupportedInCoreSettings; } diff --git a/src/webenginewidgets/api/qwebenginesettings.h b/src/webenginewidgets/api/qwebenginesettings.h index 68c0a6031..d9f57a935 100644 --- a/src/webenginewidgets/api/qwebenginesettings.h +++ b/src/webenginewidgets/api/qwebenginesettings.h @@ -54,7 +54,8 @@ public: SpatialNavigationEnabled, LocalContentCanAccessFileUrls, HyperlinkAuditingEnabled, - ScrollAnimatorEnabled + ScrollAnimatorEnabled, + ErrorPageEnabled }; enum FontSize { diff --git a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc index 3c420b805..ca9f0ca95 100644 --- a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc @@ -115,6 +115,7 @@ about security origins and local vs. remote content see QWebEngineSecurityOrigin. \value HyperlinkAuditingEnabled This setting enables support for the ping attribute for hyperlinks. It is disabled by default. \value ScrollAnimatorEnabled This setting enables animated scrolling. It is disabled by default. + \value ErrorPageEnabled This setting enables built-in error pages of Chromium. It is enabled by default. */ /*! -- cgit v1.2.3 From ca0da5d74a495247c2d7408fba8d918754ad49d3 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Mon, 13 Oct 2014 18:19:41 +0200 Subject: Fix up coding style in GetNavigationErrorStrings That code was borrowed straight from Chromium and used the Chromium coding style. Change-Id: I212aea23f19056b901cbc770640faed4998f02fd Reviewed-by: Zeno Albisser --- src/core/renderer/content_renderer_client_qt.cpp | 50 ++++++++++++------------ src/core/renderer/content_renderer_client_qt.h | 4 +- 2 files changed, 26 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 451aaac4b..bfc5c389f 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -92,36 +92,34 @@ bool ContentRendererClientQt::ShouldSuppressErrorPage(content::RenderFrame *fram } // To tap into the chromium localized strings. Ripped from the chrome layer (highly simplified). -void ContentRendererClientQt::GetNavigationErrorStrings(content::RenderView* render_view, blink::WebFrame *frame, const blink::WebURLRequest &failed_request, const blink::WebURLError &error, std::string *error_html, base::string16 *error_description) +void ContentRendererClientQt::GetNavigationErrorStrings(content::RenderView* renderView, blink::WebFrame *frame, const blink::WebURLRequest &failedRequest, const blink::WebURLError &error, std::string *errorHtml, base::string16 *errorDescription) { Q_UNUSED(frame) - - const bool isPost = EqualsASCII(failed_request.httpMethod(), "POST"); - - if (error_html) { - // Use a local error page. - int resource_id; - base::DictionaryValue error_strings; - - const std::string locale = content::RenderThread::Get()->GetLocale(); - // TODO(elproxy): We could potentially get better diagnostics here by first calling NetErrorHelper::GetErrorStringsForDnsProbe - LocalizedError::GetStrings(error.reason, error.domain.utf8(), - error.unreachableURL, isPost, error.staleCopyInCache && !isPost, - locale, render_view->GetAcceptLanguages(), scoped_ptr(), - &error_strings); - resource_id = IDR_NET_ERROR_HTML; - - - const base::StringPiece template_html(ui::ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id)); - if (template_html.empty()) - NOTREACHED() << "unable to load template. ID: " << resource_id; - else // "t" is the id of the templates root node. - *error_html = webui::GetTemplatesHtml(template_html, &error_strings, "t"); + const bool isPost = EqualsASCII(failedRequest.httpMethod(), "POST"); + + if (errorHtml) { + // Use a local error page. + int resourceId; + base::DictionaryValue errorStrings; + + const std::string locale = content::RenderThread::Get()->GetLocale(); + // TODO(elproxy): We could potentially get better diagnostics here by first calling + // NetErrorHelper::GetErrorStringsForDnsProbe, but that one is harder to untangle. + LocalizedError::GetStrings(error.reason, error.domain.utf8(), error.unreachableURL, isPost + , error.staleCopyInCache && !isPost, locale, renderView->GetAcceptLanguages() + , scoped_ptr(), &errorStrings); + resourceId = IDR_NET_ERROR_HTML; + + + const base::StringPiece template_html(ui::ResourceBundle::GetSharedInstance().GetRawDataResource(resourceId)); + if (template_html.empty()) + NOTREACHED() << "unable to load template. ID: " << resourceId; + else // "t" is the id of the templates root node. + *errorHtml = webui::GetTemplatesHtml(template_html, &errorStrings, "t"); } - if (error_description) { - *error_description = LocalizedError::GetErrorDetails(error, isPost); - } + if (errorDescription) + *errorDescription = LocalizedError::GetErrorDetails(error, isPost); } unsigned long long ContentRendererClientQt::VisitedLinkHash(const char *canonicalUrl, size_t length) diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h index 505262fc8..4e3c70cf8 100644 --- a/src/core/renderer/content_renderer_client_qt.h +++ b/src/core/renderer/content_renderer_client_qt.h @@ -52,8 +52,8 @@ public: virtual bool ShouldSuppressErrorPage(content::RenderFrame *, const GURL &) Q_DECL_OVERRIDE; virtual bool HasErrorPage(int httpStatusCode, std::string *errorDomain) Q_DECL_OVERRIDE; - virtual void GetNavigationErrorStrings(content::RenderView* render_view, blink::WebFrame* frame, const blink::WebURLRequest& failed_request - , const blink::WebURLError& error, std::string* error_html, base::string16* error_description) Q_DECL_OVERRIDE; + virtual void GetNavigationErrorStrings(content::RenderView* renderView, blink::WebFrame* frame, const blink::WebURLRequest& failedRequest + , const blink::WebURLError& error, std::string* errorHtml, base::string16* errorDescription) Q_DECL_OVERRIDE; virtual unsigned long long VisitedLinkHash(const char *canonicalUrl, size_t length) Q_DECL_OVERRIDE; virtual bool IsLinkVisited(unsigned long long linkHash) Q_DECL_OVERRIDE; -- cgit v1.2.3 From 6b64f42363308a80044cc85ae8ba6c9bf1aac8a7 Mon Sep 17 00:00:00 2001 From: Jonathan Liu Date: Wed, 15 Oct 2014 17:02:16 +1100 Subject: Fix ARM NEON detection for -mfpu=neon-vfpv4 Change-Id: I972d3560d6aa2640a2702f219cf802d2476b1c6e Reviewed-by: Andras Becsi --- src/core/gyp_run.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro index f79972a2e..026e3a2f5 100644 --- a/src/core/gyp_run.pro +++ b/src/core/gyp_run.pro @@ -69,7 +69,7 @@ cross_compile { # If the toolchain does not explicitly specify to use NEON instructions # we use arm_neon_optional for ARMv7 and newer and let chromium decide # about the mfpu option. - contains(MFPU, "neon"): GYP_ARGS += "-D arm_fpu=\"$$MFPU\" -D arm_neon=1" + contains(MFPU, "neon")|contains(MFPU, "neon-vfpv4"): GYP_ARGS += "-D arm_fpu=\"$$MFPU\" -D arm_neon=1" else:!lessThan(MARMV, 7): GYP_ARGS += "-D arm_neon=0 -D arm_neon_optional=1" else: GYP_ARGS += "-D arm_fpu=\"$$MFPU\" -D arm_neon=0 -D arm_neon_optional=0" } -- cgit v1.2.3 From 80bc08b46d2746408c69ccb3ec1dbb7db748de08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Wed, 15 Oct 2014 16:58:13 +0200 Subject: Add plugins.qmltypes for WebEngine API Task-number: QTBUG-41952 Change-Id: Ic21089a34364696c8ff7e68e397e39f8f0b7f5cc Reviewed-by: Zeno Albisser --- src/webengine/plugin/plugins.qmltypes | 164 ++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 src/webengine/plugin/plugins.qmltypes (limited to 'src') diff --git a/src/webengine/plugin/plugins.qmltypes b/src/webengine/plugin/plugins.qmltypes new file mode 100644 index 000000000..cebf986d2 --- /dev/null +++ b/src/webengine/plugin/plugins.qmltypes @@ -0,0 +1,164 @@ +import QtQuick.tooling 1.1 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. +// +// This file was auto-generated by: +// 'qmlplugindump -noinstantiate -nonrelocatable QtWebEngine 1.0' + +Module { + Component { + name: "QQuickWebEngineLoadRequest" + prototype: "QObject" + exports: ["QtWebEngine/WebEngineLoadRequest 1.0"] + isCreatable: false + exportMetaObjectRevisions: [0] + Property { name: "url"; type: "QUrl"; isReadonly: true } + Property { name: "status"; type: "QQuickWebEngineView::LoadStatus"; isReadonly: true } + Property { name: "errorString"; type: "string"; isReadonly: true } + Property { name: "errorDomain"; type: "QQuickWebEngineView::ErrorDomain"; isReadonly: true } + Property { name: "errorCode"; type: "int"; isReadonly: true } + } + Component { + name: "QQuickWebEngineNavigationRequest" + prototype: "QObject" + exports: ["QtWebEngine/WebEngineNavigationRequest 1.0"] + isCreatable: false + exportMetaObjectRevisions: [0] + Property { name: "url"; type: "QUrl"; isReadonly: true } + Property { name: "isMainFrame"; type: "bool"; isReadonly: true } + Property { name: "action"; type: "QQuickWebEngineView::NavigationRequestAction" } + Property { + name: "navigationType" + type: "QQuickWebEngineView::NavigationType" + isReadonly: true + } + } + Component { + name: "QQuickWebEngineNewViewRequest" + prototype: "QObject" + exports: ["QtWebEngine/WebEngineNewViewRequest 1.0"] + isCreatable: false + exportMetaObjectRevisions: [0] + Property { + name: "destination" + type: "QQuickWebEngineView::NewViewDestination" + isReadonly: true + } + Property { name: "userInitiated"; type: "bool"; isReadonly: true } + Method { + name: "openIn" + Parameter { name: "view"; type: "QQuickWebEngineView"; isPointer: true } + } + } + Component { + name: "QQuickWebEngineView" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtWebEngine/WebEngineView 1.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "NavigationRequestAction" + values: { + "AcceptRequest": 0, + "IgnoreRequest": 255 + } + } + Enum { + name: "NavigationType" + values: { + "LinkClickedNavigation": 0, + "TypedNavigation": 1, + "FormSubmittedNavigation": 2, + "BackForwardNavigation": 3, + "ReloadNavigation": 4, + "OtherNavigation": 5 + } + } + Enum { + name: "LoadStatus" + values: { + "LoadStartedStatus": 0, + "LoadStoppedStatus": 1, + "LoadSucceededStatus": 2, + "LoadFailedStatus": 3 + } + } + Enum { + name: "ErrorDomain" + values: { + "NoErrorDomain": 0, + "InternalErrorDomain": 1, + "ConnectionErrorDomain": 2, + "CertificateErrorDomain": 3, + "HttpErrorDomain": 4, + "FtpErrorDomain": 5, + "DnsErrorDomain": 6 + } + } + Enum { + name: "NewViewDestination" + values: { + "NewViewInWindow": 0, + "NewViewInTab": 1, + "NewViewInDialog": 2 + } + } + Enum { + name: "JavaScriptConsoleMessageLevel" + values: { + "InfoMessageLevel": 0, + "WarningMessageLevel": 1, + "ErrorMessageLevel": 2 + } + } + Property { name: "url"; type: "QUrl" } + Property { name: "icon"; type: "QUrl"; isReadonly: true } + Property { name: "loading"; type: "bool"; isReadonly: true } + Property { name: "loadProgress"; type: "int"; isReadonly: true } + Property { name: "title"; type: "string"; isReadonly: true } + Property { name: "canGoBack"; type: "bool"; isReadonly: true } + Property { name: "canGoForward"; type: "bool"; isReadonly: true } + Signal { + name: "loadingChanged" + Parameter { name: "loadRequest"; type: "QQuickWebEngineLoadRequest"; isPointer: true } + } + Signal { + name: "linkHovered" + Parameter { name: "hoveredUrl"; type: "QUrl" } + } + Signal { + name: "navigationRequested" + Parameter { name: "request"; type: "QQuickWebEngineNavigationRequest"; isPointer: true } + } + Signal { + name: "javaScriptConsoleMessage" + Parameter { name: "level"; type: "JavaScriptConsoleMessageLevel" } + Parameter { name: "message"; type: "string" } + Parameter { name: "lineNumber"; type: "int" } + Parameter { name: "sourceID"; type: "string" } + } + Method { + name: "runJavaScript" + Parameter { type: "string" } + Parameter { type: "QJSValue" } + } + Method { + name: "runJavaScript" + Parameter { type: "string" } + } + Method { + name: "loadHtml" + Parameter { name: "html"; type: "string" } + Parameter { name: "baseUrl"; type: "QUrl" } + } + Method { + name: "loadHtml" + Parameter { name: "html"; type: "string" } + } + Method { name: "goBack" } + Method { name: "goForward" } + Method { name: "reload" } + Method { name: "stop" } + } +} -- cgit v1.2.3 From dca4a72fa04f0c50cede0d4f5f56791cd6722b74 Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Thu, 16 Oct 2014 10:02:37 +0200 Subject: Allow building on boot2qt. Change-Id: I91ce455ac5e3992e50d13c14f4035f91baad85bf Reviewed-by: Andras Becsi --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/3rdparty b/src/3rdparty index ec43e18d0..0a34bb77a 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit ec43e18d084a44ed6bb4378f05f5523606316c5a +Subproject commit 0a34bb77a59122eeed3f5529a527423d45282db3 -- cgit v1.2.3 From 14fcf0d3193e2ee2bf904a305c9f34ff8d0e5ce7 Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Thu, 16 Oct 2014 04:47:32 -0700 Subject: Disable geolocation This prevents the crash when a webpage requests geolocation permission. Change-Id: I7331b869ec1439d678cee7941691289220718f3d Reviewed-by: Zeno Albisser --- src/core/content_browser_client_qt.cpp | 17 +++++++++++++++++ src/core/content_browser_client_qt.h | 7 +++++++ 2 files changed, 24 insertions(+) (limited to 'src') diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 28294dce7..3ead5314f 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -386,3 +386,20 @@ void ContentBrowserClientQt::AllowCertificateError(int render_process_id, int re QExplicitlySharedDataPointer errorController(new CertificateErrorController(new CertificateErrorControllerPrivate(cert_error, ssl_info, request_url, resource_type, overridable, strict_enforcement, callback))); contentsDelegate->allowCertificateError(errorController); } + +void ContentBrowserClientQt::RequestGeolocationPermission(content::WebContents *webContents, + int bridge_id, + const GURL &requesting_frame, + bool user_gesture, + base::Callback result_callback, + base::Closure *cancel_callback) +{ + Q_UNUSED(webContents); + Q_UNUSED(bridge_id); + Q_UNUSED(requesting_frame); + Q_UNUSED(user_gesture); + Q_UNUSED(cancel_callback); + + // TODO: Add geolocation support + result_callback.Run(false); +} diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h index 9cf1695fe..dd5d9f3a1 100644 --- a/src/core/content_browser_client_qt.h +++ b/src/core/content_browser_client_qt.h @@ -90,6 +90,13 @@ public: bool strict_enforcement, const base::Callback& callback, content::CertificateRequestResultType* result) Q_DECL_OVERRIDE; + virtual void RequestGeolocationPermission( + content::WebContents *webContents, + int bridge_id, + const GURL &requesting_frame, + bool user_gesture, + base::Callback result_callback, + base::Closure *cancel_callback) Q_DECL_OVERRIDE; BrowserContextQt* browser_context(); -- cgit v1.2.3 From ad5185ce17e60d2c0a777e0b76b991708d28b9f2 Mon Sep 17 00:00:00 2001 From: Jonathan Liu Date: Sat, 25 Oct 2014 15:24:53 +1100 Subject: Display error if building for ARM architecture older than ARMv6 Chromium is only supported on ARMv6 and ARMv7 for ARM architecture. Change-Id: I0493c9ba2baf4a537f759286622056093c0d4a25 Reviewed-by: Andras Becsi --- src/core/gyp_run.pro | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro index 026e3a2f5..137b600b9 100644 --- a/src/core/gyp_run.pro +++ b/src/core/gyp_run.pro @@ -61,6 +61,7 @@ cross_compile { !isEmpty(MARMV) { MARMV = $$split(MARMV,) MARMV = $$member(MARMV, 0) + lessThan(MARMV, 6): error("$$MARCH architecture is not supported") GYP_ARGS += "-D arm_version=\"$$MARMV\"" } -- cgit v1.2.3 From 2282c6605bc554ca610239f3dbc4d6d067c25763 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Wed, 22 Oct 2014 12:34:17 +0200 Subject: Make url handling consistent in widget and quick API Use explicit url in quick API too and use GetLastCommittedURL instead of GetVisibleURL for getting the expected urls in tests. Change-Id: If3251323645979643f3dc0e16491fe35b584f51c Reviewed-by: Andras Becsi --- src/core/web_contents_adapter.cpp | 2 +- src/webengine/api/qquickwebengineview.cpp | 5 ++++- src/webengine/api/qquickwebengineview_p_p.h | 1 + src/webenginewidgets/api/qwebenginepage.cpp | 8 ++++---- src/webenginewidgets/api/qwebenginepage_p.h | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 4129e8c33..3f223f733 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -448,7 +448,7 @@ void WebContentsAdapter::setContent(const QByteArray &data, const QString &mimeT QUrl WebContentsAdapter::activeUrl() const { Q_D(const WebContentsAdapter); - return toQt(d->webContents->GetVisibleURL()); + return toQt(d->webContents->GetLastCommittedURL()); } QUrl WebContentsAdapter::requestedUrl() const diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index b466c8566..ad850e84e 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -241,6 +241,7 @@ void QQuickWebEngineViewPrivate::urlChanged(const QUrl &url) { Q_Q(QQuickWebEngineView); Q_UNUSED(url); + explicitUrl = QUrl(); Q_EMIT q->urlChanged(); } @@ -309,6 +310,7 @@ void QQuickWebEngineViewPrivate::loadFinished(bool success, const QUrl &url, int return; } if (success) { + explicitUrl = QUrl(); QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadSucceededStatus); Q_EMIT q->loadingChanged(&loadRequest); return; @@ -506,7 +508,7 @@ QQuickWebEngineView::~QQuickWebEngineView() QUrl QQuickWebEngineView::url() const { Q_D(const QQuickWebEngineView); - return d->adapter->activeUrl(); + return d->explicitUrl.isValid() ? d->explicitUrl : d->adapter->activeUrl(); } void QQuickWebEngineView::setUrl(const QUrl& url) @@ -515,6 +517,7 @@ void QQuickWebEngineView::setUrl(const QUrl& url) return; Q_D(QQuickWebEngineView); + d->explicitUrl = url; d->adapter->load(url); } diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index ac8b8564f..6662f1f02 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -188,6 +188,7 @@ public: QScopedPointer m_history; QScopedPointer m_settings; QQmlComponent *contextMenuExtraItems; + QUrl explicitUrl; QUrl icon; int loadProgress; bool inspectable; diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 8c3c2bb45..d6782974b 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -196,7 +196,7 @@ void QWebEnginePagePrivate::titleChanged(const QString &title) void QWebEnginePagePrivate::urlChanged(const QUrl &url) { Q_Q(QWebEnginePage); - m_explicitUrl = QUrl(); + explicitUrl = QUrl(); Q_EMIT q->urlChanged(url); } @@ -256,7 +256,7 @@ void QWebEnginePagePrivate::loadFinished(bool success, const QUrl &url, int erro Q_UNUSED(errorDescription); isLoading = false; if (success) - m_explicitUrl = QUrl(); + explicitUrl = QUrl(); Q_EMIT q->loadFinished(success); updateNavigationActions(); } @@ -825,14 +825,14 @@ QString QWebEnginePage::title() const void QWebEnginePage::setUrl(const QUrl &url) { Q_D(QWebEnginePage); - d->m_explicitUrl = url; + d->explicitUrl = url; load(url); } QUrl QWebEnginePage::url() const { Q_D(const QWebEnginePage); - return d->m_explicitUrl.isValid() ? d->m_explicitUrl : d->adapter->activeUrl(); + return d->explicitUrl.isValid() ? d->explicitUrl : d->adapter->activeUrl(); } QUrl QWebEnginePage::requestedUrl() const diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h index ccbfb2bc1..54129229f 100644 --- a/src/webenginewidgets/api/qwebenginepage_p.h +++ b/src/webenginewidgets/api/qwebenginepage_p.h @@ -151,7 +151,7 @@ public: QWebEngineSettings *settings; QWebEngineView *view; QSize viewportSize; - QUrl m_explicitUrl; + QUrl explicitUrl; WebEngineContextMenuData m_menuData; bool isLoading; -- cgit v1.2.3 From ff6b175a50dd936f4cb1a32eceedc4d63aea1ca7 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Tue, 28 Oct 2014 15:22:05 +0100 Subject: Support Qt::AA_ShareOpenGLContexts QtWebEngine::initialize happens after QGuiApplication instantiation, so it is too late to simply set the application attribute. In that scenario, we don't want to override the shared context and risk a double free when both QGuiApplication and our cleanup handler try to delete it. Change-Id: Id52884abbb0c2380208876d9c00e8ddbfbc21eda Reviewed-by: Jocelyn Turcotte Reviewed-by: Andras Becsi --- src/webengine/api/qtwebengineglobal.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/webengine/api/qtwebengineglobal.cpp b/src/webengine/api/qtwebengineglobal.cpp index ea119bba6..b179da2fe 100644 --- a/src/webengine/api/qtwebengineglobal.cpp +++ b/src/webengine/api/qtwebengineglobal.cpp @@ -43,6 +43,7 @@ QT_BEGIN_NAMESPACE Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context); +Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context(); namespace QtWebEngine { @@ -54,8 +55,20 @@ static void deleteShareContext() shareContext = 0; } +// ### Qt 6: unify this logic and Qt::AA_ShareOpenGLContexts. +// QtWebEngine::initialize was introduced first and meant to be called +// after the QGuiApplication creation, when AA_ShareOpenGLContexts fills +// the same need but the flag has to be set earlier. void initialize() { +#ifdef Q_OS_WIN32 + qputenv("QT_D3DCREATE_MULTITHREADED", "1"); +#endif + + // No need to override the shared context if QApplication already set one (e.g with Qt::AA_ShareOpenGLContexts). + if (qt_gl_global_share_context()) + return; + QCoreApplication *app = QCoreApplication::instance(); if (!app) { qFatal("QWebEngine(Widgets)::initialize() must be called after the construction of the application object."); @@ -69,10 +82,6 @@ void initialize() if (shareContext) return; -#ifdef Q_OS_WIN32 - qputenv("QT_D3DCREATE_MULTITHREADED", "1"); -#endif - shareContext = new QOpenGLContext; shareContext->create(); qAddPostRoutine(deleteShareContext); -- cgit v1.2.3 From 06a94e282cd8ae90e92777dca065a6110872fb5d Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Wed, 29 Oct 2014 13:36:31 +0100 Subject: Update chromium submodule after adding fixes for MacOSX10.10.sdk. Change-Id: I935ee10d10248ab525aca31c1b1c04d2927915c1 Reviewed-by: Michael Bruning --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/3rdparty b/src/3rdparty index 0a34bb77a..0dcd4e350 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 0a34bb77a59122eeed3f5529a527423d45282db3 +Subproject commit 0dcd4e35086a90f643bb721fad1ef786f5fff8ba -- cgit v1.2.3 From 7dad257209972b86efa327892073cf0d293a5afe Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Wed, 15 Oct 2014 14:47:00 +0200 Subject: Optimize the QMatrix4x4 after a conversion from SkMatrix44 This avoids using a General matrix for tile transformations which are usually only translations in our case. Change-Id: Ic947d7ef9b78de6d5d16ea718cc03255e38a8097 Reviewed-by: Michael Bruning Reviewed-by: Andras Becsi --- src/core/type_conversion.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h index 8d33b5ffa..9d9cdd675 100644 --- a/src/core/type_conversion.h +++ b/src/core/type_conversion.h @@ -121,11 +121,13 @@ inline QColor toQt(const SkColor &c) inline QMatrix4x4 toQt(const SkMatrix44 &m) { - return QMatrix4x4( + QMatrix4x4 qtMatrix( m.get(0, 0), m.get(0, 1), m.get(0, 2), m.get(0, 3), m.get(1, 0), m.get(1, 1), m.get(1, 2), m.get(1, 3), m.get(2, 0), m.get(2, 1), m.get(2, 2), m.get(2, 3), m.get(3, 0), m.get(3, 1), m.get(3, 2), m.get(3, 3)); + qtMatrix.optimize(); + return qtMatrix; } inline QDateTime toQt(base::Time time) -- cgit v1.2.3 From d2d5baeb8c3b10579f7f144e918b2935af66bec5 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 7 Nov 2014 14:31:48 +0100 Subject: Fix enum names of audio/video features The feature enum names and documentation gave the impression it could control audio and video output, while they only control input. Also removed documentation of non connected feature permissions for Notifications and GeoLocation. Change-Id: Ia35142ca691ebd6059b7472e9803fda8cbd84813 Reviewed-by: Jocelyn Turcotte Reviewed-by: Pierre Rossi --- src/webenginewidgets/api/qwebenginepage.cpp | 16 ++++++++-------- src/webenginewidgets/api/qwebenginepage.h | 16 ++++++++++------ src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc | 8 +++----- 3 files changed, 21 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index d6782974b..72b16f28b 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -332,11 +332,11 @@ void QWebEnginePagePrivate::runMediaAccessPermissionRequest(const QUrl &security Q_Q(QWebEnginePage); QWebEnginePage::Feature requestedFeature; if (requestFlags.testFlag(WebContentsAdapterClient::MediaAudioCapture) && requestFlags.testFlag(WebContentsAdapterClient::MediaVideoCapture)) - requestedFeature = QWebEnginePage::MediaAudioVideoDevices; + requestedFeature = QWebEnginePage::MediaAudioVideoCapture; else if (requestFlags.testFlag(WebContentsAdapterClient::MediaAudioCapture)) - requestedFeature = QWebEnginePage::MediaAudioDevices; + requestedFeature = QWebEnginePage::MediaAudioCapture; else if (requestFlags.testFlag(WebContentsAdapterClient::MediaVideoCapture)) - requestedFeature = QWebEnginePage::MediaVideoDevices; + requestedFeature = QWebEnginePage::MediaVideoCapture; else return; Q_EMIT q->featurePermissionRequested(securityOrigin, requestedFeature); @@ -745,16 +745,16 @@ void QWebEnginePage::setFeaturePermission(const QUrl &securityOrigin, QWebEngine Q_D(QWebEnginePage); WebContentsAdapterClient::MediaRequestFlags flags = WebContentsAdapterClient::MediaNone; switch (feature) { - case MediaAudioVideoDevices: - case MediaAudioDevices: - case MediaVideoDevices: + case MediaAudioVideoCapture: + case MediaAudioCapture: + case MediaVideoCapture: if (policy != PermissionUnknown) { if (policy == PermissionDeniedByUser) flags = WebContentsAdapterClient::MediaNone; else { - if (feature == MediaAudioDevices) + if (feature == MediaAudioCapture) flags = WebContentsAdapterClient::MediaAudioCapture; - else if (feature == MediaVideoDevices) + else if (feature == MediaVideoCapture) flags = WebContentsAdapterClient::MediaVideoCapture; else flags = WebContentsAdapterClient::MediaRequestFlags(WebContentsAdapterClient::MediaVideoCapture | WebContentsAdapterClient::MediaAudioCapture); diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h index cda6e620f..7856b8243 100644 --- a/src/webenginewidgets/api/qwebenginepage.h +++ b/src/webenginewidgets/api/qwebenginepage.h @@ -122,7 +122,8 @@ public: FindBackward = 1, FindCaseSensitively = 2, }; - Q_DECLARE_FLAGS(FindFlags, FindFlag) + Q_DECLARE_FLAGS(FindFlags, FindFlag); + enum WebWindowType { WebBrowserWindow, WebBrowserTab, @@ -136,12 +137,15 @@ public: }; enum Feature { - Notifications, - Geolocation, - MediaAudioDevices, - MediaVideoDevices, - MediaAudioVideoDevices +#ifndef Q_QDOC + Notifications = 0, + Geolocation = 1, +#endif + MediaAudioCapture = 2, + MediaVideoCapture, + MediaAudioVideoCapture }; + // Ex-QWebFrame enum enum FileSelectionMode { diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc index 983b80d7e..e89b10ab8 100644 --- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc @@ -151,11 +151,9 @@ This enum describes the platform feature access categories that the user may be asked to grant or deny access to. - \value Notifications Grants access to display notifications to the user. - \value Geolocation The geographic location devices that may be available. - \value MediaAudioDevices Audio devices such as speakers or microphones - \value MediaVideoDevices Video devices, e.g. cameras - \value MediaAudioVideoDevices Both Audio and Video devices. + \value MediaAudioCapture Audio capture devices such a microphones + \value MediaVideoCapture Video devices, e.g. cameras + \value MediaAudioVideoCapture Both Audio and Video capture devices. \sa featurePermissionRequested(), featurePermissionRequestCanceled(), setFeaturePermission(), PermissionPolicy -- cgit v1.2.3 From f343e9d69a9aa8d64fe61725cf17c824f8f2d703 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 7 Nov 2014 17:07:48 +0100 Subject: Cache to QStandardPaths::CacheLocation We should save our cache in the configured CacheLocation, and ensure we are prepared for multiple BrowserContext by caching to a Default subdir. This matches how chromium caches on linux. Change-Id: Ibe914fca35435ea1658565be87747cfabc71e97b Reviewed-by: Jocelyn Turcotte --- src/core/browser_context_qt.cpp | 14 +++++++++++++- src/core/browser_context_qt.h | 1 + src/core/url_request_context_getter_qt.cpp | 9 +++++---- src/core/url_request_context_getter_qt.h | 5 +++-- 4 files changed, 22 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/core/browser_context_qt.cpp b/src/core/browser_context_qt.cpp index 3913b7548..44b6ca4ef 100644 --- a/src/core/browser_context_qt.cpp +++ b/src/core/browser_context_qt.cpp @@ -72,9 +72,21 @@ base::FilePath BrowserContextQt::GetPath() const dataLocation = QDir::homePath() % QDir::separator() % QChar::fromLatin1('.') % QCoreApplication::applicationName(); dataLocation.append(QDir::separator() % QLatin1String("QtWebEngine")); + dataLocation.append(QDir::separator() % QLatin1String("Default")); return base::FilePath(toFilePathString(dataLocation)); } +base::FilePath BrowserContextQt::GetCachePath() const +{ + QString cacheLocation = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); + if (cacheLocation.isEmpty()) + cacheLocation = QDir::homePath() % QDir::separator() % QChar::fromLatin1('.') % QCoreApplication::applicationName(); + + cacheLocation.append(QDir::separator() % QLatin1String("QtWebEngine")); + cacheLocation.append(QDir::separator() % QLatin1String("Default")); + return base::FilePath(toFilePathString(cacheLocation)); +} + bool BrowserContextQt::IsOffTheRecord() const { return false; @@ -133,7 +145,7 @@ content::PushMessagingService *BrowserContextQt::GetPushMessagingService() net::URLRequestContextGetter *BrowserContextQt::CreateRequestContext(content::ProtocolHandlerMap *protocol_handlers) { - url_request_getter_ = new URLRequestContextGetterQt(GetPath(), protocol_handlers); + url_request_getter_ = new URLRequestContextGetterQt(GetPath(), GetCachePath(), protocol_handlers); static_cast(resourceContext.get())->set_url_request_context_getter(url_request_getter_.get()); return url_request_getter_.get(); } diff --git a/src/core/browser_context_qt.h b/src/core/browser_context_qt.h index 8c7e707a8..125c0fc46 100644 --- a/src/core/browser_context_qt.h +++ b/src/core/browser_context_qt.h @@ -51,6 +51,7 @@ public: virtual ~BrowserContextQt(); virtual base::FilePath GetPath() const Q_DECL_OVERRIDE; + base::FilePath GetCachePath() const; virtual bool IsOffTheRecord() const Q_DECL_OVERRIDE; virtual net::URLRequestContextGetter *GetRequestContext() Q_DECL_OVERRIDE; diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp index 8d44d0ad1..8ec600a85 100644 --- a/src/core/url_request_context_getter_qt.cpp +++ b/src/core/url_request_context_getter_qt.cpp @@ -69,9 +69,10 @@ static const char kQrcSchemeQt[] = "qrc"; using content::BrowserThread; -URLRequestContextGetterQt::URLRequestContextGetterQt(const base::FilePath &basePath, content::ProtocolHandlerMap *protocolHandlers) +URLRequestContextGetterQt::URLRequestContextGetterQt(const base::FilePath &dataPath, const base::FilePath &cachePath, content::ProtocolHandlerMap *protocolHandlers) : m_ignoreCertificateErrors(false) - , m_basePath(basePath) + , m_dataPath(dataPath) + , m_cachePath(cachePath) { std::swap(m_protocolHandlers, *protocolHandlers); @@ -93,7 +94,7 @@ net::URLRequestContext *URLRequestContextGetterQt::GetURLRequestContext() m_urlRequestContext->set_network_delegate(m_networkDelegate.get()); - base::FilePath cookiesPath = m_basePath.Append(FILE_PATH_LITERAL("Cookies")); + base::FilePath cookiesPath = m_dataPath.Append(FILE_PATH_LITERAL("Cookies")); content::CookieStoreConfig cookieStoreConfig(cookiesPath, content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES, NULL, NULL); scoped_refptr cookieStore = content::CreateCookieStore(cookieStoreConfig); @@ -119,7 +120,7 @@ net::URLRequestContext *URLRequestContextGetterQt::GetURLRequestContext() net::HttpAuthHandlerFactory::CreateDefault(host_resolver.get())); m_storage->set_http_server_properties(scoped_ptr(new net::HttpServerPropertiesImpl)); - base::FilePath cache_path = m_basePath.Append(FILE_PATH_LITERAL("Cache")); + base::FilePath cache_path = m_cachePath.Append(FILE_PATH_LITERAL("Cache")); net::HttpCache::DefaultBackend* main_backend = new net::HttpCache::DefaultBackend( net::DISK_CACHE, diff --git a/src/core/url_request_context_getter_qt.h b/src/core/url_request_context_getter_qt.h index 50335291e..6c9ac6d59 100644 --- a/src/core/url_request_context_getter_qt.h +++ b/src/core/url_request_context_getter_qt.h @@ -58,7 +58,7 @@ class ProxyConfigService; class URLRequestContextGetterQt : public net::URLRequestContextGetter { public: - explicit URLRequestContextGetterQt(const base::FilePath &, content::ProtocolHandlerMap *protocolHandlers); + explicit URLRequestContextGetterQt(const base::FilePath &, const base::FilePath &, content::ProtocolHandlerMap *protocolHandlers); virtual net::URLRequestContext *GetURLRequestContext() Q_DECL_OVERRIDE; virtual scoped_refptr GetNetworkTaskRunner() const Q_DECL_OVERRIDE; @@ -67,7 +67,8 @@ private: virtual ~URLRequestContextGetterQt() {} bool m_ignoreCertificateErrors; - base::FilePath m_basePath; + base::FilePath m_dataPath; + base::FilePath m_cachePath; content::ProtocolHandlerMap m_protocolHandlers; scoped_ptr m_proxyConfigService; -- cgit v1.2.3