diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-05-28 09:55:20 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-05-28 09:55:20 +0200 |
commit | 5087a4eaa32e08fe59f1f5b71dc21dda0876a759 (patch) | |
tree | 234e059dbe9226f242ca15b063952ad37e4f54da /src | |
parent | 6eadb2f2588b240b5fcda38e1f68a49a4690eb6b (diff) | |
parent | f2db8f1988a3767d4f35aa4724d4e168e80dad59 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I40d9ae90a4ea82c6242f5d0a1665af3856ad2f0b
Diffstat (limited to 'src')
m--------- | src/3rdparty | 0 | ||||
-rw-r--r-- | src/core/compositor/chromium_gpu_helper.cpp | 16 | ||||
-rw-r--r-- | src/core/compositor/chromium_gpu_helper.h | 16 | ||||
-rw-r--r-- | src/core/compositor/delegated_frame_node.cpp | 17 | ||||
-rw-r--r-- | src/core/content_client_qt.cpp | 8 | ||||
-rw-r--r-- | src/core/extensions/component_extension_resource_manager_qt.cpp | 19 | ||||
-rw-r--r-- | src/core/file_picker_controller.cpp | 72 | ||||
-rw-r--r-- | src/core/gn_run.pro | 5 | ||||
-rw-r--r-- | src/core/permission_manager_qt.cpp | 26 | ||||
-rw-r--r-- | src/core/permission_manager_qt.h | 11 | ||||
-rw-r--r-- | src/core/profile_adapter.cpp | 2 | ||||
-rw-r--r-- | src/core/profile_adapter.h | 8 | ||||
-rw-r--r-- | src/core/web_contents_adapter.cpp | 8 | ||||
-rw-r--r-- | src/core/web_contents_adapter.h | 2 | ||||
-rw-r--r-- | src/core/web_contents_delegate_qt.cpp | 3 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview.cpp | 10 | ||||
-rw-r--r-- | src/webengine/doc/src/qtwebengine-debugging.qdoc | 8 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage.cpp | 30 |
18 files changed, 159 insertions, 102 deletions
diff --git a/src/3rdparty b/src/3rdparty -Subproject 623647821aa7c7565ed5153a27c5a1bb088efbe +Subproject 7b2f027ea83c372c33d5b50deb65a2d98244aa0 diff --git a/src/core/compositor/chromium_gpu_helper.cpp b/src/core/compositor/chromium_gpu_helper.cpp index 71d0f3687..1ddbf75e5 100644 --- a/src/core/compositor/chromium_gpu_helper.cpp +++ b/src/core/compositor/chromium_gpu_helper.cpp @@ -57,9 +57,7 @@ #include "content/gpu/gpu_child_thread.h" #include "gpu/ipc/service/gpu_channel_manager.h" -#ifdef Q_OS_QNX -#include "content/common/gpu/stream_texture_qnx.h" -#endif +#include <QtGlobal> // We need this for Q_UNUSED scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner() { @@ -87,15 +85,3 @@ void ProgressFlingIfNeeded(content::RenderWidgetHost *host, const base::TimeTick { content::RenderWidgetHostImpl::From(host)->ProgressFlingIfNeeded(current_time); } - -#ifdef Q_OS_QNX -EGLStreamData eglstream_connect_consumer(gpu::Texture *tex) -{ - EGLStreamData egl_stream; - content::StreamTexture* image = static_cast<content::StreamTexture *>(tex->GetLevelImage(GL_TEXTURE_EXTERNAL_OES, 0)); - if (image) { - image->ConnectConsumerIfNeeded(&egl_stream.egl_display, &egl_stream.egl_str_handle); - } - return egl_stream; -} -#endif diff --git a/src/core/compositor/chromium_gpu_helper.h b/src/core/compositor/chromium_gpu_helper.h index 4086d12ab..e692b9b85 100644 --- a/src/core/compositor/chromium_gpu_helper.h +++ b/src/core/compositor/chromium_gpu_helper.h @@ -40,8 +40,6 @@ #ifndef CHROMIUM_GPU_HELPER_H #define CHROMIUM_GPU_HELPER_H -#include <QtGlobal> // We need this for the Q_OS_QNX define. - #include "base/memory/scoped_refptr.h" namespace base { @@ -72,18 +70,4 @@ unsigned int service_id(gpu::TextureBase *tex); void ProgressFlingIfNeeded(content::RenderWidgetHost *host, const base::TimeTicks ¤t_time); -#ifdef Q_OS_QNX -typedef void* EGLDisplay; -typedef void* EGLStreamKHR; - -struct EGLStreamData { - EGLDisplay egl_display; - EGLStreamKHR egl_str_handle; - - EGLStreamData(): egl_display(NULL), egl_str_handle(NULL) {} -}; - -EGLStreamData eglstream_connect_consumer(gpu::Texture *tex); -#endif - #endif // CHROMIUM_GPU_HELPER_H diff --git a/src/core/compositor/delegated_frame_node.cpp b/src/core/compositor/delegated_frame_node.cpp index c20069558..de79ba514 100644 --- a/src/core/compositor/delegated_frame_node.cpp +++ b/src/core/compositor/delegated_frame_node.cpp @@ -142,9 +142,6 @@ private: #if defined(USE_OZONE) bool m_ownsTexture; #endif -#ifdef Q_OS_QNX - EGLStreamData m_eglStreamData; -#endif friend class DelegatedFrameNode; }; #endif // QT_CONFIG(opengl) @@ -467,20 +464,6 @@ void MailboxTexture::bind() if (m_fence) m_fence->wait(); glBindTexture(m_target, m_textureId); -#ifdef Q_OS_QNX - if (m_target == GL_TEXTURE_EXTERNAL_OES) { - static bool resolved = false; - static PFNEGLSTREAMCONSUMERACQUIREKHRPROC eglStreamConsumerAcquire = 0; - - if (!resolved) { - QOpenGLContext *context = QOpenGLContext::currentContext(); - eglStreamConsumerAcquire = (PFNEGLSTREAMCONSUMERACQUIREKHRPROC)context->getProcAddress("eglStreamConsumerAcquireKHR"); - resolved = true; - } - if (eglStreamConsumerAcquire) - eglStreamConsumerAcquire(m_eglStreamData.egl_display, m_eglStreamData.egl_str_handle); - } -#endif } #endif // QT_CONFIG(opengl) diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index 80eb9ceb1..083e10f2a 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -54,7 +54,7 @@ #include "ui/base/layout.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" - +#include "services/service_manager/embedder/switches.h" #include "type_conversion.h" #include <QCoreApplication> @@ -68,9 +68,7 @@ #include "third_party/widevine/cdm/widevine_cdm_common.h" #if BUILDFLAG(ENABLE_WIDEVINE) && !BUILDFLAG(ENABLE_WIDEVINE_CDM_COMPONENT) #define WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT -namespace switches { -const char kCdmWidevinePath[] = "widevine-path"; -} + // File name of the CDM on different platforms. const char kWidevineCdmFileName[] = #if defined(OS_MACOSX) @@ -287,7 +285,7 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path, content::CdmCapability *capability) { QStringList pluginPaths; - const base::CommandLine::StringType widevine_argument = base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(switches::kCdmWidevinePath); + const base::CommandLine::StringType widevine_argument = base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(service_manager::switches::kCdmWidevinePath); if (!widevine_argument.empty()) pluginPaths << QtWebEngineCore::toQt(widevine_argument); else { diff --git a/src/core/extensions/component_extension_resource_manager_qt.cpp b/src/core/extensions/component_extension_resource_manager_qt.cpp index bb1dd045c..1f58de151 100644 --- a/src/core/extensions/component_extension_resource_manager_qt.cpp +++ b/src/core/extensions/component_extension_resource_manager_qt.cpp @@ -92,12 +92,27 @@ const ui::TemplateReplacements *ComponentExtensionResourceManagerQt::GetTemplate void ComponentExtensionResourceManagerQt::AddComponentResourceEntries(const GritResourceMap *entries, size_t size) { + base::FilePath gen_folder_path = base::FilePath().AppendASCII("@out_folder@/gen/chrome/browser/resources/"); + gen_folder_path = gen_folder_path.NormalizePathSeparators(); + for (size_t i = 0; i < size; ++i) { base::FilePath resource_path = base::FilePath().AppendASCII(entries[i].name); resource_path = resource_path.NormalizePathSeparators(); - DCHECK(!base::Contains(path_to_resource_id_, resource_path)); - path_to_resource_id_[resource_path] = entries[i].value; + + if (!gen_folder_path.IsParent(resource_path)) { + DCHECK(!base::Contains(path_to_resource_id_, resource_path)); + path_to_resource_id_[resource_path] = entries[i].value; + } else { + // If the resource is a generated file, strip the generated folder's path, + // so that it can be served from a normal URL (as if it were not + // generated). + base::FilePath effective_path = + base::FilePath().AppendASCII(resource_path.AsUTF8Unsafe().substr( + gen_folder_path.value().length())); + DCHECK(!base::Contains(path_to_resource_id_, effective_path)); + path_to_resource_id_[effective_path] = entries[i].value; + } } } diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp index 3c81a977c..01a6d0746 100644 --- a/src/core/file_picker_controller.cpp +++ b/src/core/file_picker_controller.cpp @@ -39,9 +39,8 @@ #include "file_picker_controller.h" #include "type_conversion.h" -#if defined(OS_WIN) + #include "base/files/file_path.h" -#endif #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/file_select_listener.h" @@ -72,27 +71,64 @@ void FilePickerController::accepted(const QStringList &files) for (const QString &urlString : files) { // We accept strings on both absolute-path and file-URL form: - if (QDir::isAbsolutePath(urlString)) { - QString absolutePath = QDir::fromNativeSeparators(urlString); -#if defined(OS_WIN) - if (absolutePath.at(0).isLetter() && absolutePath.at(1) == QLatin1Char(':') && !base::FilePath::IsSeparator(absolutePath.at(2).toLatin1())) - qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString)); - else + if (toFilePath(urlString).IsAbsolute()) { + stringList.append(urlString); + continue; + } + + if (urlString.startsWith("file:")) { + base::FilePath filePath = toFilePath(urlString).NormalizePathSeparators(); + std::vector<base::FilePath::StringType> pathComponents; + // Splits the file URL into host name, path and file name. + filePath.GetComponents(&pathComponents); + + QString absolutePath; +#if !defined(OS_WIN) + absolutePath = "/"; #endif - stringList.append(absolutePath); - } else { - QUrl url(urlString, QUrl::StrictMode); - if (url.isLocalFile() && QDir::isAbsolutePath(url.toLocalFile())) { - QString absolutePath = url.toLocalFile(); + + QString scheme = toQt(pathComponents[0]); + if (scheme.size() > 5) { #if defined(OS_WIN) - if (absolutePath.at(0).isLetter() && absolutePath.at(1) == QLatin1Char(':') && !base::FilePath::IsSeparator(absolutePath.at(2).toLatin1())) + // There is no slash at the end of the file scheme and it is valid on Windows: file:C:/ + if (scheme.at(5).isLetter() && scheme.at(6) != ':') { + absolutePath += scheme.at(5) + ":/"; + } else { +#endif qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString)); - else + continue; +#if defined(OS_WIN) + } +#endif + } + + // Non-local file and UNC Path validation: file://path/file + if (base::FilePath::IsSeparator(urlString.at(5).toLatin1()) + && base::FilePath::IsSeparator(urlString.at(6).toLatin1()) + && !base::FilePath::IsSeparator(urlString.at(7).toLatin1())) { +#if defined(OS_WIN) + if (urlString.at(8) != ':' && pathComponents.size() > 2) { + absolutePath += "//"; +#else + if (pathComponents.size() > 2) { + absolutePath += "/"; #endif - stringList.append(absolutePath); - } else - qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString)); + } else { + qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString)); + continue; + } + } + + // Build absolute path from file URI componenets. + for (int j = 1; j < pathComponents.size(); j++) + absolutePath += toQt(pathComponents[j]) + (j != pathComponents.size()-1 ? "/" : ""); + + if (toFilePath(absolutePath).IsAbsolute()) { + stringList.append(absolutePath); + continue; + } } + qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString)); } FilePickerController::filesSelectedInChooser(stringList); diff --git a/src/core/gn_run.pro b/src/core/gn_run.pro index 4f1ccce43..f72efc8d5 100644 --- a/src/core/gn_run.pro +++ b/src/core/gn_run.pro @@ -61,3 +61,8 @@ build_pass|!debug_and_release { notParallel.target = .NOTPARALLEL QMAKE_EXTRA_TARGETS += notParallel } + +build_pass:CONFIG(debug, debug|release) { + TARGET = gn_run_debug +} + diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index 2f9543769..862a1c262 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -102,6 +102,18 @@ static bool canRequestPermissionFor(ProfileAdapter::PermissionType type) return false; } +static blink::mojom::PermissionStatus toBlink(ProfileAdapter::PermissionState reply) +{ + switch (reply) { + case ProfileAdapter::AskPermission: + return blink::mojom::PermissionStatus::ASK; + case ProfileAdapter::AllowedPermission: + return blink::mojom::PermissionStatus::GRANTED; + case ProfileAdapter::DeniedPermission: + return blink::mojom::PermissionStatus::DENIED; + } +} + PermissionManagerQt::PermissionManagerQt() : m_requestIdCount(0) , m_subscriberIdCount(0) @@ -112,7 +124,7 @@ PermissionManagerQt::~PermissionManagerQt() { } -void PermissionManagerQt::permissionRequestReply(const QUrl &url, ProfileAdapter::PermissionType type, bool reply) +void PermissionManagerQt::permissionRequestReply(const QUrl &url, ProfileAdapter::PermissionType type, ProfileAdapter::PermissionState reply) { // Normalize the QUrl to GURL origin form. const GURL gorigin = toGurl(url).GetOrigin(); @@ -120,9 +132,12 @@ void PermissionManagerQt::permissionRequestReply(const QUrl &url, ProfileAdapter if (origin.isEmpty()) return; QPair<QUrl, ProfileAdapter::PermissionType> key(origin, type); - m_permissions[key] = reply; - blink::mojom::PermissionStatus status = reply ? blink::mojom::PermissionStatus::GRANTED : blink::mojom::PermissionStatus::DENIED; - { + if (reply == ProfileAdapter::AskPermission) + m_permissions.remove(key); + else + m_permissions[key] = (reply == ProfileAdapter::AllowedPermission); + blink::mojom::PermissionStatus status = toBlink(reply); + if (reply != ProfileAdapter::AskPermission) { auto it = m_requests.begin(); while (it != m_requests.end()) { if (it->origin == origin && it->type == type) { @@ -137,6 +152,9 @@ void PermissionManagerQt::permissionRequestReply(const QUrl &url, ProfileAdapter it.second.callback.Run(status); } + if (reply == ProfileAdapter::AskPermission) + return; + auto it = m_multiRequests.begin(); while (it != m_multiRequests.end()) { if (it->origin == origin) { diff --git a/src/core/permission_manager_qt.h b/src/core/permission_manager_qt.h index 6ab071237..e046174df 100644 --- a/src/core/permission_manager_qt.h +++ b/src/core/permission_manager_qt.h @@ -54,10 +54,9 @@ class PermissionManagerQt : public content::PermissionControllerDelegate { public: PermissionManagerQt(); ~PermissionManagerQt(); - typedef ProfileAdapter::PermissionType PermissionType; - void permissionRequestReply(const QUrl &origin, PermissionType type, bool reply); - bool checkPermission(const QUrl &origin, PermissionType type); + void permissionRequestReply(const QUrl &origin, ProfileAdapter::PermissionType type, ProfileAdapter::PermissionState reply); + bool checkPermission(const QUrl &origin, ProfileAdapter::PermissionType type); // content::PermissionManager implementation: int RequestPermission( @@ -99,10 +98,10 @@ public: void UnsubscribePermissionStatusChange(int subscription_id) override; private: - QHash<QPair<QUrl, PermissionType>, bool> m_permissions; + QHash<QPair<QUrl, ProfileAdapter::PermissionType>, bool> m_permissions; struct Request { int id; - PermissionType type; + ProfileAdapter::PermissionType type; QUrl origin; base::OnceCallback<void(blink::mojom::PermissionStatus)> callback; }; @@ -113,7 +112,7 @@ private: base::OnceCallback<void(const std::vector<blink::mojom::PermissionStatus>&)> callback; }; struct Subscription { - PermissionType type; + ProfileAdapter::PermissionType type; QUrl origin; base::RepeatingCallback<void(blink::mojom::PermissionStatus)> callback; }; diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp index b87591c97..4557ad7a4 100644 --- a/src/core/profile_adapter.cpp +++ b/src/core/profile_adapter.cpp @@ -543,7 +543,7 @@ UserResourceControllerHost *ProfileAdapter::userResourceController() return m_userResourceController.data(); } -void ProfileAdapter::permissionRequestReply(const QUrl &origin, PermissionType type, bool reply) +void ProfileAdapter::permissionRequestReply(const QUrl &origin, PermissionType type, PermissionState reply) { static_cast<PermissionManagerQt*>(profile()->GetPermissionControllerDelegate())->permissionRequestReply(origin, type, reply); } diff --git a/src/core/profile_adapter.h b/src/core/profile_adapter.h index 1e5a3e21f..efd56e50e 100644 --- a/src/core/profile_adapter.h +++ b/src/core/profile_adapter.h @@ -164,6 +164,12 @@ public: ClipboardWrite = 6, }; + enum PermissionState { + AskPermission = 0, + AllowedPermission = 1, + DeniedPermission = 2 + }; + HttpCacheType httpCacheType() const; void setHttpCacheType(ProfileAdapter::HttpCacheType); @@ -187,7 +193,7 @@ public: const QList<QByteArray> customUrlSchemes() const; UserResourceControllerHost *userResourceController(); - void permissionRequestReply(const QUrl &origin, PermissionType type, bool reply); + void permissionRequestReply(const QUrl &origin, PermissionType type, PermissionState reply); bool checkPermission(const QUrl &origin, PermissionType type); QString httpAcceptLanguageWithoutQualities() const; diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 0f2f21f83..ef482ef08 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -1360,15 +1360,15 @@ void WebContentsAdapter::grantMediaAccessPermission(const QUrl &securityOrigin, CHECK_INITIALIZED(); // Let the permission manager remember the reply. if (flags & WebContentsAdapterClient::MediaAudioCapture) - m_profileAdapter->permissionRequestReply(securityOrigin, ProfileAdapter::AudioCapturePermission, true); + m_profileAdapter->permissionRequestReply(securityOrigin, ProfileAdapter::AudioCapturePermission, ProfileAdapter::AllowedPermission); if (flags & WebContentsAdapterClient::MediaVideoCapture) - m_profileAdapter->permissionRequestReply(securityOrigin, ProfileAdapter::VideoCapturePermission, true); + m_profileAdapter->permissionRequestReply(securityOrigin, ProfileAdapter::VideoCapturePermission, ProfileAdapter::AllowedPermission); MediaCaptureDevicesDispatcher::GetInstance()->handleMediaAccessPermissionResponse(m_webContents.get(), securityOrigin, flags); } -void WebContentsAdapter::runFeatureRequestCallback(const QUrl &securityOrigin, ProfileAdapter::PermissionType feature, bool allowed) +void WebContentsAdapter::grantFeaturePermission(const QUrl &securityOrigin, ProfileAdapter::PermissionType feature, ProfileAdapter::PermissionState allowed) { - CHECK_INITIALIZED(); + Q_ASSERT(m_profileAdapter); m_profileAdapter->permissionRequestReply(securityOrigin, feature, allowed); } diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h index 66808ce5e..d833314f2 100644 --- a/src/core/web_contents_adapter.h +++ b/src/core/web_contents_adapter.h @@ -196,7 +196,7 @@ public: void grantMediaAccessPermission(const QUrl &securityOrigin, WebContentsAdapterClient::MediaRequestFlags flags); void grantMouseLockPermission(const QUrl &securityOrigin, bool granted); void handlePendingMouseLockPermission(); - void runFeatureRequestCallback(const QUrl &securityOrigin, ProfileAdapter::PermissionType feature, bool allowed); + void grantFeaturePermission(const QUrl &securityOrigin, ProfileAdapter::PermissionType feature, ProfileAdapter::PermissionState allowed); void setBackgroundColor(const QColor &color); QAccessibleInterface *browserAccessible(); diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index bf0254e82..63f52433e 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -251,8 +251,9 @@ void WebContentsDelegateQt::AddNewContents(content::WebContents* source, std::un void WebContentsDelegateQt::CloseContents(content::WebContents *source) { - m_viewClient->close(); GetJavaScriptDialogManager(source)->CancelDialogs(source, /* whatever?: */false); + // Must be the last call because close() might trigger the destruction of this object. + m_viewClient->close(); } void WebContentsDelegateQt::LoadProgressChanged(double progress) diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 6e5469ab4..f659d15ca 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -1644,9 +1644,6 @@ void QQuickWebEngineView::grantFeaturePermission(const QUrl &securityOrigin, QQu case MediaAudioVideoCapture: d_ptr->adapter->grantMediaAccessPermission(securityOrigin, WebContentsAdapterClient::MediaRequestFlags(WebContentsAdapterClient::MediaAudioCapture | WebContentsAdapterClient::MediaVideoCapture)); break; - case Geolocation: - d_ptr->adapter->runFeatureRequestCallback(securityOrigin, ProfileAdapter::GeolocationPermission, granted); - break; case DesktopVideoCapture: d_ptr->adapter->grantMediaAccessPermission(securityOrigin, WebContentsAdapterClient::MediaDesktopVideoCapture); break; @@ -1657,8 +1654,13 @@ void QQuickWebEngineView::grantFeaturePermission(const QUrl &securityOrigin, QQu WebContentsAdapterClient::MediaDesktopAudioCapture | WebContentsAdapterClient::MediaDesktopVideoCapture)); break; + case Geolocation: + d_ptr->adapter->grantFeaturePermission(securityOrigin, ProfileAdapter::GeolocationPermission, + granted ? ProfileAdapter::AllowedPermission : ProfileAdapter::DeniedPermission); + break; case Notifications: - d_ptr->adapter->runFeatureRequestCallback(securityOrigin, ProfileAdapter::NotificationPermission, granted); + d_ptr->adapter->grantFeaturePermission(securityOrigin, ProfileAdapter::NotificationPermission, + granted ? ProfileAdapter::AllowedPermission : ProfileAdapter::DeniedPermission); break; default: Q_UNREACHABLE(); diff --git a/src/webengine/doc/src/qtwebengine-debugging.qdoc b/src/webengine/doc/src/qtwebengine-debugging.qdoc index 088db5f87..0db35c85c 100644 --- a/src/webengine/doc/src/qtwebengine-debugging.qdoc +++ b/src/webengine/doc/src/qtwebengine-debugging.qdoc @@ -97,6 +97,11 @@ \li \c {--single-process} runs the renderer and plugins in the same process as the browser. This is useful for getting stack traces for renderer crashes. + \li \c {--enable-features=NetworkServiceInProcess} runs networking in + the main process. This may help firewall management, since only the + application executable will need to be whitelisted and + not QtWebEngineProcess. It means losing the security of + sandboxing of the network service though. \endlist Alternatively, the environment variable QTWEBENGINE_CHROMIUM_FLAGS can be @@ -106,4 +111,7 @@ \code QTWEBENGINE_CHROMIUM_FLAGS="--disable-logging" mybrowser \endcode + + QTWEBENGINE_CHROMIUM_FLAGS can also be set using {qputenv} from within the + application if called before QtWebEngine::initialize(). */ diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 7045fd856..6fb3c5c43 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -1910,8 +1910,24 @@ QMenu *QWebEnginePage::createStandardContextMenu() void QWebEnginePage::setFeaturePermission(const QUrl &securityOrigin, QWebEnginePage::Feature feature, QWebEnginePage::PermissionPolicy policy) { Q_D(QWebEnginePage); - if (policy == PermissionUnknown) + if (policy == PermissionUnknown) { + switch (feature) { + case MediaAudioVideoCapture: + case MediaAudioCapture: + case MediaVideoCapture: + case DesktopAudioVideoCapture: + case DesktopVideoCapture: + case MouseLock: + break; + case Geolocation: + d->adapter->grantFeaturePermission(securityOrigin, ProfileAdapter::GeolocationPermission, ProfileAdapter::AskPermission); + break; + case Notifications: + d->adapter->grantFeaturePermission(securityOrigin, ProfileAdapter::NotificationPermission, ProfileAdapter::AskPermission); + break; + } return; + } const WebContentsAdapterClient::MediaRequestFlags audioVideoCaptureFlags( WebContentsAdapterClient::MediaVideoCapture | @@ -1937,14 +1953,14 @@ void QWebEnginePage::setFeaturePermission(const QUrl &securityOrigin, QWebEngine case DesktopVideoCapture: d->adapter->grantMediaAccessPermission(securityOrigin, WebContentsAdapterClient::MediaDesktopVideoCapture); break; - case Geolocation: - d->adapter->runFeatureRequestCallback(securityOrigin, ProfileAdapter::GeolocationPermission, true); - break; case MouseLock: d->adapter->grantMouseLockPermission(securityOrigin, true); break; + case Geolocation: + d->adapter->grantFeaturePermission(securityOrigin, ProfileAdapter::GeolocationPermission, ProfileAdapter::AllowedPermission); + break; case Notifications: - d->adapter->runFeatureRequestCallback(securityOrigin, ProfileAdapter::NotificationPermission, true); + d->adapter->grantFeaturePermission(securityOrigin, ProfileAdapter::NotificationPermission, ProfileAdapter::AllowedPermission); break; } } else { // if (policy == PermissionDeniedByUser) @@ -1957,13 +1973,13 @@ void QWebEnginePage::setFeaturePermission(const QUrl &securityOrigin, QWebEngine d->adapter->grantMediaAccessPermission(securityOrigin, WebContentsAdapterClient::MediaNone); break; case Geolocation: - d->adapter->runFeatureRequestCallback(securityOrigin, ProfileAdapter::GeolocationPermission, false); + d->adapter->grantFeaturePermission(securityOrigin, ProfileAdapter::GeolocationPermission, ProfileAdapter::DeniedPermission); break; case MouseLock: d->adapter->grantMouseLockPermission(securityOrigin, false); break; case Notifications: - d->adapter->runFeatureRequestCallback(securityOrigin, ProfileAdapter::NotificationPermission, false); + d->adapter->grantFeaturePermission(securityOrigin, ProfileAdapter::NotificationPermission, ProfileAdapter::DeniedPermission); break; } } |