| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ash/common/shutdown_controller.h" |
| 6 |
| 7 #include "ash/common/shell_delegate.h" |
| 8 #include "ash/common/wm_shell.h" |
| 9 |
| 10 #if defined(OS_CHROMEOS) |
| 11 #include "base/sys_info.h" |
| 12 #include "chromeos/dbus/dbus_thread_manager.h" |
| 13 #include "chromeos/dbus/power_manager_client.h" |
| 14 #endif |
| 15 |
| 16 namespace ash { |
| 17 |
| 18 ShutdownController::ShutdownController() {} |
| 19 |
| 20 ShutdownController::~ShutdownController() {} |
| 21 |
| 22 void ShutdownController::ShutDownOrReboot() { |
| 23 #if defined(OS_CHROMEOS) |
| 24 if (base::SysInfo::IsRunningOnChromeOS()) { |
| 25 // Power manager handles shutdown on Chrome OS hardware. |
| 26 using chromeos::DBusThreadManager; |
| 27 if (reboot_on_shutdown_) |
| 28 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
| 29 else |
| 30 DBusThreadManager::Get()->GetPowerManagerClient()->RequestShutdown(); |
| 31 return; |
| 32 } |
| 33 #endif // defined(OS_CHROMEOS) |
| 34 |
| 35 // On Windows and on Linux desktop just exit. |
| 36 WmShell::Get()->delegate()->Exit(); |
| 37 } |
| 38 |
| 39 void ShutdownController::SetRebootOnShutdown(bool reboot_on_shutdown) { |
| 40 reboot_on_shutdown_ = reboot_on_shutdown; |
| 41 } |
| 42 |
| 43 void ShutdownController::BindRequest(mojom::ShutdownControllerRequest request) { |
| 44 bindings_.AddBinding(this, std::move(request)); |
| 45 } |
| 46 |
| 47 } // namespace ash |
| OLD | NEW |