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

Unified Diff: ash/session/session_controller.cc

Issue 2830933002: cros: Use SessionController for lock starting code (Closed)
Patch Set: fix nit Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/session/session_controller.h ('k') | ash/wm/lock_state_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/session/session_controller.cc
diff --git a/ash/session/session_controller.cc b/ash/session/session_controller.cc
index b546c92beb460d343e225adc25238ff112ea1449..46e363cec155c5bd4da168d4235197f7237a81c5 100644
--- a/ash/session/session_controller.cc
+++ b/ash/session/session_controller.cc
@@ -41,9 +41,14 @@ SessionState GetDefaultSessionState() {
} // namespace
-SessionController::SessionController() : state_(GetDefaultSessionState()) {}
+SessionController::SessionController()
+ : state_(GetDefaultSessionState()), weak_ptr_factory_(this) {}
-SessionController::~SessionController() {}
+SessionController::~SessionController() {
+ // Abort pending start lock request.
+ if (!start_lock_callback_.is_null())
+ std::move(start_lock_callback_).Run(false /* locked */);
+}
void SessionController::BindRequest(mojom::SessionControllerRequest request) {
bindings_.AddBinding(this, std::move(request));
@@ -210,6 +215,19 @@ void SessionController::SetUserSessionOrder(
}
}
+void SessionController::StartLock(const StartLockCallback& callback) {
+ DCHECK(start_lock_callback_.is_null());
+ start_lock_callback_ = callback;
+
+ LockStateController* const lock_state_controller =
+ Shell::Get()->lock_state_controller();
+
+ lock_state_controller->SetLockScreenDisplayedCallback(
+ base::Bind(&SessionController::OnLockAnimationFinished,
+ weak_ptr_factory_.GetWeakPtr()));
+ lock_state_controller->OnStartingLock();
+}
+
void SessionController::RunUnlockAnimation(
const RunUnlockAnimationCallback& callback) {
is_unlocking_ = true;
@@ -335,4 +353,9 @@ void SessionController::UpdateLoginStatus() {
observer.OnLoginStatusChanged(login_status_);
}
+void SessionController::OnLockAnimationFinished() {
+ if (!start_lock_callback_.is_null())
+ std::move(start_lock_callback_).Run(true /* locked */);
+}
+
} // namespace ash
« no previous file with comments | « ash/session/session_controller.h ('k') | ash/wm/lock_state_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698