diff options
author | Viktor Engelmann <viktor.engelmann@qt.io> | 2017-07-03 15:51:51 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-09-18 18:06:55 +0000 |
commit | 49c0ce8403e5caeb864f66553f122c68a7c975fb (patch) | |
tree | a3b4c1f89754c316fe1fb5cce4392dd05f1db4e7 /src/core/renderer_host | |
parent | 8365186b3fdc2f1eca7e015147688d23bfdf81e9 (diff) |
Add Setting to allow passing unknown URL schemes to QDesktopServices
A new enum UnknownUrlSchemePolicy was added to WebEngineSettings,
QWebEngineSettings and QQuickWebEngineSettings.
WebContentsDelegate now has a new attribute of that type, which can
be read and written through the public APIs
Q(Quick)WebEngineSettings::unknownUrlSchemeNavigationPolicy and
Q(Quick)WebEngineSettings::setUnknownUrlSchemeNavigationPolicy.
This way, one can control, whether URLs with unknown schemes are passed
to QDesktopServices. WebContentsAdapterClient::navigationRequested is
called on these requests, so this allows more fine-grained control
over the schemes and origins, that are allowed.
Task-number: QTBUG-58627
Change-Id: Ie81d9503456d63ea1ed5606483254acf437cd8f7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/renderer_host')
-rw-r--r-- | src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
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; } |