| 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/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| 11 #include "ash/mus/accelerators/accelerator_registrar_impl.h" | 11 #include "ash/mus/accelerators/accelerator_registrar_impl.h" |
| 12 #include "ash/mus/native_widget_factory_mus.h" | 12 #include "ash/mus/native_widget_factory_mus.h" |
| 13 #include "ash/mus/shelf_delegate_mus.h" | 13 #include "ash/mus/shelf_delegate_mus.h" |
| 14 #include "ash/mus/system_tray_delegate_mus.h" |
| 14 #include "ash/mus/wallpaper_delegate_mus.h" | 15 #include "ash/mus/wallpaper_delegate_mus.h" |
| 15 #include "ash/mus/window_manager.h" | 16 #include "ash/mus/window_manager.h" |
| 16 #include "base/bind.h" | 17 #include "base/bind.h" |
| 17 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
| 18 #include "services/shell/public/cpp/connection.h" | 19 #include "services/shell/public/cpp/connection.h" |
| 19 #include "services/shell/public/cpp/connector.h" | 20 #include "services/shell/public/cpp/connector.h" |
| 20 #include "services/tracing/public/cpp/provider.h" | 21 #include "services/tracing/public/cpp/provider.h" |
| 21 #include "services/ui/common/event_matcher_util.h" | 22 #include "services/ui/common/event_matcher_util.h" |
| 22 #include "services/ui/public/cpp/gpu_service.h" | 23 #include "services/ui/public/cpp/gpu_service.h" |
| 23 #include "services/ui/public/cpp/window.h" | 24 #include "services/ui/public/cpp/window.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 148 |
| 148 const size_t kMaxNumberThreads = 3u; // Matches that of content. | 149 const size_t kMaxNumberThreads = 3u; // Matches that of content. |
| 149 const char kThreadNamePrefix[] = "MashBlocking"; | 150 const char kThreadNamePrefix[] = "MashBlocking"; |
| 150 blocking_pool_ = new base::SequencedWorkerPool( | 151 blocking_pool_ = new base::SequencedWorkerPool( |
| 151 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); | 152 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); |
| 152 InitWindowManager(std::move(window_tree_client), blocking_pool_); | 153 InitWindowManager(std::move(window_tree_client), blocking_pool_); |
| 153 } | 154 } |
| 154 | 155 |
| 155 bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity, | 156 bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity, |
| 156 shell::InterfaceRegistry* registry) { | 157 shell::InterfaceRegistry* registry) { |
| 157 registry->AddInterface<ash::mojom::ShelfController>(this); | 158 registry->AddInterface<mojom::ShelfController>(this); |
| 158 registry->AddInterface<ash::mojom::WallpaperController>(this); | 159 registry->AddInterface<mojom::SystemTray>(this); |
| 160 registry->AddInterface<mojom::WallpaperController>(this); |
| 159 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); | 161 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); |
| 160 if (remote_identity.name() == "mojo:mash_session") { | 162 if (remote_identity.name() == "mojo:mash_session") { |
| 161 connector()->ConnectToInterface(remote_identity, &session_); | 163 connector()->ConnectToInterface(remote_identity, &session_); |
| 162 session_->AddScreenlockStateListener( | 164 session_->AddScreenlockStateListener( |
| 163 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); | 165 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); |
| 164 } | 166 } |
| 165 return true; | 167 return true; |
| 166 } | 168 } |
| 167 | 169 |
| 168 void WindowManagerApplication::Create( | 170 void WindowManagerApplication::Create(const shell::Identity& remote_identity, |
| 169 const shell::Identity& remote_identity, | 171 mojom::ShelfControllerRequest request) { |
| 170 ash::mojom::ShelfControllerRequest request) { | 172 mojom::ShelfController* shelf_controller = |
| 171 ash::mojom::ShelfController* shelf_controller = | |
| 172 static_cast<ShelfDelegateMus*>(WmShell::Get()->shelf_delegate()); | 173 static_cast<ShelfDelegateMus*>(WmShell::Get()->shelf_delegate()); |
| 173 DCHECK(shelf_controller); | 174 DCHECK(shelf_controller); |
| 174 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request)); | 175 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request)); |
| 175 } | 176 } |
| 176 | 177 |
| 178 void WindowManagerApplication::Create(const shell::Identity& remote_identity, |
| 179 mojom::SystemTrayRequest request) { |
| 180 mojom::SystemTray* system_tray = SystemTrayDelegateMus::Get(); |
| 181 DCHECK(system_tray); |
| 182 system_tray_bindings_.AddBinding(system_tray, std::move(request)); |
| 183 } |
| 184 |
| 177 void WindowManagerApplication::Create( | 185 void WindowManagerApplication::Create( |
| 178 const ::shell::Identity& remote_identity, | 186 const ::shell::Identity& remote_identity, |
| 179 ash::mojom::WallpaperControllerRequest request) { | 187 mojom::WallpaperControllerRequest request) { |
| 180 ash::mojom::WallpaperController* wallpaper_controller = | 188 mojom::WallpaperController* wallpaper_controller = |
| 181 static_cast<WallpaperDelegateMus*>(WmShell::Get()->wallpaper_delegate()); | 189 static_cast<WallpaperDelegateMus*>(WmShell::Get()->wallpaper_delegate()); |
| 182 DCHECK(wallpaper_controller); | 190 DCHECK(wallpaper_controller); |
| 183 wallpaper_controller_bindings_.AddBinding(wallpaper_controller, | 191 wallpaper_controller_bindings_.AddBinding(wallpaper_controller, |
| 184 std::move(request)); | 192 std::move(request)); |
| 185 } | 193 } |
| 186 | 194 |
| 187 void WindowManagerApplication::Create( | 195 void WindowManagerApplication::Create( |
| 188 const shell::Identity& remote_identity, | 196 const shell::Identity& remote_identity, |
| 189 ui::mojom::AcceleratorRegistrarRequest request) { | 197 ui::mojom::AcceleratorRegistrarRequest request) { |
| 190 if (!window_manager_->window_manager_client()) | 198 if (!window_manager_->window_manager_client()) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 202 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, | 210 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, |
| 203 base::Unretained(this)))); | 211 base::Unretained(this)))); |
| 204 } | 212 } |
| 205 | 213 |
| 206 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { | 214 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { |
| 207 window_manager_->SetScreenLocked(locked); | 215 window_manager_->SetScreenLocked(locked); |
| 208 } | 216 } |
| 209 | 217 |
| 210 } // namespace mus | 218 } // namespace mus |
| 211 } // namespace ash | 219 } // namespace ash |
| OLD | NEW |