Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: ash/common/shutdown_controller.cc

Issue 2497123002: chromeos: Move device shutdown handling out of chrome into ash (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/common/shutdown_controller.h ('k') | ash/common/system/chromeos/shutdown_policy_observer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « ash/common/shutdown_controller.h ('k') | ash/common/system/chromeos/shutdown_policy_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698