| 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/guest_user_view.h" | 5 #include "chrome/browser/chromeos/login/guest_user_view.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/chromeos/login/user_controller.h" | 9 #include "chrome/browser/chromeos/login/user_controller.h" |
| 10 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" | 10 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" |
| 11 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 | 14 |
| 15 // Button with custom processing for Tab/Shift+Tab to select entries. | 15 // Button with custom processing for Tab/Shift+Tab to select entries. |
| 16 class UserEntryButton : public login::WideButton { | 16 class UserEntryButton : public login::WideButton { |
| 17 public: | 17 public: |
| 18 UserEntryButton(views::ButtonListener* button_listener, | 18 UserEntryButton(views::ButtonListener* button_listener, |
| 19 UserController* user_controller, | 19 UserController* user_controller, |
| 20 const std::wstring& label) | 20 const std::wstring& label) |
| 21 : WideButton(button_listener, label), | 21 : WideButton(button_listener, label), |
| 22 user_controller_(user_controller) {} | 22 user_controller_(user_controller) {} |
| 23 | 23 |
| 24 // Overridden from views::View: | 24 // Overridden from views::View: |
| 25 virtual bool OnKeyPressed(const views::KeyEvent& e) { | 25 virtual bool OnKeyPressed(const views::KeyEvent& e) { |
| 26 if (e.GetKeyCode() == app::VKEY_TAB) { | 26 if (e.GetKeyCode() == ui::VKEY_TAB) { |
| 27 user_controller_->SelectUserRelative(e.IsShiftDown() ? -1 : 1); | 27 user_controller_->SelectUserRelative(e.IsShiftDown() ? -1 : 1); |
| 28 return true; | 28 return true; |
| 29 } | 29 } |
| 30 return WideButton::OnKeyPressed(e); | 30 return WideButton::OnKeyPressed(e); |
| 31 } | 31 } |
| 32 | 32 |
| 33 virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { | 33 virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { |
| 34 if (e.GetKeyCode() == app::VKEY_TAB) | 34 if (e.GetKeyCode() == ui::VKEY_TAB) |
| 35 return true; | 35 return true; |
| 36 return WideButton::SkipDefaultKeyEventProcessing(e); | 36 return WideButton::SkipDefaultKeyEventProcessing(e); |
| 37 } | 37 } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 UserController* user_controller_; | 40 UserController* user_controller_; |
| 41 | 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(UserEntryButton); | 42 DISALLOW_COPY_AND_ASSIGN(UserEntryButton); |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 | 45 |
| 46 GuestUserView::GuestUserView(UserController* uc) | 46 GuestUserView::GuestUserView(UserController* uc) |
| 47 : submit_button_(NULL), | 47 : submit_button_(NULL), |
| 48 user_controller_(uc), | 48 user_controller_(uc), |
| 49 accel_toggle_accessibility_( | 49 accel_toggle_accessibility_( |
| 50 WizardAccessibilityHelper::GetAccelerator()), | 50 WizardAccessibilityHelper::GetAccelerator()), |
| 51 accel_login_off_the_record_( | 51 accel_login_off_the_record_( |
| 52 views::Accelerator(app::VKEY_B, false, false, true)), | 52 views::Accelerator(ui::VKEY_B, false, false, true)), |
| 53 accel_previous_pod_by_arrow_( | 53 accel_previous_pod_by_arrow_( |
| 54 views::Accelerator(app::VKEY_LEFT, false, false, false)), | 54 views::Accelerator(ui::VKEY_LEFT, false, false, false)), |
| 55 accel_next_pod_by_arrow_( | 55 accel_next_pod_by_arrow_( |
| 56 views::Accelerator(app::VKEY_RIGHT, false, false, false)) { | 56 views::Accelerator(ui::VKEY_RIGHT, false, false, false)) { |
| 57 AddAccelerator(accel_toggle_accessibility_); | 57 AddAccelerator(accel_toggle_accessibility_); |
| 58 AddAccelerator(accel_login_off_the_record_); | 58 AddAccelerator(accel_login_off_the_record_); |
| 59 AddAccelerator(accel_previous_pod_by_arrow_); | 59 AddAccelerator(accel_previous_pod_by_arrow_); |
| 60 AddAccelerator(accel_next_pod_by_arrow_); | 60 AddAccelerator(accel_next_pod_by_arrow_); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void GuestUserView::RecreateFields() { | 63 void GuestUserView::RecreateFields() { |
| 64 delete submit_button_; | 64 delete submit_button_; |
| 65 submit_button_ = new UserEntryButton( | 65 submit_button_ = new UserEntryButton( |
| 66 this, | 66 this, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 void GuestUserView::ClearAndFocusPassword() { | 127 void GuestUserView::ClearAndFocusPassword() { |
| 128 } | 128 } |
| 129 | 129 |
| 130 gfx::Rect GuestUserView::GetMainInputScreenBounds() const { | 130 gfx::Rect GuestUserView::GetMainInputScreenBounds() const { |
| 131 NOTREACHED(); | 131 NOTREACHED(); |
| 132 return gfx::Rect(); | 132 return gfx::Rect(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace chromeos | 135 } // namespace chromeos |
| OLD | NEW |