Commit 7688c89d authored by Thomas Tellier's avatar Thomas Tellier Committed by Chromium LUCI CQ

[CrOS] Center password's placeholder text on login/lock screen

Bug: 1160230
Change-Id: I1eac02e8a68b83dbd0b4c1cc82b7d6e6ca33b05b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2627852Reviewed-by: default avatarRoman Aleksandrov <raleksandrov@google.com>
Commit-Queue: Thomas Tellier <tellier@google.com>
Cr-Commit-Position: refs/heads/master@{#843497}
parent cfc99805
...@@ -686,6 +686,10 @@ LoginPasswordView::LoginPasswordView(const LoginPalette& palette) ...@@ -686,6 +686,10 @@ LoginPasswordView::LoginPasswordView(const LoginPalette& palette)
view->InvertPasswordDisplayingState(); view->InvertPasswordDisplayingState();
}, },
this))); this)));
password_end_space_ =
password_row_->AddChildView(std::make_unique<NonAccessibleView>());
password_end_space_->SetPreferredSize(gfx::Size(kIconSizeDp, kIconSizeDp));
password_end_space_->SetVisible(false);
submit_button_ = AddChildView(std::make_unique<ArrowButtonView>( submit_button_ = AddChildView(std::make_unique<ArrowButtonView>(
base::BindRepeating(&LoginPasswordView::SubmitPassword, base::BindRepeating(&LoginPasswordView::SubmitPassword,
...@@ -763,6 +767,7 @@ void LoginPasswordView::SetFocusEnabledForTextfield(bool enable) { ...@@ -763,6 +767,7 @@ void LoginPasswordView::SetFocusEnabledForTextfield(bool enable) {
void LoginPasswordView::SetDisplayPasswordButtonVisible(bool visible) { void LoginPasswordView::SetDisplayPasswordButtonVisible(bool visible) {
display_password_button_->SetVisible(visible); display_password_button_->SetVisible(visible);
password_end_space_->SetVisible(!visible);
// Only start the timer if the display password button is enabled. // Only start the timer if the display password button is enabled.
if (visible) { if (visible) {
clear_password_timer_->Start( clear_password_timer_->Start(
...@@ -933,20 +938,20 @@ bool LoginPasswordView::IsPasswordSubmittable() { ...@@ -933,20 +938,20 @@ bool LoginPasswordView::IsPasswordSubmittable() {
void LoginPasswordView::HandleLeftIconsVisibilities(bool handling_capslock) { void LoginPasswordView::HandleLeftIconsVisibilities(bool handling_capslock) {
views::View* handled_view = easy_unlock_icon_; views::View* handled_view = easy_unlock_icon_;
views::View* other_view = capslock_icon_; views::View* other_view = capslock_icon_;
bool handled_should_show = should_show_easy_unlock_; bool should_show_handled_view = should_show_easy_unlock_;
bool other_should_show = should_show_capslock_; bool should_show_other_view = should_show_capslock_;
if (handling_capslock) { if (handling_capslock) {
std::swap(handled_view, other_view); std::swap(handled_view, other_view);
std::swap(handled_should_show, other_should_show); std::swap(should_show_handled_view, should_show_other_view);
} }
if (handled_should_show) { if (should_show_handled_view) {
// If the view that is currently handled should be shown, we immediately // If the view that is currently handled should be shown, we immediately
// show it; if the other view should be shown as well, we make it invisible // show it; if the other view should be shown as well, we make it invisible
// for the moment and start a cyclic animation that will show these two // for the moment and start a cyclic animation that will show these two
// views alternatively. // views alternatively.
handled_view->SetVisible(true); handled_view->SetVisible(true);
if (other_should_show) { if (should_show_other_view) {
other_view->SetVisible(false); other_view->SetVisible(false);
left_icon_->ScheduleAnimation(handled_view, other_view); left_icon_->ScheduleAnimation(handled_view, other_view);
} }
...@@ -956,7 +961,7 @@ void LoginPasswordView::HandleLeftIconsVisibilities(bool handling_capslock) { ...@@ -956,7 +961,7 @@ void LoginPasswordView::HandleLeftIconsVisibilities(bool handling_capslock) {
// We also make the other view visible if needed, as its current state // We also make the other view visible if needed, as its current state
// may depend on how long the animation has been running. // may depend on how long the animation has been running.
left_icon_->AbortAnimationIfAny(); left_icon_->AbortAnimationIfAny();
other_view->SetVisible(other_should_show); other_view->SetVisible(should_show_other_view);
handled_view->SetVisible(false); handled_view->SetVisible(false);
} }
password_row_->Layout(); password_row_->Layout();
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "ash/ime/ime_controller_impl.h" #include "ash/ime/ime_controller_impl.h"
#include "ash/login/ui/animated_rounded_image_view.h" #include "ash/login/ui/animated_rounded_image_view.h"
#include "ash/login/ui/login_palette.h" #include "ash/login/ui/login_palette.h"
#include "ash/login/ui/non_accessible_view.h"
#include "ash/public/cpp/session/user_info.h" #include "ash/public/cpp/session/user_info.h"
#include "base/scoped_observer.h" #include "base/scoped_observer.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
...@@ -206,6 +207,7 @@ class ASH_EXPORT LoginPasswordView : public views::View, ...@@ -206,6 +207,7 @@ class ASH_EXPORT LoginPasswordView : public views::View,
LoginTextfield* textfield_ = nullptr; LoginTextfield* textfield_ = nullptr;
ArrowButtonView* submit_button_ = nullptr; ArrowButtonView* submit_button_ = nullptr;
DisplayPasswordButton* display_password_button_ = nullptr; DisplayPasswordButton* display_password_button_ = nullptr;
NonAccessibleView* password_end_space_ = nullptr;
// Could show either the caps lock icon or the easy unlock icon. // Could show either the caps lock icon or the easy unlock icon.
AlternateIconsView* left_icon_ = nullptr; AlternateIconsView* left_icon_ = nullptr;
views::ImageView* capslock_icon_ = nullptr; views::ImageView* capslock_icon_ = nullptr;
......
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