| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ash/mus/window_manager_application.h" | 5 #include "ash/mus/window_manager_application.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
| 10 #include "ash/common/mojo_interface_factory.h" | 10 #include "ash/common/mojo_interface_factory.h" |
| 11 #include "ash/common/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
| 12 #include "ash/mus/accelerators/accelerator_registrar_impl.h" | 12 #include "ash/mus/accelerators/accelerator_registrar_impl.h" |
| 13 #include "ash/mus/native_widget_factory_mus.h" | 13 #include "ash/mus/native_widget_factory_mus.h" |
| 14 #include "ash/mus/wallpaper_delegate_mus.h" | |
| 15 #include "ash/mus/window_manager.h" | 14 #include "ash/mus/window_manager.h" |
| 16 #include "base/bind.h" | 15 #include "base/bind.h" |
| 17 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 18 #include "services/service_manager/public/cpp/connection.h" | 17 #include "services/service_manager/public/cpp/connection.h" |
| 19 #include "services/service_manager/public/cpp/connector.h" | 18 #include "services/service_manager/public/cpp/connector.h" |
| 20 #include "services/tracing/public/cpp/provider.h" | 19 #include "services/tracing/public/cpp/provider.h" |
| 21 #include "services/ui/common/event_matcher_util.h" | 20 #include "services/ui/common/event_matcher_util.h" |
| 22 #include "services/ui/public/cpp/gpu_service.h" | 21 #include "services/ui/public/cpp/gpu_service.h" |
| 23 #include "services/ui/public/cpp/window.h" | 22 #include "services/ui/public/cpp/window.h" |
| 24 #include "services/ui/public/cpp/window_tree_client.h" | 23 #include "services/ui/public/cpp/window_tree_client.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 InitWindowManager(std::move(window_tree_client), blocking_pool_); | 156 InitWindowManager(std::move(window_tree_client), blocking_pool_); |
| 158 } | 157 } |
| 159 | 158 |
| 160 bool WindowManagerApplication::OnConnect( | 159 bool WindowManagerApplication::OnConnect( |
| 161 const service_manager::Identity& remote_identity, | 160 const service_manager::Identity& remote_identity, |
| 162 service_manager::InterfaceRegistry* registry) { | 161 service_manager::InterfaceRegistry* registry) { |
| 163 // Register services used in both classic ash and mash. | 162 // Register services used in both classic ash and mash. |
| 164 mojo_interface_factory::RegisterInterfaces( | 163 mojo_interface_factory::RegisterInterfaces( |
| 165 registry, base::ThreadTaskRunnerHandle::Get()); | 164 registry, base::ThreadTaskRunnerHandle::Get()); |
| 166 | 165 |
| 167 registry->AddInterface<mojom::WallpaperController>(this); | |
| 168 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); | 166 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); |
| 169 if (remote_identity.name() == "service:mash_session") { | 167 if (remote_identity.name() == "service:mash_session") { |
| 170 connector()->ConnectToInterface(remote_identity, &session_); | 168 connector()->ConnectToInterface(remote_identity, &session_); |
| 171 session_->AddScreenlockStateListener( | 169 session_->AddScreenlockStateListener( |
| 172 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); | 170 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); |
| 173 } | 171 } |
| 174 return true; | 172 return true; |
| 175 } | 173 } |
| 176 | 174 |
| 177 void WindowManagerApplication::Create( | 175 void WindowManagerApplication::Create( |
| 178 const ::service_manager::Identity& remote_identity, | |
| 179 mojom::WallpaperControllerRequest request) { | |
| 180 mojom::WallpaperController* wallpaper_controller = | |
| 181 static_cast<WallpaperDelegateMus*>(WmShell::Get()->wallpaper_delegate()); | |
| 182 DCHECK(wallpaper_controller); | |
| 183 wallpaper_controller_bindings_.AddBinding(wallpaper_controller, | |
| 184 std::move(request)); | |
| 185 } | |
| 186 | |
| 187 void WindowManagerApplication::Create( | |
| 188 const service_manager::Identity& remote_identity, | 176 const service_manager::Identity& remote_identity, |
| 189 ui::mojom::AcceleratorRegistrarRequest request) { | 177 ui::mojom::AcceleratorRegistrarRequest request) { |
| 190 if (!window_manager_->window_manager_client()) | 178 if (!window_manager_->window_manager_client()) |
| 191 return; // Can happen during shutdown. | 179 return; // Can happen during shutdown. |
| 192 | 180 |
| 193 uint16_t accelerator_namespace_id; | 181 uint16_t accelerator_namespace_id; |
| 194 if (!window_manager_->GetNextAcceleratorNamespaceId( | 182 if (!window_manager_->GetNextAcceleratorNamespaceId( |
| 195 &accelerator_namespace_id)) { | 183 &accelerator_namespace_id)) { |
| 196 DVLOG(1) << "Max number of accelerators registered, ignoring request."; | 184 DVLOG(1) << "Max number of accelerators registered, ignoring request."; |
| 197 // All ids are used. Normally shouldn't happen, so we close the connection. | 185 // All ids are used. Normally shouldn't happen, so we close the connection. |
| 198 return; | 186 return; |
| 199 } | 187 } |
| 200 accelerator_registrars_.insert(new AcceleratorRegistrarImpl( | 188 accelerator_registrars_.insert(new AcceleratorRegistrarImpl( |
| 201 window_manager_.get(), accelerator_namespace_id, std::move(request), | 189 window_manager_.get(), accelerator_namespace_id, std::move(request), |
| 202 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, | 190 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, |
| 203 base::Unretained(this)))); | 191 base::Unretained(this)))); |
| 204 } | 192 } |
| 205 | 193 |
| 206 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { | 194 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { |
| 207 window_manager_->SetScreenLocked(locked); | 195 window_manager_->SetScreenLocked(locked); |
| 208 } | 196 } |
| 209 | 197 |
| 210 } // namespace mus | 198 } // namespace mus |
| 211 } // namespace ash | 199 } // namespace ash |
| OLD | NEW |