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

Unified Diff: chrome/browser/chromeos/login/lock/screen_locker.cc

Issue 2896093003: cros: Make sure views-based lock screen is destroyed after it is dismissed. (Closed)
Patch Set: Address comments Created 3 years, 6 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
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 b2749be3448dea234a64e2c2b8c0f3f4ecda179a..52569e6c82454aeab59866a02c108e1d607e5a71 100644
--- a/chrome/browser/chromeos/login/lock/screen_locker.cc
+++ b/chrome/browser/chromeos/login/lock/screen_locker.cc
@@ -215,11 +215,12 @@ void ScreenLocker::Init() {
views_screen_locker_->Init();
// 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())
- views_screen_locker_->OnLockScreenReady();
+ LockScreenClient::Get()->ShowLockScreen(base::BindOnce(
+ [](ViewsScreenLocker* screen_locker, bool did_show) {
+ CHECK(did_show);
+ screen_locker->OnLockScreenReady();
+ },
+ views_screen_locker_.get()));
} else {
web_ui_.reset(new WebUIScreenLocker(this));
delegate_ = web_ui_.get();
@@ -262,6 +263,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) {
@@ -316,6 +320,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) {
@@ -345,10 +352,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())
« no previous file with comments | « chrome/browser/chromeos/login/lock/screen_locker.h ('k') | chrome/browser/chromeos/login/lock/webui_screen_locker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698