Commit ba9174e6 authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Mash cleanup: remove more methods from mojom::LoginScreen

TBR=tsepez@chromium.org

Bug: 958206
Change-Id: I01f9ed3e56ea54f8bbc6c6674e28afcacd23a738
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1636169
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664916}
parent 76d722a8
......@@ -352,19 +352,6 @@ void LoginScreenController::SetAuthType(
}
}
void LoginScreenController::SetPinEnabledForUser(const AccountId& account_id,
bool is_enabled) {
// Chrome will update pin pod state every time user tries to authenticate.
// LockScreen is destroyed in the case of authentication success.
login_data_dispatcher_.SetPinEnabledForUser(account_id, is_enabled);
}
void LoginScreenController::NotifyFingerprintAuthResult(
const AccountId& account_id,
bool successful) {
login_data_dispatcher_.NotifyFingerprintAuthResult(account_id, successful);
}
void LoginScreenController::EnableAuthForUser(const AccountId& account_id) {
login_data_dispatcher_.EnableAuthForUser(account_id);
}
......@@ -376,15 +363,6 @@ void LoginScreenController::DisableAuthForUser(
std::move(auth_disabled_data));
}
void LoginScreenController::SetSystemInfo(
bool show_if_hidden,
const std::string& os_version_label_text,
const std::string& enterprise_info_text,
const std::string& bluetooth_name) {
login_data_dispatcher_.SetSystemInfo(show_if_hidden, os_version_label_text,
enterprise_info_text, bluetooth_name);
}
void LoginScreenController::IsReadyForPassword(
IsReadyForPasswordCallback callback) {
std::move(callback).Run(LockScreen::HasInstance() && !IsAuthenticating());
......
......@@ -122,18 +122,10 @@ class ASH_EXPORT LoginScreenController : public mojom::LoginScreen,
void SetAuthType(const AccountId& account_id,
proximity_auth::mojom::AuthType auth_type,
const base::string16& initial_value) override;
void SetPinEnabledForUser(const AccountId& account_id,
bool is_enabled) override;
void NotifyFingerprintAuthResult(const AccountId& account_id,
bool successful) override;
void EnableAuthForUser(const AccountId& account_id) override;
void DisableAuthForUser(
const AccountId& account_id,
ash::mojom::AuthDisabledDataPtr auth_disabled_data) override;
void SetSystemInfo(bool show_if_hidden,
const std::string& os_version_label_text,
const std::string& enterprise_info_text,
const std::string& bluetooth_name) override;
void IsReadyForPassword(IsReadyForPasswordCallback callback) override;
void ShowKioskAppError(const std::string& message) override;
void SetAddUserButtonEnabled(bool enable) override;
......
......@@ -106,6 +106,8 @@ void LoginDataDispatcher::SetUserList(const std::vector<LoginUserInfo>& users) {
void LoginDataDispatcher::SetPinEnabledForUser(const AccountId& user,
bool enabled) {
// Chrome will update pin pod state every time user tries to authenticate.
// LockScreen is destroyed in the case of authentication success.
for (auto& observer : observers_)
observer.OnPinEnabledForUserChanged(user, enabled);
}
......
......@@ -151,13 +151,13 @@ class ASH_EXPORT LoginDataDispatcher : public LoginScreenModel {
// LoginScreenModel is complete, separate out the methods that aren't
// overrides.
void SetUserList(const std::vector<LoginUserInfo>& users) override;
void SetPinEnabledForUser(const AccountId& user, bool enabled);
void SetPinEnabledForUser(const AccountId& user, bool enabled) override;
void SetFingerprintState(const AccountId& account_id,
FingerprintState state) override;
void SetAvatarForUser(const AccountId& account_id,
const UserAvatar& avatar) override;
void NotifyFingerprintAuthResult(const AccountId& account_id,
bool successful);
bool successful) override;
void EnableAuthForUser(const AccountId& account_id);
void DisableAuthForUser(const AccountId& account_id,
ash::mojom::AuthDisabledDataPtr auth_disabled_data);
......@@ -170,7 +170,7 @@ class ASH_EXPORT LoginDataDispatcher : public LoginScreenModel {
void SetSystemInfo(bool show_if_hidden,
const std::string& os_version_label_text,
const std::string& enterprise_info_text,
const std::string& bluetooth_name);
const std::string& bluetooth_name) override;
void SetPublicSessionDisplayName(const AccountId& account_id,
const std::string& display_name) override;
void SetPublicSessionLocales(const AccountId& account_id,
......
......@@ -26,6 +26,15 @@ struct UserAvatar;
// ash::LoginDataDispatcher.
class ASH_PUBLIC_EXPORT LoginScreenModel {
public:
// Set the users who are displayed on the login UI. |users| is filtered
// and does not correspond to every user on the device.
virtual void SetUserList(const std::vector<LoginUserInfo>& users) = 0;
// Notification if pin is enabled or disabled for the given user.
// |account_id|: The account id of the user in the user pod.
// |is_enabled|: True if pin unlock is enabled.
virtual void SetPinEnabledForUser(const AccountId& user, bool enabled) = 0;
// Requests to show the custom icon in the user pod.
// |account_id|: The account id of the user in the user pod.
// |icon|: Information regarding the icon.
......@@ -38,18 +47,34 @@ class ASH_PUBLIC_EXPORT LoginScreenModel {
// on login.) If |message| is empty, the banner will be hidden.
virtual void UpdateWarningMessage(const base::string16& message) = 0;
// Set the users who are displayed on the login UI. |users| is filtered
// and does not correspond to every user on the device.
virtual void SetUserList(const std::vector<LoginUserInfo>& users) = 0;
// Update the status of fingerprint for |account_id|.
virtual void SetFingerprintState(const AccountId& account_id,
FingerprintState state) = 0;
// Called after a fingerprint authentication attempt has been made. If
// |successful| is true, then the fingerprint authentication attempt was
// successful and the device should be unlocked. If false, an error message
// should be shown to the user.
virtual void NotifyFingerprintAuthResult(const AccountId& account_id,
bool successful) = 0;
// Called when |avatar| for |account_id| has changed.
virtual void SetAvatarForUser(const AccountId& account_id,
const UserAvatar& avatar) = 0;
// Called when new system information is available.
// |show_if_hidden|: If true, the system information should be displayed to
// the user if it is currently hidden. If false, the system
// information should remain hidden if not already shown.
// Hidden system information can be shown by pressing alt-v.
// |os_version_label_text|: The OS version.
// |enterprise_info_text|: The enterprise info.
// |bluetooth_name|: The name of the bluetooth adapter.
virtual void SetSystemInfo(bool show_if_hidden,
const std::string& os_version_label_text,
const std::string& enterprise_info_text,
const std::string& bluetooth_name) = 0;
// Set the public session display name for user with |account_id|.
virtual void SetPublicSessionDisplayName(const AccountId& account_id,
const std::string& display_name) = 0;
......
......@@ -74,17 +74,6 @@ interface LoginScreen {
proximity_auth.mojom.AuthType auth_type,
mojo_base.mojom.String16 initial_value);
// Notification if pin is enabled or disabled for the given user.
// |account_id|: The account id of the user in the user pod.
// |is_enabled|: True if pin unlock is enabled.
SetPinEnabledForUser(signin.mojom.AccountId account_id, bool is_enabled);
// Called after a fingerprint authentication attempt has been made. If
// |successful| is true, then the fingerprint authentication attempt was
// successful and the device should be unlocked. If false, an error message
// should be shown to the user.
NotifyFingerprintAuthResult(signin.mojom.AccountId account_id,
bool successful);
// Called when auth should be enabled for the given user. When auth is
// disabled, the user cannot unlock the device. Auth is enabled by default.
......@@ -98,19 +87,6 @@ interface LoginScreen {
DisableAuthForUser(signin.mojom.AccountId account_id,
AuthDisabledData auth_disabled_data);
// Called when new system information is available.
// |show_if_hidden|: If true, the system information should be displayed to
// the user if it is currently hidden. If false, the system
// information should remain hidden if not already shown.
// Hidden system information can be shown by pressing alt-v.
// |os_version_label_text|: The OS version.
// |enterprise_info_text|: The enterprise info.
// |bluetooth_name|: The name of the bluetooth adapter.
SetSystemInfo(bool show_if_hidden,
string os_version_label_text,
string enterprise_info_text,
string bluetooth_name);
// Check if the login/lock screen is ready for a password.
IsReadyForPassword() => (bool is_ready);
......
......@@ -736,8 +736,8 @@ void ScreenLocker::OnAuthScanDone(
OnFingerprintAuthFailure(*active_user);
return;
}
delegate_->NotifyFingerprintAuthResult(active_user->GetAccountId(),
true /*success*/);
ash::LoginScreen::Get()->GetModel()->NotifyFingerprintAuthResult(
active_user->GetAccountId(), true /*success*/);
VLOG(1) << "Fingerprint unlock is successful.";
LoginScreenClient::Get()->auth_recorder()->RecordFingerprintAuthSuccess(
true /*success*/,
......@@ -754,8 +754,8 @@ void ScreenLocker::OnFingerprintAuthFailure(const user_manager::User& user) {
unlock_attempt_type_, UnlockType::AUTH_COUNT);
LoginScreenClient::Get()->auth_recorder()->RecordFingerprintAuthSuccess(
false /*success*/, base::nullopt /*num_attempts*/);
delegate_->NotifyFingerprintAuthResult(user.GetAccountId(),
false /*success*/);
ash::LoginScreen::Get()->GetModel()->NotifyFingerprintAuthResult(
user.GetAccountId(), false /*success*/);
quick_unlock::QuickUnlockStorage* quick_unlock_storage =
quick_unlock::QuickUnlockFactory::GetForUser(&user);
......@@ -821,8 +821,8 @@ void ScreenLocker::MaybeDisablePinAndFingerprintFromTimeout(
void ScreenLocker::OnPinCanAuthenticate(const AccountId& account_id,
bool can_authenticate) {
LoginScreenClient::Get()->login_screen()->SetPinEnabledForUser(
account_id, can_authenticate);
ash::LoginScreen::Get()->GetModel()->SetPinEnabledForUser(account_id,
can_authenticate);
}
} // namespace chromeos
......@@ -57,9 +57,6 @@ class ScreenLocker : public AuthStatusConsumer,
// Called by ScreenLocker to notify that ash lock animation finishes.
virtual void OnAshLockAnimationFinished() = 0;
// Called after a fingerprint authentication attempt.
virtual void NotifyFingerprintAuthResult(const AccountId& account_id,
bool success) = 0;
private:
DISALLOW_COPY_AND_ASSIGN(Delegate);
};
......
......@@ -155,12 +155,6 @@ void ViewsScreenLocker::OnAshLockAnimationFinished() {
SessionControllerClientImpl::Get()->NotifyChromeLockAnimationsComplete();
}
void ViewsScreenLocker::NotifyFingerprintAuthResult(const AccountId& account_id,
bool success) {
LoginScreenClient::Get()->login_screen()->NotifyFingerprintAuthResult(
account_id, success);
}
void ViewsScreenLocker::HandleAuthenticateUserWithPasswordOrPin(
const AccountId& account_id,
const std::string& password,
......@@ -343,8 +337,8 @@ void ViewsScreenLocker::OnAllowedInputMethodsChanged() {
void ViewsScreenLocker::OnPinCanAuthenticate(const AccountId& account_id,
bool can_authenticate) {
LoginScreenClient::Get()->login_screen()->SetPinEnabledForUser(
account_id, can_authenticate);
ash::LoginScreen::Get()->GetModel()->SetPinEnabledForUser(account_id,
can_authenticate);
}
void ViewsScreenLocker::OnExternalBinaryAuthTimeout() {
......
......@@ -43,8 +43,6 @@ class ViewsScreenLocker : public LoginScreenClient::Delegate,
HelpAppLauncher::HelpTopic help_topic_id) override;
void ClearErrors() override;
void OnAshLockAnimationFinished() override;
void NotifyFingerprintAuthResult(const AccountId& account_id,
bool success) override;
// LoginScreenClient::Delegate
void HandleAuthenticateUserWithPasswordOrPin(
......
......@@ -4,8 +4,9 @@
#include "chrome/browser/chromeos/login/mojo_system_info_dispatcher.h"
#include "ash/public/cpp/login_screen.h"
#include "ash/public/cpp/login_screen_model.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/ash/login_screen_client.h"
#include "chrome/common/channel_info.h"
#include "chrome/grit/generated_resources.h"
#include "components/version_info/channel.h"
......@@ -51,7 +52,7 @@ void MojoSystemInfoDispatcher::OnSystemInfoUpdated() {
version_info::Channel channel = chrome::GetChannel();
bool show_if_hidden = channel != version_info::Channel::STABLE &&
channel != version_info::Channel::BETA;
LoginScreenClient::Get()->login_screen()->SetSystemInfo(
ash::LoginScreen::Get()->GetModel()->SetSystemInfo(
show_if_hidden, os_version_label_text_, enterprise_info_,
bluetooth_name_);
}
......
......@@ -307,8 +307,8 @@ void LoginDisplayMojo::OnLoginScreenShown(bool users_empty, bool did_show) {
void LoginDisplayMojo::OnPinCanAuthenticate(const AccountId& account_id,
bool can_authenticate) {
LoginScreenClient::Get()->login_screen()->SetPinEnabledForUser(
account_id, can_authenticate);
ash::LoginScreen::Get()->GetModel()->SetPinEnabledForUser(account_id,
can_authenticate);
}
} // namespace chromeos
......@@ -52,23 +52,12 @@ void TestLoginScreen::SetAuthType(const AccountId& account_id,
::proximity_auth::mojom::AuthType auth_type,
const base::string16& initial_value) {}
void TestLoginScreen::SetPinEnabledForUser(const AccountId& account_id,
bool is_enabled) {}
void TestLoginScreen::NotifyFingerprintAuthResult(const AccountId& account_id,
bool successful) {}
void TestLoginScreen::EnableAuthForUser(const AccountId& account_id) {}
void TestLoginScreen::DisableAuthForUser(
const AccountId& account_id,
ash::mojom::AuthDisabledDataPtr auth_disabled_data) {}
void TestLoginScreen::SetSystemInfo(bool show_if_hidden,
const std::string& os_version_label_text,
const std::string& enterprise_info_text,
const std::string& bluetooth_name) {}
void TestLoginScreen::IsReadyForPassword(IsReadyForPasswordCallback callback) {
std::move(callback).Run(true);
}
......
......@@ -39,19 +39,10 @@ class TestLoginScreen : public ash::mojom::LoginScreen,
void SetAuthType(const AccountId& account_id,
::proximity_auth::mojom::AuthType auth_type,
const base::string16& initial_value) override;
void SetPinEnabledForUser(const AccountId& account_id,
bool is_enabled) override;
void NotifyFingerprintAuthResult(const AccountId& account_id,
bool successful) override;
void EnableAuthForUser(const AccountId& account_id) override;
void DisableAuthForUser(
const AccountId& account_id,
ash::mojom::AuthDisabledDataPtr auth_disabled_data) override;
void SetSystemInfo(bool show_if_hidden,
const std::string& os_version_label_text,
const std::string& enterprise_info_text,
const std::string& bluetooth_name) override;
void IsReadyForPassword(IsReadyForPasswordCallback callback) override;
void ShowKioskAppError(const std::string& message) override;
void SetAddUserButtonEnabled(bool enable) override;
......
......@@ -9,15 +9,25 @@ TestLoginScreenModel::~TestLoginScreenModel() = default;
void TestLoginScreenModel::SetUserList(
const std::vector<ash::LoginUserInfo>& users) {}
void TestLoginScreenModel::SetPinEnabledForUser(const AccountId& account_id,
bool is_enabled) {}
void TestLoginScreenModel::SetFingerprintState(const AccountId& account_id,
ash::FingerprintState state) {}
void TestLoginScreenModel::SetAvatarForUser(const AccountId& account_id,
const ash::UserAvatar& avatar) {}
void TestLoginScreenModel::NotifyFingerprintAuthResult(
const AccountId& account_id,
bool successful) {}
void TestLoginScreenModel::ShowEasyUnlockIcon(
const AccountId& account_id,
const ash::EasyUnlockIconOptions& icon) {}
void TestLoginScreenModel::UpdateWarningMessage(const base::string16& message) {
}
void TestLoginScreenModel::SetFingerprintState(const AccountId& account_id,
ash::FingerprintState state) {}
void TestLoginScreenModel::SetSystemInfo(
bool show_if_hidden,
const std::string& os_version_label_text,
const std::string& enterprise_info_text,
const std::string& bluetooth_name) {}
void TestLoginScreenModel::SetPublicSessionDisplayName(
const AccountId& account_id,
const std::string& display_name) {}
......
......@@ -15,13 +15,21 @@ class TestLoginScreenModel : public ash::LoginScreenModel {
// ash::LoginScreenModel:
void SetUserList(const std::vector<ash::LoginUserInfo>& users) override;
void SetAvatarForUser(const AccountId& account_id,
const ash::UserAvatar& avatar) override;
void SetPinEnabledForUser(const AccountId& account_id,
bool is_enabled) override;
void SetFingerprintState(const AccountId& account_id,
ash::FingerprintState state) override;
void SetAvatarForUser(const AccountId& account_id,
const ash::UserAvatar& avatar) override;
void NotifyFingerprintAuthResult(const AccountId& account_id,
bool successful) override;
void ShowEasyUnlockIcon(const AccountId& user,
const ash::EasyUnlockIconOptions& icon) override;
void UpdateWarningMessage(const base::string16& message) override;
void SetSystemInfo(bool show_if_hidden,
const std::string& os_version_label_text,
const std::string& enterprise_info_text,
const std::string& bluetooth_name) override;
void SetPublicSessionLocales(const AccountId& account_id,
const std::vector<ash::LocaleItem>& locales,
const std::string& default_locale,
......
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