| 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
|
|
|