| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 // platforms there is no DeviceDataManager so don't create touch controller. | 207 // platforms there is no DeviceDataManager so don't create touch controller. |
| 207 if (ui::DeviceDataManager::HasInstance()) | 208 if (ui::DeviceDataManager::HasInstance()) |
| 208 touch_controller_.reset( | 209 touch_controller_.reset( |
| 209 new ws::TouchController(window_server_->display_manager())); | 210 new ws::TouchController(window_server_->display_manager())); |
| 210 } | 211 } |
| 211 | 212 |
| 212 bool MusApp::AcceptConnection(Connection* connection) { | 213 bool MusApp::AcceptConnection(Connection* connection) { |
| 213 connection->AddInterface<mojom::Clipboard>(this); | 214 connection->AddInterface<mojom::Clipboard>(this); |
| 214 connection->AddInterface<mojom::DisplayManager>(this); | 215 connection->AddInterface<mojom::DisplayManager>(this); |
| 215 connection->AddInterface<mojom::UserAccessManager>(this); | 216 connection->AddInterface<mojom::UserAccessManager>(this); |
| 217 connection->AddInterface<mojom::UserActivityMonitor>(this); |
| 216 connection->AddInterface<WindowTreeHostFactory>(this); | 218 connection->AddInterface<WindowTreeHostFactory>(this); |
| 217 connection->AddInterface<mojom::WindowManagerWindowTreeFactory>(this); | 219 connection->AddInterface<mojom::WindowManagerWindowTreeFactory>(this); |
| 218 connection->AddInterface<mojom::WindowTreeFactory>(this); | 220 connection->AddInterface<mojom::WindowTreeFactory>(this); |
| 219 if (test_config_) | 221 if (test_config_) |
| 220 connection->AddInterface<WindowServerTest>(this); | 222 connection->AddInterface<WindowServerTest>(this); |
| 221 | 223 |
| 222 if (use_chrome_gpu_command_buffer_) { | 224 if (use_chrome_gpu_command_buffer_) { |
| 223 connection->AddInterface<mojom::GpuService>(this); | 225 connection->AddInterface<mojom::GpuService>(this); |
| 224 } else { | 226 } else { |
| 225 connection->AddInterface<Gpu>(this); | 227 connection->AddInterface<Gpu>(this); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 return; | 304 return; |
| 303 new GpuServiceImpl(std::move(request), connection); | 305 new GpuServiceImpl(std::move(request), connection); |
| 304 } | 306 } |
| 305 | 307 |
| 306 void MusApp::Create(shell::Connection* connection, | 308 void MusApp::Create(shell::Connection* connection, |
| 307 mojom::UserAccessManagerRequest request) { | 309 mojom::UserAccessManagerRequest request) { |
| 308 window_server_->user_id_tracker()->Bind(std::move(request)); | 310 window_server_->user_id_tracker()->Bind(std::move(request)); |
| 309 } | 311 } |
| 310 | 312 |
| 311 void MusApp::Create(shell::Connection* connection, | 313 void MusApp::Create(shell::Connection* connection, |
| 314 mojom::UserActivityMonitorRequest request) { |
| 315 AddUserIfNecessary(connection); |
| 316 const ws::UserId& user_id = connection->GetRemoteIdentity().user_id(); |
| 317 window_server_->GetUserActivityMonitorForUser(user_id)->Add( |
| 318 std::move(request)); |
| 319 } |
| 320 |
| 321 void MusApp::Create(shell::Connection* connection, |
| 312 mojom::WindowManagerWindowTreeFactoryRequest request) { | 322 mojom::WindowManagerWindowTreeFactoryRequest request) { |
| 313 AddUserIfNecessary(connection); | 323 AddUserIfNecessary(connection); |
| 314 window_server_->window_manager_window_tree_factory_set()->Add( | 324 window_server_->window_manager_window_tree_factory_set()->Add( |
| 315 connection->GetRemoteIdentity().user_id(), std::move(request)); | 325 connection->GetRemoteIdentity().user_id(), std::move(request)); |
| 316 } | 326 } |
| 317 | 327 |
| 318 void MusApp::Create(Connection* connection, | 328 void MusApp::Create(Connection* connection, |
| 319 mojom::WindowTreeFactoryRequest request) { | 329 mojom::WindowTreeFactoryRequest request) { |
| 320 AddUserIfNecessary(connection); | 330 AddUserIfNecessary(connection); |
| 321 if (!window_server_->display_manager()->has_displays()) { | 331 if (!window_server_->display_manager()->has_displays()) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 // Display manages its own lifetime. | 367 // Display manages its own lifetime. |
| 358 ws::Display* host_impl = | 368 ws::Display* host_impl = |
| 359 new ws::Display(window_server_.get(), platform_display_init_params_); | 369 new ws::Display(window_server_.get(), platform_display_init_params_); |
| 360 host_impl->Init(nullptr); | 370 host_impl->Init(nullptr); |
| 361 | 371 |
| 362 if (touch_controller_) | 372 if (touch_controller_) |
| 363 touch_controller_->UpdateTouchTransforms(); | 373 touch_controller_->UpdateTouchTransforms(); |
| 364 } | 374 } |
| 365 | 375 |
| 366 } // namespace mus | 376 } // namespace mus |
| OLD | NEW |