| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/mus/mus_app.h" | 5 #include "components/mus/mus_app.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "base/threading/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "components/mus/common/args.h" | 13 #include "components/mus/common/args.h" |
| 14 #include "components/mus/gles2/gpu_impl.h" | 14 #include "components/mus/gles2/gpu_impl.h" |
| 15 #include "components/mus/ws/connection_manager.h" | 15 #include "components/mus/ws/connection_manager.h" |
| 16 #include "components/mus/ws/display.h" | 16 #include "components/mus/ws/display.h" |
| 17 #include "components/mus/ws/display_binding.h" | 17 #include "components/mus/ws/display_binding.h" |
| 18 #include "components/mus/ws/display_manager.h" | 18 #include "components/mus/ws/display_manager.h" |
| 19 #include "components/mus/ws/user_display_manager.h" |
| 19 #include "components/mus/ws/window_tree.h" | 20 #include "components/mus/ws/window_tree.h" |
| 20 #include "components/mus/ws/window_tree_binding.h" | 21 #include "components/mus/ws/window_tree_binding.h" |
| 21 #include "components/mus/ws/window_tree_factory.h" | 22 #include "components/mus/ws/window_tree_factory.h" |
| 22 #include "components/resource_provider/public/cpp/resource_loader.h" | 23 #include "components/resource_provider/public/cpp/resource_loader.h" |
| 23 #include "mojo/public/c/system/main.h" | 24 #include "mojo/public/c/system/main.h" |
| 24 #include "mojo/services/tracing/public/cpp/tracing_impl.h" | 25 #include "mojo/services/tracing/public/cpp/tracing_impl.h" |
| 25 #include "mojo/shell/public/cpp/connection.h" | 26 #include "mojo/shell/public/cpp/connection.h" |
| 26 #include "mojo/shell/public/cpp/connector.h" | 27 #include "mojo/shell/public/cpp/connector.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/base/ui_base_paths.h" | 29 #include "ui/base/ui_base_paths.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 175 |
| 175 void MandolineUIServicesApp::CreateDefaultDisplays() { | 176 void MandolineUIServicesApp::CreateDefaultDisplays() { |
| 176 // Display manages its own lifetime. | 177 // Display manages its own lifetime. |
| 177 ws::Display* host_impl = new ws::Display( | 178 ws::Display* host_impl = new ws::Display( |
| 178 connection_manager_.get(), connector_, gpu_state_, surfaces_state_); | 179 connection_manager_.get(), connector_, gpu_state_, surfaces_state_); |
| 179 host_impl->Init(nullptr); | 180 host_impl->Init(nullptr); |
| 180 } | 181 } |
| 181 | 182 |
| 182 void MandolineUIServicesApp::Create(mojo::Connection* connection, | 183 void MandolineUIServicesApp::Create(mojo::Connection* connection, |
| 183 mojom::DisplayManagerRequest request) { | 184 mojom::DisplayManagerRequest request) { |
| 184 if (!connection_manager_->display_manager()->has_displays()) { | 185 // TODO(sky): validate id. |
| 185 scoped_ptr<PendingRequest> pending_request(new PendingRequest); | 186 connection_manager_->display_manager() |
| 186 pending_request->dm_request.reset( | 187 ->GetUserDisplayManager(connection->GetRemoteUserID()) |
| 187 new mojo::InterfaceRequest<mojom::DisplayManager>(std::move(request))); | 188 ->AddDisplayManagerBinding(std::move(request)); |
| 188 pending_requests_.push_back(std::move(pending_request)); | |
| 189 return; | |
| 190 } | |
| 191 connection_manager_->AddDisplayManagerBinding(std::move(request)); | |
| 192 } | 189 } |
| 193 | 190 |
| 194 void MandolineUIServicesApp::Create( | 191 void MandolineUIServicesApp::Create( |
| 195 mojo::Connection* connection, | 192 mojo::Connection* connection, |
| 196 mojom::WindowManagerFactoryServiceRequest request) { | 193 mojom::WindowManagerFactoryServiceRequest request) { |
| 197 connection_manager_->window_manager_factory_registry()->Register( | 194 connection_manager_->window_manager_factory_registry()->Register( |
| 198 connection->GetRemoteUserID(), std::move(request)); | 195 connection->GetRemoteUserID(), std::move(request)); |
| 199 } | 196 } |
| 200 | 197 |
| 201 void MandolineUIServicesApp::Create(Connection* connection, | 198 void MandolineUIServicesApp::Create(Connection* connection, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 ws::Display* host_impl = new ws::Display( | 234 ws::Display* host_impl = new ws::Display( |
| 238 connection_manager_.get(), connector_, gpu_state_, surfaces_state_); | 235 connection_manager_.get(), connector_, gpu_state_, surfaces_state_); |
| 239 | 236 |
| 240 scoped_ptr<ws::DisplayBindingImpl> display_binding(new ws::DisplayBindingImpl( | 237 scoped_ptr<ws::DisplayBindingImpl> display_binding(new ws::DisplayBindingImpl( |
| 241 std::move(host), host_impl, std::move(tree_client), | 238 std::move(host), host_impl, std::move(tree_client), |
| 242 connection_manager_.get())); | 239 connection_manager_.get())); |
| 243 host_impl->Init(std::move(display_binding)); | 240 host_impl->Init(std::move(display_binding)); |
| 244 } | 241 } |
| 245 | 242 |
| 246 } // namespace mus | 243 } // namespace mus |
| OLD | NEW |