Index: chrome/browser/chromeos/login/lock/screen_locker.cc |
diff --git a/chrome/browser/chromeos/login/lock/screen_locker.cc b/chrome/browser/chromeos/login/lock/screen_locker.cc |
index 7e1a29aa46ee77b9d397d6552773a70e69d1a8c7..06e9c433914fc5441a28801c892c77aa76fb1dbd 100644 |
--- a/chrome/browser/chromeos/login/lock/screen_locker.cc |
+++ b/chrome/browser/chromeos/login/lock/screen_locker.cc |
@@ -244,13 +244,11 @@ void ScreenLocker::Init() { |
owns_delegate_ = true; |
// Create and display lock screen. |
- // TODO(jdufault): Calling ash::ShowLockScreenInWidget should be a mojo |
- // call. We should only set the session state to locked after the mojo call |
- // has completed. |
- if (ash::ShowLockScreen()) { |
+ LockScreenClient::Get()->ShowLockScreen(base::BindOnce([](bool did_show) { |
+ CHECK(did_show); |
session_manager::SessionManager::Get()->SetSessionState( |
session_manager::SessionState::LOCKED); |
- } |
+ })); |
} else { |
web_ui_.reset(new WebUIScreenLocker(this)); |
delegate_ = web_ui_.get(); |
@@ -294,6 +292,9 @@ void ScreenLocker::OnAuthFailure(const AuthFailure& error) { |
if (auth_status_consumer_) |
auth_status_consumer_->OnAuthFailure(error); |
+ |
+ if (on_auth_complete_) |
+ std::move(on_auth_complete_).Run(false); |
} |
void ScreenLocker::OnAuthSuccess(const UserContext& user_context) { |
@@ -348,6 +349,9 @@ void ScreenLocker::OnAuthSuccess(const UserContext& user_context) { |
weak_factory_.GetWeakPtr()), |
base::TimeDelta::FromMilliseconds(kUnlockGuardTimeoutMs)); |
delegate_->AnimateAuthenticationSuccess(); |
+ |
+ if (on_auth_complete_) |
+ std::move(on_auth_complete_).Run(true); |
} |
void ScreenLocker::OnPasswordAuthSuccess(const UserContext& user_context) { |
@@ -377,10 +381,14 @@ void ScreenLocker::UnlockOnLoginSuccess() { |
chromeos::ScreenLocker::Hide(); |
} |
-void ScreenLocker::Authenticate(const UserContext& user_context) { |
+void ScreenLocker::Authenticate(const UserContext& user_context, |
+ AuthenticateCallback callback) { |
LOG_ASSERT(IsUserLoggedIn(user_context.GetAccountId())) |
<< "Invalid user trying to unlock."; |
+ DCHECK(!on_auth_complete_); |
+ on_auth_complete_ = std::move(callback); |
+ |
authentication_start_time_ = base::Time::Now(); |
delegate_->SetPasswordInputEnabled(false); |
if (user_context.IsUsingPin()) |