Chromium Code Reviews| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 DCHECK(ui::ClientNativePixmapFactory::GetInstance()); | 176 DCHECK(ui::ClientNativePixmapFactory::GetInstance()); |
| 177 #endif | 177 #endif |
| 178 | 178 |
| 179 // TODO(rjkroege): Enter sandbox here before we start threads in GpuState | 179 // TODO(rjkroege): Enter sandbox here before we start threads in GpuState |
| 180 // http://crbug.com/584532 | 180 // http://crbug.com/584532 |
| 181 | 181 |
| 182 #if !defined(OS_ANDROID) | 182 #if !defined(OS_ANDROID) |
| 183 event_source_ = ui::PlatformEventSource::CreateDefault(); | 183 event_source_ = ui::PlatformEventSource::CreateDefault(); |
| 184 #endif | 184 #endif |
| 185 | 185 |
| 186 // This needs to happen after DeviceDataManager has been constructed. That | 186 // This needs to happen after DeviceDataManager has been constructed. That |
|
msw
2017/01/10 19:43:27
optional nit: dcheck for DeviceDataManager::HasIns
kylechar
2017/01/10 22:12:18
There is an if DDM::HasInstance() in the method th
msw
2017/01/10 22:36:57
Acknowledged.
| |
| 187 // happens either during OzonePlatform or PlatformEventSource initialization, | 187 // happens either during OzonePlatform or PlatformEventSource initialization, |
| 188 // so keep this line below both of those. | 188 // so keep this line below both of those. |
| 189 input_device_server_.RegisterAsObserver(); | 189 input_device_server_.RegisterAsObserver(); |
| 190 | 190 |
| 191 // Gpu must be running before the ScreenManager can be initialized. | 191 // Gpu must be running before the ScreenManager can be initialized. |
| 192 window_server_.reset(new ws::WindowServer(this)); | 192 window_server_.reset(new ws::WindowServer(this)); |
| 193 | 193 |
| 194 // DeviceDataManager must be initialized before TouchController. On non-Linux | |
| 195 // platforms there is no DeviceDataManager so don't create touch controller. | |
| 196 if (ui::DeviceDataManager::HasInstance()) | |
| 197 touch_controller_.reset( | |
| 198 new ws::TouchController(window_server_->display_manager())); | |
| 199 | |
| 200 ime_server_.Init(context()->connector(), test_config_); | 194 ime_server_.Init(context()->connector(), test_config_); |
| 201 | 195 |
| 202 discardable_shared_memory_manager_ = | 196 discardable_shared_memory_manager_ = |
| 203 base::MakeUnique<discardable_memory::DiscardableSharedMemoryManager>(); | 197 base::MakeUnique<discardable_memory::DiscardableSharedMemoryManager>(); |
| 204 } | 198 } |
| 205 | 199 |
| 206 bool Service::OnConnect(const service_manager::ServiceInfo& remote_info, | 200 bool Service::OnConnect(const service_manager::ServiceInfo& remote_info, |
| 207 service_manager::InterfaceRegistry* registry) { | 201 service_manager::InterfaceRegistry* registry) { |
| 208 registry->AddInterface<mojom::AccessibilityManager>(this); | 202 registry->AddInterface<mojom::AccessibilityManager>(this); |
| 209 registry->AddInterface<mojom::Clipboard>(this); | 203 registry->AddInterface<mojom::Clipboard>(this); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 if (base::MessageLoop::current() && | 250 if (base::MessageLoop::current() && |
| 257 base::MessageLoop::current()->is_running()) { | 251 base::MessageLoop::current()->is_running()) { |
| 258 base::MessageLoop::current()->QuitWhenIdle(); | 252 base::MessageLoop::current()->QuitWhenIdle(); |
| 259 } | 253 } |
| 260 } | 254 } |
| 261 | 255 |
| 262 bool Service::IsTestConfig() const { | 256 bool Service::IsTestConfig() const { |
| 263 return test_config_; | 257 return test_config_; |
| 264 } | 258 } |
| 265 | 259 |
| 266 void Service::UpdateTouchTransforms() { | |
| 267 if (touch_controller_) | |
| 268 touch_controller_->UpdateTouchTransforms(); | |
| 269 } | |
| 270 | |
| 271 void Service::Create(const service_manager::Identity& remote_identity, | 260 void Service::Create(const service_manager::Identity& remote_identity, |
| 272 mojom::AccessibilityManagerRequest request) { | 261 mojom::AccessibilityManagerRequest request) { |
| 273 UserState* user_state = GetUserState(remote_identity); | 262 UserState* user_state = GetUserState(remote_identity); |
| 274 if (!user_state->accessibility) { | 263 if (!user_state->accessibility) { |
| 275 const ws::UserId& user_id = remote_identity.user_id(); | 264 const ws::UserId& user_id = remote_identity.user_id(); |
| 276 user_state->accessibility.reset( | 265 user_state->accessibility.reset( |
| 277 new ws::AccessibilityManager(window_server_.get(), user_id)); | 266 new ws::AccessibilityManager(window_server_.get(), user_id)); |
| 278 } | 267 } |
| 279 user_state->accessibility->Bind(std::move(request)); | 268 user_state->accessibility->Bind(std::move(request)); |
| 280 } | 269 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 mojom::WindowServerTestRequest request) { | 365 mojom::WindowServerTestRequest request) { |
| 377 if (!test_config_) | 366 if (!test_config_) |
| 378 return; | 367 return; |
| 379 mojo::MakeStrongBinding( | 368 mojo::MakeStrongBinding( |
| 380 base::MakeUnique<ws::WindowServerTestImpl>(window_server_.get()), | 369 base::MakeUnique<ws::WindowServerTestImpl>(window_server_.get()), |
| 381 std::move(request)); | 370 std::move(request)); |
| 382 } | 371 } |
| 383 | 372 |
| 384 | 373 |
| 385 } // namespace ui | 374 } // namespace ui |
| OLD | NEW |