OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/mus/render_widget_window_tree_client_factory.h" | 5 #include "content/renderer/mus/render_widget_window_tree_client_factory.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "components/mus/public/interfaces/window_tree.mojom.h" | 12 #include "components/mus/public/interfaces/window_tree.mojom.h" |
13 #include "content/common/render_widget_window_tree_client_factory.mojom.h" | 13 #include "content/common/render_widget_window_tree_client_factory.mojom.h" |
| 14 #include "content/public/child/child_thread.h" |
14 #include "content/public/common/mojo_shell_connection.h" | 15 #include "content/public/common/mojo_shell_connection.h" |
15 #include "content/renderer/mus/render_widget_mus_connection.h" | 16 #include "content/renderer/mus/render_widget_mus_connection.h" |
16 #include "mojo/public/cpp/bindings/binding_set.h" | 17 #include "mojo/public/cpp/bindings/binding_set.h" |
17 #include "services/shell/public/cpp/connection.h" | 18 #include "services/shell/public/cpp/connection.h" |
18 #include "services/shell/public/cpp/interface_factory.h" | 19 #include "services/shell/public/cpp/interface_factory.h" |
19 #include "services/shell/public/cpp/shell_client.h" | 20 #include "services/shell/public/cpp/shell_client.h" |
20 #include "url/gurl.h" | 21 #include "url/gurl.h" |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 // This object's lifetime is managed by MojoShellConnection because it's a | 27 // This object's lifetime is managed by MojoShellConnection because it's a |
27 // registered with it. | 28 // registered with it. |
28 class RenderWidgetWindowTreeClientFactoryImpl | 29 class RenderWidgetWindowTreeClientFactoryImpl |
29 : public shell::ShellClient, | 30 : public shell::ShellClient, |
30 public shell::InterfaceFactory< | 31 public shell::InterfaceFactory< |
31 mojom::RenderWidgetWindowTreeClientFactory>, | 32 mojom::RenderWidgetWindowTreeClientFactory>, |
32 public mojom::RenderWidgetWindowTreeClientFactory { | 33 public mojom::RenderWidgetWindowTreeClientFactory { |
33 public: | 34 public: |
34 RenderWidgetWindowTreeClientFactoryImpl() { | 35 RenderWidgetWindowTreeClientFactoryImpl() { |
35 DCHECK(MojoShellConnection::GetForProcess()); | 36 DCHECK(ChildThread::Get()->GetMojoShellConnection()); |
36 } | 37 } |
37 | 38 |
38 ~RenderWidgetWindowTreeClientFactoryImpl() override {} | 39 ~RenderWidgetWindowTreeClientFactoryImpl() override {} |
39 | 40 |
40 private: | 41 private: |
41 // shell::ShellClient implementation: | 42 // shell::ShellClient implementation: |
42 bool AcceptConnection(shell::Connection* connection) override { | 43 bool AcceptConnection(shell::Connection* connection) override { |
43 connection->AddInterface<mojom::RenderWidgetWindowTreeClientFactory>(this); | 44 connection->AddInterface<mojom::RenderWidgetWindowTreeClientFactory>(this); |
44 return true; | 45 return true; |
45 } | 46 } |
(...skipping 15 matching lines...) Expand all Loading... |
61 } | 62 } |
62 | 63 |
63 mojo::BindingSet<mojom::RenderWidgetWindowTreeClientFactory> bindings_; | 64 mojo::BindingSet<mojom::RenderWidgetWindowTreeClientFactory> bindings_; |
64 | 65 |
65 DISALLOW_COPY_AND_ASSIGN(RenderWidgetWindowTreeClientFactoryImpl); | 66 DISALLOW_COPY_AND_ASSIGN(RenderWidgetWindowTreeClientFactoryImpl); |
66 }; | 67 }; |
67 | 68 |
68 } // namespace | 69 } // namespace |
69 | 70 |
70 void CreateRenderWidgetWindowTreeClientFactory() { | 71 void CreateRenderWidgetWindowTreeClientFactory() { |
71 MojoShellConnection::GetForProcess()->AddEmbeddedShellClient( | 72 ChildThread::Get()->GetMojoShellConnection()->AddEmbeddedShellClient( |
72 base::WrapUnique(new RenderWidgetWindowTreeClientFactoryImpl)); | 73 base::WrapUnique(new RenderWidgetWindowTreeClientFactoryImpl)); |
73 } | 74 } |
74 | 75 |
75 } // namespace content | 76 } // namespace content |
OLD | NEW |