Commit 623bd293 authored by Ryan Hansberry's avatar Ryan Hansberry Committed by Commit Bot

[Smart Lock] Re-disable lock screen password entry button when needed.

Unlocking by pressing the submit button is initially disabled, and only
enabled when Smart Lock finds the phone and the phone is unlocked.
This change makes sure that Smart Lock cleans up after itself if the
phone can no longer be found or becomes locked (making the submit button
disabled again).

Bug: 943211
Change-Id: Ie347cb009732fd60ac7ba27f13c44f337c3ae793
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1755187
Commit-Queue: Ryan Hansberry <hansberry@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#687367}
parent bb8096ab
...@@ -101,12 +101,6 @@ void LoginDataDispatcher::RemoveObserver(Observer* observer) { ...@@ -101,12 +101,6 @@ void LoginDataDispatcher::RemoveObserver(Observer* observer) {
observers_.RemoveObserver(observer); observers_.RemoveObserver(observer);
} }
void LoginDataDispatcher::SetTapToUnlockEnabledForUser(const AccountId& user,
bool enabled) {
for (auto& observer : observers_)
observer.OnTapToUnlockEnabledForUserChanged(user, enabled);
}
void LoginDataDispatcher::SetUserList(const std::vector<LoginUserInfo>& users) { void LoginDataDispatcher::SetUserList(const std::vector<LoginUserInfo>& users) {
for (auto& observer : observers_) for (auto& observer : observers_)
observer.OnUsersChanged(users); observer.OnUsersChanged(users);
...@@ -158,8 +152,10 @@ void LoginDataDispatcher::DisableAuthForUser( ...@@ -158,8 +152,10 @@ void LoginDataDispatcher::DisableAuthForUser(
observer.OnAuthDisabledForUser(account_id, auth_disabled_data); observer.OnAuthDisabledForUser(account_id, auth_disabled_data);
} }
void LoginDataDispatcher::EnableTapToUnlockForUser(const AccountId& user) { void LoginDataDispatcher::SetTapToUnlockEnabledForUser(const AccountId& user,
SetTapToUnlockEnabledForUser(user, true); bool enabled) {
for (auto& observer : observers_)
observer.OnTapToUnlockEnabledForUserChanged(user, enabled);
} }
void LoginDataDispatcher::ForceOnlineSignInForUser(const AccountId& user) { void LoginDataDispatcher::ForceOnlineSignInForUser(const AccountId& user) {
......
...@@ -146,8 +146,6 @@ class ASH_EXPORT LoginDataDispatcher : public LoginScreenModel { ...@@ -146,8 +146,6 @@ class ASH_EXPORT LoginDataDispatcher : public LoginScreenModel {
void AddObserver(Observer* observer); void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer); void RemoveObserver(Observer* observer);
void SetTapToUnlockEnabledForUser(const AccountId& user, bool enabled);
// LoginScreenModel: // LoginScreenModel:
// TODO(estade): for now, LoginScreenModel overrides are mixed with // TODO(estade): for now, LoginScreenModel overrides are mixed with
// non-virtual methods. More of the non-virtual methods will become a part of // non-virtual methods. More of the non-virtual methods will become a part of
...@@ -167,7 +165,8 @@ class ASH_EXPORT LoginDataDispatcher : public LoginScreenModel { ...@@ -167,7 +165,8 @@ class ASH_EXPORT LoginDataDispatcher : public LoginScreenModel {
void EnableAuthForUser(const AccountId& account_id) override; void EnableAuthForUser(const AccountId& account_id) override;
void DisableAuthForUser(const AccountId& account_id, void DisableAuthForUser(const AccountId& account_id,
const AuthDisabledData& auth_disabled_data) override; const AuthDisabledData& auth_disabled_data) override;
void EnableTapToUnlockForUser(const AccountId& user) override; void SetTapToUnlockEnabledForUser(const AccountId& user,
bool enabled) override;
void ForceOnlineSignInForUser(const AccountId& user) override; void ForceOnlineSignInForUser(const AccountId& user) override;
void SetLockScreenNoteState(mojom::TrayActionState state); void SetLockScreenNoteState(mojom::TrayActionState state);
void ShowEasyUnlockIcon(const AccountId& user, void ShowEasyUnlockIcon(const AccountId& user,
......
...@@ -77,8 +77,9 @@ class ASH_PUBLIC_EXPORT LoginScreenModel { ...@@ -77,8 +77,9 @@ class ASH_PUBLIC_EXPORT LoginScreenModel {
const AccountId& account_id, const AccountId& account_id,
const AuthDisabledData& auth_disabled_data) = 0; const AuthDisabledData& auth_disabled_data) = 0;
// Sets the authentication type to tap-to-unlock for the user. // Enables or disables the authentication type to tap-to-unlock for the user.
virtual void EnableTapToUnlockForUser(const AccountId& account_id) = 0; virtual void SetTapToUnlockEnabledForUser(const AccountId& account_id,
bool enabled) = 0;
// Forces online sign-in for the user. // Forces online sign-in for the user.
virtual void ForceOnlineSignInForUser(const AccountId& account_id) = 0; virtual void ForceOnlineSignInForUser(const AccountId& account_id) = 0;
......
...@@ -122,12 +122,11 @@ void UserBoardViewMojo::HideUserPodCustomIcon(const AccountId& account_id) { ...@@ -122,12 +122,11 @@ void UserBoardViewMojo::HideUserPodCustomIcon(const AccountId& account_id) {
void UserBoardViewMojo::SetAuthType(const AccountId& account_id, void UserBoardViewMojo::SetAuthType(const AccountId& account_id,
proximity_auth::mojom::AuthType auth_type, proximity_auth::mojom::AuthType auth_type,
const base::string16& initial_value) { const base::string16& initial_value) {
if (auth_type == proximity_auth::mojom::AuthType::USER_CLICK) { ash::LoginScreen::Get()->GetModel()->SetTapToUnlockEnabledForUser(
ash::LoginScreen::Get()->GetModel()->EnableTapToUnlockForUser(account_id); account_id, auth_type == proximity_auth::mojom::AuthType::USER_CLICK);
} else if (auth_type == proximity_auth::mojom::AuthType::ONLINE_SIGN_IN) {
if (auth_type == proximity_auth::mojom::AuthType::ONLINE_SIGN_IN) {
ash::LoginScreen::Get()->GetModel()->ForceOnlineSignInForUser(account_id); ash::LoginScreen::Get()->GetModel()->ForceOnlineSignInForUser(account_id);
} else {
NOTIMPLEMENTED();
} }
} }
......
...@@ -22,8 +22,9 @@ void TestLoginScreenModel::EnableAuthForUser(const AccountId& account_id) {} ...@@ -22,8 +22,9 @@ void TestLoginScreenModel::EnableAuthForUser(const AccountId& account_id) {}
void TestLoginScreenModel::DisableAuthForUser( void TestLoginScreenModel::DisableAuthForUser(
const AccountId& account_id, const AccountId& account_id,
const ash::AuthDisabledData& auth_disabled_data) {} const ash::AuthDisabledData& auth_disabled_data) {}
void TestLoginScreenModel::EnableTapToUnlockForUser( void TestLoginScreenModel::SetTapToUnlockEnabledForUser(
const AccountId& account_id) {} const AccountId& account_id,
bool enabled) {}
void TestLoginScreenModel::ForceOnlineSignInForUser( void TestLoginScreenModel::ForceOnlineSignInForUser(
const AccountId& account_id) {} const AccountId& account_id) {}
void TestLoginScreenModel::ShowEasyUnlockIcon( void TestLoginScreenModel::ShowEasyUnlockIcon(
......
...@@ -27,7 +27,8 @@ class TestLoginScreenModel : public ash::LoginScreenModel { ...@@ -27,7 +27,8 @@ class TestLoginScreenModel : public ash::LoginScreenModel {
void DisableAuthForUser( void DisableAuthForUser(
const AccountId& account_id, const AccountId& account_id,
const ash::AuthDisabledData& auth_disabled_data) override; const ash::AuthDisabledData& auth_disabled_data) override;
void EnableTapToUnlockForUser(const AccountId& account_id) override; void SetTapToUnlockEnabledForUser(const AccountId& account_id,
bool enabled) override;
void ForceOnlineSignInForUser(const AccountId& account_id) override; void ForceOnlineSignInForUser(const AccountId& account_id) override;
void ShowEasyUnlockIcon(const AccountId& user, void ShowEasyUnlockIcon(const AccountId& user,
const ash::EasyUnlockIconOptions& icon) override; const ash::EasyUnlockIconOptions& icon) override;
......
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