Skip to content

Commit

Permalink
adds offscreen renderer ipc message to disable external popups
Browse files Browse the repository at this point in the history
  • Loading branch information
gerhardberger authored and brenca committed May 10, 2017
1 parent 6b33564 commit 155fef9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 2 additions & 3 deletions atom/browser/osr/osr_web_contents_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 2 additions & 0 deletions atom/common/api/api_messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<atom::DraggableRegion> /* regions */)
Expand Down
5 changes: 5 additions & 0 deletions atom/renderer/atom_render_view_observer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -169,4 +170,8 @@ void AtomRenderViewObserver::OnBrowserMessage(bool send_to_all,
}
}

void AtomRenderViewObserver::OnOffscreen() {
blink::WebView::setUseExternalPopupMenus(false);
}

} // namespace atom
2 changes: 2 additions & 0 deletions atom/renderer/atom_render_view_observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 155fef9

Please sign in to comment.