Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/renderer/render_process_client_connection_listener.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "base/macros.h" | |
| 9 #include "components/mus/public/interfaces/window_tree.mojom.h" | |
| 10 #include "content/common/render_process_client.mojom.h" | |
| 11 #include "content/public/common/mojo_shell_connection.h" | |
| 12 #include "content/renderer/render_widget_mus_connection.h" | |
| 13 #include "mojo/application/public/cpp/application_connection.h" | |
| 14 #include "mojo/application/public/cpp/interface_factory.h" | |
| 15 #include "mojo/common/weak_binding_set.h" | |
| 16 #include "url/gurl.h" | |
| 17 | |
| 18 namespace content { | |
| 19 | |
| 20 namespace { | |
| 21 | |
| 22 class RenderProcessClientConnectionListener | |
|
Ben Goodger (Google)
2015/11/25 04:07:28
RenderWidgetWindowTreeClientFactoryImpl
Fady Samuel
2015/11/25 17:45:53
Done.
| |
| 23 : public MojoShellConnection::Listener, | |
| 24 public mojo::InterfaceFactory<mojom::RenderProcessClient>, | |
| 25 public mojom::RenderProcessClient { | |
| 26 public: | |
| 27 static void Create() { new RenderProcessClientConnectionListener; } | |
| 28 | |
| 29 private: | |
| 30 RenderProcessClientConnectionListener() { | |
| 31 DCHECK(MojoShellConnection::Get()); | |
| 32 MojoShellConnection::Get()->AddListener(this); | |
| 33 } | |
| 34 | |
| 35 ~RenderProcessClientConnectionListener() override {} | |
| 36 | |
| 37 // MojoShellConnection::Listener implementation: | |
| 38 bool ConfigureIncomingConnection( | |
| 39 mojo::ApplicationConnection* connection) override { | |
| 40 connection->AddService<mojom::RenderProcessClient>(this); | |
| 41 return true; | |
| 42 } | |
| 43 | |
| 44 // mojo::InterfaceFactory<mojom::RenderProcessClient>: | |
| 45 void Create( | |
| 46 mojo::ApplicationConnection* connection, | |
| 47 mojo::InterfaceRequest<mojom::RenderProcessClient> request) override { | |
| 48 bindings_.AddBinding(this, request.Pass()); | |
| 49 } | |
| 50 | |
| 51 // mojom::RenderProcessClient implementation. | |
| 52 void OnRenderWidgetHostViewCreated( | |
| 53 uint32_t routing_id, | |
| 54 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) override { | |
| 55 new RenderWidgetMusConnection(routing_id, request.Pass()); | |
| 56 } | |
| 57 | |
| 58 mojo::WeakBindingSet<mojom::RenderProcessClient> bindings_; | |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(RenderProcessClientConnectionListener); | |
| 61 }; | |
| 62 | |
| 63 } // namespace | |
| 64 | |
| 65 void CreateRenderProcessClientConnectionListener() { | |
| 66 RenderProcessClientConnectionListener::Create(); | |
| 67 } | |
| 68 | |
| 69 } // namespace content | |
| OLD | NEW |