| 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 "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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 return it->second.get(); | 135 return it->second.get(); |
| 136 user_id_to_user_state_[user_id] = base::WrapUnique(new UserState); | 136 user_id_to_user_state_[user_id] = base::WrapUnique(new UserState); |
| 137 return user_id_to_user_state_[user_id].get(); | 137 return user_id_to_user_state_[user_id].get(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void Service::AddUserIfNecessary(shell::Connection* connection) { | 140 void Service::AddUserIfNecessary(shell::Connection* connection) { |
| 141 window_server_->user_id_tracker()->AddUserId( | 141 window_server_->user_id_tracker()->AddUserId( |
| 142 connection->GetRemoteIdentity().user_id()); | 142 connection->GetRemoteIdentity().user_id()); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void Service::Initialize(shell::Connector* connector, | 145 void Service::OnStart(shell::Connector* connector, |
| 146 const shell::Identity& identity, | 146 const shell::Identity& identity, |
| 147 uint32_t id) { | 147 uint32_t id) { |
| 148 platform_display_init_params_.surfaces_state = new SurfacesState; | 148 platform_display_init_params_.surfaces_state = new SurfacesState; |
| 149 | 149 |
| 150 base::PlatformThread::SetName("mus"); | 150 base::PlatformThread::SetName("mus"); |
| 151 tracing_.Initialize(connector, identity.name()); | 151 tracing_.Initialize(connector, identity.name()); |
| 152 TRACE_EVENT0("mus", "Service::Initialize started"); | 152 TRACE_EVENT0("mus", "Service::Initialize started"); |
| 153 | 153 |
| 154 test_config_ = base::CommandLine::ForCurrentProcess()->HasSwitch( | 154 test_config_ = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 155 switches::kUseTestConfig); | 155 switches::kUseTestConfig); |
| 156 // TODO(penghuang): Kludge: use mojo command buffer when running on Windows | 156 // TODO(penghuang): Kludge: use mojo command buffer when running on Windows |
| 157 // since Chrome command buffer breaks unit tests | 157 // since Chrome command buffer breaks unit tests |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 window_server_.reset( | 216 window_server_.reset( |
| 217 new ws::WindowServer(this, platform_display_init_params_.surfaces_state)); | 217 new ws::WindowServer(this, platform_display_init_params_.surfaces_state)); |
| 218 | 218 |
| 219 // DeviceDataManager must be initialized before TouchController. On non-Linux | 219 // DeviceDataManager must be initialized before TouchController. On non-Linux |
| 220 // platforms there is no DeviceDataManager so don't create touch controller. | 220 // platforms there is no DeviceDataManager so don't create touch controller. |
| 221 if (ui::DeviceDataManager::HasInstance()) | 221 if (ui::DeviceDataManager::HasInstance()) |
| 222 touch_controller_.reset( | 222 touch_controller_.reset( |
| 223 new ws::TouchController(window_server_->display_manager())); | 223 new ws::TouchController(window_server_->display_manager())); |
| 224 } | 224 } |
| 225 | 225 |
| 226 bool Service::AcceptConnection(Connection* connection) { | 226 bool Service::OnConnect(Connection* connection) { |
| 227 connection->AddInterface<mojom::Clipboard>(this); | 227 connection->AddInterface<mojom::Clipboard>(this); |
| 228 connection->AddInterface<mojom::DisplayManager>(this); | 228 connection->AddInterface<mojom::DisplayManager>(this); |
| 229 connection->AddInterface<mojom::UserAccessManager>(this); | 229 connection->AddInterface<mojom::UserAccessManager>(this); |
| 230 connection->AddInterface<mojom::UserActivityMonitor>(this); | 230 connection->AddInterface<mojom::UserActivityMonitor>(this); |
| 231 connection->AddInterface<WindowTreeHostFactory>(this); | 231 connection->AddInterface<WindowTreeHostFactory>(this); |
| 232 connection->AddInterface<mojom::WindowManagerWindowTreeFactory>(this); | 232 connection->AddInterface<mojom::WindowManagerWindowTreeFactory>(this); |
| 233 connection->AddInterface<mojom::WindowTreeFactory>(this); | 233 connection->AddInterface<mojom::WindowTreeFactory>(this); |
| 234 if (test_config_) | 234 if (test_config_) |
| 235 connection->AddInterface<WindowServerTest>(this); | 235 connection->AddInterface<WindowServerTest>(this); |
| 236 | 236 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 // Display manages its own lifetime. | 380 // Display manages its own lifetime. |
| 381 ws::Display* host_impl = | 381 ws::Display* host_impl = |
| 382 new ws::Display(window_server_.get(), platform_display_init_params_); | 382 new ws::Display(window_server_.get(), platform_display_init_params_); |
| 383 host_impl->Init(nullptr); | 383 host_impl->Init(nullptr); |
| 384 | 384 |
| 385 if (touch_controller_) | 385 if (touch_controller_) |
| 386 touch_controller_->UpdateTouchTransforms(); | 386 touch_controller_->UpdateTouchTransforms(); |
| 387 } | 387 } |
| 388 | 388 |
| 389 } // namespace ui | 389 } // namespace ui |
| OLD | NEW |