Commit dc06ccdc authored by Renato Silva's avatar Renato Silva Committed by Commit Bot

Chrome OS - Login/lock screen clean up

Improve padding mechanism in LoginAuthUserView and
add smart card option to login screen debug tool.

Remove an extra container that used to host the password
view and replace it with a fade animation for the
smart card view.

Bug: 1075994
Change-Id: I102a39a327e05935b67a8f8bfec53e9271cb4285
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2343110Reviewed-by: default avatarDenis Kuznetsov [CET] <antrim@chromium.org>
Commit-Queue: Renato Silva <rrsilva@google.com>
Cr-Commit-Position: refs/heads/master@{#797180}
parent 25482c74
...@@ -1097,7 +1097,7 @@ void LockContentsView::OnShowEasyUnlockIcon(const AccountId& user, ...@@ -1097,7 +1097,7 @@ void LockContentsView::OnShowEasyUnlockIcon(const AccountId& user,
tooltip_bubble_->Hide(); tooltip_bubble_->Hide();
if (icon.autoshow_tooltip) { if (icon.autoshow_tooltip) {
tooltip_bubble_->SetAnchorView(big_user->auth_user()->password_view()); tooltip_bubble_->SetAnchorView(big_user->auth_user()->GetAnchorView());
tooltip_bubble_->SetText(icon.tooltip); tooltip_bubble_->SetText(icon.tooltip);
tooltip_bubble_->Show(); tooltip_bubble_->Show();
tooltip_bubble_->SetVisible(true); tooltip_bubble_->SetVisible(true);
...@@ -1121,7 +1121,7 @@ void LockContentsView::OnWarningMessageUpdated(const base::string16& message) { ...@@ -1121,7 +1121,7 @@ void LockContentsView::OnWarningMessageUpdated(const base::string16& message) {
warning_banner_bubble_->Hide(); warning_banner_bubble_->Hide();
// Shows warning banner as a persistent error bubble. // Shows warning banner as a persistent error bubble.
warning_banner_bubble_->SetAnchorView( warning_banner_bubble_->SetAnchorView(
CurrentBigUserView()->auth_user()->password_view()); CurrentBigUserView()->auth_user()->GetAnchorView());
warning_banner_bubble_->SetTextContent(message); warning_banner_bubble_->SetTextContent(message);
warning_banner_bubble_->Show(); warning_banner_bubble_->Show();
} }
...@@ -1283,7 +1283,7 @@ void LockContentsView::OnDetachableBasePairingStatusChanged( ...@@ -1283,7 +1283,7 @@ void LockContentsView::OnDetachableBasePairingStatusChanged(
detachable_base_error_bubble_->SetTextContent(error_text); detachable_base_error_bubble_->SetTextContent(error_text);
detachable_base_error_bubble_->SetAnchorView( detachable_base_error_bubble_->SetAnchorView(
CurrentBigUserView()->auth_user()->password_view()); CurrentBigUserView()->auth_user()->GetAnchorView());
detachable_base_error_bubble_->Show(); detachable_base_error_bubble_->Show();
// Remove the focus from the password field, to make user less likely to enter // Remove the focus from the password field, to make user less likely to enter
...@@ -1887,7 +1887,7 @@ void LockContentsView::OnBigUserChanged() { ...@@ -1887,7 +1887,7 @@ void LockContentsView::OnBigUserChanged() {
supervised_user_deprecation_bubble_->SetTextContent(message); supervised_user_deprecation_bubble_->SetTextContent(message);
supervised_user_deprecation_bubble_->SetAnchorView( supervised_user_deprecation_bubble_->SetAnchorView(
CurrentBigUserView()->auth_user()->password_view()); CurrentBigUserView()->auth_user()->GetAnchorView());
supervised_user_deprecation_bubble_->Show(); supervised_user_deprecation_bubble_->Show();
} else if (supervised_user_deprecation_bubble_->GetVisible()) { } else if (supervised_user_deprecation_bubble_->GetVisible()) {
supervised_user_deprecation_bubble_->Hide(); supervised_user_deprecation_bubble_->Hide();
...@@ -1997,7 +1997,7 @@ void LockContentsView::ShowAuthErrorMessage() { ...@@ -1997,7 +1997,7 @@ void LockContentsView::ShowAuthErrorMessage() {
container->AddChildView(std::move(label)); container->AddChildView(std::move(label));
container->AddChildView(std::move(learn_more_button)); container->AddChildView(std::move(learn_more_button));
auth_error_bubble_->SetAnchorView(big_view->auth_user()->password_view()); auth_error_bubble_->SetAnchorView(big_view->auth_user()->GetAnchorView());
auth_error_bubble_->SetContent(container.release()); auth_error_bubble_->SetContent(container.release());
auth_error_bubble_->SetAccessibleName(error_text); auth_error_bubble_->SetAccessibleName(error_text);
auth_error_bubble_->SetPersistent(false); auth_error_bubble_->SetPersistent(false);
...@@ -2015,7 +2015,7 @@ void LockContentsView::OnEasyUnlockIconHovered() { ...@@ -2015,7 +2015,7 @@ void LockContentsView::OnEasyUnlockIconHovered() {
DCHECK(state->easy_unlock_state); DCHECK(state->easy_unlock_state);
if (!state->easy_unlock_state->tooltip.empty()) { if (!state->easy_unlock_state->tooltip.empty()) {
tooltip_bubble_->SetAnchorView(big_view->auth_user()->password_view()); tooltip_bubble_->SetAnchorView(big_view->auth_user()->GetAnchorView());
tooltip_bubble_->SetText(state->easy_unlock_state->tooltip); tooltip_bubble_->SetText(state->easy_unlock_state->tooltip);
tooltip_bubble_->Show(); tooltip_bubble_->Show();
} }
......
...@@ -62,6 +62,7 @@ enum { ...@@ -62,6 +62,7 @@ enum {
kGlobalToggleManagedSessionDisclosure, kGlobalToggleManagedSessionDisclosure,
kGlobalShowParentAccess, kGlobalShowParentAccess,
kPerUserTogglePin, kPerUserTogglePin,
kPerUserToggleChallengeResponse,
kPerUserToggleTap, kPerUserToggleTap,
kPerUserCycleEasyUnlockState, kPerUserCycleEasyUnlockState,
kPerUserCycleFingerprintState, kPerUserCycleFingerprintState,
...@@ -112,6 +113,7 @@ struct UserMetadata { ...@@ -112,6 +113,7 @@ struct UserMetadata {
std::string display_name; std::string display_name;
bool enable_pin = false; bool enable_pin = false;
bool enable_tap_to_unlock = false; bool enable_tap_to_unlock = false;
bool enable_challenge_response = false; // Smart Card
bool enable_auth = true; bool enable_auth = true;
user_manager::UserType type = user_manager::USER_TYPE_REGULAR; user_manager::UserType type = user_manager::USER_TYPE_REGULAR;
EasyUnlockIconId easy_unlock_id = EasyUnlockIconId::NONE; EasyUnlockIconId easy_unlock_id = EasyUnlockIconId::NONE;
...@@ -271,6 +273,17 @@ class LockDebugView::DebugDataDispatcherTransformer ...@@ -271,6 +273,17 @@ class LockDebugView::DebugDataDispatcherTransformer
debug_user->enable_pin); debug_user->enable_pin);
} }
// Activates or deactivates challenge response for the user at
// |user_index|.
void ToggleChallengeResponseStateForUserIndex(size_t user_index) {
DCHECK(user_index < debug_users_.size());
UserMetadata* debug_user = &debug_users_[user_index];
debug_user->enable_challenge_response =
!debug_user->enable_challenge_response;
debug_dispatcher_.SetChallengeResponseAuthEnabledForUser(
debug_user->account_id, debug_user->enable_challenge_response);
}
// Activates or deactivates tap unlock for the user at |user_index|. // Activates or deactivates tap unlock for the user at |user_index|.
void ToggleTapStateForUserIndex(size_t user_index) { void ToggleTapStateForUserIndex(size_t user_index) {
DCHECK(user_index >= 0 && user_index < debug_users_.size()); DCHECK(user_index >= 0 && user_index < debug_users_.size());
...@@ -1015,6 +1028,12 @@ void LockDebugView::ButtonPressed(views::Button* sender, ...@@ -1015,6 +1028,12 @@ void LockDebugView::ButtonPressed(views::Button* sender,
if (sender->GetID() == ButtonId::kPerUserTogglePin) if (sender->GetID() == ButtonId::kPerUserTogglePin)
debug_data_dispatcher_->TogglePinStateForUserIndex(sender->tag()); debug_data_dispatcher_->TogglePinStateForUserIndex(sender->tag());
// Enable or disable challenge response. (Smart Card)
if (sender->GetID() == ButtonId::kPerUserToggleChallengeResponse) {
debug_data_dispatcher_->ToggleChallengeResponseStateForUserIndex(
sender->tag());
}
// Enable or disable tap. // Enable or disable tap.
if (sender->GetID() == ButtonId::kPerUserToggleTap) if (sender->GetID() == ButtonId::kPerUserToggleTap)
debug_data_dispatcher_->ToggleTapStateForUserIndex(sender->tag()); debug_data_dispatcher_->ToggleTapStateForUserIndex(sender->tag());
...@@ -1094,6 +1113,9 @@ void LockDebugView::UpdatePerUserActionContainer() { ...@@ -1094,6 +1113,9 @@ void LockDebugView::UpdatePerUserActionContainer() {
row->AddChildView(name); row->AddChildView(name);
AddButton("Toggle PIN", ButtonId::kPerUserTogglePin, row)->set_tag(i); AddButton("Toggle PIN", ButtonId::kPerUserTogglePin, row)->set_tag(i);
AddButton("Toggle Smart card",
ButtonId::kPerUserToggleChallengeResponse, row)
->set_tag(i);
AddButton("Toggle Tap", ButtonId::kPerUserToggleTap, row)->set_tag(i); AddButton("Toggle Tap", ButtonId::kPerUserToggleTap, row)->set_tag(i);
AddButton("Cycle easy unlock", ButtonId::kPerUserCycleEasyUnlockState, row) AddButton("Cycle easy unlock", ButtonId::kPerUserCycleEasyUnlockState, row)
->set_tag(i); ->set_tag(i);
......
This diff is collapsed.
...@@ -158,6 +158,9 @@ class ASH_EXPORT LoginAuthUserView : public NonAccessibleView, ...@@ -158,6 +158,9 @@ class ASH_EXPORT LoginAuthUserView : public NonAccessibleView,
const LoginUserInfo& current_user() const; const LoginUserInfo& current_user() const;
// Provides the view that should be the anchor to message bubbles. Either the
// password field, or the PIN field.
views::View* GetAnchorView();
LoginPasswordView* password_view() { return password_view_; } LoginPasswordView* password_view() { return password_view_; }
LoginUserView* user_view() { return user_view_; } LoginUserView* user_view() { return user_view_; }
...@@ -191,8 +194,9 @@ class ASH_EXPORT LoginAuthUserView : public NonAccessibleView, ...@@ -191,8 +194,9 @@ class ASH_EXPORT LoginAuthUserView : public NonAccessibleView,
// Called when the online sign-in message is tapped. It opens the Gaia screen. // Called when the online sign-in message is tapped. It opens the Gaia screen.
void OnOnlineSignInMessageTap(); void OnOnlineSignInMessageTap();
// Called when the user presses the back button of the PIN keyboard. // Called from LoginPinView, forwards the calls to the active input field.
void OnPinBack(); void OnPinPadBackspace();
void OnPinPadInsertDigit(int digit);
// Helper method to check if an auth method is enable. Use it like this: // Helper method to check if an auth method is enable. Use it like this:
// bool has_tap = HasAuthMethod(AUTH_TAP). // bool has_tap = HasAuthMethod(AUTH_TAP).
...@@ -214,6 +218,10 @@ class ASH_EXPORT LoginAuthUserView : public NonAccessibleView, ...@@ -214,6 +218,10 @@ class ASH_EXPORT LoginAuthUserView : public NonAccessibleView,
bool ShouldShowPinPad() const; bool ShouldShowPinPad() const;
bool ShouldShowPasswordField() const; bool ShouldShowPasswordField() const;
// Convenience methods to determine the necessary paddings.
gfx::Size GetPaddingBelowUserView() const;
gfx::Size GetPaddingBelowPasswordView() const;
// Convenience methods to determine UI text based on the InputFieldMode. // Convenience methods to determine UI text based on the InputFieldMode.
base::string16 GetPasswordViewPlaceholder() const; base::string16 GetPasswordViewPlaceholder() const;
...@@ -233,6 +241,9 @@ class ASH_EXPORT LoginAuthUserView : public NonAccessibleView, ...@@ -233,6 +241,9 @@ class ASH_EXPORT LoginAuthUserView : public NonAccessibleView,
FingerprintView* fingerprint_view_ = nullptr; FingerprintView* fingerprint_view_ = nullptr;
ChallengeResponseView* challenge_response_view_ = nullptr; ChallengeResponseView* challenge_response_view_ = nullptr;
// Padding below the user view. Grows when there isn't an input field
// or smart card login.
NonAccessibleView* padding_below_user_view_ = nullptr;
// Displays padding between: // Displays padding between:
// 1. Password field and pin keyboard // 1. Password field and pin keyboard
// 2. Password field and fingerprint view, when pin is not available. // 2. Password field and fingerprint view, when pin is not available.
......
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