| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/existing_user_view.h" | 5 #include "chrome/browser/chromeos/login/existing_user_view.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/chromeos/login/user_controller.h" | 8 #include "chrome/browser/chromeos/login/user_controller.h" |
| 9 #include "chrome/browser/chromeos/login/textfield_with_margin.h" | 9 #include "chrome/browser/chromeos/login/textfield_with_margin.h" |
| 10 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" | 10 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // Textfield with custom processing for Tab/Shift+Tab to select entries. | 26 // Textfield with custom processing for Tab/Shift+Tab to select entries. |
| 27 class UserEntryTextfield : public TextfieldWithMargin { | 27 class UserEntryTextfield : public TextfieldWithMargin { |
| 28 public: | 28 public: |
| 29 UserEntryTextfield(UserController* controller, | 29 UserEntryTextfield(UserController* controller, |
| 30 views::Textfield::StyleFlags style) | 30 views::Textfield::StyleFlags style) |
| 31 : TextfieldWithMargin(style), | 31 : TextfieldWithMargin(style), |
| 32 controller_(controller) {} | 32 controller_(controller) {} |
| 33 | 33 |
| 34 // Overridden from views::View: | 34 // Overridden from views::View: |
| 35 virtual bool OnKeyPressed(const views::KeyEvent& e) { | 35 virtual bool OnKeyPressed(const views::KeyEvent& e) { |
| 36 if (e.GetKeyCode() == ui::VKEY_TAB) { | 36 if (e.key_code() == ui::VKEY_TAB) { |
| 37 controller_->SelectUserRelative(e.IsShiftDown() ? -1 : 1); | 37 controller_->SelectUserRelative(e.IsShiftDown() ? -1 : 1); |
| 38 return true; | 38 return true; |
| 39 } else if (e.GetKeyCode() == ui::VKEY_LEFT) { | 39 } else if (e.key_code() == ui::VKEY_LEFT) { |
| 40 controller_->SelectUserRelative(-1); | 40 controller_->SelectUserRelative(-1); |
| 41 return true; | 41 return true; |
| 42 } else if (e.GetKeyCode() == ui::VKEY_RIGHT) { | 42 } else if (e.key_code() == ui::VKEY_RIGHT) { |
| 43 controller_->SelectUserRelative(1); | 43 controller_->SelectUserRelative(1); |
| 44 return true; | 44 return true; |
| 45 } else { | 45 } else { |
| 46 return false; | 46 return false; |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 | 49 |
| 50 virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { | 50 virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { |
| 51 if (e.GetKeyCode() == ui::VKEY_TAB) | 51 if (e.key_code() == ui::VKEY_TAB) |
| 52 return true; | 52 return true; |
| 53 else | 53 else |
| 54 return views::Textfield::SkipDefaultKeyEventProcessing(e); | 54 return views::Textfield::SkipDefaultKeyEventProcessing(e); |
| 55 } | 55 } |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 UserController* controller_; | 58 UserController* controller_; |
| 59 | 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(UserEntryTextfield); | 60 DISALLOW_COPY_AND_ASSIGN(UserEntryTextfield); |
| 61 }; | 61 }; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 return true; | 97 return true; |
| 98 } else if (accelerator == accel_toggle_accessibility_) { | 98 } else if (accelerator == accel_toggle_accessibility_) { |
| 99 WizardAccessibilityHelper::GetInstance()->ToggleAccessibility(); | 99 WizardAccessibilityHelper::GetInstance()->ToggleAccessibility(); |
| 100 return true; | 100 return true; |
| 101 } | 101 } |
| 102 return false; | 102 return false; |
| 103 } | 103 } |
| 104 | 104 |
| 105 bool ExistingUserView::HandleKeyEvent(views::Textfield* sender, | 105 bool ExistingUserView::HandleKeyEvent(views::Textfield* sender, |
| 106 const views::KeyEvent& key_event) { | 106 const views::KeyEvent& key_event) { |
| 107 if (key_event.GetKeyCode() == ui::VKEY_RETURN) { | 107 if (key_event.key_code() == ui::VKEY_RETURN) { |
| 108 if (!password_field_->text().empty()) | 108 if (!password_field_->text().empty()) |
| 109 user_controller_->OnLogin("", UTF16ToUTF8(password_field_->text())); | 109 user_controller_->OnLogin("", UTF16ToUTF8(password_field_->text())); |
| 110 } else { | 110 } else { |
| 111 user_controller_->ClearErrors(); | 111 user_controller_->ClearErrors(); |
| 112 return false; | 112 return false; |
| 113 } | 113 } |
| 114 return true; | 114 return true; |
| 115 } | 115 } |
| 116 | 116 |
| 117 void ExistingUserView::RequestFocus() { | 117 void ExistingUserView::RequestFocus() { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 143 | 143 |
| 144 gfx::Rect ExistingUserView::GetMainInputScreenBounds() const { | 144 gfx::Rect ExistingUserView::GetMainInputScreenBounds() const { |
| 145 return password_field_->GetScreenBounds(); | 145 return password_field_->GetScreenBounds(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void ExistingUserView::OnLocaleChanged() { | 148 void ExistingUserView::OnLocaleChanged() { |
| 149 RecreateFields(); | 149 RecreateFields(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace chromeos | 152 } // namespace chromeos |
| OLD | NEW |