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

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

Issue 2616023005: cros: Remove OS_CHROMEOS ifdefs in ash/common (Closed)
Patch Set: Created 3 years, 11 months 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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/common/shutdown_controller.h" 5 #include "ash/common/shutdown_controller.h"
6 6
7 #include "ash/common/shell_delegate.h" 7 #include "ash/common/shell_delegate.h"
8 #include "ash/common/wm_shell.h" 8 #include "ash/common/wm_shell.h"
9
10 #if defined(OS_CHROMEOS)
11 #include "base/sys_info.h" 9 #include "base/sys_info.h"
12 #include "chromeos/dbus/dbus_thread_manager.h" 10 #include "chromeos/dbus/dbus_thread_manager.h"
13 #include "chromeos/dbus/power_manager_client.h" 11 #include "chromeos/dbus/power_manager_client.h"
14 #endif
15 12
16 namespace ash { 13 namespace ash {
17 14
18 ShutdownController::ShutdownController() {} 15 ShutdownController::ShutdownController() {}
19 16
20 ShutdownController::~ShutdownController() {} 17 ShutdownController::~ShutdownController() {}
21 18
22 void ShutdownController::ShutDownOrReboot() { 19 void ShutdownController::ShutDownOrReboot() {
23 #if defined(OS_CHROMEOS)
24 if (base::SysInfo::IsRunningOnChromeOS()) { 20 if (base::SysInfo::IsRunningOnChromeOS()) {
msw 2017/01/06 18:22:51 Weird, what is this? (It's not very well documente
James Cook 2017/01/06 20:33:05 It's how we check if we're running on real chromeo
25 // Power manager handles shutdown on Chrome OS hardware. 21 // Power manager handles shutdown on Chrome OS hardware.
26 using chromeos::DBusThreadManager; 22 using chromeos::DBusThreadManager;
27 if (reboot_on_shutdown_) 23 if (reboot_on_shutdown_)
28 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); 24 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart();
29 else 25 else
30 DBusThreadManager::Get()->GetPowerManagerClient()->RequestShutdown(); 26 DBusThreadManager::Get()->GetPowerManagerClient()->RequestShutdown();
31 return; 27 return;
32 } 28 }
33 #endif // defined(OS_CHROMEOS)
34 29
35 // On Windows and on Linux desktop just exit. 30 // On Linux desktop just exit.
36 WmShell::Get()->delegate()->Exit(); 31 WmShell::Get()->delegate()->Exit();
37 } 32 }
38 33
39 void ShutdownController::SetRebootOnShutdown(bool reboot_on_shutdown) { 34 void ShutdownController::SetRebootOnShutdown(bool reboot_on_shutdown) {
40 reboot_on_shutdown_ = reboot_on_shutdown; 35 reboot_on_shutdown_ = reboot_on_shutdown;
41 } 36 }
42 37
43 void ShutdownController::BindRequest(mojom::ShutdownControllerRequest request) { 38 void ShutdownController::BindRequest(mojom::ShutdownControllerRequest request) {
44 bindings_.AddBinding(this, std::move(request)); 39 bindings_.AddBinding(this, std::move(request));
45 } 40 }
46 41
47 } // namespace ash 42 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698