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

Unified Diff: ash/wm/lock_state_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/lock_state_controller.h ('k') | ash/wm/lock_state_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/lock_state_controller.cc
diff --git a/ash/wm/lock_state_controller.cc b/ash/wm/lock_state_controller.cc
index d2d8da6b55dd69a1bb5bc278082883bab9acb4c3..5842f1706c5083ff5492aaf7dceb4902af91372d 100644
--- a/ash/wm/lock_state_controller.cc
+++ b/ash/wm/lock_state_controller.cc
@@ -11,13 +11,13 @@
#include "ash/cancel_mode.h"
#include "ash/common/accessibility_delegate.h"
#include "ash/common/shell_delegate.h"
+#include "ash/common/shutdown_controller.h"
#include "ash/common/wm_shell.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/public/interfaces/shutdown.mojom.h"
#include "ash/shell.h"
#include "ash/wm/session_state_animator.h"
#include "ash/wm/session_state_animator_impl.h"
-#include "ash/wm/shutdown_client_proxy.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
@@ -72,7 +72,8 @@ const int LockStateController::kLockFailTimeoutMs = 8000 * kTimeoutMultiplier;
const int LockStateController::kLockToShutdownTimeoutMs = 150;
const int LockStateController::kShutdownRequestDelayMs = 50;
-LockStateController::LockStateController(service_manager::Connector* connector)
+LockStateController::LockStateController(
+ ShutdownController* shutdown_controller)
: animator_(new SessionStateAnimatorImpl()),
login_status_(LoginStatus::NOT_LOGGED_IN),
system_is_locked_(false),
@@ -80,8 +81,9 @@ LockStateController::LockStateController(service_manager::Connector* connector)
shutdown_after_lock_(false),
animating_lock_(false),
can_cancel_lock_animation_(false),
- shutdown_client_(base::MakeUnique<ShutdownClientProxy>(connector)),
+ shutdown_controller_(shutdown_controller),
weak_ptr_factory_(this) {
+ DCHECK(shutdown_controller_);
Shell::GetPrimaryRootWindow()->GetHost()->AddObserver(this);
}
@@ -308,25 +310,9 @@ void LockStateController::StartRealShutdownTimer(bool with_animation_time) {
void LockStateController::OnRealPowerTimeout() {
VLOG(1) << "OnRealPowerTimeout";
DCHECK(shutting_down_);
-#if defined(OS_CHROMEOS)
- if (!base::SysInfo::IsRunningOnChromeOS()) {
- ShellDelegate* delegate = WmShell::Get()->delegate();
- if (delegate) {
- delegate->Exit();
- return;
- }
- }
-#endif
WmShell::Get()->RecordUserMetricsAction(UMA_ACCEL_SHUT_DOWN_POWER_BUTTON);
-
- // Connect to the browser to tell it to shutdown the computer. It will either
- // shut down or restart the computer based on the device settings.
- //
- // TODO(erg): Once CrosSettings has been moved out of chrome/,
- // LockStateController should become a preference observer of it, and we
- // should move the current content_browser implementation here.
- // crbug.com/628792
- shutdown_client_->RequestShutdown();
+ // Shut down or reboot based on device policy.
+ shutdown_controller_->ShutDownOrReboot();
}
void LockStateController::StartCancellableShutdownAnimation() {
« no previous file with comments | « ash/wm/lock_state_controller.h ('k') | ash/wm/lock_state_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698