Commit 9c575941 authored by Jacob Dufault's avatar Jacob Dufault Committed by Commit Bot

cros: Remove ScreenLocker::AnimateAuthenticationSuccess

This is not used in views lock screen. The implementation is also complicated
and possibly crashy if UnlockOnLoginSuccess is called twice.

One side-effect of this cleanup is that views lock screen now dismisses 400ms
faster, because it was never calling UnlockOnLoginSuccess and instead relied on
the fallback handler.

Bug: 902451
Change-Id: I16c02dab2b263ee7fa304490e3df0bc002252a41
Reviewed-on: https://chromium-review.googlesource.com/c/1320794Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606064}
parent 01d07ebf
......@@ -85,11 +85,6 @@ namespace chromeos {
namespace {
// Timeout for unlock animation guard - some animations may be required to run
// on successful authentication before unlocking, but we want to be sure that
// unlock happens even if animations are broken.
const int kUnlockGuardTimeoutMs = 400;
// Returns true if fingerprint authentication is available for |user|.
bool IsFingerprintAvailableForUser(const user_manager::User* user) {
quick_unlock::QuickUnlockStorage* quick_unlock_storage =
......@@ -311,20 +306,15 @@ void ScreenLocker::OnAuthSuccess(const UserContext& user_context) {
NOTREACHED() << "Logged in user not found.";
}
authentication_capture_.reset(new AuthenticationParametersCapture());
authentication_capture_->user_context = user_context;
// Add guard for case when something get broken in call chain to unlock
// for sure.
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
base::BindOnce(&ScreenLocker::UnlockOnLoginSuccess,
weak_factory_.GetWeakPtr()),
base::TimeDelta::FromMilliseconds(kUnlockGuardTimeoutMs));
delegate_->AnimateAuthenticationSuccess();
if (on_auth_complete_)
std::move(on_auth_complete_).Run(true);
if (auth_status_consumer_)
auth_status_consumer_->OnAuthSuccess(user_context);
weak_factory_.InvalidateWeakPtrs();
VLOG(1) << "Hiding the lock screen.";
chromeos::ScreenLocker::Hide();
}
void ScreenLocker::OnPasswordAuthSuccess(const UserContext& user_context) {
......@@ -337,24 +327,6 @@ void ScreenLocker::OnPasswordAuthSuccess(const UserContext& user_context) {
SaveSyncPasswordHash(user_context);
}
void ScreenLocker::UnlockOnLoginSuccess() {
DCHECK(base::MessageLoopForUI::IsCurrent());
if (!authentication_capture_.get()) {
LOG(WARNING) << "Call to UnlockOnLoginSuccess without previous "
<< "authentication success.";
return;
}
if (auth_status_consumer_) {
auth_status_consumer_->OnAuthSuccess(authentication_capture_->user_context);
}
authentication_capture_.reset();
weak_factory_.InvalidateWeakPtrs();
VLOG(1) << "Hiding the lock screen.";
chromeos::ScreenLocker::Hide();
}
void ScreenLocker::Authenticate(const UserContext& user_context,
AuthenticateCallback callback) {
LOG_ASSERT(IsUserLoggedIn(user_context.GetAccountId()))
......
......@@ -66,10 +66,6 @@ class ScreenLocker : public AuthStatusConsumer,
// Close any displayed error messages.
virtual void ClearErrors() = 0;
// Run any visual effects after authentication is successful. This must call
// ScreenLocker::UnlockOnLoginSuccess() after all effects are done.
virtual void AnimateAuthenticationSuccess() = 0;
// Called when the webui lock screen is ready. This gets invoked by a
// chrome.send from the embedded webui.
virtual void OnLockWebUIReady() = 0;
......@@ -120,10 +116,6 @@ class ScreenLocker : public AuthStatusConsumer,
// unlock the device.
void OnPasswordAuthSuccess(const UserContext& user_context);
// Does actual unlocking once authentication is successful and all blocking
// animations are done.
void UnlockOnLoginSuccess();
// Authenticates the user with given |user_context|.
void Authenticate(const UserContext& user_context,
AuthenticateCallback callback);
......@@ -194,10 +186,6 @@ class ScreenLocker : public AuthStatusConsumer,
// than directly before AUTH_COUNT.
enum UnlockType { AUTH_PASSWORD = 0, AUTH_PIN, AUTH_FINGERPRINT, AUTH_COUNT };
struct AuthenticationParametersCapture {
UserContext user_context;
};
~ScreenLocker() override;
// fingerprint::mojom::FingerprintObserver:
......@@ -289,10 +277,6 @@ class ScreenLocker : public AuthStatusConsumer,
// Callback to run, if any, when authentication is done.
AuthenticateCallback on_auth_complete_;
// Copy of parameters passed to last call of OnLoginSuccess for usage in
// UnlockOnLoginSuccess().
std::unique_ptr<AuthenticationParametersCapture> authentication_capture_;
// Provider for button icon set by the screenlockPrivate API.
std::unique_ptr<ScreenlockIconProvider> screenlock_icon_provider_;
......
......@@ -155,10 +155,6 @@ void ViewsScreenLocker::ClearErrors() {
LoginScreenClient::Get()->login_screen()->ClearErrors();
}
void ViewsScreenLocker::AnimateAuthenticationSuccess() {
NOTIMPLEMENTED();
}
void ViewsScreenLocker::OnLockWebUIReady() {
NOTIMPLEMENTED();
}
......
......@@ -43,7 +43,6 @@ class ViewsScreenLocker : public LoginScreenClient::Delegate,
void ShowErrorMessage(int error_msg_id,
HelpAppLauncher::HelpTopic help_topic_id) override;
void ClearErrors() override;
void AnimateAuthenticationSuccess() override;
void OnLockWebUIReady() override;
void OnLockBackgroundDisplayed() override;
void OnHeaderBarVisible() override;
......
......@@ -180,11 +180,6 @@ void WebUIScreenLocker::ShowErrorMessage(
help_topic_id);
}
void WebUIScreenLocker::AnimateAuthenticationSuccess() {
GetWebUI()->CallJavascriptFunctionUnsafe(
"cr.ui.Oobe.animateAuthenticationSuccess");
}
void WebUIScreenLocker::ClearErrors() {
GetWebUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.clearErrors");
}
......
......@@ -75,7 +75,6 @@ class WebUIScreenLocker : public WebUILoginView,
void ShowErrorMessage(int error_msg_id,
HelpAppLauncher::HelpTopic help_topic_id) override;
void ClearErrors() override;
void AnimateAuthenticationSuccess() override;
void OnLockWebUIReady() override;
void OnLockBackgroundDisplayed() override;
void OnHeaderBarVisible() override;
......
......@@ -216,16 +216,6 @@ cr.define('cr.ui', function() {
DisplayManager.clearErrors();
};
/**
* Displays animations on successful authentication, that have to happen
* before login UI is dismissed.
*/
Oobe.animateAuthenticationSuccess = function() {
login.HeaderBar.animateOut(function() {
chrome.send('unlockOnLoginSuccess');
});
};
/**
* Displays animations that have to happen once login UI is fully displayed.
*/
......
......@@ -217,16 +217,6 @@ cr.define('cr.ui', function() {
DisplayManager.clearErrors();
};
/**
* Displays animations on successful authentication, that have to happen
* before login UI is dismissed.
*/
Oobe.animateAuthenticationSuccess = function() {
login.HeaderBar.animateOut(function() {
chrome.send('unlockOnLoginSuccess');
});
};
/**
* Displays animations that have to happen once login UI is fully displayed.
*/
......
......@@ -530,8 +530,6 @@ void SigninScreenHandler::RegisterMessages() {
AddCallback("resyncUserData", &SigninScreenHandler::HandleResyncUserData);
AddCallback("loginUIStateChanged",
&SigninScreenHandler::HandleLoginUIStateChanged);
AddCallback("unlockOnLoginSuccess",
&SigninScreenHandler::HandleUnlockOnLoginSuccess);
AddCallback("showLoadingTimeoutError",
&SigninScreenHandler::HandleShowLoadingTimeoutError);
AddCallback("focusPod", &SigninScreenHandler::HandleFocusPod);
......@@ -1499,12 +1497,6 @@ void SigninScreenHandler::HandleLoginUIStateChanged(const std::string& source,
}
}
void SigninScreenHandler::HandleUnlockOnLoginSuccess() {
DCHECK(user_manager::UserManager::Get()->IsUserLoggedIn());
if (ScreenLocker::default_screen_locker())
ScreenLocker::default_screen_locker()->UnlockOnLoginSuccess();
}
void SigninScreenHandler::HandleShowLoadingTimeoutError() {
UpdateState(NetworkError::ERROR_REASON_LOADING_TIMEOUT);
}
......
......@@ -386,7 +386,6 @@ class SigninScreenHandler
void HandleMigrateUserData(const std::string& password);
void HandleResyncUserData();
void HandleLoginUIStateChanged(const std::string& source, bool active);
void HandleUnlockOnLoginSuccess();
void HandleLoginScreenUpdate();
void HandleShowLoadingTimeoutError();
void HandleFocusPod(const AccountId& account_id, bool is_large_pod);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment