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

Unified Diff: ash/wm/lock_state_controller.cc

Issue 2471643002: mash: remove the LockStateControllerDelegate. (Closed)
Patch Set: sky comments 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 b0392dd7249352ed550f48190c0c429625740d9c..d2d8da6b55dd69a1bb5bc278082883bab9acb4c3 100644
--- a/ash/wm/lock_state_controller.cc
+++ b/ash/wm/lock_state_controller.cc
@@ -13,9 +13,11 @@
#include "ash/common/shell_delegate.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"
@@ -70,12 +72,7 @@ const int LockStateController::kLockFailTimeoutMs = 8000 * kTimeoutMultiplier;
const int LockStateController::kLockToShutdownTimeoutMs = 150;
const int LockStateController::kShutdownRequestDelayMs = 50;
-LockStateController::TestApi::TestApi(LockStateController* controller)
- : controller_(controller) {}
-
-LockStateController::TestApi::~TestApi() {}
-
-LockStateController::LockStateController()
+LockStateController::LockStateController(service_manager::Connector* connector)
: animator_(new SessionStateAnimatorImpl()),
login_status_(LoginStatus::NOT_LOGGED_IN),
system_is_locked_(false),
@@ -83,6 +80,7 @@ LockStateController::LockStateController()
shutdown_after_lock_(false),
animating_lock_(false),
can_cancel_lock_animation_(false),
+ shutdown_client_(base::MakeUnique<ShutdownClientProxy>(connector)),
weak_ptr_factory_(this) {
Shell::GetPrimaryRootWindow()->GetHost()->AddObserver(this);
}
@@ -91,11 +89,6 @@ LockStateController::~LockStateController() {
Shell::GetPrimaryRootWindow()->GetHost()->RemoveObserver(this);
}
-void LockStateController::SetDelegate(
- std::unique_ptr<LockStateControllerDelegate> delegate) {
- delegate_ = std::move(delegate);
-}
-
void LockStateController::StartLockAnimation(bool shutdown_after_lock) {
if (animating_lock_)
return;
@@ -325,7 +318,15 @@ void LockStateController::OnRealPowerTimeout() {
}
#endif
WmShell::Get()->RecordUserMetricsAction(UMA_ACCEL_SHUT_DOWN_POWER_BUTTON);
- delegate_->RequestShutdown();
+
+ // 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();
}
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