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

Side by Side Diff: chrome/browser/chromeos/power/shutdown_client_impl.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
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 "chrome/browser/chromeos/power/shutdown_client_impl.h"
6
7 #include "base/logging.h"
8 #include "chrome/browser/chromeos/settings/cros_settings.h"
9 #include "chromeos/dbus/dbus_thread_manager.h"
10 #include "chromeos/dbus/power_manager_client.h"
11 #include "chromeos/dbus/session_manager_client.h"
12 #include "chromeos/settings/cros_settings_names.h"
13
14 namespace chromeos {
15
16 ShutdownClientImpl::ShutdownClientImpl() : weak_factory_(this) {}
17
18 ShutdownClientImpl::~ShutdownClientImpl() {}
19
20 void ShutdownClientImpl::RequestShutdown() {
21 CrosSettings* cros_settings = CrosSettings::Get();
22 CrosSettingsProvider::TrustedStatus status =
23 cros_settings->PrepareTrustedValues(base::Bind(
24 &ShutdownClientImpl::RequestShutdown, weak_factory_.GetWeakPtr()));
25 if (status != CrosSettingsProvider::TRUSTED)
26 return;
27
28 // Get the updated policy.
29 bool reboot_on_shutdown = false;
30 cros_settings->GetBoolean(kRebootOnShutdown, &reboot_on_shutdown);
31
32 if (reboot_on_shutdown)
33 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart();
34 else
35 DBusThreadManager::Get()->GetPowerManagerClient()->RequestShutdown();
36 }
37
38 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/power/shutdown_client_impl.h ('k') | chrome/browser/chromeos/settings/shutdown_policy_forwarder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698