diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-10-14 12:29:28 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-10-14 12:29:54 +0200 |
commit | 9be23eb946580519b2b0600cc854ec8050b90659 (patch) | |
tree | 63ccf0e565f346a0788d937b004e01d2ec029b5e /src/core/resource_dispatcher_host_delegate_qt.cpp | |
parent | 4f2e66f9d898e9c11a7ad6e552d0d47bb15d4051 (diff) | |
parent | 981e38d2dc82c047c6ad8ec19427d3ac7434dc3c (diff) |
Merge remote-tracking branch 'origin/5.6' into devwip/47-based
Change-Id: I0569b04ced3456a1d5d91e02e117963115fcf1b2
Diffstat (limited to 'src/core/resource_dispatcher_host_delegate_qt.cpp')
-rw-r--r-- | src/core/resource_dispatcher_host_delegate_qt.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/core/resource_dispatcher_host_delegate_qt.cpp b/src/core/resource_dispatcher_host_delegate_qt.cpp index b63ecd5c7..e6c513bf6 100644 --- a/src/core/resource_dispatcher_host_delegate_qt.cpp +++ b/src/core/resource_dispatcher_host_delegate_qt.cpp @@ -130,6 +130,35 @@ void ResourceDispatcherHostLoginDelegateQt::destroy() m_request = 0; } +static void LaunchURL(const GURL& url, int render_process_id, int render_view_id, + ui::PageTransition page_transition, bool is_main_frame) +{ + Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + content::RenderViewHost *render_view_host = content::RenderViewHost::FromID(render_process_id, render_view_id); + if (!render_view_host) + return; + content::WebContents* webContents = content::WebContents::FromRenderViewHost(render_view_host); + if (!webContents) + return; + WebContentsDelegateQt *contentsDelegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate()); + contentsDelegate->launchExternalURL(toQt(url), page_transition, is_main_frame); +} + +bool ResourceDispatcherHostDelegateQt::HandleExternalProtocol(const GURL& url, int child_id, int route_id, + bool is_main_frame, ui::PageTransition page_transition, bool has_user_gesture) +{ + Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); + // We don't want to launch external applications unless it is based on a user action + if (!has_user_gesture) + return false; + + content::BrowserThread::PostTask( + content::BrowserThread::UI, + FROM_HERE, + base::Bind(&LaunchURL, url, child_id, route_id, page_transition, is_main_frame)); + return true; +} + content::ResourceDispatcherHostLoginDelegate *ResourceDispatcherHostDelegateQt::CreateLoginDelegate(net::AuthChallengeInfo *authInfo, net::URLRequest *request) { // ResourceDispatcherHostLoginDelegateQt is ref-counted and will be released after we called ClearLoginDelegateForRequest. |