| 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/shelf_delegate_mus.h" | |
| 15 #include "ash/mus/wallpaper_delegate_mus.h" | 14 #include "ash/mus/wallpaper_delegate_mus.h" |
| 16 #include "ash/mus/window_manager.h" | 15 #include "ash/mus/window_manager.h" |
| 17 #include "base/bind.h" | 16 #include "base/bind.h" |
| 18 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 19 #include "services/shell/public/cpp/connection.h" | 18 #include "services/shell/public/cpp/connection.h" |
| 20 #include "services/shell/public/cpp/connector.h" | 19 #include "services/shell/public/cpp/connector.h" |
| 21 #include "services/tracing/public/cpp/provider.h" | 20 #include "services/tracing/public/cpp/provider.h" |
| 22 #include "services/ui/common/event_matcher_util.h" | 21 #include "services/ui/common/event_matcher_util.h" |
| 23 #include "services/ui/public/cpp/gpu_service.h" | 22 #include "services/ui/public/cpp/gpu_service.h" |
| 24 #include "services/ui/public/cpp/window.h" | 23 #include "services/ui/public/cpp/window.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); | 176 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); |
| 178 InitWindowManager(std::move(window_tree_client), blocking_pool_); | 177 InitWindowManager(std::move(window_tree_client), blocking_pool_); |
| 179 } | 178 } |
| 180 | 179 |
| 181 bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity, | 180 bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity, |
| 182 shell::InterfaceRegistry* registry) { | 181 shell::InterfaceRegistry* registry) { |
| 183 // Register services used in both classic ash and mash. | 182 // Register services used in both classic ash and mash. |
| 184 mojo_interface_factory::RegisterInterfaces( | 183 mojo_interface_factory::RegisterInterfaces( |
| 185 registry, base::ThreadTaskRunnerHandle::Get()); | 184 registry, base::ThreadTaskRunnerHandle::Get()); |
| 186 | 185 |
| 187 registry->AddInterface<mojom::ShelfController>(this); | |
| 188 registry->AddInterface<mojom::WallpaperController>(this); | 186 registry->AddInterface<mojom::WallpaperController>(this); |
| 189 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); | 187 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); |
| 190 if (remote_identity.name() == "service:mash_session") { | 188 if (remote_identity.name() == "service:mash_session") { |
| 191 connector()->ConnectToInterface(remote_identity, &session_); | 189 connector()->ConnectToInterface(remote_identity, &session_); |
| 192 session_->AddScreenlockStateListener( | 190 session_->AddScreenlockStateListener( |
| 193 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); | 191 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); |
| 194 } | 192 } |
| 195 return true; | 193 return true; |
| 196 } | 194 } |
| 197 | 195 |
| 198 void WindowManagerApplication::Create(const shell::Identity& remote_identity, | |
| 199 mojom::ShelfControllerRequest request) { | |
| 200 mojom::ShelfController* shelf_controller = | |
| 201 static_cast<ShelfDelegateMus*>(WmShell::Get()->shelf_delegate()); | |
| 202 DCHECK(shelf_controller); | |
| 203 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request)); | |
| 204 } | |
| 205 | |
| 206 void WindowManagerApplication::Create( | 196 void WindowManagerApplication::Create( |
| 207 const ::shell::Identity& remote_identity, | 197 const ::shell::Identity& remote_identity, |
| 208 mojom::WallpaperControllerRequest request) { | 198 mojom::WallpaperControllerRequest request) { |
| 209 mojom::WallpaperController* wallpaper_controller = | 199 mojom::WallpaperController* wallpaper_controller = |
| 210 static_cast<WallpaperDelegateMus*>(WmShell::Get()->wallpaper_delegate()); | 200 static_cast<WallpaperDelegateMus*>(WmShell::Get()->wallpaper_delegate()); |
| 211 DCHECK(wallpaper_controller); | 201 DCHECK(wallpaper_controller); |
| 212 wallpaper_controller_bindings_.AddBinding(wallpaper_controller, | 202 wallpaper_controller_bindings_.AddBinding(wallpaper_controller, |
| 213 std::move(request)); | 203 std::move(request)); |
| 214 } | 204 } |
| 215 | 205 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 231 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, | 221 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, |
| 232 base::Unretained(this)))); | 222 base::Unretained(this)))); |
| 233 } | 223 } |
| 234 | 224 |
| 235 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { | 225 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { |
| 236 window_manager_->SetScreenLocked(locked); | 226 window_manager_->SetScreenLocked(locked); |
| 237 } | 227 } |
| 238 | 228 |
| 239 } // namespace mus | 229 } // namespace mus |
| 240 } // namespace ash | 230 } // namespace ash |
| OLD | NEW |