Chromium Code Reviews| 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" | |
| 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" |
| 25 #include "services/ui/public/cpp/window_tree_client.h" | 24 #include "services/ui/public/cpp/window_tree_client.h" |
| 26 #include "ui/aura/env.h" | 25 #include "ui/aura/env.h" |
| 27 #include "ui/events/event.h" | 26 #include "ui/events/event.h" |
| 28 #include "ui/message_center/message_center.h" | 27 #include "ui/message_center/message_center.h" |
| 29 #include "ui/views/mus/aura_init.h" | 28 #include "ui/views/mus/aura_init.h" |
| 30 #include "ui/views/mus/surface_context_factory.h" | 29 #include "ui/views/mus/surface_context_factory.h" |
| 31 | 30 |
| 32 #if defined(OS_CHROMEOS) | 31 #if defined(OS_CHROMEOS) |
| 33 #include "ash/common/system/chromeos/power/power_status.h" | 32 #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/system/fake_statistics_provider.h" | 37 #include "chromeos/system/fake_statistics_provider.h" |
| 37 #include "device/bluetooth/dbus/bluez_dbus_manager.h" // nogncheck | 38 #include "device/bluetooth/dbus/bluez_dbus_manager.h" // nogncheck |
| 38 #endif | 39 #endif |
| 39 | 40 |
| 40 namespace ash { | 41 namespace ash { |
| 41 namespace mus { | 42 namespace mus { |
| 42 namespace { | 43 namespace { |
| 43 | 44 |
| 44 void InitializeComponents() { | 45 void InitializeComponents() { |
| 45 message_center::MessageCenter::Initialize(); | 46 message_center::MessageCenter::Initialize(); |
| 46 #if defined(OS_CHROMEOS) | 47 #if defined(OS_CHROMEOS) |
| 47 // Must occur after mojo::ApplicationRunner has initialized AtExitManager, but | 48 // Must occur after mojo::ApplicationRunner has initialized AtExitManager, but |
| 48 // before WindowManager::Init(). | 49 // before WindowManager::Init(). |
| 49 chromeos::DBusThreadManager::Initialize( | 50 chromeos::DBusThreadManager::Initialize( |
| 50 chromeos::DBusThreadManager::PROCESS_ASH); | 51 chromeos::DBusThreadManager::PROCESS_ASH); |
| 51 | 52 |
| 52 // See ChromeBrowserMainPartsChromeos for ordering details. | 53 // See ChromeBrowserMainPartsChromeos for ordering details. |
| 53 bluez::BluezDBusManager::Initialize( | 54 bluez::BluezDBusManager::Initialize( |
| 54 chromeos::DBusThreadManager::Get()->GetSystemBus(), | 55 chromeos::DBusThreadManager::Get()->GetSystemBus(), |
| 55 chromeos::DBusThreadManager::Get()->IsUsingFakes()); | 56 chromeos::DBusThreadManager::Get()->IsUsingFakes()); |
| 57 chromeos::NetworkHandler::Initialize(); | |
| 56 // TODO(jamescook): Initialize real audio handler. | 58 // TODO(jamescook): Initialize real audio handler. |
| 57 chromeos::CrasAudioHandler::InitializeForTesting(); | 59 chromeos::CrasAudioHandler::InitializeForTesting(); |
| 58 PowerStatus::Initialize(); | 60 PowerStatus::Initialize(); |
| 59 #endif | 61 #endif |
| 60 } | 62 } |
| 61 | 63 |
| 62 void ShutdownComponents() { | 64 void ShutdownComponents() { |
| 63 #if defined(OS_CHROMEOS) | 65 #if defined(OS_CHROMEOS) |
| 64 PowerStatus::Shutdown(); | 66 PowerStatus::Shutdown(); |
| 65 chromeos::CrasAudioHandler::Shutdown(); | 67 chromeos::CrasAudioHandler::Shutdown(); |
| 68 chromeos::NetworkHandler::Shutdown(); | |
| 66 bluez::BluezDBusManager::Shutdown(); | 69 bluez::BluezDBusManager::Shutdown(); |
| 67 chromeos::DBusThreadManager::Shutdown(); | 70 chromeos::DBusThreadManager::Shutdown(); |
| 68 #endif | 71 #endif |
| 69 message_center::MessageCenter::Shutdown(); | 72 message_center::MessageCenter::Shutdown(); |
| 70 } | 73 } |
| 71 | 74 |
| 72 } // namespace | 75 } // namespace |
| 73 | 76 |
| 74 WindowManagerApplication::WindowManagerApplication() | 77 WindowManagerApplication::WindowManagerApplication() |
| 75 : screenlock_state_listener_binding_(this) {} | 78 : screenlock_state_listener_binding_(this) {} |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 void WindowManagerApplication::Create(const shell::Identity& remote_identity, | 172 void WindowManagerApplication::Create(const shell::Identity& remote_identity, |
| 170 mojom::ShelfControllerRequest request) { | 173 mojom::ShelfControllerRequest request) { |
| 171 mojom::ShelfController* shelf_controller = | 174 mojom::ShelfController* shelf_controller = |
| 172 static_cast<ShelfDelegateMus*>(WmShell::Get()->shelf_delegate()); | 175 static_cast<ShelfDelegateMus*>(WmShell::Get()->shelf_delegate()); |
| 173 DCHECK(shelf_controller); | 176 DCHECK(shelf_controller); |
| 174 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request)); | 177 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request)); |
| 175 } | 178 } |
| 176 | 179 |
| 177 void WindowManagerApplication::Create(const shell::Identity& remote_identity, | 180 void WindowManagerApplication::Create(const shell::Identity& remote_identity, |
| 178 mojom::SystemTrayRequest request) { | 181 mojom::SystemTrayRequest request) { |
| 182 #if defined(OS_CHROMEOS) | |
| 183 // Chrome-with-ash only runs on Chrome OS, so don't provide the SystemTray | |
|
msw
2016/09/29 16:54:52
q: What about windows debugging?
James Cook
2016/09/29 17:05:10
You can't debug system tray behavior on Windows to
msw
2016/09/29 17:26:46
Ah, using DefaultSystemTrayDelegate is fine; I tho
| |
| 184 // interface on other platforms. | |
| 179 mojom::SystemTray* system_tray = SystemTrayDelegateMus::Get(); | 185 mojom::SystemTray* system_tray = SystemTrayDelegateMus::Get(); |
| 180 DCHECK(system_tray); | 186 DCHECK(system_tray); |
| 181 system_tray_bindings_.AddBinding(system_tray, std::move(request)); | 187 system_tray_bindings_.AddBinding(system_tray, std::move(request)); |
| 188 #endif | |
| 182 } | 189 } |
| 183 | 190 |
| 184 void WindowManagerApplication::Create( | 191 void WindowManagerApplication::Create( |
| 185 const ::shell::Identity& remote_identity, | 192 const ::shell::Identity& remote_identity, |
| 186 mojom::WallpaperControllerRequest request) { | 193 mojom::WallpaperControllerRequest request) { |
| 187 mojom::WallpaperController* wallpaper_controller = | 194 mojom::WallpaperController* wallpaper_controller = |
| 188 static_cast<WallpaperDelegateMus*>(WmShell::Get()->wallpaper_delegate()); | 195 static_cast<WallpaperDelegateMus*>(WmShell::Get()->wallpaper_delegate()); |
| 189 DCHECK(wallpaper_controller); | 196 DCHECK(wallpaper_controller); |
| 190 wallpaper_controller_bindings_.AddBinding(wallpaper_controller, | 197 wallpaper_controller_bindings_.AddBinding(wallpaper_controller, |
| 191 std::move(request)); | 198 std::move(request)); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 209 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, | 216 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, |
| 210 base::Unretained(this)))); | 217 base::Unretained(this)))); |
| 211 } | 218 } |
| 212 | 219 |
| 213 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { | 220 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { |
| 214 window_manager_->SetScreenLocked(locked); | 221 window_manager_->SetScreenLocked(locked); |
| 215 } | 222 } |
| 216 | 223 |
| 217 } // namespace mus | 224 } // namespace mus |
| 218 } // namespace ash | 225 } // namespace ash |
| OLD | NEW |