Index: services/ui/ws/window_tree_host_factory_registrar.cc |
diff --git a/services/ui/ws/window_tree_host_factory_registrar.cc b/services/ui/ws/window_tree_host_factory_registrar.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6da3cf69165a0bc4ffb570de1f21715a49cd2288 |
--- /dev/null |
+++ b/services/ui/ws/window_tree_host_factory_registrar.cc |
@@ -0,0 +1,33 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "services/ui/ws/window_tree_host_factory_registrar.h" |
+ |
+#include "services/ui/ws/window_server.h" |
+#include "services/ui/ws/window_tree_host_factory.h" |
+ |
+namespace ui { |
+namespace ws { |
+ |
+WindowTreeHostFactoryRegistrar::WindowTreeHostFactoryRegistrar( |
+ WindowServer* window_server, |
+ const UserId& user_id) |
+ : window_server_(window_server), user_id_(user_id) {} |
+ |
+WindowTreeHostFactoryRegistrar::~WindowTreeHostFactoryRegistrar() {} |
+ |
+void WindowTreeHostFactoryRegistrar::Register( |
+ mojom::WindowTreeHostFactoryRequest host_factory_request, |
+ mojom::WindowTreeRequest tree_request, |
+ mojom::WindowTreeClientPtr tree_client) { |
+ std::unique_ptr<WindowTreeHostFactory> host_factory( |
+ new WindowTreeHostFactory(window_server_, user_id_)); |
+ host_factory->Init(std::move(host_factory_request), std::move(tree_request), |
+ std::move(tree_client)); |
+ |
+ window_server_->set_window_tree_host_factory(std::move(host_factory)); |
+} |
+ |
+} // namespace ws |
+} // namespace ui |