Chromium Code Reviews| Index: content/renderer/render_process_client_connection_listener.cc |
| diff --git a/content/renderer/render_process_client_connection_listener.cc b/content/renderer/render_process_client_connection_listener.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7ad8eb14306178eaf2f33e6e86e8572c33c8182b |
| --- /dev/null |
| +++ b/content/renderer/render_process_client_connection_listener.cc |
| @@ -0,0 +1,69 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/renderer/render_process_client_connection_listener.h" |
| + |
| +#include "base/logging.h" |
| +#include "base/macros.h" |
| +#include "components/mus/public/interfaces/window_tree.mojom.h" |
| +#include "content/common/render_process_client.mojom.h" |
| +#include "content/public/common/mojo_shell_connection.h" |
| +#include "content/renderer/render_widget_mus_connection.h" |
| +#include "mojo/application/public/cpp/application_connection.h" |
| +#include "mojo/application/public/cpp/interface_factory.h" |
| +#include "mojo/common/weak_binding_set.h" |
| +#include "url/gurl.h" |
| + |
| +namespace content { |
| + |
| +namespace { |
| + |
| +class RenderProcessClientConnectionListener |
|
Ben Goodger (Google)
2015/11/25 04:07:28
RenderWidgetWindowTreeClientFactoryImpl
Fady Samuel
2015/11/25 17:45:53
Done.
|
| + : public MojoShellConnection::Listener, |
| + public mojo::InterfaceFactory<mojom::RenderProcessClient>, |
| + public mojom::RenderProcessClient { |
| + public: |
| + static void Create() { new RenderProcessClientConnectionListener; } |
| + |
| + private: |
| + RenderProcessClientConnectionListener() { |
| + DCHECK(MojoShellConnection::Get()); |
| + MojoShellConnection::Get()->AddListener(this); |
| + } |
| + |
| + ~RenderProcessClientConnectionListener() override {} |
| + |
| + // MojoShellConnection::Listener implementation: |
| + bool ConfigureIncomingConnection( |
| + mojo::ApplicationConnection* connection) override { |
| + connection->AddService<mojom::RenderProcessClient>(this); |
| + return true; |
| + } |
| + |
| + // mojo::InterfaceFactory<mojom::RenderProcessClient>: |
| + void Create( |
| + mojo::ApplicationConnection* connection, |
| + mojo::InterfaceRequest<mojom::RenderProcessClient> request) override { |
| + bindings_.AddBinding(this, request.Pass()); |
| + } |
| + |
| + // mojom::RenderProcessClient implementation. |
| + void OnRenderWidgetHostViewCreated( |
| + uint32_t routing_id, |
| + mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) override { |
| + new RenderWidgetMusConnection(routing_id, request.Pass()); |
| + } |
| + |
| + mojo::WeakBindingSet<mojom::RenderProcessClient> bindings_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(RenderProcessClientConnectionListener); |
| +}; |
| + |
| +} // namespace |
| + |
| +void CreateRenderProcessClientConnectionListener() { |
| + RenderProcessClientConnectionListener::Create(); |
| +} |
| + |
| +} // namespace content |