OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ws/window_tree_factory.h" | 5 #include "services/ui/ws/window_tree_factory.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "services/ui/ws/default_access_policy.h" | 8 #include "services/ui/ws/default_access_policy.h" |
9 #include "services/ui/ws/window_server.h" | 9 #include "services/ui/ws/window_server.h" |
10 #include "services/ui/ws/window_tree.h" | 10 #include "services/ui/ws/window_tree.h" |
11 #include "services/ui/ws/window_tree_binding.h" | 11 #include "services/ui/ws/window_tree_binding.h" |
12 | 12 |
13 namespace ui { | 13 namespace ui { |
14 namespace ws { | 14 namespace ws { |
15 | 15 |
16 WindowTreeFactory::WindowTreeFactory(WindowServer* window_server, | 16 WindowTreeFactory::WindowTreeFactory(WindowServer* window_server, |
17 const UserId& user_id, | 17 const UserId& user_id, |
18 const std::string& client_name, | 18 const std::string& client_name) |
19 mojom::WindowTreeFactoryRequest request) | |
20 : window_server_(window_server), | 19 : window_server_(window_server), |
21 user_id_(user_id), | 20 user_id_(user_id), |
22 client_name_(client_name), | 21 client_name_(client_name) {} |
23 binding_(this, std::move(request)) {} | |
24 | 22 |
25 WindowTreeFactory::~WindowTreeFactory() {} | 23 WindowTreeFactory::~WindowTreeFactory() {} |
26 | 24 |
27 void WindowTreeFactory::CreateWindowTree( | 25 void WindowTreeFactory::CreateWindowTree( |
28 mojo::InterfaceRequest<mojom::WindowTree> tree_request, | 26 mojo::InterfaceRequest<mojom::WindowTree> tree_request, |
29 mojom::WindowTreeClientPtr client) { | 27 mojom::WindowTreeClientPtr client) { |
30 std::unique_ptr<ws::WindowTree> service( | 28 std::unique_ptr<ws::WindowTree> service( |
31 new ws::WindowTree(window_server_, user_id_, nullptr, | 29 new ws::WindowTree(window_server_, user_id_, nullptr, |
32 base::WrapUnique(new DefaultAccessPolicy))); | 30 base::WrapUnique(new DefaultAccessPolicy))); |
33 std::unique_ptr<ws::DefaultWindowTreeBinding> binding( | 31 std::unique_ptr<ws::DefaultWindowTreeBinding> binding( |
34 new ws::DefaultWindowTreeBinding(service.get(), window_server_, | 32 new ws::DefaultWindowTreeBinding(service.get(), window_server_, |
35 std::move(tree_request), | 33 std::move(tree_request), |
36 std::move(client))); | 34 std::move(client))); |
37 service->set_name(client_name_); | 35 service->set_name(client_name_); |
38 window_server_->AddTree(std::move(service), std::move(binding), nullptr); | 36 window_server_->AddTree(std::move(service), std::move(binding), nullptr); |
39 } | 37 } |
40 | 38 |
41 } // namespace ws | 39 } // namespace ws |
42 } // namespace ui | 40 } // namespace ui |
OLD | NEW |