| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 Create(nullptr, std::move(*request->dm_request)); | 153 Create(nullptr, std::move(*request->dm_request)); |
| 154 else | 154 else |
| 155 Create(nullptr, std::move(*request->wtf_request)); | 155 Create(nullptr, std::move(*request->wtf_request)); |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 | 158 |
| 159 void MandolineUIServicesApp::OnNoMoreRootConnections() { | 159 void MandolineUIServicesApp::OnNoMoreRootConnections() { |
| 160 base::MessageLoop::current()->QuitWhenIdle(); | 160 base::MessageLoop::current()->QuitWhenIdle(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 ws::ClientConnection* | 163 scoped_ptr<ws::ClientConnection> |
| 164 MandolineUIServicesApp::CreateClientConnectionForEmbedAtWindow( | 164 MandolineUIServicesApp::CreateClientConnectionForEmbedAtWindow( |
| 165 ws::ConnectionManager* connection_manager, | 165 ws::ConnectionManager* connection_manager, |
| 166 ws::WindowTreeImpl* tree, |
| 166 mojom::WindowTreeRequest tree_request, | 167 mojom::WindowTreeRequest tree_request, |
| 167 ws::ServerWindow* root, | |
| 168 uint32_t policy_bitmask, | |
| 169 mojom::WindowTreeClientPtr client) { | 168 mojom::WindowTreeClientPtr client) { |
| 170 scoped_ptr<ws::WindowTreeImpl> service( | 169 return make_scoped_ptr(new ws::DefaultClientConnection( |
| 171 new ws::WindowTreeImpl(connection_manager, root, policy_bitmask)); | 170 tree, connection_manager, std::move(tree_request), std::move(client))); |
| 172 return new ws::DefaultClientConnection(std::move(service), connection_manager, | |
| 173 std::move(tree_request), | |
| 174 std::move(client)); | |
| 175 } | |
| 176 | |
| 177 ws::ClientConnection* | |
| 178 MandolineUIServicesApp::CreateClientConnectionForWindowManager( | |
| 179 ws::WindowTreeHostImpl* tree_host, | |
| 180 ws::ServerWindow* window, | |
| 181 const mojom::Display& display, | |
| 182 uint32_t user_id, | |
| 183 mojom::WindowManagerFactory* factory) { | |
| 184 // TODO(sky): figure out a better way to factor this. Having the delegate | |
| 185 // have to add to the ConnectionManager is ick! | |
| 186 mojom::WindowTreeClientPtr tree_client; | |
| 187 factory->CreateWindowManager(display.Clone(), GetProxy(&tree_client)); | |
| 188 scoped_ptr<ws::WindowTreeImpl> service( | |
| 189 new ws::WindowTreeImpl(connection_manager_.get(), window, | |
| 190 mojom::WindowTree::kAccessPolicyEmbedRoot)); | |
| 191 scoped_ptr<ws::DefaultClientConnection> connection( | |
| 192 new ws::DefaultClientConnection(std::move(service), | |
| 193 connection_manager_.get(), | |
| 194 std::move(tree_client))); | |
| 195 mojom::WindowTreePtr tree = connection->CreateInterfacePtrAndBind(); | |
| 196 ws::DefaultClientConnection* raw_connection = connection.get(); | |
| 197 connection_manager_->AddConnection(std::move(connection), std::move(tree)); | |
| 198 return raw_connection; | |
| 199 } | 171 } |
| 200 | 172 |
| 201 void MandolineUIServicesApp::CreateDefaultWindowTreeHosts() { | 173 void MandolineUIServicesApp::CreateDefaultWindowTreeHosts() { |
| 202 // WindowTreeHostImpl manages its own lifetime. | 174 // WindowTreeHostImpl manages its own lifetime. |
| 203 ws::WindowTreeHostImpl* host_impl = new ws::WindowTreeHostImpl( | 175 ws::WindowTreeHostImpl* host_impl = new ws::WindowTreeHostImpl( |
| 204 connection_manager_.get(), connector_, gpu_state_, surfaces_state_); | 176 connection_manager_.get(), connector_, gpu_state_, surfaces_state_); |
| 205 host_impl->Init(nullptr); | 177 host_impl->Init(nullptr); |
| 206 } | 178 } |
| 207 | 179 |
| 208 void MandolineUIServicesApp::Create(mojo::Connection* connection, | 180 void MandolineUIServicesApp::Create(mojo::Connection* connection, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 connection_manager_.get(), connector_, gpu_state_, surfaces_state_); | 236 connection_manager_.get(), connector_, gpu_state_, surfaces_state_); |
| 265 | 237 |
| 266 scoped_ptr<ws::WindowTreeHostConnectionImpl> host_connection( | 238 scoped_ptr<ws::WindowTreeHostConnectionImpl> host_connection( |
| 267 new ws::WindowTreeHostConnectionImpl(std::move(host), host_impl, | 239 new ws::WindowTreeHostConnectionImpl(std::move(host), host_impl, |
| 268 std::move(tree_client), | 240 std::move(tree_client), |
| 269 connection_manager_.get())); | 241 connection_manager_.get())); |
| 270 host_impl->Init(std::move(host_connection)); | 242 host_impl->Init(std::move(host_connection)); |
| 271 } | 243 } |
| 272 | 244 |
| 273 } // namespace mus | 245 } // namespace mus |
| OLD | NEW |