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_widget_window_tree_client_factory.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_widget_window_tree_client_factory.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 RenderWidgetWindowTreeClientFactoryImpl | |
| 23 : public MojoShellConnection::Listener, | |
| 24 public mojo::InterfaceFactory<mojom::RenderWidgetWindowTreeClientFactory>, | |
| 25 public mojom::RenderWidgetWindowTreeClientFactory { | |
| 26 public: | |
| 27 static void Create() { new RenderWidgetWindowTreeClientFactoryImpl; } | |
|
Ben Goodger (Google)
2015/11/25 20:28:15
at this point you may as well just make the ctor p
Fady Samuel
2015/11/25 20:46:50
Done.
| |
| 28 | |
| 29 private: | |
| 30 RenderWidgetWindowTreeClientFactoryImpl() { | |
| 31 DCHECK(MojoShellConnection::Get()); | |
| 32 MojoShellConnection::Get()->AddListener(this); | |
| 33 } | |
| 34 | |
| 35 ~RenderWidgetWindowTreeClientFactoryImpl() override {} | |
|
Ben Goodger (Google)
2015/11/25 20:28:15
how is this object ever deleted?
Fady Samuel
2015/11/25 20:46:50
It's owned by MojoShellConnection because it's a l
Ben Goodger (Google)
2015/11/25 20:50:56
duh. i know you have the comment in MojoShellConne
| |
| 36 | |
| 37 // MojoShellConnection::Listener implementation: | |
| 38 bool ConfigureIncomingConnection( | |
| 39 mojo::ApplicationConnection* connection) override { | |
| 40 connection->AddService<mojom::RenderWidgetWindowTreeClientFactory>(this); | |
| 41 return true; | |
| 42 } | |
| 43 | |
| 44 // mojo::InterfaceFactory<mojom::RenderWidgetWindowTreeClientFactory>: | |
| 45 void Create(mojo::ApplicationConnection* connection, | |
| 46 mojo::InterfaceRequest<mojom::RenderWidgetWindowTreeClientFactory> | |
| 47 request) override { | |
| 48 bindings_.AddBinding(this, request.Pass()); | |
| 49 } | |
| 50 | |
| 51 // mojom::RenderWidgetWindowTreeClientFactory implementation. | |
| 52 void CreateWindowTreeClientForRenderWidget( | |
| 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::RenderWidgetWindowTreeClientFactory> bindings_; | |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(RenderWidgetWindowTreeClientFactoryImpl); | |
| 61 }; | |
| 62 | |
| 63 } // namespace | |
| 64 | |
| 65 void CreateRenderWidgetWindowTreeClientFactory() { | |
| 66 RenderWidgetWindowTreeClientFactoryImpl::Create(); | |
| 67 } | |
| 68 | |
| 69 } // namespace content | |
| OLD | NEW |