| 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/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
| 11 #include "ash/mus/accelerators/accelerator_registrar_impl.h" | 12 #include "ash/mus/accelerators/accelerator_registrar_impl.h" |
| 12 #include "ash/mus/native_widget_factory_mus.h" | 13 #include "ash/mus/native_widget_factory_mus.h" |
| 13 #include "ash/mus/shelf_delegate_mus.h" | 14 #include "ash/mus/shelf_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" |
| 24 #include "services/ui/public/cpp/window_tree_client.h" | 25 #include "services/ui/public/cpp/window_tree_client.h" |
| 25 #include "ui/aura/env.h" | 26 #include "ui/aura/env.h" |
| 26 #include "ui/events/event.h" | 27 #include "ui/events/event.h" |
| 27 #include "ui/message_center/message_center.h" | 28 #include "ui/message_center/message_center.h" |
| 28 #include "ui/views/mus/aura_init.h" | 29 #include "ui/views/mus/aura_init.h" |
| 29 #include "ui/views/mus/surface_context_factory.h" | 30 #include "ui/views/mus/surface_context_factory.h" |
| 30 | 31 |
| 31 #if defined(OS_CHROMEOS) | 32 #if defined(OS_CHROMEOS) |
| 32 #include "ash/common/system/chromeos/power/power_status.h" | 33 #include "ash/common/system/chromeos/power/power_status.h" |
| 33 #include "ash/mus/system_tray_delegate_mus.h" | |
| 34 #include "chromeos/audio/cras_audio_handler.h" | 34 #include "chromeos/audio/cras_audio_handler.h" |
| 35 #include "chromeos/dbus/dbus_thread_manager.h" | 35 #include "chromeos/dbus/dbus_thread_manager.h" |
| 36 #include "chromeos/network/network_handler.h" | 36 #include "chromeos/network/network_handler.h" |
| 37 #include "chromeos/system/fake_statistics_provider.h" | 37 #include "chromeos/system/fake_statistics_provider.h" |
| 38 #include "device/bluetooth/dbus/bluez_dbus_manager.h" // nogncheck | 38 #include "device/bluetooth/dbus/bluez_dbus_manager.h" // nogncheck |
| 39 #endif | 39 #endif |
| 40 | 40 |
| 41 namespace ash { | 41 namespace ash { |
| 42 namespace mus { | 42 namespace mus { |
| 43 namespace { | 43 namespace { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 149 |
| 150 const size_t kMaxNumberThreads = 3u; // Matches that of content. | 150 const size_t kMaxNumberThreads = 3u; // Matches that of content. |
| 151 const char kThreadNamePrefix[] = "MashBlocking"; | 151 const char kThreadNamePrefix[] = "MashBlocking"; |
| 152 blocking_pool_ = new base::SequencedWorkerPool( | 152 blocking_pool_ = new base::SequencedWorkerPool( |
| 153 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); | 153 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); |
| 154 InitWindowManager(std::move(window_tree_client), blocking_pool_); | 154 InitWindowManager(std::move(window_tree_client), blocking_pool_); |
| 155 } | 155 } |
| 156 | 156 |
| 157 bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity, | 157 bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity, |
| 158 shell::InterfaceRegistry* registry) { | 158 shell::InterfaceRegistry* registry) { |
| 159 // Register services used in both classic ash and mash. |
| 160 MojoInterfaceFactory::RegisterInterfaces(registry, |
| 161 base::ThreadTaskRunnerHandle::Get()); |
| 162 |
| 159 registry->AddInterface<mojom::ShelfController>(this); | 163 registry->AddInterface<mojom::ShelfController>(this); |
| 160 registry->AddInterface<mojom::SystemTray>(this); | |
| 161 registry->AddInterface<mojom::WallpaperController>(this); | 164 registry->AddInterface<mojom::WallpaperController>(this); |
| 162 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); | 165 registry->AddInterface<ui::mojom::AcceleratorRegistrar>(this); |
| 163 if (remote_identity.name() == "mojo:mash_session") { | 166 if (remote_identity.name() == "mojo:mash_session") { |
| 164 connector()->ConnectToInterface(remote_identity, &session_); | 167 connector()->ConnectToInterface(remote_identity, &session_); |
| 165 session_->AddScreenlockStateListener( | 168 session_->AddScreenlockStateListener( |
| 166 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); | 169 screenlock_state_listener_binding_.CreateInterfacePtrAndBind()); |
| 167 } | 170 } |
| 168 return true; | 171 return true; |
| 169 } | 172 } |
| 170 | 173 |
| 171 void WindowManagerApplication::Create(const shell::Identity& remote_identity, | 174 void WindowManagerApplication::Create(const shell::Identity& remote_identity, |
| 172 mojom::ShelfControllerRequest request) { | 175 mojom::ShelfControllerRequest request) { |
| 173 mojom::ShelfController* shelf_controller = | 176 mojom::ShelfController* shelf_controller = |
| 174 static_cast<ShelfDelegateMus*>(WmShell::Get()->shelf_delegate()); | 177 static_cast<ShelfDelegateMus*>(WmShell::Get()->shelf_delegate()); |
| 175 DCHECK(shelf_controller); | 178 DCHECK(shelf_controller); |
| 176 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request)); | 179 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request)); |
| 177 } | 180 } |
| 178 | 181 |
| 179 void WindowManagerApplication::Create(const shell::Identity& remote_identity, | |
| 180 mojom::SystemTrayRequest request) { | |
| 181 #if defined(OS_CHROMEOS) | |
| 182 // Chrome-with-ash only runs on Chrome OS, so don't provide the SystemTray | |
| 183 // interface on other platforms. | |
| 184 mojom::SystemTray* system_tray = SystemTrayDelegateMus::Get(); | |
| 185 DCHECK(system_tray); | |
| 186 system_tray_bindings_.AddBinding(system_tray, std::move(request)); | |
| 187 #endif | |
| 188 } | |
| 189 | |
| 190 void WindowManagerApplication::Create( | 182 void WindowManagerApplication::Create( |
| 191 const ::shell::Identity& remote_identity, | 183 const ::shell::Identity& remote_identity, |
| 192 mojom::WallpaperControllerRequest request) { | 184 mojom::WallpaperControllerRequest request) { |
| 193 mojom::WallpaperController* wallpaper_controller = | 185 mojom::WallpaperController* wallpaper_controller = |
| 194 static_cast<WallpaperDelegateMus*>(WmShell::Get()->wallpaper_delegate()); | 186 static_cast<WallpaperDelegateMus*>(WmShell::Get()->wallpaper_delegate()); |
| 195 DCHECK(wallpaper_controller); | 187 DCHECK(wallpaper_controller); |
| 196 wallpaper_controller_bindings_.AddBinding(wallpaper_controller, | 188 wallpaper_controller_bindings_.AddBinding(wallpaper_controller, |
| 197 std::move(request)); | 189 std::move(request)); |
| 198 } | 190 } |
| 199 | 191 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 215 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, | 207 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, |
| 216 base::Unretained(this)))); | 208 base::Unretained(this)))); |
| 217 } | 209 } |
| 218 | 210 |
| 219 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { | 211 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { |
| 220 window_manager_->SetScreenLocked(locked); | 212 window_manager_->SetScreenLocked(locked); |
| 221 } | 213 } |
| 222 | 214 |
| 223 } // namespace mus | 215 } // namespace mus |
| 224 } // namespace ash | 216 } // namespace ash |
| OLD | NEW |