diff options
Diffstat (limited to 'src/core/renderer_host')
3 files changed, 32 insertions, 18 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 bf61f1851..53d3e88ba 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/renderer_host/user_resource_controller_host.cpp b/src/core/renderer_host/user_resource_controller_host.cpp index 2799d5d85..a9071df8f 100644 --- a/src/core/renderer_host/user_resource_controller_host.cpp +++ b/src/core/renderer_host/user_resource_controller_host.cpp @@ -142,9 +142,10 @@ void UserResourceControllerHost::addUserScript(const UserScript &script, WebCont m_perContentsScripts.insert(contents, currentScripts); } } - contents->Send(new RenderFrameObserverHelper_AddScript(contents->GetRenderViewHost()-> - GetMainFrame()->GetRoutingID(), - script.data())); + contents->GetRenderViewHost()->Send( + new RenderFrameObserverHelper_AddScript( + contents->GetRenderViewHost()->GetMainFrame()->GetRoutingID(), + script.data())); } } @@ -180,9 +181,10 @@ bool UserResourceControllerHost::removeUserScript(const UserScript &script, WebC QList<UserScript>::iterator it = std::find(list.begin(), list.end(), script); if (it == list.end()) return false; - contents->Send(new RenderFrameObserverHelper_RemoveScript(contents-> - GetMainFrame()->GetRoutingID(), - (*it).data())); + contents->GetRenderViewHost()->Send( + new RenderFrameObserverHelper_RemoveScript( + contents->GetMainFrame()->GetRoutingID(), + (*it).data())); list.erase(it); } return true; @@ -198,8 +200,8 @@ void UserResourceControllerHost::clearAllScripts(WebContentsAdapter *adapter) } else { content::WebContents *contents = adapter->webContents(); m_perContentsScripts.remove(contents); - contents->Send(new RenderFrameObserverHelper_ClearScripts(contents-> - GetMainFrame()->GetRoutingID())); + contents->GetRenderViewHost()->Send( + new RenderFrameObserverHelper_ClearScripts(contents->GetMainFrame()->GetRoutingID())); } } diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.cpp b/src/core/renderer_host/web_channel_ipc_transport_host.cpp index c47b255b7..b624d7e45 100644 --- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp +++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp @@ -41,6 +41,7 @@ #include "base/strings/string16.h" #include "content/public/browser/render_view_host.h" +#include "content/public/browser/web_contents.h" #include "common/qt_messages.h" #include "type_conversion.h" @@ -55,7 +56,10 @@ WebChannelIPCTransportHost::WebChannelIPCTransportHost(content::WebContents *con , content::WebContentsObserver(contents) , m_worldId(worldId) { - Send(new WebChannelIPCTransport_Install(routing_id(), m_worldId)); + contents->GetRenderViewHost()->Send( + new WebChannelIPCTransport_Install( + contents->GetRenderViewHost()->GetRoutingID(), + m_worldId)); } WebChannelIPCTransportHost::~WebChannelIPCTransportHost() @@ -78,9 +82,15 @@ void WebChannelIPCTransportHost::setWorldId(uint worldId) { if (worldId == m_worldId) return; - Send(new WebChannelIPCTransport_Uninstall(routing_id(), m_worldId)); + web_contents()->GetRenderViewHost()->Send( + new WebChannelIPCTransport_Uninstall( + web_contents()->GetRenderViewHost()->GetRoutingID(), + m_worldId)); m_worldId = worldId; - Send(new WebChannelIPCTransport_Install(routing_id(), m_worldId)); + web_contents()->GetRenderViewHost()->Send( + new WebChannelIPCTransport_Install( + web_contents()->GetRenderViewHost()->GetRoutingID(), + m_worldId)); } void WebChannelIPCTransportHost::sendMessage(const QJsonObject &message) @@ -88,7 +98,11 @@ void WebChannelIPCTransportHost::sendMessage(const QJsonObject &message) QJsonDocument doc(message); int size = 0; const char *rawData = doc.rawData(&size); - Send(new WebChannelIPCTransport_Message(routing_id(), std::vector<char>(rawData, rawData + size), m_worldId)); + web_contents()->GetRenderViewHost()->Send( + new WebChannelIPCTransport_Message( + web_contents()->GetRenderViewHost()->GetRoutingID(), + std::vector<char>(rawData, rawData + size), + m_worldId)); } void WebChannelIPCTransportHost::onWebChannelMessage(const std::vector<char> &message) |