| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "components/mus/clipboard/clipboard_impl.h" | 15 #include "components/mus/clipboard/clipboard_impl.h" |
| 16 #include "components/mus/common/switches.h" | 16 #include "components/mus/common/switches.h" |
| 17 #include "components/mus/gles2/gpu_impl.h" | 17 #include "components/mus/gles2/gpu_impl.h" |
| 18 #include "components/mus/gpu/gpu_service_impl.h" | 18 #include "components/mus/gpu/gpu_service_impl.h" |
| 19 #include "components/mus/gpu/gpu_service_mus.h" | 19 #include "components/mus/gpu/gpu_service_mus.h" |
| 20 #include "components/mus/ws/display.h" | 20 #include "components/mus/ws/display.h" |
| 21 #include "components/mus/ws/display_binding.h" | 21 #include "components/mus/ws/display_binding.h" |
| 22 #include "components/mus/ws/display_manager.h" | 22 #include "components/mus/ws/display_manager.h" |
| 23 #include "components/mus/ws/platform_screen.h" | 23 #include "components/mus/ws/platform_screen.h" |
| 24 #include "components/mus/ws/user_activity_monitor.h" |
| 24 #include "components/mus/ws/user_display_manager.h" | 25 #include "components/mus/ws/user_display_manager.h" |
| 25 #include "components/mus/ws/window_server.h" | 26 #include "components/mus/ws/window_server.h" |
| 26 #include "components/mus/ws/window_server_test_impl.h" | 27 #include "components/mus/ws/window_server_test_impl.h" |
| 27 #include "components/mus/ws/window_tree.h" | 28 #include "components/mus/ws/window_tree.h" |
| 28 #include "components/mus/ws/window_tree_binding.h" | 29 #include "components/mus/ws/window_tree_binding.h" |
| 29 #include "components/mus/ws/window_tree_factory.h" | 30 #include "components/mus/ws/window_tree_factory.h" |
| 30 #include "components/mus/ws/window_tree_host_factory.h" | 31 #include "components/mus/ws/window_tree_host_factory.h" |
| 31 #include "mojo/public/c/system/main.h" | 32 #include "mojo/public/c/system/main.h" |
| 32 #include "services/catalog/public/cpp/resource_loader.h" | 33 #include "services/catalog/public/cpp/resource_loader.h" |
| 33 #include "services/shell/public/cpp/connection.h" | 34 #include "services/shell/public/cpp/connection.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 // platforms there is no DeviceDataManager so don't create touch controller. | 219 // platforms there is no DeviceDataManager so don't create touch controller. |
| 219 if (ui::DeviceDataManager::HasInstance()) | 220 if (ui::DeviceDataManager::HasInstance()) |
| 220 touch_controller_.reset( | 221 touch_controller_.reset( |
| 221 new ws::TouchController(window_server_->display_manager())); | 222 new ws::TouchController(window_server_->display_manager())); |
| 222 } | 223 } |
| 223 | 224 |
| 224 bool MusApp::AcceptConnection(Connection* connection) { | 225 bool MusApp::AcceptConnection(Connection* connection) { |
| 225 connection->AddInterface<mojom::Clipboard>(this); | 226 connection->AddInterface<mojom::Clipboard>(this); |
| 226 connection->AddInterface<mojom::DisplayManager>(this); | 227 connection->AddInterface<mojom::DisplayManager>(this); |
| 227 connection->AddInterface<mojom::UserAccessManager>(this); | 228 connection->AddInterface<mojom::UserAccessManager>(this); |
| 229 connection->AddInterface<mojom::UserActivityMonitor>(this); |
| 228 connection->AddInterface<WindowTreeHostFactory>(this); | 230 connection->AddInterface<WindowTreeHostFactory>(this); |
| 229 connection->AddInterface<mojom::WindowManagerWindowTreeFactory>(this); | 231 connection->AddInterface<mojom::WindowManagerWindowTreeFactory>(this); |
| 230 connection->AddInterface<mojom::WindowTreeFactory>(this); | 232 connection->AddInterface<mojom::WindowTreeFactory>(this); |
| 231 if (test_config_) | 233 if (test_config_) |
| 232 connection->AddInterface<WindowServerTest>(this); | 234 connection->AddInterface<WindowServerTest>(this); |
| 233 | 235 |
| 234 if (use_chrome_gpu_command_buffer_) { | 236 if (use_chrome_gpu_command_buffer_) { |
| 235 connection->AddInterface<mojom::GpuService>(this); | 237 connection->AddInterface<mojom::GpuService>(this); |
| 236 } else { | 238 } else { |
| 237 connection->AddInterface<Gpu>(this); | 239 connection->AddInterface<Gpu>(this); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 return; | 316 return; |
| 315 new GpuServiceImpl(std::move(request), connection); | 317 new GpuServiceImpl(std::move(request), connection); |
| 316 } | 318 } |
| 317 | 319 |
| 318 void MusApp::Create(shell::Connection* connection, | 320 void MusApp::Create(shell::Connection* connection, |
| 319 mojom::UserAccessManagerRequest request) { | 321 mojom::UserAccessManagerRequest request) { |
| 320 window_server_->user_id_tracker()->Bind(std::move(request)); | 322 window_server_->user_id_tracker()->Bind(std::move(request)); |
| 321 } | 323 } |
| 322 | 324 |
| 323 void MusApp::Create(shell::Connection* connection, | 325 void MusApp::Create(shell::Connection* connection, |
| 326 mojom::UserActivityMonitorRequest request) { |
| 327 AddUserIfNecessary(connection); |
| 328 const ws::UserId& user_id = connection->GetRemoteIdentity().user_id(); |
| 329 window_server_->GetUserActivityMonitorForUser(user_id)->Add( |
| 330 std::move(request)); |
| 331 } |
| 332 |
| 333 void MusApp::Create(shell::Connection* connection, |
| 324 mojom::WindowManagerWindowTreeFactoryRequest request) { | 334 mojom::WindowManagerWindowTreeFactoryRequest request) { |
| 325 AddUserIfNecessary(connection); | 335 AddUserIfNecessary(connection); |
| 326 window_server_->window_manager_window_tree_factory_set()->Add( | 336 window_server_->window_manager_window_tree_factory_set()->Add( |
| 327 connection->GetRemoteIdentity().user_id(), std::move(request)); | 337 connection->GetRemoteIdentity().user_id(), std::move(request)); |
| 328 } | 338 } |
| 329 | 339 |
| 330 void MusApp::Create(Connection* connection, | 340 void MusApp::Create(Connection* connection, |
| 331 mojom::WindowTreeFactoryRequest request) { | 341 mojom::WindowTreeFactoryRequest request) { |
| 332 AddUserIfNecessary(connection); | 342 AddUserIfNecessary(connection); |
| 333 if (!window_server_->display_manager()->has_displays()) { | 343 if (!window_server_->display_manager()->has_displays()) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 // Display manages its own lifetime. | 379 // Display manages its own lifetime. |
| 370 ws::Display* host_impl = | 380 ws::Display* host_impl = |
| 371 new ws::Display(window_server_.get(), platform_display_init_params_); | 381 new ws::Display(window_server_.get(), platform_display_init_params_); |
| 372 host_impl->Init(nullptr); | 382 host_impl->Init(nullptr); |
| 373 | 383 |
| 374 if (touch_controller_) | 384 if (touch_controller_) |
| 375 touch_controller_->UpdateTouchTransforms(); | 385 touch_controller_->UpdateTouchTransforms(); |
| 376 } | 386 } |
| 377 | 387 |
| 378 } // namespace mus | 388 } // namespace mus |
| OLD | NEW |