Chromium Code Reviews| Index: chrome/browser/chromeos/login/new_user_view.cc |
| diff --git a/chrome/browser/chromeos/login/new_user_view.cc b/chrome/browser/chromeos/login/new_user_view.cc |
| index 974ad66860053bdf3ccb9e1003a9615910eeeb56..e28d7305ced2ffa5796417cf9f84d7dcea11e082 100644 |
| --- a/chrome/browser/chromeos/login/new_user_view.cc |
| +++ b/chrome/browser/chromeos/login/new_user_view.cc |
| @@ -20,7 +20,6 @@ |
| #include "base/string_util.h" |
| #include "base/utf_string_conversions.h" |
| #include "chrome/browser/chromeos/cros/cros_library.h" |
| -#include "chrome/browser/chromeos/login/helper.h" |
| #include "chrome/browser/chromeos/login/rounded_rect_painter.h" |
| #include "chrome/browser/chromeos/login/textfield_with_margin.h" |
| #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" |
| @@ -83,7 +82,8 @@ namespace chromeos { |
| NewUserView::NewUserView(Delegate* delegate, |
| bool need_border, |
| bool need_guest_link) |
| - : username_field_(NULL), |
| + : ThrobberHost(this), |
| + username_field_(NULL), |
| password_field_(NULL), |
| title_label_(NULL), |
| title_hint_label_(NULL), |
| @@ -95,7 +95,6 @@ NewUserView::NewUserView(Delegate* delegate, |
| create_account_link_(NULL), |
| guest_link_(NULL), |
| languages_menubutton_(NULL), |
| - throbber_(NULL), |
| accel_focus_pass_(views::Accelerator(app::VKEY_P, false, false, true)), |
| accel_focus_user_(views::Accelerator(app::VKEY_U, false, false, true)), |
| accel_login_off_the_record_( |
| @@ -158,9 +157,6 @@ void NewUserView::Init() { |
| password_field_->set_background(new CopyBackground(this)); |
| AddChildView(password_field_); |
| - throbber_ = CreateDefaultSmoothedThrobber(); |
| - AddChildView(throbber_); |
| - |
| language_switch_menu_.InitLanguageMenu(); |
| RecreatePeculiarControls(); |
| @@ -417,15 +413,8 @@ void NewUserView::Layout() { |
| y += setViewBounds(username_field_, x, y, width, true) + kRowPad; |
| y += setViewBounds(password_field_, x, y, width, true) + kRowPad; |
| - int throbber_y = y; |
| int sign_in_button_width = sign_in_button_->GetPreferredSize().width(); |
| setViewBounds(sign_in_button_, x, y, sign_in_button_width,true); |
| - setViewBounds(throbber_, |
| - x + width - throbber_->GetPreferredSize().width(), |
| - throbber_y + (sign_in_button_->GetPreferredSize().height() - |
| - throbber_->GetPreferredSize().height()) / 2, |
| - width, |
| - false); |
| SchedulePaint(); |
| } |
| @@ -448,9 +437,7 @@ void NewUserView::Login() { |
| if (login_in_process_ || username_field_->text().empty()) |
| return; |
| - StartThrobber(); |
| login_in_process_ = true; |
| - EnableInputControls(false); |
| std::string username = UTF16ToUTF8(username_field_->text()); |
| // todo(cmasone) Need to sanitize memory used to store password. |
| std::string password = UTF16ToUTF8(password_field_->text()); |
| @@ -478,37 +465,42 @@ void NewUserView::LinkActivated(views::Link* source, int event_flags) { |
| } |
| } |
| -void NewUserView::ClearAndEnablePassword() { |
| +void NewUserView::ClearAndFocusControls() { |
| login_in_process_ = false; |
| - EnableInputControls(true); |
| + SetUsername(std::string()); |
| SetPassword(std::string()); |
| - password_field_->RequestFocus(); |
| - StopThrobber(); |
| + username_field_->RequestFocus(); |
| } |
| -void NewUserView::ClearAndEnableFields() { |
| +void NewUserView::ClearAndFocusPassword() { |
| login_in_process_ = false; |
| - EnableInputControls(true); |
| - SetUsername(std::string()); |
| SetPassword(std::string()); |
| - username_field_->RequestFocus(); |
| - StopThrobber(); |
| + password_field_->RequestFocus(); |
| } |
| -gfx::Rect NewUserView::GetPasswordBounds() const { |
| - return password_field_->GetScreenBounds(); |
| +gfx::Rect NewUserView::GetMainInputScreenBounds() const { |
| + return GetUsernameBounds(); |
| } |
| -gfx::Rect NewUserView::GetUsernameBounds() const { |
| - return username_field_->GetScreenBounds(); |
| +gfx::Rect NewUserView::CalculateThrobberBounds(views::Throbber* throbber) { |
| + DCHECK(password_field_); |
| + DCHECK(sign_in_button_); |
| + |
| + gfx::Size throbber_size = throbber->GetPreferredSize(); |
| + int x = password_field_->x(); |
| + x += password_field_->width()- throbber_size.width(); |
|
whywhat
2010/12/13 16:10:55
space before -
altimofeev
2010/12/14 11:15:21
Done.
|
| + int y = sign_in_button_->y(); |
| + y += (sign_in_button_->height() - throbber_size.height()) / 2; |
| + |
| + return gfx::Rect(gfx::Point(x,y), throbber_size); |
|
whywhat
2010/12/13 16:10:55
space between , and y
altimofeev
2010/12/14 11:15:21
Done.
|
| } |
| -void NewUserView::StartThrobber() { |
| - throbber_->Start(); |
| +gfx::Rect NewUserView::GetPasswordBounds() const { |
| + return password_field_->GetScreenBounds(); |
| } |
| -void NewUserView::StopThrobber() { |
| - throbber_->Stop(); |
| +gfx::Rect NewUserView::GetUsernameBounds() const { |
| + return username_field_->GetScreenBounds(); |
| } |
| bool NewUserView::HandleKeystroke(views::Textfield* s, |
| @@ -549,7 +541,6 @@ void NewUserView::EnableInputControls(bool enabled) { |
| if (need_guest_link_) { |
| guest_link_->SetEnabled(enabled); |
| } |
| - delegate_->SetStatusAreaEnabled(enabled); |
| } |
| void NewUserView::InitLink(views::Link** link) { |