| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 bool need_border, | 76 bool need_border, |
| 77 bool need_browse_without_signin) | 77 bool need_browse_without_signin) |
| 78 : username_field_(NULL), | 78 : username_field_(NULL), |
| 79 password_field_(NULL), | 79 password_field_(NULL), |
| 80 title_label_(NULL), | 80 title_label_(NULL), |
| 81 sign_in_button_(NULL), | 81 sign_in_button_(NULL), |
| 82 create_account_link_(NULL), | 82 create_account_link_(NULL), |
| 83 browse_without_signin_link_(NULL), | 83 browse_without_signin_link_(NULL), |
| 84 languages_menubutton_(NULL), | 84 languages_menubutton_(NULL), |
| 85 throbber_(NULL), | 85 throbber_(NULL), |
| 86 accel_focus_user_(views::Accelerator(base::VKEY_U, false, false, true)), | 86 accel_focus_user_(views::Accelerator(app::VKEY_U, false, false, true)), |
| 87 accel_focus_pass_(views::Accelerator(base::VKEY_P, false, false, true)), | 87 accel_focus_pass_(views::Accelerator(app::VKEY_P, false, false, true)), |
| 88 delegate_(delegate), | 88 delegate_(delegate), |
| 89 ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)), | 89 ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)), |
| 90 focus_delayed_(false), | 90 focus_delayed_(false), |
| 91 login_in_process_(false), | 91 login_in_process_(false), |
| 92 need_border_(need_border), | 92 need_border_(need_border), |
| 93 need_browse_without_signin_(need_browse_without_signin) { | 93 need_browse_without_signin_(need_browse_without_signin) { |
| 94 } | 94 } |
| 95 | 95 |
| 96 NewUserView::~NewUserView() { | 96 NewUserView::~NewUserView() { |
| 97 } | 97 } |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 | 378 |
| 379 void NewUserView::StopThrobber() { | 379 void NewUserView::StopThrobber() { |
| 380 throbber_->Stop(); | 380 throbber_->Stop(); |
| 381 } | 381 } |
| 382 | 382 |
| 383 bool NewUserView::HandleKeystroke(views::Textfield* s, | 383 bool NewUserView::HandleKeystroke(views::Textfield* s, |
| 384 const views::Textfield::Keystroke& keystroke) { | 384 const views::Textfield::Keystroke& keystroke) { |
| 385 if (!CrosLibrary::Get()->EnsureLoaded() || login_in_process_) | 385 if (!CrosLibrary::Get()->EnsureLoaded() || login_in_process_) |
| 386 return false; | 386 return false; |
| 387 | 387 |
| 388 if (keystroke.GetKeyboardCode() == base::VKEY_RETURN) { | 388 if (keystroke.GetKeyboardCode() == app::VKEY_RETURN) { |
| 389 Login(); | 389 Login(); |
| 390 // Return true so that processing ends | 390 // Return true so that processing ends |
| 391 return true; | 391 return true; |
| 392 } else if (keystroke.GetKeyboardCode() == base::VKEY_LEFT) { | 392 } else if (keystroke.GetKeyboardCode() == app::VKEY_LEFT) { |
| 393 if (s == username_field_ && | 393 if (s == username_field_ && |
| 394 username_field_->text().empty() && | 394 username_field_->text().empty() && |
| 395 password_field_->text().empty()) { | 395 password_field_->text().empty()) { |
| 396 delegate_->NavigateAway(); | 396 delegate_->NavigateAway(); |
| 397 return true; | 397 return true; |
| 398 } | 398 } |
| 399 } | 399 } |
| 400 delegate_->ClearErrors(); | 400 delegate_->ClearErrors(); |
| 401 // Return false so that processing does not end | 401 // Return false so that processing does not end |
| 402 return false; | 402 return false; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 413 } | 413 } |
| 414 } | 414 } |
| 415 | 415 |
| 416 void NewUserView::InitLink(views::Link** link) { | 416 void NewUserView::InitLink(views::Link** link) { |
| 417 *link = new views::Link(std::wstring()); | 417 *link = new views::Link(std::wstring()); |
| 418 (*link)->SetController(this); | 418 (*link)->SetController(this); |
| 419 AddChildView(*link); | 419 AddChildView(*link); |
| 420 } | 420 } |
| 421 | 421 |
| 422 } // namespace chromeos | 422 } // namespace chromeos |
| OLD | NEW |