| 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/mojo_shell_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/render_widget_mus_connection.h" |
| 20 #include "mojo/public/cpp/bindings/binding_set.h" | 20 #include "mojo/public/cpp/bindings/binding_set.h" |
| 21 #include "services/shell/public/cpp/interface_factory.h" | 21 #include "services/shell/public/cpp/interface_factory.h" |
| 22 #include "services/shell/public/cpp/service.h" | 22 #include "services/shell/public/cpp/service.h" |
| 23 #include "services/ui/public/interfaces/window_tree.mojom.h" | 23 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 24 #include "url/gurl.h" | 24 #include "url/gurl.h" |
| 25 | 25 |
| 26 namespace content { | 26 namespace content { |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 void BindMusConnectionOnMainThread( | 30 void BindMusConnectionOnMainThread( |
| 31 uint32_t routing_id, | 31 uint32_t routing_id, |
| 32 ui::mojom::WindowTreeClientRequest request) { | 32 ui::mojom::WindowTreeClientRequest request) { |
| 33 RenderWidgetMusConnection* connection = | 33 RenderWidgetMusConnection* connection = |
| 34 RenderWidgetMusConnection::GetOrCreate(routing_id); | 34 RenderWidgetMusConnection::GetOrCreate(routing_id); |
| 35 connection->Bind(std::move(request)); | 35 connection->Bind(std::move(request)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 // This object's lifetime is managed by MojoShellConnection because it's a | 38 // This object's lifetime is managed by ServiceManagerConnection because it's a |
| 39 // registered with it. | 39 // registered with it. |
| 40 class RenderWidgetWindowTreeClientFactoryImpl | 40 class RenderWidgetWindowTreeClientFactoryImpl |
| 41 : public ConnectionFilter, | 41 : public ConnectionFilter, |
| 42 public mojom::RenderWidgetWindowTreeClientFactory { | 42 public mojom::RenderWidgetWindowTreeClientFactory { |
| 43 public: | 43 public: |
| 44 RenderWidgetWindowTreeClientFactoryImpl() : weak_factory_(this) { | 44 RenderWidgetWindowTreeClientFactoryImpl() : weak_factory_(this) { |
| 45 main_thread_task_runner_ = base::ThreadTaskRunnerHandle::Get(); | 45 main_thread_task_runner_ = base::ThreadTaskRunnerHandle::Get(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 ~RenderWidgetWindowTreeClientFactoryImpl() override {} | 48 ~RenderWidgetWindowTreeClientFactoryImpl() override {} |
| (...skipping 26 matching lines...) Expand all Loading... |
| 75 scoped_refptr<base::SequencedTaskRunner> main_thread_task_runner_; | 75 scoped_refptr<base::SequencedTaskRunner> main_thread_task_runner_; |
| 76 mojo::BindingSet<mojom::RenderWidgetWindowTreeClientFactory> bindings_; | 76 mojo::BindingSet<mojom::RenderWidgetWindowTreeClientFactory> bindings_; |
| 77 base::WeakPtrFactory<RenderWidgetWindowTreeClientFactoryImpl> weak_factory_; | 77 base::WeakPtrFactory<RenderWidgetWindowTreeClientFactoryImpl> weak_factory_; |
| 78 | 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(RenderWidgetWindowTreeClientFactoryImpl); | 79 DISALLOW_COPY_AND_ASSIGN(RenderWidgetWindowTreeClientFactoryImpl); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace | 82 } // namespace |
| 83 | 83 |
| 84 void CreateRenderWidgetWindowTreeClientFactory( | 84 void CreateRenderWidgetWindowTreeClientFactory( |
| 85 MojoShellConnection* connection) { | 85 ServiceManagerConnection* connection) { |
| 86 connection->AddConnectionFilter( | 86 connection->AddConnectionFilter( |
| 87 base::MakeUnique<RenderWidgetWindowTreeClientFactoryImpl>()); | 87 base::MakeUnique<RenderWidgetWindowTreeClientFactoryImpl>()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace content | 90 } // namespace content |
| OLD | NEW |