atom_render_view_observer.cc 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright (c) 2013 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #include "atom/renderer/atom_render_view_observer.h"
  5. #include "atom/common/api/api_messages.h"
  6. #include "content/public/renderer/render_view.h"
  7. #include "ipc/ipc_message_macros.h"
  8. #include "third_party/WebKit/public/web/WebView.h"
  9. namespace atom {
  10. AtomRenderViewObserver::AtomRenderViewObserver(content::RenderView* render_view)
  11. : content::RenderViewObserver(render_view) {}
  12. AtomRenderViewObserver::~AtomRenderViewObserver() {}
  13. bool AtomRenderViewObserver::OnMessageReceived(const IPC::Message& message) {
  14. bool handled = true;
  15. IPC_BEGIN_MESSAGE_MAP(AtomRenderViewObserver, message)
  16. IPC_MESSAGE_HANDLER(AtomViewMsg_Offscreen, OnOffscreen)
  17. IPC_MESSAGE_UNHANDLED(handled = false)
  18. IPC_END_MESSAGE_MAP()
  19. return handled;
  20. }
  21. void AtomRenderViewObserver::OnDestruct() {
  22. delete this;
  23. }
  24. void AtomRenderViewObserver::OnOffscreen() {
  25. blink::WebView::SetUseExternalPopupMenus(false);
  26. }
  27. } // namespace atom