| 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" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 connection->AddInterface<mojom::WindowManagerFactoryService>(this); | 142 connection->AddInterface<mojom::WindowManagerFactoryService>(this); |
| 143 connection->AddInterface<mojom::WindowTreeFactory>(this); | 143 connection->AddInterface<mojom::WindowTreeFactory>(this); |
| 144 connection->AddInterface<WindowTreeHostFactory>(this); | 144 connection->AddInterface<WindowTreeHostFactory>(this); |
| 145 return true; | 145 return true; |
| 146 } | 146 } |
| 147 | 147 |
| 148 void MandolineUIServicesApp::OnFirstRootConnectionCreated() { | 148 void MandolineUIServicesApp::OnFirstRootConnectionCreated() { |
| 149 PendingRequests requests; | 149 PendingRequests requests; |
| 150 requests.swap(pending_requests_); | 150 requests.swap(pending_requests_); |
| 151 for (auto& request : requests) { | 151 for (auto& request : requests) { |
| 152 // TODO(sky): this needs to cache user id too! |
| 152 if (request->dm_request) | 153 if (request->dm_request) |
| 153 Create(nullptr, std::move(*request->dm_request)); | 154 Create(nullptr, std::move(*request->dm_request)); |
| 154 else | 155 else |
| 155 Create(nullptr, std::move(*request->wtf_request)); | 156 Create(nullptr, std::move(*request->wtf_request)); |
| 156 } | 157 } |
| 157 } | 158 } |
| 158 | 159 |
| 159 void MandolineUIServicesApp::OnNoMoreRootConnections() { | 160 void MandolineUIServicesApp::OnNoMoreRootConnections() { |
| 160 base::MessageLoop::current()->QuitWhenIdle(); | 161 base::MessageLoop::current()->QuitWhenIdle(); |
| 161 } | 162 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 185 new mojo::InterfaceRequest<mojom::DisplayManager>(std::move(request))); | 186 new mojo::InterfaceRequest<mojom::DisplayManager>(std::move(request))); |
| 186 pending_requests_.push_back(std::move(pending_request)); | 187 pending_requests_.push_back(std::move(pending_request)); |
| 187 return; | 188 return; |
| 188 } | 189 } |
| 189 connection_manager_->AddDisplayManagerBinding(std::move(request)); | 190 connection_manager_->AddDisplayManagerBinding(std::move(request)); |
| 190 } | 191 } |
| 191 | 192 |
| 192 void MandolineUIServicesApp::Create( | 193 void MandolineUIServicesApp::Create( |
| 193 mojo::Connection* connection, | 194 mojo::Connection* connection, |
| 194 mojom::WindowManagerFactoryServiceRequest request) { | 195 mojom::WindowManagerFactoryServiceRequest request) { |
| 195 connection_manager_->CreateWindowManagerFactoryService( | 196 connection_manager_->window_manager_factory_registry()->Register( |
| 196 connection->GetRemoteUserID(), std::move(request)); | 197 connection->GetRemoteUserID(), std::move(request)); |
| 197 } | 198 } |
| 198 | 199 |
| 199 void MandolineUIServicesApp::Create(Connection* connection, | 200 void MandolineUIServicesApp::Create(Connection* connection, |
| 200 mojom::WindowTreeFactoryRequest request) { | 201 mojom::WindowTreeFactoryRequest request) { |
| 201 if (!connection_manager_->has_tree_host_connections()) { | 202 if (!connection_manager_->has_tree_host_connections()) { |
| 202 scoped_ptr<PendingRequest> pending_request(new PendingRequest); | 203 scoped_ptr<PendingRequest> pending_request(new PendingRequest); |
| 203 pending_request->wtf_request.reset( | 204 pending_request->wtf_request.reset( |
| 204 new mojo::InterfaceRequest<mojom::WindowTreeFactory>( | 205 new mojo::InterfaceRequest<mojom::WindowTreeFactory>( |
| 205 std::move(request))); | 206 std::move(request))); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 236 connection_manager_.get(), connector_, gpu_state_, surfaces_state_); | 237 connection_manager_.get(), connector_, gpu_state_, surfaces_state_); |
| 237 | 238 |
| 238 scoped_ptr<ws::WindowTreeHostConnectionImpl> host_connection( | 239 scoped_ptr<ws::WindowTreeHostConnectionImpl> host_connection( |
| 239 new ws::WindowTreeHostConnectionImpl(std::move(host), host_impl, | 240 new ws::WindowTreeHostConnectionImpl(std::move(host), host_impl, |
| 240 std::move(tree_client), | 241 std::move(tree_client), |
| 241 connection_manager_.get())); | 242 connection_manager_.get())); |
| 242 host_impl->Init(std::move(host_connection)); | 243 host_impl->Init(std::move(host_connection)); |
| 243 } | 244 } |
| 244 | 245 |
| 245 } // namespace mus | 246 } // namespace mus |
| OLD | NEW |