| 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 "services/ui/public/cpp/window_tree_host_factory.h" | 5 #include "services/ui/public/cpp/window_tree_host_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" |
| 7 #include "services/shell/public/cpp/connector.h" | 8 #include "services/shell/public/cpp/connector.h" |
| 8 #include "services/ui/public/cpp/window_tree_client.h" | 9 #include "services/ui/public/cpp/window_tree_client.h" |
| 9 #include "services/ui/public/cpp/window_tree_client_delegate.h" | 10 #include "services/ui/public/cpp/window_tree_client_delegate.h" |
| 10 | 11 |
| 11 namespace ui { | 12 namespace ui { |
| 12 | 13 |
| 13 void CreateWindowTreeHost(mojom::WindowTreeHostFactory* factory, | 14 std::unique_ptr<WindowTreeClient> CreateWindowTreeHost( |
| 14 WindowTreeClientDelegate* delegate, | 15 mojom::WindowTreeHostFactory* factory, |
| 15 mojom::WindowTreeHostPtr* host, | 16 WindowTreeClientDelegate* delegate, |
| 16 WindowManagerDelegate* window_manager_delegate) { | 17 mojom::WindowTreeHostPtr* host, |
| 18 WindowManagerDelegate* window_manager_delegate) { |
| 17 mojom::WindowTreeClientPtr tree_client; | 19 mojom::WindowTreeClientPtr tree_client; |
| 18 new WindowTreeClient(delegate, window_manager_delegate, | 20 std::unique_ptr<WindowTreeClient> window_tree_client = |
| 19 GetProxy(&tree_client)); | 21 base::MakeUnique<WindowTreeClient>(delegate, window_manager_delegate, |
| 22 GetProxy(&tree_client)); |
| 20 factory->CreateWindowTreeHost(GetProxy(host), std::move(tree_client)); | 23 factory->CreateWindowTreeHost(GetProxy(host), std::move(tree_client)); |
| 24 return window_tree_client; |
| 21 } | 25 } |
| 22 | 26 |
| 23 void CreateWindowTreeHost(shell::Connector* connector, | 27 std::unique_ptr<WindowTreeClient> CreateWindowTreeHost( |
| 24 WindowTreeClientDelegate* delegate, | 28 shell::Connector* connector, |
| 25 mojom::WindowTreeHostPtr* host, | 29 WindowTreeClientDelegate* delegate, |
| 26 WindowManagerDelegate* window_manager_delegate) { | 30 mojom::WindowTreeHostPtr* host, |
| 31 WindowManagerDelegate* window_manager_delegate) { |
| 27 mojom::WindowTreeHostFactoryPtr factory; | 32 mojom::WindowTreeHostFactoryPtr factory; |
| 28 connector->ConnectToInterface("mojo:ui", &factory); | 33 connector->ConnectToInterface("mojo:ui", &factory); |
| 29 CreateWindowTreeHost(factory.get(), delegate, host, window_manager_delegate); | 34 return CreateWindowTreeHost(factory.get(), delegate, host, |
| 35 window_manager_delegate); |
| 30 } | 36 } |
| 31 | 37 |
| 32 } // namespace ui | 38 } // namespace ui |
| OLD | NEW |