mustash: Enable connections to mus from the Chrome renderer [take 2]
This CL introduces the initial plumbing to enable
connections to mus from the Chrome renderer.
The connection is established as follows:
1. RenderWidgetHostViewMus requests a
RenderWidgetWindowTreeClientFactory interface from the renderer. It
uses that client ptr to issue an CreateWindowTreeClientForRenderWidget
with the host routing ID and an interface request to a WindowTreeClient.
2. The renderer receives the request for
RenderWidgetWindowTreeClientFactory and handles it in
RenderWidgetWindowTreeClientFactoryImpl. The renderer sees
the subsequent CreateWindowTreeClientForRenderWidget call, and
creates a RenderWidgetMusConnection.
3. RenderWidgetMusConnection uses the WindowTreeClient
interface request to establish a WindowTreeConnection.
4. RenderWidgetMusConnection receives an OnEmbed from mus
with a mus::Window as its root and starts putting things
on screen inside this window.
BUG=551250
Review URL: https://codereview.chromium.org/1476643002
Cr-Commit-Position: refs/heads/master@{#361820}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index c36e3a7..358754a 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -136,6 +136,7 @@
#if defined(MOJO_SHELL_CLIENT)
#include "content/browser/web_contents/web_contents_view_mus.h"
#include "content/public/common/mojo_shell_connection.h"
+#include "ui/aura/mus/mus_util.h"
#endif
namespace content {
@@ -1391,8 +1392,11 @@
if (MojoShellConnection::Get() &&
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kUseMusInRenderer)) {
- view_.reset(new WebContentsViewMus(this, view_.Pass(),
- &render_view_host_delegate_view_));
+ mus::Window* window = aura::GetMusWindow(params.context);
+ if (window) {
+ view_.reset(new WebContentsViewMus(this, window, view_.Pass(),
+ &render_view_host_delegate_view_));
+ }
}
#endif