| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/login/new_user_view.h" | 5 #include "chrome/browser/chromeos/login/new_user_view.h" |
| 6 | 6 |
| 7 #include <signal.h> | 7 #include <signal.h> |
| 8 #include <sys/types.h> | 8 #include <sys/types.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "app/keyboard_codes.h" |
| 13 #include "app/l10n_util.h" | 14 #include "app/l10n_util.h" |
| 14 #include "app/resource_bundle.h" | 15 #include "app/resource_bundle.h" |
| 15 #include "base/callback.h" | 16 #include "base/callback.h" |
| 16 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 17 #include "base/keyboard_codes.h" | |
| 18 #include "base/logging.h" | 18 #include "base/logging.h" |
| 19 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
| 20 #include "base/process_util.h" | 20 #include "base/process_util.h" |
| 21 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
| 22 #include "base/string_util.h" | 22 #include "base/string_util.h" |
| 23 #include "chrome/browser/chromeos/cros/cros_library.h" | 23 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 24 #include "chrome/browser/chromeos/login/helper.h" | 24 #include "chrome/browser/chromeos/login/helper.h" |
| 25 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" | 25 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" |
| 26 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 27 #include "views/controls/button/native_button.h" | 27 #include "views/controls/button/native_button.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 NewUserView::NewUserView(Delegate* delegate, bool need_border) | 75 NewUserView::NewUserView(Delegate* delegate, bool need_border) |
| 76 : username_field_(NULL), | 76 : username_field_(NULL), |
| 77 password_field_(NULL), | 77 password_field_(NULL), |
| 78 title_label_(NULL), | 78 title_label_(NULL), |
| 79 sign_in_button_(NULL), | 79 sign_in_button_(NULL), |
| 80 create_account_link_(NULL), | 80 create_account_link_(NULL), |
| 81 cant_access_account_link_(NULL), | 81 cant_access_account_link_(NULL), |
| 82 browse_without_signin_link_(NULL), | 82 browse_without_signin_link_(NULL), |
| 83 languages_menubutton_(NULL), | 83 languages_menubutton_(NULL), |
| 84 throbber_(NULL), | 84 throbber_(NULL), |
| 85 accel_focus_user_(views::Accelerator(base::VKEY_U, false, false, true)), | 85 accel_focus_user_(views::Accelerator(app::VKEY_U, false, false, true)), |
| 86 accel_focus_pass_(views::Accelerator(base::VKEY_P, false, false, true)), | 86 accel_focus_pass_(views::Accelerator(app::VKEY_P, false, false, true)), |
| 87 delegate_(delegate), | 87 delegate_(delegate), |
| 88 ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)), | 88 ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)), |
| 89 focus_delayed_(false), | 89 focus_delayed_(false), |
| 90 login_in_process_(false), | 90 login_in_process_(false), |
| 91 need_border_(need_border) { | 91 need_border_(need_border) { |
| 92 } | 92 } |
| 93 | 93 |
| 94 NewUserView::~NewUserView() { | 94 NewUserView::~NewUserView() { |
| 95 } | 95 } |
| 96 | 96 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 | 380 |
| 381 void NewUserView::StopThrobber() { | 381 void NewUserView::StopThrobber() { |
| 382 throbber_->Stop(); | 382 throbber_->Stop(); |
| 383 } | 383 } |
| 384 | 384 |
| 385 bool NewUserView::HandleKeystroke(views::Textfield* s, | 385 bool NewUserView::HandleKeystroke(views::Textfield* s, |
| 386 const views::Textfield::Keystroke& keystroke) { | 386 const views::Textfield::Keystroke& keystroke) { |
| 387 if (!CrosLibrary::Get()->EnsureLoaded() || login_in_process_) | 387 if (!CrosLibrary::Get()->EnsureLoaded() || login_in_process_) |
| 388 return false; | 388 return false; |
| 389 | 389 |
| 390 if (keystroke.GetKeyboardCode() == base::VKEY_RETURN) { | 390 if (keystroke.GetKeyboardCode() == app::VKEY_RETURN) { |
| 391 Login(); | 391 Login(); |
| 392 // Return true so that processing ends | 392 // Return true so that processing ends |
| 393 return true; | 393 return true; |
| 394 } else if (keystroke.GetKeyboardCode() == base::VKEY_LEFT) { | 394 } else if (keystroke.GetKeyboardCode() == app::VKEY_LEFT) { |
| 395 if (s == username_field_ && | 395 if (s == username_field_ && |
| 396 username_field_->text().empty() && | 396 username_field_->text().empty() && |
| 397 password_field_->text().empty()) { | 397 password_field_->text().empty()) { |
| 398 delegate_->NavigateAway(); | 398 delegate_->NavigateAway(); |
| 399 return true; | 399 return true; |
| 400 } | 400 } |
| 401 } | 401 } |
| 402 delegate_->ClearErrors(); | 402 delegate_->ClearErrors(); |
| 403 // Return false so that processing does not end | 403 // Return false so that processing does not end |
| 404 return false; | 404 return false; |
| 405 } | 405 } |
| 406 | 406 |
| 407 void NewUserView::EnableInputControls(bool enabled) { | 407 void NewUserView::EnableInputControls(bool enabled) { |
| 408 languages_menubutton_->SetEnabled(enabled); | 408 languages_menubutton_->SetEnabled(enabled); |
| 409 username_field_->SetEnabled(enabled); | 409 username_field_->SetEnabled(enabled); |
| 410 password_field_->SetEnabled(enabled); | 410 password_field_->SetEnabled(enabled); |
| 411 sign_in_button_->SetEnabled(enabled); | 411 sign_in_button_->SetEnabled(enabled); |
| 412 create_account_link_->SetEnabled(enabled); | 412 create_account_link_->SetEnabled(enabled); |
| 413 cant_access_account_link_->SetEnabled(enabled); | 413 cant_access_account_link_->SetEnabled(enabled); |
| 414 browse_without_signin_link_->SetEnabled(enabled); | 414 browse_without_signin_link_->SetEnabled(enabled); |
| 415 } | 415 } |
| 416 | 416 |
| 417 void NewUserView::InitLink(views::Link** link) { | 417 void NewUserView::InitLink(views::Link** link) { |
| 418 *link = new views::Link(std::wstring()); | 418 *link = new views::Link(std::wstring()); |
| 419 (*link)->SetController(this); | 419 (*link)->SetController(this); |
| 420 AddChildView(*link); | 420 AddChildView(*link); |
| 421 } | 421 } |
| 422 | 422 |
| 423 } // namespace chromeos | 423 } // namespace chromeos |
| OLD | NEW |