From 155fef99aede6b2314a3c602ec4501c050219401 Mon Sep 17 00:00:00 2001 From: gellert Date: Tue, 11 Apr 2017 14:19:34 +0200 Subject: [PATCH] adds offscreen renderer ipc message to disable external popups --- atom/browser/osr/osr_web_contents_view.cc | 5 ++--- atom/common/api/api_messages.h | 2 ++ atom/renderer/atom_render_view_observer.cc | 5 +++++ atom/renderer/atom_render_view_observer.h | 2 ++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/atom/browser/osr/osr_web_contents_view.cc b/atom/browser/osr/osr_web_contents_view.cc index f5c07c8ed1f..8fe69683195 100644 --- a/atom/browser/osr/osr_web_contents_view.cc +++ b/atom/browser/osr/osr_web_contents_view.cc @@ -4,7 +4,7 @@ #include "atom/browser/osr/osr_web_contents_view.h" -#include "content/common/worker_messages.h" +#include "atom/common/api/api_messages.h" #include "content/public/browser/render_view_host.h" #include "third_party/WebKit/public/platform/WebScreenInfo.h" #include "ui/display/screen.h" @@ -127,8 +127,7 @@ void OffScreenWebContentsView::RenderViewCreated( GetView()->InstallTransparency(); #if defined(OS_MACOSX) - host->Send(new WorkerProcessMsg_DisableExternalPopupMenus( - host->GetRoutingID())); + host->Send(new AtomViewMsg_Offscreen(host->GetRoutingID())); #endif } diff --git a/atom/common/api/api_messages.h b/atom/common/api/api_messages.h index ef945d9eebe..e25089b869a 100644 --- a/atom/common/api/api_messages.h +++ b/atom/common/api/api_messages.h @@ -35,6 +35,8 @@ IPC_MESSAGE_ROUTED3(AtomViewMsg_Message, base::string16 /* channel */, base::ListValue /* arguments */) +IPC_MESSAGE_ROUTED0(AtomViewMsg_Offscreen) + // Sent by the renderer when the draggable regions are updated. IPC_MESSAGE_ROUTED1(AtomViewHostMsg_UpdateDraggableRegions, std::vector /* regions */) diff --git a/atom/renderer/atom_render_view_observer.cc b/atom/renderer/atom_render_view_observer.cc index a68238ba4ce..6aa26cccaf0 100644 --- a/atom/renderer/atom_render_view_observer.cc +++ b/atom/renderer/atom_render_view_observer.cc @@ -136,6 +136,7 @@ bool AtomRenderViewObserver::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(AtomRenderViewObserver, message) IPC_MESSAGE_HANDLER(AtomViewMsg_Message, OnBrowserMessage) + IPC_MESSAGE_HANDLER(AtomViewMsg_Offscreen, OnOffscreen) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -169,4 +170,8 @@ void AtomRenderViewObserver::OnBrowserMessage(bool send_to_all, } } +void AtomRenderViewObserver::OnOffscreen() { + blink::WebView::setUseExternalPopupMenus(false); +} + } // namespace atom diff --git a/atom/renderer/atom_render_view_observer.h b/atom/renderer/atom_render_view_observer.h index e642bbe9422..4751db2d8c6 100644 --- a/atom/renderer/atom_render_view_observer.h +++ b/atom/renderer/atom_render_view_observer.h @@ -40,6 +40,8 @@ class AtomRenderViewObserver : public content::RenderViewObserver { const base::string16& channel, const base::ListValue& args); + void OnOffscreen(); + AtomRendererClient* renderer_client_; // Whether the document object has been created.