summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--examples/webengine/quicknanobrowser/BrowserWindow.qml9
m---------src/3rdparty0
-rw-r--r--src/core/clipboard_qt.h2
-rw-r--r--src/core/content_browser_client_qt.cpp12
-rw-r--r--src/core/core_chromium.pri11
-rw-r--r--src/core/network_delegate_qt.h40
-rw-r--r--src/core/qtwebengine_resources.gni6
-rw-r--r--src/core/qtwebengine_sources.gni27
-rw-r--r--src/core/quota_permission_context_qt.cpp107
-rw-r--r--src/core/quota_permission_context_qt.h61
-rw-r--r--src/core/quota_permission_controller.cpp98
-rw-r--r--src/core/quota_permission_controller.h70
-rw-r--r--src/core/quota_permission_controller_p.h66
-rw-r--r--src/core/renderer/web_channel_ipc_transport.cpp2
-rw-r--r--src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp10
-rw-r--r--src/core/ssl_host_state_delegate_qt.h12
-rw-r--r--src/core/web_contents_adapter_client.h2
-rw-r--r--src/core/web_contents_delegate_qt.cpp41
-rw-r--r--src/core/web_contents_delegate_qt.h2
-rw-r--r--src/core/web_engine_context.cpp4
-rw-r--r--src/core/web_engine_settings.cpp18
-rw-r--r--src/core/web_engine_settings.h12
-rw-r--r--src/core/webui/webui_controller_factory_qt.cpp219
-rw-r--r--src/core/webui/webui_controller_factory_qt.h79
-rw-r--r--src/plugins/qwebengineview/qwebengineview_plugin.h22
-rw-r--r--src/webengine/api/qquickwebengineprofile_p.h4
-rw-r--r--src/webengine/api/qquickwebenginesettings.cpp41
-rw-r--r--src/webengine/api/qquickwebenginesettings_p.h12
-rw-r--r--src/webengine/api/qquickwebengineview.cpp37
-rw-r--r--src/webengine/api/qquickwebengineview_p.h42
-rw-r--r--src/webengine/api/qquickwebengineview_p_p.h129
-rw-r--r--src/webengine/doc/src/webengineview.qdoc58
-rw-r--r--src/webengine/plugin/plugin.cpp6
-rw-r--r--src/webengine/plugin/plugins.qmltypes22
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.h80
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quickwindow.h48
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp19
-rw-r--r--src/webenginewidgets/api/qwebenginepage.h2
-rw-r--r--src/webenginewidgets/api/qwebenginepage_p.h115
-rw-r--r--src/webenginewidgets/api/qwebengineprofile_p.h4
-rw-r--r--src/webenginewidgets/api/qwebenginequotapermissionrequest.cpp98
-rw-r--r--src/webenginewidgets/api/qwebenginequotapermissionrequest.h71
-rw-r--r--src/webenginewidgets/api/qwebenginesettings.cpp25
-rw-r--r--src/webenginewidgets/api/qwebenginesettings.h10
-rw-r--r--src/webenginewidgets/api/qwebengineview.h18
-rw-r--r--src/webenginewidgets/api/qwebengineview_p.h6
-rw-r--r--src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc35
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h58
-rw-r--r--src/webenginewidgets/ui/messagebubblewidget_p.h2
-rw-r--r--src/webenginewidgets/webenginewidgets.pro2
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp6
-rw-r--r--tests/auto/quick/qmltests/data/TestWebEngineView.qml2
-rw-r--r--tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp2
-rw-r--r--tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp21
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp42
-rw-r--r--tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp69
57 files changed, 1705 insertions, 315 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 76ab2f4b2..d4700d4ce 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -5,4 +5,4 @@ QTWEBENGINE_OUT_ROOT = $$shadowed($$PWD)
load(qt_build_config)
CONFIG += warning_clean
-MODULE_VERSION = 5.10.0
+MODULE_VERSION = 5.11.0
diff --git a/examples/webengine/quicknanobrowser/BrowserWindow.qml b/examples/webengine/quicknanobrowser/BrowserWindow.qml
index 16efc9e37..633ec7a98 100644
--- a/examples/webengine/quicknanobrowser/BrowserWindow.qml
+++ b/examples/webengine/quicknanobrowser/BrowserWindow.qml
@@ -57,7 +57,7 @@ import QtQuick.Controls.Styles 1.0
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.0
import QtQuick.Window 2.1
-import QtWebEngine 1.3
+import QtWebEngine 1.7
ApplicationWindow {
id: browserWindow
@@ -423,6 +423,13 @@ ApplicationWindow {
request.accept();
}
+ onQuotaPermissionRequested: {
+ if (request.requestedSize <= 5 * 1024 * 1024)
+ request.accept();
+ else
+ request.reject();
+ }
+
onRenderProcessTerminated: {
var status = "";
switch (terminationStatus) {
diff --git a/src/3rdparty b/src/3rdparty
-Subproject d23df0c25c334dbde96ef5eb65cc098eee47859
+Subproject 1f8630df0b982e344aac5c5f1faadf647255ecb
diff --git a/src/core/clipboard_qt.h b/src/core/clipboard_qt.h
index 20b51a599..2089208bf 100644
--- a/src/core/clipboard_qt.h
+++ b/src/core/clipboard_qt.h
@@ -82,7 +82,7 @@ public:
void ReadBookmark(base::string16* title, std::string* url) const override;
void ReadData(const FormatType& format, std::string* result) const override;
- virtual void OnPreShutdown() Q_DECL_OVERRIDE { }
+ void OnPreShutdown() override { }
protected:
void WriteObjects(ui::ClipboardType type, const ObjectMap& objects) override;
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index 97d3ad6bb..a422c63a3 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -54,7 +54,6 @@
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/media_observer.h"
-#include "content/public/browser/quota_permission_context.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
@@ -98,6 +97,7 @@
#include "printing_message_filter_qt.h"
#endif // BUILDFLAG(ENABLE_BASIC_PRINTING)
#include "qrc_protocol_handler_qt.h"
+#include "quota_permission_context_qt.h"
#include "renderer_host/resource_dispatcher_host_delegate_qt.h"
#include "renderer_host/user_resource_controller_host.h"
#include "web_contents_delegate_qt.h"
@@ -375,16 +375,6 @@ void ShareGroupQtQuick::AboutToAddFirstContext()
#endif
}
-class QuotaPermissionContextQt : public content::QuotaPermissionContext {
-public:
- void RequestQuotaPermission(const content::StorageQuotaParams &params, int render_process_id, const PermissionCallback &callback) override
- {
- Q_UNUSED(params);
- Q_UNUSED(render_process_id);
- callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
- }
-};
-
ContentBrowserClientQt::ContentBrowserClientQt()
: m_browserMainParts(0)
{
diff --git a/src/core/core_chromium.pri b/src/core/core_chromium.pri
index 71f74f51a..6b43b08b7 100644
--- a/src/core/core_chromium.pri
+++ b/src/core/core_chromium.pri
@@ -77,6 +77,8 @@ SOURCES = \
process_main.cpp \
proxy_config_service_qt.cpp \
qrc_protocol_handler_qt.cpp \
+ quota_permission_context_qt.cpp \
+ quota_permission_controller.cpp \
render_view_observer_host_qt.cpp \
render_widget_host_view_qt.cpp \
render_widget_host_view_qt_delegate.cpp \
@@ -107,7 +109,8 @@ SOURCES = \
web_engine_error.cpp \
web_engine_library_info.cpp \
web_engine_settings.cpp \
- web_event_factory.cpp
+ web_event_factory.cpp \
+ webui/webui_controller_factory_qt.cpp
HEADERS = \
access_token_store_qt.h \
@@ -154,6 +157,9 @@ HEADERS = \
process_main.h \
proxy_config_service_qt.h \
qrc_protocol_handler_qt.h \
+ quota_permission_context_qt.h \
+ quota_permission_controller.h \
+ quota_permission_controller_p.h \
render_view_observer_host_qt.h \
render_widget_host_view_qt.h \
render_widget_host_view_qt_delegate.h \
@@ -185,7 +191,8 @@ HEADERS = \
web_engine_error.h \
web_engine_library_info.h \
web_engine_settings.h \
- web_event_factory.h
+ web_event_factory.h \
+ webui/webui_controller_factory_qt.h
qtConfig(pepper-plugins) {
diff --git a/src/core/network_delegate_qt.h b/src/core/network_delegate_qt.h
index 590b3b20c..75d141ceb 100644
--- a/src/core/network_delegate_qt.h
+++ b/src/core/network_delegate_qt.h
@@ -73,29 +73,29 @@ public:
const net::CompletionCallback &callback);
// net::NetworkDelegate implementation
- virtual int OnBeforeURLRequest(net::URLRequest* request, const net::CompletionCallback& callback, GURL* newUrl) override;
- virtual void OnURLRequestDestroyed(net::URLRequest* request) override;
- virtual bool OnCanSetCookie(const net::URLRequest&, const std::string&, net::CookieOptions*) override;
- virtual int OnBeforeStartTransaction(net::URLRequest *request, const net::CompletionCallback &callback, net::HttpRequestHeaders *headers) override;
+ int OnBeforeURLRequest(net::URLRequest* request, const net::CompletionCallback& callback, GURL* newUrl) override;
+ void OnURLRequestDestroyed(net::URLRequest* request) override;
+ bool OnCanSetCookie(const net::URLRequest&, const std::string&, net::CookieOptions*) override;
+ int OnBeforeStartTransaction(net::URLRequest *request, const net::CompletionCallback &callback, net::HttpRequestHeaders *headers) override;
virtual void OnBeforeSendHeaders(net::URLRequest* request, const net::ProxyInfo& proxy_info,
const net::ProxyRetryInfoMap& proxy_retry_info, net::HttpRequestHeaders* headers) override;
- virtual void OnStartTransaction(net::URLRequest *request, const net::HttpRequestHeaders &headers) override;
- virtual int OnHeadersReceived(net::URLRequest*, const net::CompletionCallback&, const net::HttpResponseHeaders*, scoped_refptr<net::HttpResponseHeaders>*, GURL*) override;
- virtual void OnBeforeRedirect(net::URLRequest*, const GURL&) override;
- virtual void OnResponseStarted(net::URLRequest*) override;
- virtual void OnNetworkBytesReceived(net::URLRequest*, int64_t) override;
- virtual void OnNetworkBytesSent(net::URLRequest *, int64_t) override;
- virtual void OnCompleted(net::URLRequest*, bool) override;
- virtual void OnPACScriptError(int, const base::string16&) override;
- virtual net::NetworkDelegate::AuthRequiredResponse OnAuthRequired(net::URLRequest*, const net::AuthChallengeInfo&, const AuthCallback&, net::AuthCredentials*) override;
- virtual bool OnCanGetCookies(const net::URLRequest&, const net::CookieList&) override;
- virtual bool OnCanAccessFile(const net::URLRequest& request, const base::FilePath& path) const override;
- virtual bool OnCanEnablePrivacyMode(const GURL&, const GURL&) const override;
- virtual bool OnAreExperimentalCookieFeaturesEnabled() const override;
- virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(const net::URLRequest&, const GURL&, const GURL&) const override;
+ void OnStartTransaction(net::URLRequest *request, const net::HttpRequestHeaders &headers) override;
+ int OnHeadersReceived(net::URLRequest*, const net::CompletionCallback&, const net::HttpResponseHeaders*, scoped_refptr<net::HttpResponseHeaders>*, GURL*) override;
+ void OnBeforeRedirect(net::URLRequest*, const GURL&) override;
+ void OnResponseStarted(net::URLRequest*) override;
+ void OnNetworkBytesReceived(net::URLRequest*, int64_t) override;
+ void OnNetworkBytesSent(net::URLRequest *, int64_t) override;
+ void OnCompleted(net::URLRequest*, bool) override;
+ void OnPACScriptError(int, const base::string16&) override;
+ net::NetworkDelegate::AuthRequiredResponse OnAuthRequired(net::URLRequest*, const net::AuthChallengeInfo&, const AuthCallback&, net::AuthCredentials*) override;
+ bool OnCanGetCookies(const net::URLRequest&, const net::CookieList&) override;
+ bool OnCanAccessFile(const net::URLRequest& request, const base::FilePath& path) const override;
+ bool OnCanEnablePrivacyMode(const GURL&, const GURL&) const override;
+ bool OnAreExperimentalCookieFeaturesEnabled() const override;
+ bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(const net::URLRequest&, const GURL&, const GURL&) const override;
- virtual bool OnCanQueueReportingReport(const url::Origin& origin) const override;
- virtual bool OnCanSendReportingReport(const url::Origin& origin) const override;
+ bool OnCanQueueReportingReport(const url::Origin& origin) const override;
+ bool OnCanSendReportingReport(const url::Origin& origin) const override;
virtual bool OnCanSetReportingClient(const url::Origin& origin,
const GURL& endpoint) const override;
virtual bool OnCanUseReportingClient(const url::Origin& origin,
diff --git a/src/core/qtwebengine_resources.gni b/src/core/qtwebengine_resources.gni
index acf5f1590..6bff6a9a4 100644
--- a/src/core/qtwebengine_resources.gni
+++ b/src/core/qtwebengine_resources.gni
@@ -17,6 +17,9 @@ group("qtwebengine_resources") {
repack("qtwebengine_repack_resources") {
sources = [
"$root_gen_dir/blink/public/resources/blink_resources.pak",
+ "$root_gen_dir/chrome/qt_webengine_resources.pak",
+ "$root_gen_dir/chrome/quota_internals_resources.pak",
+ "$root_gen_dir/chrome/task_scheduler_internals_resources.pak",
"$root_gen_dir/components/components_resources.pak",
"$root_gen_dir/content/content_resources.pak",
"$root_gen_dir/net/net_resources.pak",
@@ -24,6 +27,9 @@ repack("qtwebengine_repack_resources") {
]
output = "$root_out_dir/qtwebengine_resources.pak"
deps = [
+ "//chrome/browser/resources:qt_webengine_resources",
+ "//chrome/browser/resources:quota_internals_resources",
+ "//chrome/browser/resources:task_scheduler_internals_resources",
"//components/resources:components_resources_grit",
"//content:resources_grit",
"//net:net_resources_grit",
diff --git a/src/core/qtwebengine_sources.gni b/src/core/qtwebengine_sources.gni
index d7fe4d70d..6e75a3247 100644
--- a/src/core/qtwebengine_sources.gni
+++ b/src/core/qtwebengine_sources.gni
@@ -45,8 +45,26 @@ source_set("qtwebengine_sources") {
"//chrome/browser/media/webrtc/desktop_media_list.h",
"//chrome/browser/media/webrtc/desktop_streams_registry.cc",
"//chrome/browser/media/webrtc/desktop_streams_registry.h",
+ "//chrome/browser/profiles/profile.cc",
+ "//chrome/browser/profiles/profile.h",
+ "//chrome/browser/ui/webui/devtools_ui.cc",
+ "//chrome/browser/ui/webui/devtools_ui.h",
+ "//chrome/browser/ui/webui/quota_internals/quota_internals_handler.cc",
+ "//chrome/browser/ui/webui/quota_internals/quota_internals_handler.h",
+ "//chrome/browser/ui/webui/quota_internals/quota_internals_proxy.cc",
+ "//chrome/browser/ui/webui/quota_internals/quota_internals_proxy.h",
+ "//chrome/browser/ui/webui/quota_internals/quota_internals_types.cc",
+ "//chrome/browser/ui/webui/quota_internals/quota_internals_types.h",
+ "//chrome/browser/ui/webui/quota_internals/quota_internals_ui.cc",
+ "//chrome/browser/ui/webui/quota_internals/quota_internals_ui.h",
+ "//chrome/browser/ui/webui/task_scheduler_internals/task_scheduler_internals_ui.cc",
+ "//chrome/browser/ui/webui/task_scheduler_internals/task_scheduler_internals_ui.h",
"//chrome/common/chrome_switches.cc",
"//chrome/common/chrome_switches.h",
+ "//chrome/common/pref_names.cc",
+ "//chrome/common/pref_names.h",
+ "//chrome/common/url_constants.cc",
+ "//chrome/common/url_constants.h",
"//components/prefs/in_memory_pref_store.cc",
"//components/prefs/in_memory_pref_store.h",
"//extensions/common/constants.cc",
@@ -55,11 +73,14 @@ source_set("qtwebengine_sources") {
"//extensions/common/url_pattern.h",
]
- if (enable_spellcheck) {
+ if (is_linux) {
sources += [
- "//chrome/common/pref_names.cc",
- "//chrome/common/pref_names.h",
+ "//chrome/browser/ui/webui/sandbox_internals_ui.cc",
+ "//chrome/browser/ui/webui/sandbox_internals_ui.h",
]
+ }
+
+ if (enable_spellcheck) {
deps += [
":qtwebengine_spellcheck_sources",
"//chrome/tools/convert_dict",
diff --git a/src/core/quota_permission_context_qt.cpp b/src/core/quota_permission_context_qt.cpp
new file mode 100644
index 000000000..10249bbf0
--- /dev/null
+++ b/src/core/quota_permission_context_qt.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "quota_permission_context_qt.h"
+
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/web_contents.h"
+#include "quota_permission_controller.h"
+#include "quota_permission_controller_p.h"
+#include "web_contents_delegate_qt.h"
+#include "web_contents_view_qt.h"
+
+using content::QuotaPermissionContext;
+using content::RenderFrameHost;
+using content::StorageQuotaParams;
+using content::WebContents;
+
+namespace QtWebEngineCore {
+
+void QuotaPermissionContextQt::RequestQuotaPermission(const StorageQuotaParams &params, int render_process_id, const PermissionCallback &callback)
+{
+ if (params.storage_type != storage::kStorageTypePersistent) {
+ // For now we only support requesting quota with this interface
+ // for Persistent storage type.
+ callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
+ return;
+ }
+
+ if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI, FROM_HERE,
+ base::Bind(&QuotaPermissionContextQt::RequestQuotaPermission, this,
+ params, render_process_id, callback));
+ return;
+ }
+
+ RenderFrameHost *renderFrameHost = RenderFrameHost::FromID(render_process_id, params.render_frame_id);
+ if (!renderFrameHost)
+ return;
+
+ WebContents *webContents = WebContents::FromRenderFrameHost(renderFrameHost);
+ if (!webContents)
+ return;
+
+ WebContentsAdapterClient *client = WebContentsViewQt::from(static_cast<content::WebContentsImpl *>(webContents)->GetView())->client();
+ if (!client)
+ return;
+
+ QSharedPointer<QuotaPermissionController> controller(new QuotaPermissionController(new QuotaPermissionControllerPrivate(this, params, callback)));
+ client->runQuotaPermissionRequest(controller);
+}
+
+void QuotaPermissionContextQt::dispatchCallbackOnIOThread(const PermissionCallback &callback,
+ QuotaPermissionContext::QuotaPermissionResponse response)
+{
+ if (callback.is_null())
+ return;
+
+ if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)) {
+ content::BrowserThread::PostTask(
+ content::BrowserThread::IO, FROM_HERE,
+ base::Bind(&QuotaPermissionContextQt::dispatchCallbackOnIOThread,
+ this, callback, response));
+ return;
+ }
+
+ callback.Run(response);
+}
+
+} // namespace QtWebEngineCore
diff --git a/src/core/quota_permission_context_qt.h b/src/core/quota_permission_context_qt.h
new file mode 100644
index 000000000..99e07eec7
--- /dev/null
+++ b/src/core/quota_permission_context_qt.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QUOTA_PERMISSION_CONTEXT_QT_H
+#define QUOTA_PERMISSION_CONTEXT_QT_H
+
+#include "content/public/browser/quota_permission_context.h"
+
+#include <QtCore/qcompilerdetection.h> // Needed for override
+
+namespace QtWebEngineCore {
+
+class QuotaPermissionContextQt : public content::QuotaPermissionContext {
+public:
+ void RequestQuotaPermission(const content::StorageQuotaParams &params,
+ int render_process_id,
+ const PermissionCallback &callback) override;
+
+ void dispatchCallbackOnIOThread(const PermissionCallback &callback,
+ QuotaPermissionContext::QuotaPermissionResponse response);
+};
+
+} // namespace QtWebEngineCore
+
+#endif // QUOTA_PERMISSION_CONTEXT_QT_H
diff --git a/src/core/quota_permission_controller.cpp b/src/core/quota_permission_controller.cpp
new file mode 100644
index 000000000..59fc6198d
--- /dev/null
+++ b/src/core/quota_permission_controller.cpp
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "quota_permission_controller.h"
+#include "quota_permission_controller_p.h"
+
+#include "quota_permission_context_qt.h"
+#include "type_conversion.h"
+
+namespace QtWebEngineCore {
+
+QuotaPermissionControllerPrivate::QuotaPermissionControllerPrivate(QuotaPermissionContextQt *context,
+ const content::StorageQuotaParams &params,
+ const content::QuotaPermissionContext::PermissionCallback &callback)
+ : m_context(context),
+ m_originUrl(toQt(params.origin_url)),
+ m_requestedSize(params.requested_size),
+ m_callback(callback)
+{
+}
+
+QuotaPermissionControllerPrivate::~QuotaPermissionControllerPrivate()
+{
+}
+
+QuotaPermissionController::QuotaPermissionController(QuotaPermissionControllerPrivate *controllerPrivate)
+ : d(controllerPrivate)
+ , m_answered(false)
+{
+}
+
+QuotaPermissionController::~QuotaPermissionController()
+{
+}
+
+void QuotaPermissionController::accept()
+{
+ if (!m_answered) {
+ d->m_context->dispatchCallbackOnIOThread(d->m_callback, QuotaPermissionContextQt::QUOTA_PERMISSION_RESPONSE_ALLOW);
+ m_answered = true;
+ }
+}
+
+void QuotaPermissionController::cancel()
+{
+ if (!m_answered) {
+ d->m_context->dispatchCallbackOnIOThread(d->m_callback, QuotaPermissionContextQt::QUOTA_PERMISSION_RESPONSE_DISALLOW);
+ m_answered = true;
+ }
+}
+
+QUrl QuotaPermissionController::origin()
+{
+ return d->m_originUrl;
+}
+
+qint64 QuotaPermissionController::requestedSize()
+{
+ return d->m_requestedSize;
+}
+
+} // namespace QtWebEngineCore
diff --git a/src/core/quota_permission_controller.h b/src/core/quota_permission_controller.h
new file mode 100644
index 000000000..36f751c2c
--- /dev/null
+++ b/src/core/quota_permission_controller.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QUOTA_PERMISSION_CONTROLLER_H
+#define QUOTA_PERMISSION_CONTROLLER_H
+
+#include "qtwebenginecoreglobal.h"
+#include <QtCore/qscopedpointer.h>
+#include <QtCore/qurl.h>
+
+namespace QtWebEngineCore {
+
+class QuotaPermissionContextQt;
+class QuotaPermissionControllerPrivate;
+
+class QWEBENGINE_EXPORT QuotaPermissionController {
+public:
+ QuotaPermissionController(QuotaPermissionControllerPrivate *controllerPrivate);
+ ~QuotaPermissionController();
+
+ void accept();
+ void cancel();
+
+ QUrl origin();
+ qint64 requestedSize();
+
+private:
+ QScopedPointer<QuotaPermissionControllerPrivate> d;
+ bool m_answered;
+};
+
+} // namespace QtWebEngineCore
+
+#endif // QUOTA_PERMISSION_CONTROLLER_H
diff --git a/src/core/quota_permission_controller_p.h b/src/core/quota_permission_controller_p.h
new file mode 100644
index 000000000..c00ae42c9
--- /dev/null
+++ b/src/core/quota_permission_controller_p.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QUOTA_PERMISSION_CONTROLLER_P_H
+#define QUOTA_PERMISSION_CONTROLLER_P_H
+
+#include "quota_permission_context_qt.h"
+#include <QtCore/qurl.h>
+
+namespace QtWebEngineCore {
+
+class QuotaPermissionControllerPrivate {
+public:
+ QuotaPermissionControllerPrivate(QuotaPermissionContextQt *context,
+ const content::StorageQuotaParams &params,
+ const content::QuotaPermissionContext::PermissionCallback &callback);
+ ~QuotaPermissionControllerPrivate();
+
+private:
+ scoped_refptr<QuotaPermissionContextQt> m_context;
+ QUrl m_originUrl;
+ qint64 m_requestedSize;
+ content::QuotaPermissionContext::PermissionCallback m_callback;
+
+ friend class QuotaPermissionController;
+};
+
+} // namespace QtWebEngineCore
+
+#endif // QUOTA_PERMISSION_CONTROLLER_P_H
diff --git a/src/core/renderer/web_channel_ipc_transport.cpp b/src/core/renderer/web_channel_ipc_transport.cpp
index cec8344b6..aaf831fb6 100644
--- a/src/core/renderer/web_channel_ipc_transport.cpp
+++ b/src/core/renderer/web_channel_ipc_transport.cpp
@@ -66,7 +66,7 @@ public:
private:
content::RenderView *GetRenderView(v8::Isolate *isolate);
WebChannelTransport() { }
- virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate *isolate) override;
+ gin::ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate *isolate) override;
bool NativeQtSendMessage(gin::Arguments *args)
{
diff --git a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp b/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp
index afc2ea8fa..279a03d42 100644
--- a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp
+++ b/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp
@@ -138,7 +138,7 @@ void ResourceDispatcherHostLoginDelegateQt::destroy()
static void LaunchURL(const GURL& url, int render_process_id,
const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
- ui::PageTransition page_transition, bool is_main_frame)
+ ui::PageTransition page_transition, bool is_main_frame, bool has_user_gesture)
{
Q_UNUSED(render_process_id);
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
@@ -146,16 +146,13 @@ static void LaunchURL(const GURL& url, int render_process_id,
if (!webContents)
return;
WebContentsDelegateQt *contentsDelegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate());
- contentsDelegate->launchExternalURL(toQt(url), page_transition, is_main_frame);
+ contentsDelegate->launchExternalURL(toQt(url), page_transition, is_main_frame, has_user_gesture);
}
bool ResourceDispatcherHostDelegateQt::HandleExternalProtocol(const GURL& url, content::ResourceRequestInfo* info)
{
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 (!info->HasUserGesture())
- return false;
content::BrowserThread::PostTask(
content::BrowserThread::UI,
@@ -164,7 +161,8 @@ bool ResourceDispatcherHostDelegateQt::HandleExternalProtocol(const GURL& url, c
info->GetChildID(),
info->GetWebContentsGetterForRequest(),
info->GetPageTransition(),
- info->IsMainFrame())
+ info->IsMainFrame(),
+ info->HasUserGesture())
);
return true;
}
diff --git a/src/core/ssl_host_state_delegate_qt.h b/src/core/ssl_host_state_delegate_qt.h
index 7cc63b339..6d05ea366 100644
--- a/src/core/ssl_host_state_delegate_qt.h
+++ b/src/core/ssl_host_state_delegate_qt.h
@@ -61,14 +61,14 @@ public:
~SSLHostStateDelegateQt();
// content::SSLHostStateDelegate implementation:
- virtual void AllowCert(const std::string &, const net::X509Certificate &cert, net::CertStatus error) override;
- virtual void Clear(const base::Callback<bool(const std::string&)>& host_filter) override;
+ void AllowCert(const std::string &, const net::X509Certificate &cert, net::CertStatus error) override;
+ void Clear(const base::Callback<bool(const std::string&)>& host_filter) override;
virtual CertJudgment QueryPolicy(const std::string &host, const net::X509Certificate &cert,
net::CertStatus error,bool *expired_previous_decision) override;
- virtual void HostRanInsecureContent(const std::string& host, int child_id, InsecureContentType content_type) override;
- virtual bool DidHostRunInsecureContent(const std::string& host, int child_id, InsecureContentType content_type) const override;
- virtual void RevokeUserAllowExceptions(const std::string &host) override;
- virtual bool HasAllowException(const std::string &host) const override;
+ void HostRanInsecureContent(const std::string& host, int child_id, InsecureContentType content_type) override;
+ bool DidHostRunInsecureContent(const std::string& host, int child_id, InsecureContentType content_type) const override;
+ void RevokeUserAllowExceptions(const std::string &host) override;
+ bool HasAllowException(const std::string &host) const override;
private:
std::map<std::string, CertPolicy> m_certPolicyforHost;
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
index 4280dbfe1..47bef1b21 100644
--- a/src/core/web_contents_adapter_client.h
+++ b/src/core/web_contents_adapter_client.h
@@ -64,6 +64,7 @@ class BrowserContextAdapter;
class ColorChooserController;
class FilePickerController;
class JavaScriptDialogController;
+class QuotaPermissionController;
class RenderWidgetHostViewQt;
class RenderWidgetHostViewQtDelegate;
class RenderWidgetHostViewQtDelegateClient;
@@ -409,6 +410,7 @@ public:
virtual void runGeolocationPermissionRequest(const QUrl &securityOrigin) = 0;
virtual void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) = 0;
virtual void runMouseLockPermissionRequest(const QUrl &securityOrigin) = 0;
+ virtual void runQuotaPermissionRequest(QSharedPointer<QuotaPermissionController>) = 0;
virtual WebEngineSettings *webEngineSettings() const = 0;
virtual void showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) = 0;
virtual void hideValidationMessage() = 0;
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index ad0e7ad6d..31180a1c1 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -499,14 +499,45 @@ void WebContentsDelegateQt::requestGeolocationPermission(const QUrl &requestingO
extern WebContentsAdapterClient::NavigationType pageTransitionToNavigationType(ui::PageTransition transition);
-void WebContentsDelegateQt::launchExternalURL(const QUrl &url, ui::PageTransition page_transition, bool is_main_frame)
+void WebContentsDelegateQt::launchExternalURL(const QUrl &url, ui::PageTransition page_transition, bool is_main_frame, bool has_user_gesture)
{
- int navigationRequestAction = WebContentsAdapterClient::AcceptRequest;
- m_viewClient->navigationRequested(pageTransitionToNavigationType(page_transition), url, navigationRequestAction, is_main_frame);
+ WebEngineSettings *settings = m_viewClient->webEngineSettings();
+ bool navigationAllowedByPolicy = false;
+ bool navigationRequestAccepted = true;
+
+ switch (settings->unknownUrlSchemePolicy()) {
+ case WebEngineSettings::DisallowUnknownUrlSchemes:
+ break;
+ case WebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction:
+ navigationAllowedByPolicy = has_user_gesture;
+ break;
+ case WebEngineSettings::AllowAllUnknownUrlSchemes:
+ navigationAllowedByPolicy = true;
+ break;
+ default:
+ Q_UNREACHABLE();
+ }
+
+ if (navigationAllowedByPolicy) {
+ int navigationRequestAction = WebContentsAdapterClient::AcceptRequest;
+ m_viewClient->navigationRequested(pageTransitionToNavigationType(page_transition), url, navigationRequestAction, is_main_frame);
+ navigationRequestAccepted = navigationRequestAction == WebContentsAdapterClient::AcceptRequest;
#ifndef QT_NO_DESKTOPSERVICES
- if (navigationRequestAction == WebContentsAdapterClient::AcceptRequest)
- QDesktopServices::openUrl(url);
+ if (navigationRequestAccepted)
+ QDesktopServices::openUrl(url);
#endif
+ }
+
+ if (!navigationAllowedByPolicy || !navigationRequestAccepted) {
+ if (!navigationAllowedByPolicy)
+ didFailLoad(url, 420, QStringLiteral("Launching external protocol forbidden by WebEngineSettings::UnknownUrlSchemePolicy"));
+ else
+ didFailLoad(url, 420, QStringLiteral("Launching external protocol suppressed by WebContentsAdapterClient::navigationRequested"));
+ if (settings->testAttribute(WebEngineSettings::ErrorPageEnabled)) {
+ EmitLoadStarted(toQt(GURL(content::kUnreachableWebDataURL)), true);
+ m_viewClient->webContentsAdapter()->load(toQt(GURL(content::kUnreachableWebDataURL)));
+ }
+ }
}
void WebContentsDelegateQt::ShowValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view, const base::string16 &main_text, const base::string16 &sub_text)
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
index 2e37c498a..dab693780 100644
--- a/src/core/web_contents_delegate_qt.h
+++ b/src/core/web_contents_delegate_qt.h
@@ -142,7 +142,7 @@ public:
void overrideWebPreferences(content::WebContents *, content::WebPreferences*);
void allowCertificateError(const QSharedPointer<CertificateErrorController> &) ;
void requestGeolocationPermission(const QUrl &requestingOrigin);
- void launchExternalURL(const QUrl &url, ui::PageTransition page_transition, bool is_main_frame);
+ void launchExternalURL(const QUrl &url, ui::PageTransition page_transition, bool is_main_frame, bool has_user_gesture);
FaviconManager *faviconManager();
void setSavePageInfo(const SavePageInfo &spi) { m_savePageInfo = spi; }
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 2339537aa..8eb9075bc 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -88,6 +88,8 @@
#include "type_conversion.h"
#include "surface_factory_qt.h"
#include "web_engine_library_info.h"
+#include "webui/webui_controller_factory_qt.h"
+
#include <QFileInfo>
#include <QGuiApplication>
#include <QOffscreenSurface>
@@ -509,6 +511,8 @@ WebEngineContext::WebEngineContext()
#if BUILDFLAG(ENABLE_BASIC_PRINTING)
m_printJobManager.reset(new printing::PrintJobManager());
#endif // defined(ENABLE_BASIC_PRINTING)
+
+ content::WebUIControllerFactory::RegisterFactory(WebUIControllerFactoryQt::GetInstance());
}
#if BUILDFLAG(ENABLE_BASIC_PRINTING)
diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp
index 498c4e799..44ecaf2ef 100644
--- a/src/core/web_engine_settings.cpp
+++ b/src/core/web_engine_settings.cpp
@@ -110,6 +110,7 @@ WebEngineSettings::WebEngineSettings(WebEngineSettings *_parentSettings)
: m_adapter(0)
, m_batchTimer(new BatchTimer(this))
, parentSettings(_parentSettings)
+ , m_unknownUrlSchemePolicy(WebEngineSettings::InheritedUnknownUrlSchemePolicy)
{
if (parentSettings)
parentSettings->childSettings.insert(this);
@@ -212,6 +213,22 @@ QString WebEngineSettings::defaultTextEncoding() const
return m_defaultEncoding.isEmpty()? parentSettings->defaultTextEncoding() : m_defaultEncoding;
}
+void WebEngineSettings::setUnknownUrlSchemePolicy(WebEngineSettings::UnknownUrlSchemePolicy policy)
+{
+ m_unknownUrlSchemePolicy = policy;
+}
+
+WebEngineSettings::UnknownUrlSchemePolicy WebEngineSettings::unknownUrlSchemePolicy() const
+{
+ // value InheritedUnknownUrlSchemePolicy means it is taken from parent, if possible. If there
+ // is no parent, then AllowUnknownUrlSchemesFromUserInteraction (the default behavior) is used.
+ if (m_unknownUrlSchemePolicy != InheritedUnknownUrlSchemePolicy)
+ return m_unknownUrlSchemePolicy;
+ if (parentSettings)
+ return parentSettings->unknownUrlSchemePolicy();
+ return AllowUnknownUrlSchemesFromUserInteraction;
+}
+
void WebEngineSettings::initDefaults()
{
if (s_defaultAttributes.isEmpty()) {
@@ -284,6 +301,7 @@ void WebEngineSettings::initDefaults()
}
m_defaultEncoding = QStringLiteral("ISO-8859-1");
+ m_unknownUrlSchemePolicy = InheritedUnknownUrlSchemePolicy;
}
void WebEngineSettings::scheduleApply()
diff --git a/src/core/web_engine_settings.h b/src/core/web_engine_settings.h
index 18963344a..ea647a61f 100644
--- a/src/core/web_engine_settings.h
+++ b/src/core/web_engine_settings.h
@@ -107,6 +107,14 @@ public:
DefaultFixedFontSize
};
+ // Must match the values from the public API in qwebenginesettings.h.
+ enum UnknownUrlSchemePolicy {
+ InheritedUnknownUrlSchemePolicy = 0,
+ DisallowUnknownUrlSchemes = 1,
+ AllowUnknownUrlSchemesFromUserInteraction,
+ AllowAllUnknownUrlSchemes
+ };
+
explicit WebEngineSettings(WebEngineSettings *parentSettings = 0);
~WebEngineSettings();
@@ -129,6 +137,9 @@ public:
void setDefaultTextEncoding(const QString &encoding);
QString defaultTextEncoding() const;
+ void setUnknownUrlSchemePolicy(UnknownUrlSchemePolicy policy);
+ UnknownUrlSchemePolicy unknownUrlSchemePolicy() const;
+
void initDefaults();
void scheduleApply();
@@ -155,6 +166,7 @@ private:
static QHash<Attribute, bool> s_defaultAttributes;
static QHash<FontFamily, QString> s_defaultFontFamilies;
static QHash<FontSize, int> s_defaultFontSizes;
+ UnknownUrlSchemePolicy m_unknownUrlSchemePolicy;
friend class BatchTimer;
friend class WebContentsAdapter;
diff --git a/src/core/webui/webui_controller_factory_qt.cpp b/src/core/webui/webui_controller_factory_qt.cpp
new file mode 100644
index 000000000..3b13f03b8
--- /dev/null
+++ b/src/core/webui/webui_controller_factory_qt.cpp
@@ -0,0 +1,219 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// Based on chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc:
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webui_controller_factory_qt.h"
+
+#include "base/bind.h"
+#include "base/location.h"
+#include "base/threading/thread_task_runner_handle.h"
+#include "build/build_config.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/devtools_ui.h"
+#include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h"
+#include "chrome/browser/ui/webui/task_scheduler_internals/task_scheduler_internals_ui.h"
+#include "chrome/common/url_constants.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_ui.h"
+#include "content/public/common/content_client.h"
+#include "content/public/common/url_utils.h"
+#include "extensions/features/features.h"
+#include "media/media_features.h"
+#include "ppapi/features/features.h"
+#include "printing/features/features.h"
+#include "ui/web_dialogs/web_dialog_ui.h"
+#include "url/gurl.h"
+
+#if defined(OS_LINUX) || defined(OS_ANDROID)
+#include "chrome/browser/ui/webui/sandbox_internals_ui.h"
+#endif
+
+// The Following WebUIs are disabled because they currently doesn't build
+// or doesn't work, but would be interesting for us if they did:
+
+// #include "chrome/browser/ui/webui/inspect_ui.h"
+// #include "chrome/browser/ui/webui/user_actions/user_actions_ui.h"
+
+// #if BUILDFLAG(ENABLE_WEBRTC)
+// #include "chrome/browser/ui/webui/media/webrtc_logs_ui.h"
+// #endif
+
+// #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
+// #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
+// #endif
+
+// #if defined(USE_NSS_CERTS) && defined(USE_AURA)
+// #include "chrome/browser/ui/webui/certificate_viewer_ui.h"
+// #endif
+
+// #if BUILDFLAG(ENABLE_EXTENSIONS)
+// #include "chrome/browser/extensions/extension_web_ui.h"
+// #include "chrome/browser/ui/webui/extensions/extensions_ui.h"
+// #include "chrome/common/extensions/extension_constants.h"
+// #include "extensions/browser/extension_registry.h"
+// #include "extensions/browser/extension_system.h"
+// #include "extensions/common/constants.h"
+// #include "extensions/common/extension.h"
+// #include "extensions/common/feature_switch.h"
+// #include "extensions/common/manifest.h"
+// #endif
+
+using content::WebUI;
+using content::WebUIController;
+
+namespace {
+
+// A function for creating a new WebUI. The caller owns the return value, which
+// may be NULL (for example, if the URL refers to an non-existent extension).
+typedef WebUIController* (*WebUIFactoryFunction)(WebUI *web_ui, const GURL &url);
+
+// Template for defining WebUIFactoryFunction.
+template<class T>
+WebUIController *NewWebUI(WebUI *web_ui, const GURL &/*url*/)
+{
+ return new T(web_ui);
+}
+
+// Returns a function that can be used to create the right type of WebUI for a
+// tab, based on its URL. Returns NULL if the URL doesn't have WebUI associated
+// with it.
+WebUIFactoryFunction GetWebUIFactoryFunction(WebUI *web_ui, Profile *profile, const GURL &url)
+{
+ // This will get called a lot to check all URLs, so do a quick check of other
+ // schemes to filter out most URLs.
+ if (!content::HasWebUIScheme(url))
+ return NULL;
+
+ // We must compare hosts only since some of the Web UIs append extra stuff
+ // after the host name.
+ if (url.host() == chrome::kChromeUIQuotaInternalsHost)
+ return &NewWebUI<QuotaInternalsUI>;
+ if (url.host_piece() == chrome::kChromeUITaskSchedulerInternalsHost)
+ return &NewWebUI<TaskSchedulerInternalsUI>;
+
+ if (url.SchemeIs(content::kChromeDevToolsScheme)) {
+// if (!DevToolsUIBindings::IsValidFrontendURL(url))
+// return nullptr;
+ return &NewWebUI<DevToolsUI>;
+ }
+
+// if (url.host_piece() == chrome::kChromeUIUserActionsHost)
+// return &NewWebUI<UserActionsUI>;
+// if (url.host_piece() == chrome::kChromeUIInspectHost)
+// return &NewWebUI<InspectUI>;
+//
+//#if defined(USE_NSS_CERTS) && defined(USE_AURA)
+// if (url.host_piece() == chrome::kChromeUICertificateViewerHost)
+// return &NewWebUI<CertificateViewerUI>;
+//#endif // USE_NSS_CERTS && USE_AURA
+//#if BUILDFLAG(ENABLE_EXTENSIONS)
+// if (url.host_piece() == chrome::kChromeUIExtensionsFrameHost)
+// return &NewWebUI<extensions::ExtensionsUI>;
+//#endif
+//#if BUILDFLAG(ENABLE_PLUGINS)
+// if (url.host_piece() == chrome::kChromeUIFlashHost)
+// return &NewWebUI<FlashUI>;
+//#endif
+//#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
+// if (url.host_piece() == chrome::kChromeUIPrintHost &&
+// !profile->GetPrefs()->GetBoolean(prefs::kPrintPreviewDisabled)) {
+// return &NewWebUI<PrintPreviewUI>;
+// }
+//#endif
+//#if BUILDFLAG(ENABLE_WEBRTC)
+// if (url.host_piece() == chrome::kChromeUIWebRtcLogsHost)
+// return &NewWebUI<WebRtcLogsUI>;
+//#endif
+#if defined(OS_LINUX) || defined(OS_ANDROID)
+ if (url.host_piece() == chrome::kChromeUISandboxHost)
+ return &NewWebUI<SandboxInternalsUI>;
+#endif
+ return nullptr;
+}
+
+} // namespace
+
+namespace QtWebEngineCore {
+
+WebUI::TypeID WebUIControllerFactoryQt::GetWebUIType(content::BrowserContext *browser_context, const GURL &url) const
+{
+ Profile *profile = Profile::FromBrowserContext(browser_context);
+ WebUIFactoryFunction function = GetWebUIFactoryFunction(nullptr, profile, url);
+ return function ? reinterpret_cast<WebUI::TypeID>(function) : WebUI::kNoWebUI;
+}
+
+bool WebUIControllerFactoryQt::UseWebUIForURL(content::BrowserContext *browser_context, const GURL &url) const
+{
+ return GetWebUIType(browser_context, url) != WebUI::kNoWebUI;
+}
+
+bool WebUIControllerFactoryQt::UseWebUIBindingsForURL(content::BrowserContext *browser_context, const GURL &url) const
+{
+ return UseWebUIForURL(browser_context, url);
+}
+
+WebUIController *WebUIControllerFactoryQt::CreateWebUIControllerForURL(WebUI *web_ui, const GURL &url) const
+{
+ Profile *profile = Profile::FromWebUI(web_ui);
+ WebUIFactoryFunction function = GetWebUIFactoryFunction(web_ui, profile, url);
+ if (!function)
+ return nullptr;
+
+ return (*function)(web_ui, url);
+}
+
+// static
+WebUIControllerFactoryQt *WebUIControllerFactoryQt::GetInstance()
+{
+ return base::Singleton<WebUIControllerFactoryQt>::get();
+}
+
+WebUIControllerFactoryQt::WebUIControllerFactoryQt()
+{
+}
+
+WebUIControllerFactoryQt::~WebUIControllerFactoryQt()
+{
+}
+
+} // namespace QtWebEngineCore
diff --git a/src/core/webui/webui_controller_factory_qt.h b/src/core/webui/webui_controller_factory_qt.h
new file mode 100644
index 000000000..440dd5a13
--- /dev/null
+++ b/src/core/webui/webui_controller_factory_qt.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WEB_UI_CONTROLLER_FACTORY_QT_H_
+#define WEB_UI_CONTROLLER_FACTORY_QT_H_
+
+#include "base/macros.h"
+#include "base/memory/singleton.h"
+#include "components/favicon_base/favicon_callback.h"
+#include "content/public/browser/web_ui.h"
+#include "content/public/browser/web_ui_controller_factory.h"
+#include "ui/base/layout.h"
+
+class Profile;
+
+namespace base {
+class RefCountedMemory;
+}
+
+namespace QtWebEngineCore {
+
+class WebUIControllerFactoryQt : public content::WebUIControllerFactory {
+public:
+ content::WebUI::TypeID GetWebUIType(content::BrowserContext *browserContext, const GURL &url) const override;
+ bool UseWebUIForURL(content::BrowserContext *browserContext, const GURL &url) const override;
+ bool UseWebUIBindingsForURL(content::BrowserContext *browserContext, const GURL &url) const override;
+ content::WebUIController *CreateWebUIControllerForURL(content::WebUI *webUi, const GURL &url) const override;
+
+ static WebUIControllerFactoryQt *GetInstance();
+
+protected:
+ WebUIControllerFactoryQt();
+ ~WebUIControllerFactoryQt() override;
+
+private:
+ friend struct base::DefaultSingletonTraits<WebUIControllerFactoryQt>;
+
+ DISALLOW_COPY_AND_ASSIGN(WebUIControllerFactoryQt);
+};
+
+} // namespace QtWebEngineCore
+
+#endif // WEB_UI_CONTROLLER_FACTORY_QT_H_
diff --git a/src/plugins/qwebengineview/qwebengineview_plugin.h b/src/plugins/qwebengineview/qwebengineview_plugin.h
index 7c6f02e2a..cd0d8b3d5 100644
--- a/src/plugins/qwebengineview/qwebengineview_plugin.h
+++ b/src/plugins/qwebengineview/qwebengineview_plugin.h
@@ -83,17 +83,17 @@ class QWebEngineViewPlugin: public QObject, public QDesignerCustomWidgetInterfac
public:
explicit QWebEngineViewPlugin(QObject *parent = Q_NULLPTR);
- QString name() const Q_DECL_OVERRIDE;
- QString group() const Q_DECL_OVERRIDE;
- QString toolTip() const Q_DECL_OVERRIDE;
- QString whatsThis() const Q_DECL_OVERRIDE;
- QString includeFile() const Q_DECL_OVERRIDE;
- QIcon icon() const Q_DECL_OVERRIDE;
- bool isContainer() const Q_DECL_OVERRIDE;
- QWidget *createWidget(QWidget *parent) Q_DECL_OVERRIDE;
- bool isInitialized() const Q_DECL_OVERRIDE;
- void initialize(QDesignerFormEditorInterface *core) Q_DECL_OVERRIDE;
- QString domXml() const Q_DECL_OVERRIDE;
+ QString name() const override;
+ QString group() const override;
+ QString toolTip() const override;
+ QString whatsThis() const override;
+ QString includeFile() const override;
+ QIcon icon() const override;
+ bool isContainer() const override;
+ QWidget *createWidget(QWidget *parent) override;
+ bool isInitialized() const override;
+ void initialize(QDesignerFormEditorInterface *core) override;
+ QString domXml() const override;
private:
bool m_initialized;
diff --git a/src/webengine/api/qquickwebengineprofile_p.h b/src/webengine/api/qquickwebengineprofile_p.h
index 1828f8085..5be82a4f5 100644
--- a/src/webengine/api/qquickwebengineprofile_p.h
+++ b/src/webengine/api/qquickwebengineprofile_p.h
@@ -77,8 +77,8 @@ public:
void cancelDownload(quint32 downloadId);
void downloadDestroyed(quint32 downloadId);
- void downloadRequested(DownloadItemInfo &info) Q_DECL_OVERRIDE;
- void downloadUpdated(const DownloadItemInfo &info) Q_DECL_OVERRIDE;
+ void downloadRequested(DownloadItemInfo &info) override;
+ void downloadUpdated(const DownloadItemInfo &info) override;
// QQmlListPropertyHelpers
static void userScripts_append(QQmlListProperty<QQuickWebEngineScript> *p, QQuickWebEngineScript *script);
diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp
index 3ce53337c..fa73af8b2 100644
--- a/src/webengine/api/qquickwebenginesettings.cpp
+++ b/src/webengine/api/qquickwebenginesettings.cpp
@@ -73,6 +73,22 @@ QQuickWebEngineSettings::~QQuickWebEngineSettings()
{ }
/*!
+ \enum QQuickWebEngineSettings::UnknownUrlSchemePolicy
+ \since WebEngine 1.6
+
+ This enum describes how navigation requests to URLs with unknown schemes are handled.
+
+ \value DisallowUnknownUrlSchemes
+ Disallows all navigation requests to URLs with unknown schemes.
+ \value AllowUnknownUrlSchemesFromUserInteraction
+ Allows navigation requests to URLs with unknown schemes that are issued from
+ user-interaction (like a mouse-click), whereas other navigation requests (for example
+ from JavaScript) are suppressed.
+ \value AllowAllUnknownUrlSchemes
+ Allows all navigation requests to URLs with unknown schemes.
+*/
+
+/*!
\qmlproperty bool WebEngineSettings::autoLoadImages
Automatically loads images on web pages.
@@ -395,6 +411,22 @@ QString QQuickWebEngineSettings::defaultTextEncoding() const
return d_ptr->defaultTextEncoding();
}
+ASSERT_ENUMS_MATCH(QQuickWebEngineSettings::DisallowUnknownUrlSchemes, WebEngineSettings::DisallowUnknownUrlSchemes)
+ASSERT_ENUMS_MATCH(QQuickWebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction, WebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction)
+ASSERT_ENUMS_MATCH(QQuickWebEngineSettings::AllowAllUnknownUrlSchemes, WebEngineSettings::AllowAllUnknownUrlSchemes)
+
+/*!
+ \qmlproperty WebEngineSettings::UnknownUrlSchemePolicy WebEngineSettings::unknownUrlSchemePolicy
+ \since QtWebEngine 1.6
+ Specifies how navigation requests to URLs with unknown schemes are handled.
+
+ Default is \l{QWebEngineSettings::UnknownUrlSchemePolicy}{WebEngineSettings.AllowUnknownUrlSchemesFromUserInteraction}.
+*/
+QQuickWebEngineSettings::UnknownUrlSchemePolicy QQuickWebEngineSettings::unknownUrlSchemePolicy() const
+{
+ return static_cast<QQuickWebEngineSettings::UnknownUrlSchemePolicy>(d_ptr->unknownUrlSchemePolicy());
+}
+
void QQuickWebEngineSettings::setAutoLoadImages(bool on)
{
bool wasOn = d_ptr->testAttribute(WebEngineSettings::AutoLoadImages);
@@ -599,6 +631,15 @@ void QQuickWebEngineSettings::setShowScrollBars(bool on)
Q_EMIT showScrollBarsChanged();
}
+void QQuickWebEngineSettings::setUnknownUrlSchemePolicy(QQuickWebEngineSettings::UnknownUrlSchemePolicy policy)
+{
+ WebEngineSettings::UnknownUrlSchemePolicy oldPolicy = d_ptr->unknownUrlSchemePolicy();
+ WebEngineSettings::UnknownUrlSchemePolicy newPolicy = static_cast<WebEngineSettings::UnknownUrlSchemePolicy>(policy);
+ d_ptr->setUnknownUrlSchemePolicy(newPolicy);
+ if (oldPolicy != newPolicy)
+ Q_EMIT unknownUrlSchemePolicyChanged();
+}
+
void QQuickWebEngineSettings::setParentSettings(QQuickWebEngineSettings *parentSettings)
{
d_ptr->setParentSettings(parentSettings->d_ptr.data());
diff --git a/src/webengine/api/qquickwebenginesettings_p.h b/src/webengine/api/qquickwebenginesettings_p.h
index a8b11c769..8a405fcd3 100644
--- a/src/webengine/api/qquickwebenginesettings_p.h
+++ b/src/webengine/api/qquickwebenginesettings_p.h
@@ -88,8 +88,17 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineSettings : public QObject {
Q_PROPERTY(bool allowGeolocationOnInsecureOrigins READ allowGeolocationOnInsecureOrigins WRITE setAllowGeolocationOnInsecureOrigins NOTIFY allowGeolocationOnInsecureOriginsChanged REVISION 4 FINAL)
Q_PROPERTY(bool allowWindowActivationFromJavaScript READ allowWindowActivationFromJavaScript WRITE setAllowWindowActivationFromJavaScript NOTIFY allowWindowActivationFromJavaScriptChanged REVISION 5 FINAL)
Q_PROPERTY(bool showScrollBars READ showScrollBars WRITE setShowScrollBars NOTIFY showScrollBarsChanged REVISION 5 FINAL)
+ Q_PROPERTY(UnknownUrlSchemePolicy unknownUrlSchemePolicy READ unknownUrlSchemePolicy WRITE setUnknownUrlSchemePolicy NOTIFY unknownUrlSchemePolicyChanged REVISION 5 FINAL)
public:
+ enum UnknownUrlSchemePolicy {
+ DisallowUnknownUrlSchemes = 1,
+ AllowUnknownUrlSchemesFromUserInteraction,
+ AllowAllUnknownUrlSchemes
+ };
+
+ Q_ENUM(UnknownUrlSchemePolicy)
+
~QQuickWebEngineSettings();
bool autoLoadImages() const;
@@ -117,6 +126,7 @@ public:
bool allowGeolocationOnInsecureOrigins() const;
bool allowWindowActivationFromJavaScript() const;
bool showScrollBars() const;
+ UnknownUrlSchemePolicy unknownUrlSchemePolicy() const;
void setAutoLoadImages(bool on);
void setJavascriptEnabled(bool on);
@@ -143,6 +153,7 @@ public:
void setAllowGeolocationOnInsecureOrigins(bool on);
void setAllowWindowActivationFromJavaScript(bool on);
void setShowScrollBars(bool on);
+ void setUnknownUrlSchemePolicy(UnknownUrlSchemePolicy policy);
signals:
void autoLoadImagesChanged();
@@ -170,6 +181,7 @@ signals:
Q_REVISION(4) void allowGeolocationOnInsecureOriginsChanged();
Q_REVISION(5) void allowWindowActivationFromJavaScriptChanged();
Q_REVISION(5) void showScrollBarsChanged();
+ Q_REVISION(5) void unknownUrlSchemePolicyChanged();
private:
explicit QQuickWebEngineSettings(QQuickWebEngineSettings *parentSettings = 0);
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 78fdd8fa8..c100c1f20 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -45,6 +45,7 @@
#include "certificate_error_controller.h"
#include "file_picker_controller.h"
#include "javascript_dialog_controller.h"
+#include "quota_permission_controller.h"
#include "qquickwebenginehistory_p.h"
#include "qquickwebenginecertificateerror_p.h"
#include "qquickwebenginecontextmenurequest_p.h"
@@ -722,6 +723,13 @@ void QQuickWebEngineViewPrivate::runMouseLockPermissionRequest(const QUrl &secur
adapter->grantMouseLockPermission(false);
}
+void QQuickWebEngineViewPrivate::runQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller)
+{
+ Q_Q(QQuickWebEngineView);
+ QQuickWebEngineQuotaPermissionRequest request(controller);
+ Q_EMIT q->quotaPermissionRequested(request);
+}
+
QObject *QQuickWebEngineViewPrivate::accessibilityParentObject()
{
Q_Q(QQuickWebEngineView);
@@ -1856,5 +1864,34 @@ void QQuickWebEngineFullScreenRequest::reject()
m_viewPrivate->setFullScreenMode(!m_toggleOn);
}
+QQuickWebEngineQuotaPermissionRequest::QQuickWebEngineQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller)
+ : d_ptr(controller)
+{
+}
+
+QQuickWebEngineQuotaPermissionRequest::~QQuickWebEngineQuotaPermissionRequest()
+{
+}
+
+void QQuickWebEngineQuotaPermissionRequest::accept()
+{
+ d_ptr->accept();
+}
+
+void QQuickWebEngineQuotaPermissionRequest::reject()
+{
+ d_ptr->cancel();
+}
+
+QUrl QQuickWebEngineQuotaPermissionRequest::origin() const
+{
+ return d_ptr->origin();
+}
+
+qint64 QQuickWebEngineQuotaPermissionRequest::requestedSize() const
+{
+ return d_ptr->requestedSize();
+}
+
QT_END_NAMESPACE
diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h
index ae0523460..59636188f 100644
--- a/src/webengine/api/qquickwebengineview_p.h
+++ b/src/webengine/api/qquickwebengineview_p.h
@@ -56,6 +56,12 @@
#include <QQuickItem>
#include <QtGui/qcolor.h>
+
+namespace QtWebEngineCore {
+ class QuotaPermissionController;
+}
+
+
QT_BEGIN_NAMESPACE
class QQmlWebChannel;
@@ -98,6 +104,26 @@ private:
const bool m_toggleOn;
};
+class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineQuotaPermissionRequest {
+ Q_GADGET
+ Q_PROPERTY(QUrl origin READ origin CONSTANT FINAL)
+ Q_PROPERTY(qint64 requestedSize READ requestedSize CONSTANT FINAL)
+public:
+ QQuickWebEngineQuotaPermissionRequest() {}
+ QQuickWebEngineQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller);
+ ~QQuickWebEngineQuotaPermissionRequest();
+
+ Q_INVOKABLE void accept();
+ Q_INVOKABLE void reject();
+ QUrl origin() const;
+ qint64 requestedSize() const;
+
+private:
+ QSharedPointer<QtWebEngineCore::QuotaPermissionController> d_ptr;
+};
+
+#define LATEST_WEBENGINEVIEW_REVISION 7
+
class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem {
Q_OBJECT
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged FINAL)
@@ -450,7 +476,7 @@ public:
Q_ENUM(PrintedPageOrientation)
// QmlParserStatus
- virtual void componentComplete() Q_DECL_OVERRIDE;
+ void componentComplete() override;
QQuickWebEngineProfile *profile() const;
void setProfile(QQuickWebEngineProfile *);
@@ -529,18 +555,19 @@ Q_SIGNALS:
Q_REVISION(4) void fileDialogRequested(QQuickWebEngineFileDialogRequest *request);
Q_REVISION(4) void formValidationMessageRequested(QQuickWebEngineFormValidationMessageRequest *request);
Q_REVISION(5) void pdfPrintingFinished(const QString &filePath, bool success);
+ Q_REVISION(7) void quotaPermissionRequested(const QQuickWebEngineQuotaPermissionRequest &request);
#ifdef ENABLE_QML_TESTSUPPORT_API
void testSupportChanged();
#endif
protected:
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- void itemChange(ItemChange, const ItemChangeData &) Q_DECL_OVERRIDE;
- void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE;
- void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE;
- void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemChange(ItemChange, const ItemChangeData &) override;
+ void dragEnterEvent(QDragEnterEvent *e) override;
+ void dragLeaveEvent(QDragLeaveEvent *e) override;
+ void dragMoveEvent(QDragMoveEvent *e) override;
+ void dropEvent(QDropEvent *e) override;
private:
Q_DECLARE_PRIVATE(QQuickWebEngineView)
@@ -557,5 +584,6 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QQuickWebEngineView)
Q_DECLARE_METATYPE(QQuickWebEngineFullScreenRequest)
+Q_DECLARE_METATYPE(QQuickWebEngineQuotaPermissionRequest)
#endif // QQUICKWEBENGINEVIEW_P_H
diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h
index 19ecf5e1f..6ba9f62b8 100644
--- a/src/webengine/api/qquickwebengineview_p_p.h
+++ b/src/webengine/api/qquickwebengineview_p_p.h
@@ -89,66 +89,67 @@ public:
QtWebEngineCore::UIDelegatesManager *ui();
- virtual QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) Q_DECL_OVERRIDE;
- virtual QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegateForPopup(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) Q_DECL_OVERRIDE;
- virtual void titleChanged(const QString&) Q_DECL_OVERRIDE;
- virtual void urlChanged(const QUrl&) Q_DECL_OVERRIDE;
- virtual void iconChanged(const QUrl&) Q_DECL_OVERRIDE;
- virtual void loadProgressChanged(int progress) Q_DECL_OVERRIDE;
- virtual void didUpdateTargetURL(const QUrl&) Q_DECL_OVERRIDE;
- virtual void selectionChanged() Q_DECL_OVERRIDE { }
- virtual void recentlyAudibleChanged(bool recentlyAudible) Q_DECL_OVERRIDE;
- virtual QRectF viewportRect() const Q_DECL_OVERRIDE;
- virtual qreal dpiScale() const Q_DECL_OVERRIDE;
- virtual QColor backgroundColor() const Q_DECL_OVERRIDE;
- virtual void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) Q_DECL_OVERRIDE;
- virtual void loadCommitted() Q_DECL_OVERRIDE;
- virtual void loadVisuallyCommitted() Q_DECL_OVERRIDE;
- virtual void loadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()) Q_DECL_OVERRIDE;
- virtual void focusContainer() Q_DECL_OVERRIDE;
- virtual void unhandledKeyEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- virtual void adoptNewWindow(QSharedPointer<QtWebEngineCore::WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &, const QUrl &targetUrl) Q_DECL_OVERRIDE;
- virtual bool isBeingAdopted() Q_DECL_OVERRIDE;
- virtual void close() Q_DECL_OVERRIDE;
- virtual void windowCloseRejected() Q_DECL_OVERRIDE;
- virtual void requestFullScreenMode(const QUrl &origin, bool fullscreen) Q_DECL_OVERRIDE;
- virtual bool isFullScreenMode() const Q_DECL_OVERRIDE;
- virtual bool contextMenuRequested(const QtWebEngineCore::WebEngineContextMenuData &) Q_DECL_OVERRIDE;
- virtual void navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame) Q_DECL_OVERRIDE;
- virtual void javascriptDialog(QSharedPointer<QtWebEngineCore::JavaScriptDialogController>) Q_DECL_OVERRIDE;
- virtual void runFileChooser(QSharedPointer<QtWebEngineCore::FilePickerController>) Q_DECL_OVERRIDE;
- virtual void showColorDialog(QSharedPointer<QtWebEngineCore::ColorChooserController>) Q_DECL_OVERRIDE;
- virtual void didRunJavaScript(quint64, const QVariant&) Q_DECL_OVERRIDE;
- virtual void didFetchDocumentMarkup(quint64, const QString&) Q_DECL_OVERRIDE { }
- virtual void didFetchDocumentInnerText(quint64, const QString&) Q_DECL_OVERRIDE { }
- virtual void didFindText(quint64, int) Q_DECL_OVERRIDE;
- virtual void didPrintPage(quint64 requestId, const QByteArray &result) Q_DECL_OVERRIDE;
- virtual void didPrintPageToPdf(const QString &filePath, bool success) Q_DECL_OVERRIDE;
- virtual void passOnFocus(bool reverse) Q_DECL_OVERRIDE;
- virtual void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) Q_DECL_OVERRIDE;
- virtual void authenticationRequired(QSharedPointer<QtWebEngineCore::AuthenticationDialogController>) Q_DECL_OVERRIDE;
- virtual void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) Q_DECL_OVERRIDE;
- virtual void runMouseLockPermissionRequest(const QUrl &securityOrigin) Q_DECL_OVERRIDE;
- virtual QObject *accessibilityParentObject() Q_DECL_OVERRIDE;
- virtual QtWebEngineCore::WebEngineSettings *webEngineSettings() const Q_DECL_OVERRIDE;
- virtual void allowCertificateError(const QSharedPointer<CertificateErrorController> &errorController) Q_DECL_OVERRIDE;
- virtual void runGeolocationPermissionRequest(QUrl const&) Q_DECL_OVERRIDE;
- virtual void showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) Q_DECL_OVERRIDE;
- virtual void hideValidationMessage() Q_DECL_OVERRIDE;
- virtual void moveValidationMessage(const QRect &anchor) Q_DECL_OVERRIDE;
+ QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) override;
+ QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegateForPopup(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) override;
+ void titleChanged(const QString&) override;
+ void urlChanged(const QUrl&) override;
+ void iconChanged(const QUrl&) override;
+ void loadProgressChanged(int progress) override;
+ void didUpdateTargetURL(const QUrl&) override;
+ void selectionChanged() override { }
+ void recentlyAudibleChanged(bool recentlyAudible) override;
+ QRectF viewportRect() const override;
+ qreal dpiScale() const override;
+ QColor backgroundColor() const override;
+ void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) override;
+ void loadCommitted() override;
+ void loadVisuallyCommitted() override;
+ void loadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()) override;
+ void focusContainer() override;
+ void unhandledKeyEvent(QKeyEvent *event) override;
+ void adoptNewWindow(QSharedPointer<QtWebEngineCore::WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &, const QUrl &targetUrl) override;
+ bool isBeingAdopted() override;
+ void close() override;
+ void windowCloseRejected() override;
+ void requestFullScreenMode(const QUrl &origin, bool fullscreen) override;
+ bool isFullScreenMode() const override;
+ bool contextMenuRequested(const QtWebEngineCore::WebEngineContextMenuData &) override;
+ void navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame) override;
+ void javascriptDialog(QSharedPointer<QtWebEngineCore::JavaScriptDialogController>) override;
+ void runFileChooser(QSharedPointer<QtWebEngineCore::FilePickerController>) override;
+ void showColorDialog(QSharedPointer<QtWebEngineCore::ColorChooserController>) override;
+ void didRunJavaScript(quint64, const QVariant&) override;
+ void didFetchDocumentMarkup(quint64, const QString&) override { }
+ void didFetchDocumentInnerText(quint64, const QString&) override { }
+ void didFindText(quint64, int) override;
+ void didPrintPage(quint64 requestId, const QByteArray &result) override;
+ void didPrintPageToPdf(const QString &filePath, bool success) override;
+ void passOnFocus(bool reverse) override;
+ void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) override;
+ void authenticationRequired(QSharedPointer<QtWebEngineCore::AuthenticationDialogController>) override;
+ void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) override;
+ void runMouseLockPermissionRequest(const QUrl &securityOrigin) override;
+ void runQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController>) override;
+ QObject *accessibilityParentObject() override;
+ QtWebEngineCore::WebEngineSettings *webEngineSettings() const override;
+ void allowCertificateError(const QSharedPointer<CertificateErrorController> &errorController) override;
+ void runGeolocationPermissionRequest(QUrl const&) override;
+ void showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) override;
+ void hideValidationMessage() override;
+ void moveValidationMessage(const QRect &anchor) override;
virtual void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus,
- int exitCode) Q_DECL_OVERRIDE;
- virtual void requestGeometryChange(const QRect &geometry) Q_DECL_OVERRIDE { Q_UNUSED(geometry); }
- virtual void updateScrollPosition(const QPointF &position) Q_DECL_OVERRIDE;
- virtual void updateContentsSize(const QSizeF &size) Q_DECL_OVERRIDE;
+ int exitCode) override;
+ void requestGeometryChange(const QRect &geometry) override { Q_UNUSED(geometry); }
+ void updateScrollPosition(const QPointF &position) override;
+ void updateContentsSize(const QSizeF &size) override;
void startDragging(const content::DropData &dropData, Qt::DropActions allowedActions,
- const QPixmap &pixmap, const QPoint &offset) Q_DECL_OVERRIDE;
- virtual bool isEnabled() const Q_DECL_OVERRIDE;
- virtual void setToolTip(const QString &toolTipText) Q_DECL_OVERRIDE;
- const QObject *holdingQObject() const Q_DECL_OVERRIDE;
+ const QPixmap &pixmap, const QPoint &offset) override;
+ bool isEnabled() const override;
+ void setToolTip(const QString &toolTipText) override;
+ const QObject *holdingQObject() const override;
- virtual QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContextAdapter() Q_DECL_OVERRIDE;
- QtWebEngineCore::WebContentsAdapter *webContentsAdapter() Q_DECL_OVERRIDE;
+ QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContextAdapter() override;
+ QtWebEngineCore::WebContentsAdapter *webContentsAdapter() override;
void setDevicePixelRatio(qreal);
void adoptWebContents(QtWebEngineCore::WebContentsAdapter *webContents);
@@ -199,13 +200,13 @@ class QQuickWebEngineViewAccessible : public QAccessibleObject
{
public:
QQuickWebEngineViewAccessible(QQuickWebEngineView *o);
- QAccessibleInterface *parent() const Q_DECL_OVERRIDE;
- int childCount() const Q_DECL_OVERRIDE;
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
- int indexOfChild(const QAccessibleInterface*) const Q_DECL_OVERRIDE;
- QString text(QAccessible::Text) const Q_DECL_OVERRIDE;
- QAccessible::Role role() const Q_DECL_OVERRIDE;
- QAccessible::State state() const Q_DECL_OVERRIDE;
+ QAccessibleInterface *parent() const override;
+ int childCount() const override;
+ QAccessibleInterface *child(int index) const override;
+ int indexOfChild(const QAccessibleInterface*) const override;
+ QString text(QAccessible::Text) const override;
+ QAccessible::Role role() const override;
+ QAccessible::State state() const override;
private:
QQuickWebEngineView *engineView() const { return static_cast<QQuickWebEngineView*>(object()); }
diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc
index 9cd7e3f27..4f0c40e0d 100644
--- a/src/webengine/doc/src/webengineview.qdoc
+++ b/src/webengine/doc/src/webengineview.qdoc
@@ -1297,3 +1297,61 @@
/*! \qmlsignal WebEngineView::navigationRequested(WebEngineNavigationRequest request)
This signal is emitted when the navigation request \a request is issued.
*/
+
+/*!
+ \qmlsignal WebEngineView::quotaPermissionRequested(QuotaPermissionRequest request)
+ \since QtWebEngine 1.7
+
+ This signal is emitted when the web page requests larger persistent storage
+ than the application's current allocation in File System API. The default quota
+ is 0 bytes.
+
+ \sa QuotaPermissionRequest
+*/
+
+/*!
+ \qmltype QuotaPermissionRequest
+ \instantiates QQuickWebEngineQuotaPermissionRequest
+ \inqmlmodule QtWebEngine
+ \since QtWebEngine 1.7
+
+ \brief A utility type for the WebEngineView::quotaPermissionRequested() signal.
+
+ \sa WebEngineView::quotaPermissionRequested()
+*/
+
+/*!
+ \qmlproperty url QuotaPermissionRequest::origin
+ \readonly
+
+ The URL of the web page that issued the quota permission request.
+*/
+
+/*!
+ \qmlproperty qint64 QuotaPermissionRequest::requestedSize
+ \readonly
+
+ Contains the size of the requested disk space in bytes.
+*/
+
+/*!
+ \qmlmethod void QuotaPermissionRequest::accept()
+
+ Accepts the quota permission request.
+
+ \qml
+ WebEngineView {
+ onQuotaPermissionRequested: function(request) {
+ if (request.requestedSize <= 5 * 1024 * 1024)
+ request.accept();
+ else
+ request.reject();
+ }
+ }
+ \endqml
+*/
+
+/*!
+ \qmlmethod void QuotaPermissionRequest::reject()
+ Rejects a quota permission request.
+*/
diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp
index 5ab792699..077762352 100644
--- a/src/webengine/plugin/plugin.cpp
+++ b/src/webengine/plugin/plugin.cpp
@@ -66,13 +66,13 @@ class QtWebEnginePlugin : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- virtual void initializeEngine(QQmlEngine *engine, const char *uri) Q_DECL_OVERRIDE
+ void initializeEngine(QQmlEngine *engine, const char *uri) override
{
Q_UNUSED(uri);
engine->addImageProvider(QQuickWebEngineFaviconProvider::identifier(), new QQuickWebEngineFaviconProvider);
}
- virtual void registerTypes(const char *uri) Q_DECL_OVERRIDE
+ void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebEngine"));
@@ -133,6 +133,8 @@ public:
msgUncreatableType("FileDialogRequest"));
qmlRegisterUncreatableType<QQuickWebEngineFormValidationMessageRequest>(uri, 1, 4, "FormValidationMessageRequest",
msgUncreatableType("FormValidationMessageRequest"));
+ qmlRegisterUncreatableType<QQuickWebEngineQuotaPermissionRequest>(uri, 1, 7, "QuotaPermissionRequest",
+ tr("Cannot create a separate instance of QuotaPermissionRequest"));
}
private:
diff --git a/src/webengine/plugin/plugins.qmltypes b/src/webengine/plugin/plugins.qmltypes
index 321c462b5..e8ec1fa7a 100644
--- a/src/webengine/plugin/plugins.qmltypes
+++ b/src/webengine/plugin/plugins.qmltypes
@@ -119,10 +119,11 @@ Module {
"QtWebEngine/WebEngineDownloadItem 1.2",
"QtWebEngine/WebEngineDownloadItem 1.3",
"QtWebEngine/WebEngineDownloadItem 1.4",
- "QtWebEngine/WebEngineDownloadItem 1.5"
+ "QtWebEngine/WebEngineDownloadItem 1.5",
+ "QtWebEngine/WebEngineDownloadItem 1.6"
]
isCreatable: false
- exportMetaObjectRevisions: [0, 1, 2, 3, 4]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5]
Enum {
name: "DownloadState"
values: {
@@ -195,12 +196,18 @@ Module {
isReadonly: true
}
Property { name: "interruptReasonString"; revision: 4; type: "string"; isReadonly: true }
+ Property { name: "isFinished"; revision: 5; type: "bool"; isReadonly: true }
+ Property { name: "isPaused"; revision: 5; type: "bool"; isReadonly: true }
Signal { name: "savePageFormatChanged"; revision: 2 }
Signal { name: "mimeTypeChanged"; revision: 1 }
Signal { name: "typeChanged"; revision: 3 }
Signal { name: "interruptReasonChanged"; revision: 4 }
+ Signal { name: "isFinishedChanged"; revision: 5 }
+ Signal { name: "isPausedChanged"; revision: 5 }
Method { name: "accept" }
Method { name: "cancel" }
+ Method { name: "pause" }
+ Method { name: "resume" }
}
Component {
name: "QQuickWebEngineFileDialogRequest"
@@ -514,6 +521,14 @@ Module {
]
isCreatable: false
exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5]
+ Enum {
+ name: "UnknownUrlSchemePolicy"
+ values: {
+ "DisallowUnknownUrlSchemes": 1,
+ "AllowUnknownUrlSchemesFromUserInteraction": 2,
+ "AllowAllUnknownUrlSchemes": 3
+ }
+ }
Property { name: "autoLoadImages"; type: "bool" }
Property { name: "javascriptEnabled"; type: "bool" }
Property { name: "javascriptCanOpenWindows"; type: "bool" }
@@ -538,6 +553,7 @@ Module {
Property { name: "allowRunningInsecureContent"; revision: 3; type: "bool" }
Property { name: "allowGeolocationOnInsecureOrigins"; revision: 4; type: "bool" }
Property { name: "allowWindowActivationFromJavaScript"; revision: 5; type: "bool" }
+ Property { name: "unknownUrlSchemePolicy"; revision: 5; type: "UnknownUrlSchemePolicy" }
Signal { name: "fullScreenSupportEnabledChanged"; revision: 1 }
Signal { name: "screenCaptureEnabledChanged"; revision: 2 }
Signal { name: "webGLEnabledChanged"; revision: 2 }
@@ -549,6 +565,7 @@ Module {
Signal { name: "allowRunningInsecureContentChanged"; revision: 3 }
Signal { name: "allowGeolocationOnInsecureOriginsChanged"; revision: 4 }
Signal { name: "allowWindowActivationFromJavaScriptChanged"; revision: 5 }
+ Signal { name: "unknownUrlSchemePolicyChanged"; revision: 5 }
}
Component {
name: "QQuickWebEngineSingleton"
@@ -892,7 +909,6 @@ Module {
Property { name: "audioMuted"; revision: 3; type: "bool" }
Property { name: "recentlyAudible"; revision: 3; type: "bool"; isReadonly: true }
Property { name: "webChannelWorld"; revision: 3; type: "uint" }
- Property { name: "testSupport"; type: "QQuickWebEngineTestSupport"; isPointer: true }
Signal {
name: "loadingChanged"
Parameter { name: "loadRequest"; type: "QQuickWebEngineLoadRequest"; isPointer: true }
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.h b/src/webengine/render_widget_host_view_qt_delegate_quick.h
index 7a08e915b..3a79b20af 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.h
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.h
@@ -52,49 +52,49 @@ class RenderWidgetHostViewQtDelegateQuick : public QQuickItem, public RenderWidg
public:
RenderWidgetHostViewQtDelegateQuick(RenderWidgetHostViewQtDelegateClient *client, bool isPopup);
- virtual void initAsChild(WebContentsAdapterClient* container) Q_DECL_OVERRIDE;
- virtual void initAsPopup(const QRect&) Q_DECL_OVERRIDE;
- virtual QRectF screenRect() const Q_DECL_OVERRIDE;
- virtual QRectF contentsRect() const Q_DECL_OVERRIDE;
- virtual void setKeyboardFocus() Q_DECL_OVERRIDE;
- virtual bool hasKeyboardFocus() Q_DECL_OVERRIDE;
- virtual void lockMouse() Q_DECL_OVERRIDE;
- virtual void unlockMouse() Q_DECL_OVERRIDE;
- virtual void show() Q_DECL_OVERRIDE;
- virtual void hide() Q_DECL_OVERRIDE;
- virtual bool isVisible() const Q_DECL_OVERRIDE;
- virtual QWindow* window() const Q_DECL_OVERRIDE;
- virtual QSGTexture *createTextureFromImage(const QImage &) Q_DECL_OVERRIDE;
- virtual QSGLayer *createLayer() Q_DECL_OVERRIDE;
- virtual QSGInternalImageNode *createImageNode() Q_DECL_OVERRIDE;
- virtual QSGTextureNode *createTextureNode() Q_DECL_OVERRIDE;
- virtual QSGRectangleNode *createRectangleNode() Q_DECL_OVERRIDE;
- virtual void update() Q_DECL_OVERRIDE;
- virtual void updateCursor(const QCursor &) Q_DECL_OVERRIDE;
- virtual void resize(int width, int height) Q_DECL_OVERRIDE;
- virtual void move(const QPoint&) Q_DECL_OVERRIDE { }
- virtual void inputMethodStateChanged(bool editorVisible) Q_DECL_OVERRIDE;
- virtual void setInputMethodHints(Qt::InputMethodHints) Q_DECL_OVERRIDE { }
+ void initAsChild(WebContentsAdapterClient* container) override;
+ void initAsPopup(const QRect&) override;
+ QRectF screenRect() const override;
+ QRectF contentsRect() const override;
+ void setKeyboardFocus() override;
+ bool hasKeyboardFocus() override;
+ void lockMouse() override;
+ void unlockMouse() override;
+ void show() override;
+ void hide() override;
+ bool isVisible() const override;
+ QWindow* window() const override;
+ QSGTexture *createTextureFromImage(const QImage &) override;
+ QSGLayer *createLayer() override;
+ QSGInternalImageNode *createImageNode() override;
+ QSGTextureNode *createTextureNode() override;
+ QSGRectangleNode *createRectangleNode() override;
+ void update() override;
+ void updateCursor(const QCursor &) override;
+ void resize(int width, int height) override;
+ void move(const QPoint&) override { }
+ void inputMethodStateChanged(bool editorVisible) override;
+ void setInputMethodHints(Qt::InputMethodHints) override { }
// The QtQuick view doesn't have a backbuffer of its own and doesn't need this
- virtual void setClearColor(const QColor &) Q_DECL_OVERRIDE { }
+ void setClearColor(const QColor &) override { }
protected:
- virtual bool event(QEvent *event) Q_DECL_OVERRIDE;
- virtual void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- virtual void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- virtual void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- virtual void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- virtual void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- virtual void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- virtual void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
- virtual void touchEvent(QTouchEvent *event) Q_DECL_OVERRIDE;
- virtual void hoverMoveEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
- virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE;
- virtual void inputMethodEvent(QInputMethodEvent *event) Q_DECL_OVERRIDE;
- virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- virtual void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
- virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
+ void focusInEvent(QFocusEvent *event) override;
+ void focusOutEvent(QFocusEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
+ void wheelEvent(QWheelEvent *event) override;
+ void touchEvent(QTouchEvent *event) override;
+ void hoverMoveEvent(QHoverEvent *event) override;
+ QVariant inputMethodQuery(Qt::InputMethodQuery query) const override;
+ void inputMethodEvent(QInputMethodEvent *event) override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemChange(ItemChange change, const ItemChangeData &value) override;
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
private slots:
void onWindowPosChanged();
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h b/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h
index 057b91c75..c4a1ac67b 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h
+++ b/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h
@@ -55,30 +55,30 @@ public:
RenderWidgetHostViewQtDelegateQuickWindow(RenderWidgetHostViewQtDelegate *realDelegate);
~RenderWidgetHostViewQtDelegateQuickWindow();
- virtual void initAsChild(WebContentsAdapterClient* container) Q_DECL_OVERRIDE;
- virtual void initAsPopup(const QRect&) Q_DECL_OVERRIDE;
- virtual QRectF screenRect() const Q_DECL_OVERRIDE;
- virtual QRectF contentsRect() const Q_DECL_OVERRIDE;
- virtual void setKeyboardFocus() Q_DECL_OVERRIDE {}
- virtual bool hasKeyboardFocus() Q_DECL_OVERRIDE { return false; }
- virtual void lockMouse() Q_DECL_OVERRIDE {}
- virtual void unlockMouse() Q_DECL_OVERRIDE {}
- virtual void show() Q_DECL_OVERRIDE;
- virtual void hide() Q_DECL_OVERRIDE;
- virtual bool isVisible() const Q_DECL_OVERRIDE;
- virtual QWindow* window() const Q_DECL_OVERRIDE;
- virtual QSGTexture *createTextureFromImage(const QImage &) Q_DECL_OVERRIDE;
- virtual QSGLayer *createLayer() Q_DECL_OVERRIDE;
- virtual QSGInternalImageNode *createImageNode() Q_DECL_OVERRIDE;
- virtual QSGTextureNode *createTextureNode() Q_DECL_OVERRIDE;
- virtual QSGRectangleNode *createRectangleNode() Q_DECL_OVERRIDE;
- virtual void update() Q_DECL_OVERRIDE;
- virtual void updateCursor(const QCursor &) Q_DECL_OVERRIDE;
- virtual void resize(int width, int height) Q_DECL_OVERRIDE;
- virtual void move(const QPoint &screenPos) Q_DECL_OVERRIDE;
- virtual void inputMethodStateChanged(bool) Q_DECL_OVERRIDE {}
- virtual void setInputMethodHints(Qt::InputMethodHints) Q_DECL_OVERRIDE { }
- virtual void setClearColor(const QColor &) Q_DECL_OVERRIDE { }
+ void initAsChild(WebContentsAdapterClient* container) override;
+ void initAsPopup(const QRect&) override;
+ QRectF screenRect() const override;
+ QRectF contentsRect() const override;
+ void setKeyboardFocus() override {}
+ bool hasKeyboardFocus() override { return false; }
+ void lockMouse() override {}
+ void unlockMouse() override {}
+ void show() override;
+ void hide() override;
+ bool isVisible() const override;
+ QWindow* window() const override;
+ QSGTexture *createTextureFromImage(const QImage &) override;
+ QSGLayer *createLayer() override;
+ QSGInternalImageNode *createImageNode() override;
+ QSGTextureNode *createTextureNode() override;
+ QSGRectangleNode *createRectangleNode() override;
+ void update() override;
+ void updateCursor(const QCursor &) override;
+ void resize(int width, int height) override;
+ void move(const QPoint &screenPos) override;
+ void inputMethodStateChanged(bool) override {}
+ void setInputMethodHints(Qt::InputMethodHints) override { }
+ void setClearColor(const QColor &) override { }
private:
QScopedPointer<RenderWidgetHostViewQtDelegate> m_realDelegate;
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 76c705c6e..a6ff4583f 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -53,6 +53,7 @@
#include "qwebenginehistory_p.h"
#include "qwebengineprofile.h"
#include "qwebengineprofile_p.h"
+#include "qwebenginequotapermissionrequest.h"
#include "qwebenginescriptcollection_p.h"
#include "qwebenginesettings.h"
#include "qwebengineview.h"
@@ -579,6 +580,13 @@ void QWebEnginePagePrivate::runMouseLockPermissionRequest(const QUrl &securityOr
Q_EMIT q->featurePermissionRequested(securityOrigin, QWebEnginePage::MouseLock);
}
+void QWebEnginePagePrivate::runQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller)
+{
+ Q_Q(QWebEnginePage);
+ QWebEngineQuotaPermissionRequest request(controller);
+ Q_EMIT q->quotaPermissionRequested(request);
+}
+
QObject *QWebEnginePagePrivate::accessibilityParentObject()
{
return view;
@@ -740,6 +748,17 @@ QWebEnginePage::QWebEnginePage(QObject* parent)
*/
/*!
+ \fn QWebEnginePage::quotaPermissionRequested(QWebEngineQuotaPermissionRequest request)
+ \since 5.11
+
+ This signal is emitted when the web page requests larger persistent storage
+ than the application's current allocation in File System API. The default quota
+ is 0 bytes.
+
+ The request object \a request can be used to accept or reject the request.
+*/
+
+/*!
\fn void QWebEnginePage::pdfPrintingFinished(const QString &filePath, bool success)
\since 5.9
diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h
index 295527e74..3fad6ca09 100644
--- a/src/webenginewidgets/api/qwebenginepage.h
+++ b/src/webenginewidgets/api/qwebenginepage.h
@@ -64,6 +64,7 @@ class QWebEngineHistory;
class QWebEnginePage;
class QWebEnginePagePrivate;
class QWebEngineProfile;
+class QWebEngineQuotaPermissionRequest;
class QWebEngineScriptCollection;
class QWebEngineSettings;
@@ -330,6 +331,7 @@ Q_SIGNALS:
void featurePermissionRequested(const QUrl &securityOrigin, QWebEnginePage::Feature feature);
void featurePermissionRequestCanceled(const QUrl &securityOrigin, QWebEnginePage::Feature feature);
void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest);
+ void quotaPermissionRequested(QWebEngineQuotaPermissionRequest quotaPermissionRequest);
void authenticationRequired(const QUrl &requestUrl, QAuthenticator *authenticator);
void proxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *authenticator, const QString &proxyHost);
diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h
index ec84f05e1..1724a9dde 100644
--- a/src/webenginewidgets/api/qwebenginepage_p.h
+++ b/src/webenginewidgets/api/qwebenginepage_p.h
@@ -82,69 +82,70 @@ public:
QWebEnginePagePrivate(QWebEngineProfile *profile = 0);
~QWebEnginePagePrivate();
- virtual QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) Q_DECL_OVERRIDE;
- virtual QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegateForPopup(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) Q_DECL_OVERRIDE { return CreateRenderWidgetHostViewQtDelegate(client); }
- virtual void titleChanged(const QString&) Q_DECL_OVERRIDE;
- virtual void urlChanged(const QUrl&) Q_DECL_OVERRIDE;
- virtual void iconChanged(const QUrl&) Q_DECL_OVERRIDE;
- virtual void loadProgressChanged(int progress) Q_DECL_OVERRIDE;
- virtual void didUpdateTargetURL(const QUrl&) Q_DECL_OVERRIDE;
- virtual void selectionChanged() Q_DECL_OVERRIDE;
- virtual void recentlyAudibleChanged(bool recentlyAudible) Q_DECL_OVERRIDE;
- virtual QRectF viewportRect() const Q_DECL_OVERRIDE;
- virtual qreal dpiScale() const Q_DECL_OVERRIDE;
- virtual QColor backgroundColor() const Q_DECL_OVERRIDE;
- virtual void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) Q_DECL_OVERRIDE;
- virtual void loadCommitted() Q_DECL_OVERRIDE;
- virtual void loadVisuallyCommitted() Q_DECL_OVERRIDE { }
- virtual void loadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()) Q_DECL_OVERRIDE;
- virtual void focusContainer() Q_DECL_OVERRIDE;
- virtual void unhandledKeyEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- virtual void adoptNewWindow(QSharedPointer<QtWebEngineCore::WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &initialGeometry, const QUrl &targetUrl) Q_DECL_OVERRIDE;
+ QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) override;
+ QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegateForPopup(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) override { return CreateRenderWidgetHostViewQtDelegate(client); }
+ void titleChanged(const QString&) override;
+ void urlChanged(const QUrl&) override;
+ void iconChanged(const QUrl&) override;
+ void loadProgressChanged(int progress) override;
+ void didUpdateTargetURL(const QUrl&) override;
+ void selectionChanged() override;
+ void recentlyAudibleChanged(bool recentlyAudible) override;
+ QRectF viewportRect() const override;
+ qreal dpiScale() const override;
+ QColor backgroundColor() const override;
+ void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) override;
+ void loadCommitted() override;
+ void loadVisuallyCommitted() override { }
+ void loadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()) override;
+ void focusContainer() override;
+ void unhandledKeyEvent(QKeyEvent *event) override;
+ void adoptNewWindow(QSharedPointer<QtWebEngineCore::WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &initialGeometry, const QUrl &targetUrl) override;
void adoptNewWindowImpl(QWebEnginePage *newPage,
const QSharedPointer<QtWebEngineCore::WebContentsAdapter> &newWebContents,
const QRect &initialGeometry);
- virtual bool isBeingAdopted() 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 requestFullScreenMode(const QUrl &origin, bool fullscreen) Q_DECL_OVERRIDE;
- virtual bool isFullScreenMode() const Q_DECL_OVERRIDE;
- virtual void javascriptDialog(QSharedPointer<QtWebEngineCore::JavaScriptDialogController>) Q_DECL_OVERRIDE;
- virtual void runFileChooser(QSharedPointer<QtWebEngineCore::FilePickerController>) Q_DECL_OVERRIDE;
- virtual void showColorDialog(QSharedPointer<QtWebEngineCore::ColorChooserController>) Q_DECL_OVERRIDE;
- virtual void didRunJavaScript(quint64 requestId, const QVariant& result) Q_DECL_OVERRIDE;
- virtual void didFetchDocumentMarkup(quint64 requestId, const QString& result) Q_DECL_OVERRIDE;
- virtual void didFetchDocumentInnerText(quint64 requestId, const QString& result) Q_DECL_OVERRIDE;
- virtual void didFindText(quint64 requestId, int matchCount) Q_DECL_OVERRIDE;
- virtual void didPrintPage(quint64 requestId, const QByteArray &result) Q_DECL_OVERRIDE;
- virtual void didPrintPageToPdf(const QString &filePath, bool success) Q_DECL_OVERRIDE;
- virtual void passOnFocus(bool reverse) Q_DECL_OVERRIDE;
- virtual void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) Q_DECL_OVERRIDE;
- virtual void authenticationRequired(QSharedPointer<QtWebEngineCore::AuthenticationDialogController>) Q_DECL_OVERRIDE;
- virtual void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) Q_DECL_OVERRIDE;
- virtual void runGeolocationPermissionRequest(const QUrl &securityOrigin) Q_DECL_OVERRIDE;
- virtual void runMouseLockPermissionRequest(const QUrl &securityOrigin) Q_DECL_OVERRIDE;
- virtual QObject *accessibilityParentObject() Q_DECL_OVERRIDE;
- virtual QtWebEngineCore::WebEngineSettings *webEngineSettings() const Q_DECL_OVERRIDE;
- virtual void allowCertificateError(const QSharedPointer<CertificateErrorController> &controller) Q_DECL_OVERRIDE;
- virtual void showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) Q_DECL_OVERRIDE;
- virtual void hideValidationMessage() Q_DECL_OVERRIDE;
- virtual void moveValidationMessage(const QRect &anchor) Q_DECL_OVERRIDE;
+ bool isBeingAdopted() override;
+ void close() override;
+ void windowCloseRejected() override;
+ bool contextMenuRequested(const QtWebEngineCore::WebEngineContextMenuData &data) override;
+ void navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame) override;
+ void requestFullScreenMode(const QUrl &origin, bool fullscreen) override;
+ bool isFullScreenMode() const override;
+ void javascriptDialog(QSharedPointer<QtWebEngineCore::JavaScriptDialogController>) override;
+ void runFileChooser(QSharedPointer<QtWebEngineCore::FilePickerController>) override;
+ void showColorDialog(QSharedPointer<QtWebEngineCore::ColorChooserController>) override;
+ void didRunJavaScript(quint64 requestId, const QVariant& result) override;
+ void didFetchDocumentMarkup(quint64 requestId, const QString& result) override;
+ void didFetchDocumentInnerText(quint64 requestId, const QString& result) override;
+ void didFindText(quint64 requestId, int matchCount) override;
+ void didPrintPage(quint64 requestId, const QByteArray &result) override;
+ void didPrintPageToPdf(const QString &filePath, bool success) override;
+ void passOnFocus(bool reverse) override;
+ void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) override;
+ void authenticationRequired(QSharedPointer<QtWebEngineCore::AuthenticationDialogController>) override;
+ void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) override;
+ void runGeolocationPermissionRequest(const QUrl &securityOrigin) override;
+ void runMouseLockPermissionRequest(const QUrl &securityOrigin) override;
+ void runQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController>) override;
+ QObject *accessibilityParentObject() override;
+ QtWebEngineCore::WebEngineSettings *webEngineSettings() const override;
+ void allowCertificateError(const QSharedPointer<CertificateErrorController> &controller) override;
+ void showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) override;
+ void hideValidationMessage() override;
+ void moveValidationMessage(const QRect &anchor) override;
virtual void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus,
- int exitCode) Q_DECL_OVERRIDE;
- virtual void requestGeometryChange(const QRect &geometry) Q_DECL_OVERRIDE;
- virtual void updateScrollPosition(const QPointF &position) Q_DECL_OVERRIDE;
- virtual void updateContentsSize(const QSizeF &size) Q_DECL_OVERRIDE;
+ int exitCode) override;
+ void requestGeometryChange(const QRect &geometry) override;
+ void updateScrollPosition(const QPointF &position) override;
+ void updateContentsSize(const QSizeF &size) override;
void startDragging(const content::DropData &dropData, Qt::DropActions allowedActions,
- const QPixmap &pixmap, const QPoint &offset) Q_DECL_OVERRIDE;
- virtual bool isEnabled() const Q_DECL_OVERRIDE;
- virtual void setToolTip(const QString &toolTipText) Q_DECL_OVERRIDE;
- const QObject *holdingQObject() const Q_DECL_OVERRIDE;
+ const QPixmap &pixmap, const QPoint &offset) override;
+ bool isEnabled() const override;
+ void setToolTip(const QString &toolTipText) override;
+ const QObject *holdingQObject() const override;
- virtual QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContextAdapter() Q_DECL_OVERRIDE;
- QtWebEngineCore::WebContentsAdapter *webContentsAdapter() Q_DECL_OVERRIDE;
+ QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContextAdapter() override;
+ QtWebEngineCore::WebContentsAdapter *webContentsAdapter() override;
void updateAction(QWebEnginePage::WebAction) const;
void updateNavigationActions();
diff --git a/src/webenginewidgets/api/qwebengineprofile_p.h b/src/webenginewidgets/api/qwebengineprofile_p.h
index c5a75f6d4..ffb28ec6d 100644
--- a/src/webenginewidgets/api/qwebengineprofile_p.h
+++ b/src/webenginewidgets/api/qwebengineprofile_p.h
@@ -78,8 +78,8 @@ public:
void downloadDestroyed(quint32 downloadId);
- void downloadRequested(DownloadItemInfo &info) Q_DECL_OVERRIDE;
- void downloadUpdated(const DownloadItemInfo &info) Q_DECL_OVERRIDE;
+ void downloadRequested(DownloadItemInfo &info) override;
+ void downloadUpdated(const DownloadItemInfo &info) override;
private:
QWebEngineProfile *q_ptr;
diff --git a/src/webenginewidgets/api/qwebenginequotapermissionrequest.cpp b/src/webenginewidgets/api/qwebenginequotapermissionrequest.cpp
new file mode 100644
index 000000000..0841854ea
--- /dev/null
+++ b/src/webenginewidgets/api/qwebenginequotapermissionrequest.cpp
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwebenginequotapermissionrequest.h"
+
+#include "quota_permission_controller.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QWebEngineQuotaPermissionRequest
+ \brief The QWebEngineQuotaPermissionRequest class enables accepting or rejecting
+ requests for larger persistent storage than the application's current allocation
+ in File System API.
+
+ \since 5.11
+
+ \inmodule QtWebEngineWidgets
+*/
+
+QWebEngineQuotaPermissionRequest::QWebEngineQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller)
+ : d_ptr(controller)
+{
+}
+
+/*!
+ Rejects a request for larger persistent storage.
+*/
+void QWebEngineQuotaPermissionRequest::reject()
+{
+ d_ptr->cancel();
+}
+
+/*!
+ Accepts a request for larger persistent storage.
+*/
+void QWebEngineQuotaPermissionRequest::accept()
+{
+ d_ptr->accept();
+}
+
+/*!
+ \property QWebEngineQuotaPermissionRequest::origin
+ \brief The URL of the web page that issued the quota permission request.
+*/
+
+QUrl QWebEngineQuotaPermissionRequest::origin() const
+{
+ return d_ptr->origin();
+}
+
+/*!
+ \property QWebEngineQuotaPermissionRequest::requestedSize
+ \brief Contains the size of the requested disk space in bytes.
+*/
+
+qint64 QWebEngineQuotaPermissionRequest::requestedSize() const
+{
+ return d_ptr->requestedSize();
+}
+
+QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebenginequotapermissionrequest.h b/src/webenginewidgets/api/qwebenginequotapermissionrequest.h
new file mode 100644
index 000000000..aa0184fad
--- /dev/null
+++ b/src/webenginewidgets/api/qwebenginequotapermissionrequest.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWEBENGINEQUOTAPERMISSIONREQUEST_H
+#define QWEBENGINEQUOTAPERMISSIONREQUEST_H
+
+#include <QtCore/qsharedpointer.h>
+#include <QtCore/qurl.h>
+#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
+
+namespace QtWebEngineCore {
+ class QuotaPermissionController;
+}
+
+QT_BEGIN_NAMESPACE
+
+class QWEBENGINEWIDGETS_EXPORT QWebEngineQuotaPermissionRequest {
+ Q_GADGET
+ Q_PROPERTY(QUrl origin READ origin)
+ Q_PROPERTY(qint64 requestedSize READ requestedSize)
+public:
+ Q_INVOKABLE void accept();
+ Q_INVOKABLE void reject();
+ QUrl origin() const;
+ qint64 requestedSize() const;
+
+private:
+ QWebEngineQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller);
+ QSharedPointer<QtWebEngineCore::QuotaPermissionController> d_ptr;
+ friend class QWebEnginePagePrivate;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWEBENGINEQUOTAPERMISSIONREQUEST_H
diff --git a/src/webenginewidgets/api/qwebenginesettings.cpp b/src/webenginewidgets/api/qwebenginesettings.cpp
index 1def61cb6..2d7c68926 100644
--- a/src/webenginewidgets/api/qwebenginesettings.cpp
+++ b/src/webenginewidgets/api/qwebenginesettings.cpp
@@ -182,7 +182,6 @@ void QWebEngineSettings::resetFontSize(QWebEngineSettings::FontSize type)
d->resetFontSize(static_cast<WebEngineSettings::FontSize>(type));
}
-
void QWebEngineSettings::setDefaultTextEncoding(const QString &encoding)
{
Q_D(QWebEngineSettings);
@@ -195,6 +194,30 @@ QString QWebEngineSettings::defaultTextEncoding() const
return d->defaultTextEncoding();
}
+ASSERT_ENUMS_MATCH(WebEngineSettings::DisallowUnknownUrlSchemes, QWebEngineSettings::DisallowUnknownUrlSchemes)
+ASSERT_ENUMS_MATCH(WebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction, QWebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction)
+ASSERT_ENUMS_MATCH(WebEngineSettings::AllowAllUnknownUrlSchemes, QWebEngineSettings::AllowAllUnknownUrlSchemes)
+
+QWebEngineSettings::UnknownUrlSchemePolicy QWebEngineSettings::unknownUrlSchemePolicy() const
+{
+ Q_D(const QWebEngineSettings);
+ WebEngineSettings::UnknownUrlSchemePolicy result = d->unknownUrlSchemePolicy();
+ Q_ASSERT(result != WebEngineSettings::InheritedUnknownUrlSchemePolicy);
+ return static_cast<QWebEngineSettings::UnknownUrlSchemePolicy>(result);
+}
+
+void QWebEngineSettings::setUnknownUrlSchemePolicy(QWebEngineSettings::UnknownUrlSchemePolicy policy)
+{
+ Q_D(QWebEngineSettings);
+ d->setUnknownUrlSchemePolicy(static_cast<WebEngineSettings::UnknownUrlSchemePolicy>(policy));
+}
+
+void QWebEngineSettings::resetUnknownUrlSchemePolicy()
+{
+ Q_D(QWebEngineSettings);
+ d->setUnknownUrlSchemePolicy(WebEngineSettings::InheritedUnknownUrlSchemePolicy);
+}
+
void QWebEngineSettings::setAttribute(QWebEngineSettings::WebAttribute attr, bool on)
{
Q_D(QWebEngineSettings);
diff --git a/src/webenginewidgets/api/qwebenginesettings.h b/src/webenginewidgets/api/qwebenginesettings.h
index 470609227..fc9372968 100644
--- a/src/webenginewidgets/api/qwebenginesettings.h
+++ b/src/webenginewidgets/api/qwebenginesettings.h
@@ -101,6 +101,12 @@ public:
DefaultFixedFontSize
};
+ enum UnknownUrlSchemePolicy {
+ DisallowUnknownUrlSchemes = 1,
+ AllowUnknownUrlSchemesFromUserInteraction,
+ AllowAllUnknownUrlSchemes
+ };
+
#if QT_DEPRECATED_SINCE(5, 5)
static QWebEngineSettings *globalSettings();
#endif
@@ -121,6 +127,10 @@ public:
void setDefaultTextEncoding(const QString &encoding);
QString defaultTextEncoding() const;
+ UnknownUrlSchemePolicy unknownUrlSchemePolicy() const;
+ void setUnknownUrlSchemePolicy(UnknownUrlSchemePolicy policy);
+ void resetUnknownUrlSchemePolicy();
+
private:
Q_DISABLE_COPY(QWebEngineSettings)
typedef ::QtWebEngineCore::WebEngineSettings QWebEngineSettingsPrivate;
diff --git a/src/webenginewidgets/api/qwebengineview.h b/src/webenginewidgets/api/qwebengineview.h
index 487cc2316..795e011ad 100644
--- a/src/webenginewidgets/api/qwebengineview.h
+++ b/src/webenginewidgets/api/qwebengineview.h
@@ -103,7 +103,7 @@ public:
void findText(const QString &subString, QWebEnginePage::FindFlags options = QWebEnginePage::FindFlags(), const QWebEngineCallback<bool> &resultCallback = QWebEngineCallback<bool>());
#endif
- virtual QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
QWebEngineSettings *settings() const;
public Q_SLOTS:
@@ -126,14 +126,14 @@ Q_SIGNALS:
protected:
virtual QWebEngineView *createWindow(QWebEnginePage::WebWindowType type);
- virtual void contextMenuEvent(QContextMenuEvent*) Q_DECL_OVERRIDE;
- virtual bool event(QEvent*) Q_DECL_OVERRIDE;
- virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
- virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
- void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE;
- void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE;
- void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE;
+ void contextMenuEvent(QContextMenuEvent*) override;
+ bool event(QEvent*) override;
+ void showEvent(QShowEvent *) override;
+ void hideEvent(QHideEvent *) override;
+ void dragEnterEvent(QDragEnterEvent *e) override;
+ void dragLeaveEvent(QDragLeaveEvent *e) override;
+ void dragMoveEvent(QDragMoveEvent *e) override;
+ void dropEvent(QDropEvent *e) override;
private:
Q_DISABLE_COPY(QWebEngineView)
diff --git a/src/webenginewidgets/api/qwebengineview_p.h b/src/webenginewidgets/api/qwebengineview_p.h
index f3a37225b..7f0cdac45 100644
--- a/src/webenginewidgets/api/qwebengineview_p.h
+++ b/src/webenginewidgets/api/qwebengineview_p.h
@@ -80,9 +80,9 @@ public:
QWebEngineViewAccessible(QWebEngineView *o) : QAccessibleWidget(o)
{}
- int childCount() const Q_DECL_OVERRIDE;
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
- int indexOfChild(const QAccessibleInterface *child) const Q_DECL_OVERRIDE;
+ int childCount() const override;
+ QAccessibleInterface *child(int index) const override;
+ int indexOfChild(const QAccessibleInterface *child) const override;
private:
QWebEngineView *view() const { return static_cast<QWebEngineView*>(object()); }
diff --git a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
index d3b16a935..facc0e8e6 100644
--- a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
@@ -168,7 +168,22 @@
\value ShowScrollBars
Shows scroll bars.
Enabled by default. (Added in Qt 5.10)
+*/
+/*!
+ \enum QWebEngineSettings::UnknownUrlSchemePolicy
+ \since Qt 5.10
+
+ This enum describes how navigation requests to URLs with unknown schemes are handled.
+
+ \value DisallowUnknownUrlSchemes
+ Disallows all navigation requests to URLs with unknown schemes.
+ \value AllowUnknownUrlSchemesFromUserInteraction
+ Allows navigation requests to URLs with unknown schemes that are issued from
+ user-interaction (like a mouse-click), whereas other navigation requests (for example
+ from JavaScript) are suppressed.
+ \value AllowAllUnknownUrlSchemes
+ Allows all navigation requests to URLs with unknown schemes.
*/
/*!
@@ -224,6 +239,26 @@
*/
/*!
+ \fn QWebEngineSettings::UnknownUrlSchemePolicy QWebEngineSettings::unknownUrlSchemePolicy() const
+ Returns the currently selected policy for handling navigation requests to URLs with
+ unknown schemes. Default is \l{QWebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction}.
+ \sa setUnknownUrlSchemePolicy resetUnknownUrlSchemePolicy
+*/
+
+/*!
+ \fn void QWebEngineSettings::setUnknownUrlSchemePolicy(QWebEngineSettings::UnknownUrlSchemePolicy policy)
+ Sets the policy for handling navigation requests to URLs with unknown schemes to \a policy.
+ Default is \l{QWebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction}.
+ \sa unknownUrlSchemePolicy resetUnknownUrlSchemePolicy
+*/
+
+/*!
+ \fn void QWebEngineSettings::resetUnknownUrlSchemePolicy()
+ Removes the policy for handling navigation requests to URLs with unknown schemes.
+ \sa unknownUrlSchemePolicy setUnknownUrlSchemePolicy
+*/
+
+/*!
\fn void QWebEngineSettings::setAttribute(WebAttribute attribute, bool on)
Enables or disables the specified \a attribute feature depending on the
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h
index fb33c55c7..f971a3ee6 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h
@@ -53,38 +53,38 @@ class RenderWidgetHostViewQtDelegateWidget : public QQuickWidget, public RenderW
public:
RenderWidgetHostViewQtDelegateWidget(RenderWidgetHostViewQtDelegateClient *client, QWidget *parent = 0);
- virtual void initAsChild(WebContentsAdapterClient* container) Q_DECL_OVERRIDE;
- virtual void initAsPopup(const QRect&) Q_DECL_OVERRIDE;
- virtual QRectF screenRect() const Q_DECL_OVERRIDE;
- virtual QRectF contentsRect() const Q_DECL_OVERRIDE;
- virtual void setKeyboardFocus() Q_DECL_OVERRIDE;
- virtual bool hasKeyboardFocus() Q_DECL_OVERRIDE;
- virtual void lockMouse() Q_DECL_OVERRIDE;
- virtual void unlockMouse() Q_DECL_OVERRIDE;
- virtual void show() Q_DECL_OVERRIDE;
- virtual void hide() Q_DECL_OVERRIDE;
- virtual bool isVisible() const Q_DECL_OVERRIDE;
- virtual QWindow* window() const Q_DECL_OVERRIDE;
- virtual QSGTexture *createTextureFromImage(const QImage &) Q_DECL_OVERRIDE;
- virtual QSGLayer *createLayer() Q_DECL_OVERRIDE;
- virtual QSGInternalImageNode *createImageNode() Q_DECL_OVERRIDE;
- virtual QSGTextureNode *createTextureNode() Q_DECL_OVERRIDE;
- virtual QSGRectangleNode *createRectangleNode() Q_DECL_OVERRIDE;
- virtual void update() Q_DECL_OVERRIDE;
- virtual void updateCursor(const QCursor &) Q_DECL_OVERRIDE;
- virtual void resize(int width, int height) Q_DECL_OVERRIDE;
- virtual void move(const QPoint &screenPos) Q_DECL_OVERRIDE;
- virtual void inputMethodStateChanged(bool editorVisible) Q_DECL_OVERRIDE;
- virtual void setInputMethodHints(Qt::InputMethodHints) Q_DECL_OVERRIDE;
- virtual void setClearColor(const QColor &color) Q_DECL_OVERRIDE;
+ void initAsChild(WebContentsAdapterClient* container) override;
+ void initAsPopup(const QRect&) override;
+ QRectF screenRect() const override;
+ QRectF contentsRect() const override;
+ void setKeyboardFocus() override;
+ bool hasKeyboardFocus() override;
+ void lockMouse() override;
+ void unlockMouse() override;
+ void show() override;
+ void hide() override;
+ bool isVisible() const override;
+ QWindow* window() const override;
+ QSGTexture *createTextureFromImage(const QImage &) override;
+ QSGLayer *createLayer() override;
+ QSGInternalImageNode *createImageNode() override;
+ QSGTextureNode *createTextureNode() override;
+ QSGRectangleNode *createRectangleNode() override;
+ void update() override;
+ void updateCursor(const QCursor &) override;
+ void resize(int width, int height) override;
+ void move(const QPoint &screenPos) override;
+ void inputMethodStateChanged(bool editorVisible) override;
+ void setInputMethodHints(Qt::InputMethodHints) override;
+ void setClearColor(const QColor &color) override;
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *resizeEvent) Q_DECL_OVERRIDE;
- void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
- void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
+ void resizeEvent(QResizeEvent *resizeEvent) override;
+ void showEvent(QShowEvent *) override;
+ void hideEvent(QHideEvent *) override;
- QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE;
+ QVariant inputMethodQuery(Qt::InputMethodQuery query) const override;
private slots:
void onWindowPosChanged();
diff --git a/src/webenginewidgets/ui/messagebubblewidget_p.h b/src/webenginewidgets/ui/messagebubblewidget_p.h
index 8815d1ba4..6898aea13 100644
--- a/src/webenginewidgets/ui/messagebubblewidget_p.h
+++ b/src/webenginewidgets/ui/messagebubblewidget_p.h
@@ -73,7 +73,7 @@ public:
static void moveBubble(QWebEngineView *view, const QRect &anchor);
protected:
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) override;
private:
void createBubble(const int maxWidth, const QString &mainText, const QString &subText);
diff --git a/src/webenginewidgets/webenginewidgets.pro b/src/webenginewidgets/webenginewidgets.pro
index a5c22e7be..29c961c80 100644
--- a/src/webenginewidgets/webenginewidgets.pro
+++ b/src/webenginewidgets/webenginewidgets.pro
@@ -20,6 +20,7 @@ SOURCES = \
api/qwebenginehistory.cpp \
api/qwebenginepage.cpp \
api/qwebengineprofile.cpp \
+ api/qwebenginequotapermissionrequest.cpp \
api/qwebenginescript.cpp \
api/qwebenginescriptcollection.cpp \
api/qwebenginesettings.cpp \
@@ -38,6 +39,7 @@ HEADERS = \
api/qwebenginepage_p.h \
api/qwebengineprofile.h \
api/qwebengineprofile_p.h \
+ api/qwebenginequotapermissionrequest.h \
api/qwebenginescriptcollection.h \
api/qwebenginescriptcollection_p.h \
api/qwebenginesettings.h \
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index 5cc0d18df..7d793f1b3 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -66,6 +66,7 @@ static QList<const QMetaObject *> typesToCheck = QList<const QMetaObject *>()
<< &QQuickWebEngineScript::staticMetaObject
<< &QQuickWebEngineSettings::staticMetaObject
<< &QQuickWebEngineFullScreenRequest::staticMetaObject
+ << &QQuickWebEngineQuotaPermissionRequest::staticMetaObject
<< &QQuickWebEngineSingleton::staticMetaObject
<< &QQuickWebEngineAuthenticationDialogRequest::staticMetaObject
<< &QQuickWebEngineJavaScriptDialogRequest::staticMetaObject
@@ -183,6 +184,7 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.javaScriptConsoleMessage(JavaScriptConsoleMessageLevel,QString,int,QString) --> void"
<< "QQuickWebEngineView.certificateError(QQuickWebEngineCertificateError*) --> void"
<< "QQuickWebEngineView.fullScreenRequested(QQuickWebEngineFullScreenRequest) --> void"
+ << "QQuickWebEngineView.quotaPermissionRequested(QQuickWebEngineQuotaPermissionRequest) --> void"
<< "QQuickWebEngineView.isFullScreenChanged() --> void"
<< "QQuickWebEngineView.featurePermissionRequested(QUrl,Feature) --> void"
<< "QQuickWebEngineView.newViewRequested(QQuickWebEngineNewViewRequest*) --> void"
@@ -529,6 +531,10 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineFullScreenRequest.toggleOn --> bool"
<< "QQuickWebEngineFullScreenRequest.accept() --> void"
<< "QQuickWebEngineFullScreenRequest.reject() --> void"
+ << "QQuickWebEngineQuotaPermissionRequest.origin --> QUrl"
+ << "QQuickWebEngineQuotaPermissionRequest.requestedSize --> qlonglong"
+ << "QQuickWebEngineQuotaPermissionRequest.accept() --> void"
+ << "QQuickWebEngineQuotaPermissionRequest.reject() --> void"
<< "QQuickWebEngineSingleton.settings --> QQuickWebEngineSettings*"
<< "QQuickWebEngineSingleton.defaultProfile --> QQuickWebEngineProfile*"
;
diff --git a/tests/auto/quick/qmltests/data/TestWebEngineView.qml b/tests/auto/quick/qmltests/data/TestWebEngineView.qml
index 8304a993a..9fb8c4bfe 100644
--- a/tests/auto/quick/qmltests/data/TestWebEngineView.qml
+++ b/tests/auto/quick/qmltests/data/TestWebEngineView.qml
@@ -28,7 +28,7 @@
import QtQuick 2.0
import QtTest 1.1
-import QtWebEngine 1.3
+import QtWebEngine 1.7
WebEngineView {
property var loadStatus: null
diff --git a/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp b/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp
index 38311cad2..710561cce 100644
--- a/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp
+++ b/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp
@@ -238,7 +238,7 @@ void tst_QWebEngineFaviconManager::errorPageEnabled()
QUrl url("invalid://url");
m_page->load(url);
- QTRY_COMPARE(loadFinishedSpy.count(), 1);
+ QTRY_COMPARE(loadFinishedSpy.count(), 2);
QCOMPARE(iconUrlChangedSpy.count(), 0);
QCOMPARE(iconChangedSpy.count(), 0);
diff --git a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
index d9bbce173..7c8497fef 100644
--- a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
+++ b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
@@ -65,6 +65,7 @@ private Q_SLOTS:
void saveAndRestore_crash_2();
void saveAndRestore_crash_3();
void saveAndRestore_crash_4();
+ void saveAndRestore_InternalPage();
void popPushState_data();
void popPushState();
@@ -420,6 +421,26 @@ void tst_QWebEngineHistory::saveAndRestore_crash_4()
QTRY_COMPARE(loadFinishedSpy2.count(), 1);
}
+void tst_QWebEngineHistory::saveAndRestore_InternalPage()
+{
+ QWebEngineView view;
+ view.show();
+ QSignalSpy loadFinishedSpy(&view, &QWebEngineView::loadFinished);
+ view.load(QUrl("view-source:http://qt.io"));
+ QTRY_LOOP_IMPL((loadFinishedSpy.size() == 1), 30000, 200)
+ if (loadFinishedSpy.size() != 1 || !loadFinishedSpy.at(0).at(0).toBool())
+ QSKIP("Couldn't load page from network, skipping test.");
+
+ // get history
+ QByteArray data;
+ QDataStream stream1(&data, QIODevice::WriteOnly);
+ stream1 << *view.history();
+
+ // restore history - this should not crash. see QTBUG-57826
+ QDataStream stream2(data);
+ stream2 >> *view.history();
+}
+
void tst_QWebEngineHistory::popPushState_data()
{
QTest::addColumn<QString>("script");
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 837481fad..f8a87f309 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -47,6 +47,7 @@
#include <qwebenginehistory.h>
#include <qwebenginepage.h>
#include <qwebengineprofile.h>
+#include <qwebenginequotapermissionrequest.h>
#include <qwebenginescript.h>
#include <qwebenginescriptcollection.h>
#include <qwebenginesettings.h>
@@ -165,6 +166,7 @@ private Q_SLOTS:
void runJavaScript();
void fullScreenRequested();
+ void quotaPermissionRequested();
// Tests from tst_QWebEngineFrame
@@ -3079,6 +3081,46 @@ void tst_QWebEnginePage::fullScreenRequested()
QVERIFY(watcher.wait());
}
+void tst_QWebEnginePage::quotaPermissionRequested()
+{
+ ConsolePage page;
+ QWebEngineView view;
+ view.setPage(&page);
+ QSignalSpy loadFinishedSpy(&page, SIGNAL(loadFinished(bool)));
+ page.load(QUrl("qrc:///resources/content.html"));
+ QVERIFY(loadFinishedSpy.wait());
+
+ connect(&page, &QWebEnginePage::quotaPermissionRequested,
+ [] (QWebEngineQuotaPermissionRequest request)
+ {
+ if (request.requestedSize() <= 5000)
+ request.accept();
+ else
+ request.reject();
+ });
+
+ evaluateJavaScriptSync(&page,
+ "navigator.webkitPersistentStorage.requestQuota(1024, function(grantedSize) {" \
+ "console.log(grantedSize);" \
+ "});");
+ QTRY_COMPARE(page.messages.count(), 1);
+ QTRY_COMPARE(page.messages[0], QString("1024"));
+
+ evaluateJavaScriptSync(&page,
+ "navigator.webkitPersistentStorage.requestQuota(6000, function(grantedSize) {" \
+ "console.log(grantedSize);" \
+ "});");
+ QTRY_COMPARE(page.messages.count(), 2);
+ QTRY_COMPARE(page.messages[1], QString("1024"));
+
+ evaluateJavaScriptSync(&page,
+ "navigator.webkitPersistentStorage.queryUsageAndQuota(function(usedBytes, grantedBytes) {" \
+ "console.log(usedBytes + ', ' + grantedBytes);" \
+ "});");
+ QTRY_COMPARE(page.messages.count(), 3);
+ QTRY_COMPARE(page.messages[2], QString("0, 1024"));
+}
+
void tst_QWebEnginePage::symmetricUrl()
{
QWebEngineView view;
diff --git a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
index 5cbcf4ec0..09e1b73c9 100644
--- a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
+++ b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
@@ -19,6 +19,8 @@
#include <QtTest/QtTest>
+#include <qwebengineview.h>
+#include <qwebenginepage.h>
#include <qwebengineprofile.h>
#include <qwebenginesettings.h>
@@ -29,6 +31,7 @@ private Q_SLOTS:
void resetAttributes();
void defaultFontFamily_data();
void defaultFontFamily();
+ void unknownUrlSchemePolicy();
};
void tst_QWebEngineSettings::resetAttributes()
@@ -85,6 +88,72 @@ void tst_QWebEngineSettings::defaultFontFamily()
QVERIFY(!settings->fontFamily(static_cast<QWebEngineSettings::FontFamily>(fontFamily)).isEmpty());
}
+
+class AcceptNavigationRequestHandler : public QWebEnginePage
+{
+public:
+ AcceptNavigationRequestHandler(QObject* parent = nullptr)
+ : QWebEnginePage(parent)
+ {
+ }
+ int acceptNavigationRequestCalls = 0;
+ bool acceptNavigationRequest(const QUrl &/*url*/, NavigationType /*type*/, bool /*isMainFrame*/) override
+ {
+ this->acceptNavigationRequestCalls++;
+ return false;
+ }
+};
+
+void tst_QWebEngineSettings::unknownUrlSchemePolicy()
+{
+ QWebEngineView view;
+ AcceptNavigationRequestHandler page;
+ view.setPage(&page);
+ view.resize(400, 40);
+ view.show();
+ QTest::qWaitForWindowExposed(&view);
+ QWebEngineSettings *settings = view.page()->profile()->settings();
+ settings->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, true);
+ QSignalSpy loadFinishedSpy(&view, &QWebEngineView::loadFinished);
+
+ QWebEngineSettings::UnknownUrlSchemePolicy policies[6] = {QWebEngineSettings::DisallowUnknownUrlSchemes,
+ QWebEngineSettings::DisallowUnknownUrlSchemes,
+ QWebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction,
+ QWebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction,
+ QWebEngineSettings::AllowAllUnknownUrlSchemes,
+ QWebEngineSettings::AllowAllUnknownUrlSchemes};
+ // even iterations are for navigation-requests from javascript,
+ // odd iterations are for navigations-requests from user-interaction
+ for (int i = 0; i < 8; i++) {
+ if (i <= 5)
+ settings->setUnknownUrlSchemePolicy(policies[i]);
+ else
+ settings->resetUnknownUrlSchemePolicy();
+ loadFinishedSpy.clear();
+ page.acceptNavigationRequestCalls = 0;
+ bool shouldAccept;
+
+ if (i % 2 == 0) { // navigation request coming from javascript
+ shouldAccept = (4 <= i && i <= 5); // only case AllowAllUnknownUrlSchemes
+ view.setHtml("<html><script>setTimeout(function(){ window.location.href='nonexistentscheme://somewhere'; }, 10);</script><body>testing...</body></html>");
+ } else { // navigation request coming from user interaction
+ shouldAccept = (2 <= i); // all cases except DisallowUnknownUrlSchemes
+ view.setHtml("<html><body><a id='nonexlink' href='nonexistentscheme://somewhere'>nonexistentscheme://somewhere</a></body></html>");
+ QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.size(), 1, 30000);
+ // focus and trigger the link
+ view.page()->runJavaScript("document.getElementById('nonexlink').focus();", [&view](const QVariant &result) {
+ Q_UNUSED(result);
+ QTest::sendKeyEvent(QTest::Press, view.focusProxy(), Qt::Key_Return, QString("\r"), Qt::NoModifier);
+ QTest::sendKeyEvent(QTest::Release, view.focusProxy(), Qt::Key_Return, QString("\r"), Qt::NoModifier);
+ });
+ }
+
+ bool errorPageEnabled = settings->testAttribute(QWebEngineSettings::ErrorPageEnabled);
+ QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.size(), 2 + (errorPageEnabled ? 1 : 0), 30000);
+ QCOMPARE(page.acceptNavigationRequestCalls, shouldAccept ? 1 : 0);
+ }
+}
+
QTEST_MAIN(tst_QWebEngineSettings)
#include "tst_qwebenginesettings.moc"