Skip to content

Commit

Permalink
Clear username (along with password) in NewUserView as long as NewUse…
Browse files Browse the repository at this point in the history
…rView was abandoned and revisited later.

Also for NewUserView: get focus on username not password.

BUG=http://crosbug.com/4330
TEST=Manual

Review URL: http://codereview.chromium.org/3032053

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54910 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
nkostylev@google.com committed Aug 4, 2010
1 parent 7c6821d commit 81c2639
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion chrome/browser/chromeos/login/existing_user_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void ExistingUserController::OnUserSelected(UserController* source) {
size_t new_selected_index = i - controllers_.begin();
if (new_selected_index != selected_view_index_ &&
selected_view_index_ != kNotSelected) {
controllers_[selected_view_index_]->ClearAndEnablePassword();
controllers_[selected_view_index_]->ClearAndEnableFields();
ClearCaptchaState();
}
selected_view_index_ = new_selected_index;
Expand Down
9 changes: 9 additions & 0 deletions chrome/browser/chromeos/login/new_user_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,15 @@ void NewUserView::ClearAndEnablePassword() {
throbber_->Stop();
}

void NewUserView::ClearAndEnableFields() {
login_in_process_ = false;
EnableInputControls(true);
SetUsername(std::string());
SetPassword(std::string());
username_field_->RequestFocus();
throbber_->Stop();
}

gfx::Rect NewUserView::GetPasswordBounds() const {
gfx::Rect screen_bounds(password_field_->bounds());
gfx::Point origin(screen_bounds.origin());
Expand Down
3 changes: 3 additions & 0 deletions chrome/browser/chromeos/login/new_user_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ class NewUserView : public views::View,
// Resets password text and sets the enabled state of the password.
void ClearAndEnablePassword();

// Resets password and username text and focuses on username.
void ClearAndEnableFields();

// Stops throbber shown during login.
void StopThrobber();

Expand Down
8 changes: 8 additions & 0 deletions chrome/browser/chromeos/login/user_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ void UserController::ClearAndEnablePassword() {
}
}

void UserController::ClearAndEnableFields() {
if (is_guest_) {
new_user_view_->ClearAndEnableFields();
} else {
ClearAndEnablePassword();
}
}

void UserController::EnableNameTooltip(bool enable) {
if (is_guest_)
return;
Expand Down
3 changes: 3 additions & 0 deletions chrome/browser/chromeos/login/user_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ class UserController : public views::ButtonListener,
// Resets password text and sets the enabled state of the password.
void ClearAndEnablePassword();

// Called when user view is activated (OnUserSelected).
void ClearAndEnableFields();

// Returns bounds of password field in screen coordinates.
gfx::Rect GetScreenBounds() const;

Expand Down

0 comments on commit 81c2639

Please sign in to comment.