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

Side by Side Diff: services/ui/service.cc

Issue 2904993003: chromeos: changes how DisplayManagerObservers are notified (Closed)
Patch Set: cleanup Created 3 years, 7 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 | « services/ui/service.h ('k') | services/ui/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 "services/ui/service.h" 5 #include "services/ui/service.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 11 matching lines...) Expand all
22 #include "services/service_manager/public/c/main.h" 22 #include "services/service_manager/public/c/main.h"
23 #include "services/service_manager/public/cpp/connector.h" 23 #include "services/service_manager/public/cpp/connector.h"
24 #include "services/service_manager/public/cpp/service_context.h" 24 #include "services/service_manager/public/cpp/service_context.h"
25 #include "services/ui/clipboard/clipboard_impl.h" 25 #include "services/ui/clipboard/clipboard_impl.h"
26 #include "services/ui/common/switches.h" 26 #include "services/ui/common/switches.h"
27 #include "services/ui/display/screen_manager.h" 27 #include "services/ui/display/screen_manager.h"
28 #include "services/ui/ime/ime_registrar_impl.h" 28 #include "services/ui/ime/ime_registrar_impl.h"
29 #include "services/ui/ime/ime_server_impl.h" 29 #include "services/ui/ime/ime_server_impl.h"
30 #include "services/ui/ws/accessibility_manager.h" 30 #include "services/ui/ws/accessibility_manager.h"
31 #include "services/ui/ws/display_binding.h" 31 #include "services/ui/ws/display_binding.h"
32 #include "services/ui/ws/display_creation_config.h"
32 #include "services/ui/ws/display_manager.h" 33 #include "services/ui/ws/display_manager.h"
33 #include "services/ui/ws/gpu_host.h" 34 #include "services/ui/ws/gpu_host.h"
34 #include "services/ui/ws/user_activity_monitor.h" 35 #include "services/ui/ws/user_activity_monitor.h"
35 #include "services/ui/ws/user_display_manager.h" 36 #include "services/ui/ws/user_display_manager.h"
36 #include "services/ui/ws/window_server.h" 37 #include "services/ui/ws/window_server.h"
37 #include "services/ui/ws/window_server_test_impl.h" 38 #include "services/ui/ws/window_server_test_impl.h"
38 #include "services/ui/ws/window_tree.h" 39 #include "services/ui/ws/window_tree.h"
39 #include "services/ui/ws/window_tree_binding.h" 40 #include "services/ui/ws/window_tree_binding.h"
40 #include "services/ui/ws/window_tree_factory.h" 41 #include "services/ui/ws/window_tree_factory.h"
41 #include "services/ui/ws/window_tree_host_factory.h" 42 #include "services/ui/ws/window_tree_host_factory.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 if (base::RunLoop::IsRunningOnCurrentThread()) 282 if (base::RunLoop::IsRunningOnCurrentThread())
282 base::MessageLoop::current()->QuitWhenIdle(); 283 base::MessageLoop::current()->QuitWhenIdle();
283 } 284 }
284 285
285 bool Service::IsTestConfig() const { 286 bool Service::IsTestConfig() const {
286 return test_config_; 287 return test_config_;
287 } 288 }
288 289
289 void Service::OnWillCreateTreeForWindowManager( 290 void Service::OnWillCreateTreeForWindowManager(
290 bool automatically_create_display_roots) { 291 bool automatically_create_display_roots) {
291 if (screen_manager_config_ != ScreenManagerConfig::UNKNOWN) 292 if (window_server_->display_creation_config() !=
293 ws::DisplayCreationConfig::UNKNOWN) {
292 return; 294 return;
295 }
293 296
294 DVLOG(3) << "OnWillCreateTreeForWindowManager " 297 DVLOG(3) << "OnWillCreateTreeForWindowManager "
295 << automatically_create_display_roots; 298 << automatically_create_display_roots;
296 screen_manager_config_ = automatically_create_display_roots 299 ws::DisplayCreationConfig config = automatically_create_display_roots
297 ? ScreenManagerConfig::INTERNAL 300 ? ws::DisplayCreationConfig::AUTOMATIC
298 : ScreenManagerConfig::FORWARDING; 301 : ws::DisplayCreationConfig::MANUAL;
299 if (screen_manager_config_ == ScreenManagerConfig::FORWARDING) { 302 window_server_->SetDisplayCreationConfig(config);
303 if (window_server_->display_creation_config() ==
304 ws::DisplayCreationConfig::MANUAL) {
300 #if defined(USE_OZONE) && defined(OS_CHROMEOS) 305 #if defined(USE_OZONE) && defined(OS_CHROMEOS)
301 screen_manager_ = base::MakeUnique<display::ScreenManagerForwarding>(); 306 screen_manager_ = base::MakeUnique<display::ScreenManagerForwarding>();
302 #else 307 #else
303 CHECK(false); 308 CHECK(false);
304 #endif 309 #endif
305 } else { 310 } else {
306 screen_manager_ = display::ScreenManager::Create(); 311 screen_manager_ = display::ScreenManager::Create();
307 } 312 }
308 screen_manager_->AddInterfaces(&registry_); 313 screen_manager_->AddInterfaces(&registry_);
309 if (is_gpu_ready_) 314 if (is_gpu_ready_)
(...skipping 17 matching lines...) Expand all
327 mojom::ClipboardRequest request) { 332 mojom::ClipboardRequest request) {
328 UserState* user_state = GetUserState(source_info.identity); 333 UserState* user_state = GetUserState(source_info.identity);
329 if (!user_state->clipboard) 334 if (!user_state->clipboard)
330 user_state->clipboard.reset(new clipboard::ClipboardImpl); 335 user_state->clipboard.reset(new clipboard::ClipboardImpl);
331 user_state->clipboard->AddBinding(std::move(request)); 336 user_state->clipboard->AddBinding(std::move(request));
332 } 337 }
333 338
334 void Service::BindDisplayManagerRequest( 339 void Service::BindDisplayManagerRequest(
335 const service_manager::BindSourceInfo& source_info, 340 const service_manager::BindSourceInfo& source_info,
336 mojom::DisplayManagerRequest request) { 341 mojom::DisplayManagerRequest request) {
337 // DisplayManagerObservers generally expect there to be at least one display. 342 // Wait for the DisplayManager to be configured before binding display
338 if (!window_server_->display_manager()->has_displays()) { 343 // requests. Otherwise the client sees no displays.
344 if (!window_server_->display_manager()->IsReady()) {
339 std::unique_ptr<PendingRequest> pending_request(new PendingRequest); 345 std::unique_ptr<PendingRequest> pending_request(new PendingRequest);
340 pending_request->source_info = source_info; 346 pending_request->source_info = source_info;
341 pending_request->dm_request.reset( 347 pending_request->dm_request.reset(
342 new mojom::DisplayManagerRequest(std::move(request))); 348 new mojom::DisplayManagerRequest(std::move(request)));
343 pending_requests_.push_back(std::move(pending_request)); 349 pending_requests_.push_back(std::move(pending_request));
344 return; 350 return;
345 } 351 }
346 window_server_->display_manager() 352 window_server_->display_manager()
347 ->GetUserDisplayManager(source_info.identity.user_id()) 353 ->GetUserDisplayManager(source_info.identity.user_id())
348 ->AddDisplayManagerBinding(std::move(request)); 354 ->AddDisplayManagerBinding(std::move(request));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 mojom::WindowManagerWindowTreeFactoryRequest request) { 391 mojom::WindowManagerWindowTreeFactoryRequest request) {
386 AddUserIfNecessary(source_info.identity); 392 AddUserIfNecessary(source_info.identity);
387 window_server_->window_manager_window_tree_factory_set()->Add( 393 window_server_->window_manager_window_tree_factory_set()->Add(
388 source_info.identity.user_id(), std::move(request)); 394 source_info.identity.user_id(), std::move(request));
389 } 395 }
390 396
391 void Service::BindWindowTreeFactoryRequest( 397 void Service::BindWindowTreeFactoryRequest(
392 const service_manager::BindSourceInfo& source_info, 398 const service_manager::BindSourceInfo& source_info,
393 mojom::WindowTreeFactoryRequest request) { 399 mojom::WindowTreeFactoryRequest request) {
394 AddUserIfNecessary(source_info.identity); 400 AddUserIfNecessary(source_info.identity);
395 if (!window_server_->display_manager()->has_displays()) { 401 if (!window_server_->display_manager()->IsReady()) {
396 std::unique_ptr<PendingRequest> pending_request(new PendingRequest); 402 std::unique_ptr<PendingRequest> pending_request(new PendingRequest);
397 pending_request->source_info = source_info; 403 pending_request->source_info = source_info;
398 pending_request->wtf_request.reset( 404 pending_request->wtf_request.reset(
399 new mojom::WindowTreeFactoryRequest(std::move(request))); 405 new mojom::WindowTreeFactoryRequest(std::move(request)));
400 pending_requests_.push_back(std::move(pending_request)); 406 pending_requests_.push_back(std::move(pending_request));
401 return; 407 return;
402 } 408 }
403 AddUserIfNecessary(source_info.identity); 409 AddUserIfNecessary(source_info.identity);
404 mojo::MakeStrongBinding( 410 mojo::MakeStrongBinding(
405 base::MakeUnique<ws::WindowTreeFactory>(window_server_.get(), 411 base::MakeUnique<ws::WindowTreeFactory>(window_server_.get(),
(...skipping 24 matching lines...) Expand all
430 mojom::WindowServerTestRequest request) { 436 mojom::WindowServerTestRequest request) {
431 if (!test_config_) 437 if (!test_config_)
432 return; 438 return;
433 mojo::MakeStrongBinding( 439 mojo::MakeStrongBinding(
434 base::MakeUnique<ws::WindowServerTestImpl>(window_server_.get()), 440 base::MakeUnique<ws::WindowServerTestImpl>(window_server_.get()),
435 std::move(request)); 441 std::move(request));
436 } 442 }
437 443
438 444
439 } // namespace ui 445 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/service.h ('k') | services/ui/ws/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698