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 "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
16 #include "content/common/render_widget_window_tree_client_factory.mojom.h" | 16 #include "content/common/render_widget_window_tree_client_factory.mojom.h" |
17 #include "content/public/common/connection_filter.h" | 17 #include "content/public/common/connection_filter.h" |
18 #include "content/public/common/service_manager_connection.h" | 18 #include "content/public/common/service_manager_connection.h" |
19 #include "content/renderer/mus/render_widget_mus_connection.h" | 19 #include "content/renderer/mus/renderer_window_tree_client.h" |
20 #include "mojo/public/cpp/bindings/binding_set.h" | 20 #include "mojo/public/cpp/bindings/binding_set.h" |
21 #include "services/service_manager/public/cpp/interface_factory.h" | 21 #include "services/service_manager/public/cpp/interface_factory.h" |
22 #include "services/service_manager/public/cpp/interface_registry.h" | 22 #include "services/service_manager/public/cpp/interface_registry.h" |
23 #include "services/service_manager/public/cpp/service.h" | 23 #include "services/service_manager/public/cpp/service.h" |
24 #include "services/ui/public/interfaces/window_tree.mojom.h" | 24 #include "services/ui/public/interfaces/window_tree.mojom.h" |
25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
26 | 26 |
27 namespace content { | 27 namespace content { |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 void BindMusConnectionOnMainThread( | 31 void BindMusConnectionOnMainThread( |
32 uint32_t routing_id, | 32 uint32_t routing_id, |
33 ui::mojom::WindowTreeClientRequest request) { | 33 ui::mojom::WindowTreeClientRequest request) { |
34 RenderWidgetMusConnection* connection = | 34 RendererWindowTreeClient::Get(routing_id)->Bind(std::move(request)); |
35 RenderWidgetMusConnection::GetOrCreate(routing_id); | |
36 connection->Bind(std::move(request)); | |
37 } | 35 } |
38 | 36 |
39 // This object's lifetime is managed by ServiceManagerConnection because it's a | 37 // This object's lifetime is managed by ServiceManagerConnection because it's a |
40 // registered with it. | 38 // registered with it. |
41 class RenderWidgetWindowTreeClientFactoryImpl | 39 class RenderWidgetWindowTreeClientFactoryImpl |
42 : public ConnectionFilter, | 40 : public ConnectionFilter, |
43 public mojom::RenderWidgetWindowTreeClientFactory { | 41 public mojom::RenderWidgetWindowTreeClientFactory { |
44 public: | 42 public: |
45 RenderWidgetWindowTreeClientFactoryImpl() : weak_factory_(this) { | 43 RenderWidgetWindowTreeClientFactoryImpl() : weak_factory_(this) { |
46 main_thread_task_runner_ = base::ThreadTaskRunnerHandle::Get(); | 44 main_thread_task_runner_ = base::ThreadTaskRunnerHandle::Get(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 80 |
83 } // namespace | 81 } // namespace |
84 | 82 |
85 void CreateRenderWidgetWindowTreeClientFactory( | 83 void CreateRenderWidgetWindowTreeClientFactory( |
86 ServiceManagerConnection* connection) { | 84 ServiceManagerConnection* connection) { |
87 connection->AddConnectionFilter( | 85 connection->AddConnectionFilter( |
88 base::MakeUnique<RenderWidgetWindowTreeClientFactoryImpl>()); | 86 base::MakeUnique<RenderWidgetWindowTreeClientFactoryImpl>()); |
89 } | 87 } |
90 | 88 |
91 } // namespace content | 89 } // namespace content |
OLD | NEW |