Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: components/mus/mus_app.cc

Issue 1755223002: Adds WindowManagerManager to mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge and WindowManagerState Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/mus/mus_app.h ('k') | components/mus/ws/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/stl_util.h" 10 #include "base/stl_util.h"
11 #include "base/threading/platform_thread.h"
10 #include "build/build_config.h" 12 #include "build/build_config.h"
11 #include "base/threading/platform_thread.h"
12 #include "components/mus/common/args.h" 13 #include "components/mus/common/args.h"
13 #include "components/mus/gles2/gpu_impl.h" 14 #include "components/mus/gles2/gpu_impl.h"
14 #include "components/mus/ws/client_connection.h" 15 #include "components/mus/ws/client_connection.h"
15 #include "components/mus/ws/connection_manager.h" 16 #include "components/mus/ws/connection_manager.h"
16 #include "components/mus/ws/window_tree_factory.h" 17 #include "components/mus/ws/window_tree_factory.h"
17 #include "components/mus/ws/window_tree_host_connection.h" 18 #include "components/mus/ws/window_tree_host_connection.h"
18 #include "components/mus/ws/window_tree_host_impl.h" 19 #include "components/mus/ws/window_tree_host_impl.h"
19 #include "components/mus/ws/window_tree_impl.h" 20 #include "components/mus/ws/window_tree_impl.h"
20 #include "components/resource_provider/public/cpp/resource_loader.h" 21 #include "components/resource_provider/public/cpp/resource_loader.h"
21 #include "mojo/public/c/system/main.h" 22 #include "mojo/public/c/system/main.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 156 }
156 } 157 }
157 158
158 void MandolineUIServicesApp::OnNoMoreRootConnections() { 159 void MandolineUIServicesApp::OnNoMoreRootConnections() {
159 base::MessageLoop::current()->QuitWhenIdle(); 160 base::MessageLoop::current()->QuitWhenIdle();
160 } 161 }
161 162
162 ws::ClientConnection* 163 ws::ClientConnection*
163 MandolineUIServicesApp::CreateClientConnectionForEmbedAtWindow( 164 MandolineUIServicesApp::CreateClientConnectionForEmbedAtWindow(
164 ws::ConnectionManager* connection_manager, 165 ws::ConnectionManager* connection_manager,
165 mojo::InterfaceRequest<mojom::WindowTree> tree_request, 166 mojom::WindowTreeRequest tree_request,
166 ws::ServerWindow* root, 167 ws::ServerWindow* root,
167 uint32_t policy_bitmask, 168 uint32_t policy_bitmask,
168 mojom::WindowTreeClientPtr client) { 169 mojom::WindowTreeClientPtr client) {
169 scoped_ptr<ws::WindowTreeImpl> service( 170 scoped_ptr<ws::WindowTreeImpl> service(
170 new ws::WindowTreeImpl(connection_manager, root, policy_bitmask)); 171 new ws::WindowTreeImpl(connection_manager, root, policy_bitmask));
171 return new ws::DefaultClientConnection(std::move(service), connection_manager, 172 return new ws::DefaultClientConnection(std::move(service), connection_manager,
172 std::move(tree_request), 173 std::move(tree_request),
173 std::move(client)); 174 std::move(client));
174 } 175 }
175 176
176 void MandolineUIServicesApp::Create( 177 ws::ClientConnection*
177 mojo::Connection* connection, 178 MandolineUIServicesApp::CreateClientConnectionForWindowManager(
178 mojo::InterfaceRequest<mojom::DisplayManager> request) { 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 }
200
201 void MandolineUIServicesApp::CreateDefaultWindowTreeHosts() {
202 // WindowTreeHostImpl manages its own lifetime.
203 ws::WindowTreeHostImpl* host_impl = new ws::WindowTreeHostImpl(
204 connection_manager_.get(), connector_, gpu_state_, surfaces_state_);
205 host_impl->Init(nullptr);
206 }
207
208 void MandolineUIServicesApp::Create(mojo::Connection* connection,
209 mojom::DisplayManagerRequest request) {
179 if (!connection_manager_->has_tree_host_connections()) { 210 if (!connection_manager_->has_tree_host_connections()) {
180 scoped_ptr<PendingRequest> pending_request(new PendingRequest); 211 scoped_ptr<PendingRequest> pending_request(new PendingRequest);
181 pending_request->dm_request.reset( 212 pending_request->dm_request.reset(
182 new mojo::InterfaceRequest<mojom::DisplayManager>(std::move(request))); 213 new mojo::InterfaceRequest<mojom::DisplayManager>(std::move(request)));
183 pending_requests_.push_back(std::move(pending_request)); 214 pending_requests_.push_back(std::move(pending_request));
184 return; 215 return;
185 } 216 }
186 connection_manager_->AddDisplayManagerBinding(std::move(request)); 217 connection_manager_->AddDisplayManagerBinding(std::move(request));
187 } 218 }
188 219
189 void MandolineUIServicesApp::Create( 220 void MandolineUIServicesApp::Create(
190 mojo::Connection* connection, 221 mojo::Connection* connection,
191 mojo::InterfaceRequest<mojom::WindowManagerFactoryService> request) { 222 mojom::WindowManagerFactoryServiceRequest request) {
192 connection_manager_->CreateWindowManagerFactoryService(std::move(request)); 223 connection_manager_->CreateWindowManagerFactoryService(
224 connection->GetRemoteUserID(), std::move(request));
193 } 225 }
194 226
195 void MandolineUIServicesApp::Create( 227 void MandolineUIServicesApp::Create(Connection* connection,
196 Connection* connection, 228 mojom::WindowTreeFactoryRequest request) {
197 InterfaceRequest<mojom::WindowTreeFactory> request) {
198 if (!connection_manager_->has_tree_host_connections()) { 229 if (!connection_manager_->has_tree_host_connections()) {
199 scoped_ptr<PendingRequest> pending_request(new PendingRequest); 230 scoped_ptr<PendingRequest> pending_request(new PendingRequest);
200 pending_request->wtf_request.reset( 231 pending_request->wtf_request.reset(
201 new mojo::InterfaceRequest<mojom::WindowTreeFactory>( 232 new mojo::InterfaceRequest<mojom::WindowTreeFactory>(
202 std::move(request))); 233 std::move(request)));
203 pending_requests_.push_back(std::move(pending_request)); 234 pending_requests_.push_back(std::move(pending_request));
204 return; 235 return;
205 } 236 }
206 if (!window_tree_factory_) { 237 if (!window_tree_factory_) {
207 window_tree_factory_.reset( 238 window_tree_factory_.reset(
208 new ws::WindowTreeFactory(connection_manager_.get())); 239 new ws::WindowTreeFactory(connection_manager_.get()));
209 } 240 }
210 window_tree_factory_->AddBinding(std::move(request)); 241 window_tree_factory_->AddBinding(std::move(request));
211 } 242 }
212 243
213 void MandolineUIServicesApp::Create( 244 void MandolineUIServicesApp::Create(
214 Connection* connection, 245 Connection* connection,
215 InterfaceRequest<WindowTreeHostFactory> request) { 246 mojom::WindowTreeHostFactoryRequest request) {
216 factory_bindings_.AddBinding(this, std::move(request)); 247 factory_bindings_.AddBinding(this, std::move(request));
217 } 248 }
218 249
219 void MandolineUIServicesApp::Create(mojo::Connection* connection, 250 void MandolineUIServicesApp::Create(mojo::Connection* connection,
220 mojo::InterfaceRequest<Gpu> request) { 251 mojom::GpuRequest request) {
221 DCHECK(gpu_state_); 252 DCHECK(gpu_state_);
222 new GpuImpl(std::move(request), gpu_state_); 253 new GpuImpl(std::move(request), gpu_state_);
223 } 254 }
224 255
225 void MandolineUIServicesApp::CreateWindowTreeHost( 256 void MandolineUIServicesApp::CreateWindowTreeHost(
226 mojo::InterfaceRequest<mojom::WindowTreeHost> host, 257 mojom::WindowTreeHostRequest host,
227 mojom::WindowTreeClientPtr tree_client) { 258 mojom::WindowTreeClientPtr tree_client) {
228 DCHECK(connection_manager_); 259 DCHECK(connection_manager_);
229 260
230 // TODO(fsamuel): We need to make sure that only the window manager can create 261 // TODO(fsamuel): We need to make sure that only the window manager can create
231 // new roots. 262 // new roots.
232 ws::WindowTreeHostImpl* host_impl = new ws::WindowTreeHostImpl( 263 ws::WindowTreeHostImpl* host_impl = new ws::WindowTreeHostImpl(
233 connection_manager_.get(), connector_, gpu_state_, surfaces_state_); 264 connection_manager_.get(), connector_, gpu_state_, surfaces_state_);
234 265
235 scoped_ptr<ws::WindowTreeHostConnectionImpl> host_connection( 266 scoped_ptr<ws::WindowTreeHostConnectionImpl> host_connection(
236 new ws::WindowTreeHostConnectionImpl(std::move(host), host_impl, 267 new ws::WindowTreeHostConnectionImpl(std::move(host), host_impl,
237 std::move(tree_client), 268 std::move(tree_client),
238 connection_manager_.get())); 269 connection_manager_.get()));
239 host_impl->Init(std::move(host_connection)); 270 host_impl->Init(std::move(host_connection));
240 } 271 }
241 272
242 } // namespace mus 273 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/mus_app.h ('k') | components/mus/ws/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698