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/existing_user_view.h" | 5 #include "chrome/browser/chromeos/login/existing_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/textfield_with_margin.h" | 10 #include "chrome/browser/chromeos/login/textfield_with_margin.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 DISALLOW_COPY_AND_ASSIGN(UserEntryTextfield); | 54 DISALLOW_COPY_AND_ASSIGN(UserEntryTextfield); |
55 }; | 55 }; |
56 | 56 |
57 | 57 |
58 ExistingUserView::ExistingUserView(UserController* user_controller) | 58 ExistingUserView::ExistingUserView(UserController* user_controller) |
59 : user_controller_(user_controller), | 59 : user_controller_(user_controller), |
60 password_field_(NULL), | 60 password_field_(NULL), |
61 accel_login_off_the_record_( | 61 accel_login_off_the_record_( |
62 views::Accelerator(app::VKEY_B, false, false, true)), | 62 views::Accelerator(app::VKEY_B, false, false, true)), |
63 accel_enable_accessibility_( | 63 accel_toggle_accessibility_( |
64 WizardAccessibilityHelper::GetAccelerator()) { | 64 WizardAccessibilityHelper::GetAccelerator()) { |
65 AddAccelerator(accel_login_off_the_record_); | 65 AddAccelerator(accel_login_off_the_record_); |
66 AddAccelerator(accel_enable_accessibility_); | 66 AddAccelerator(accel_toggle_accessibility_); |
67 } | 67 } |
68 | 68 |
69 void ExistingUserView::RecreateFields() { | 69 void ExistingUserView::RecreateFields() { |
70 if (password_field_ == NULL) { | 70 if (password_field_ == NULL) { |
71 SetLayoutManager(new views::FillLayout); | 71 SetLayoutManager(new views::FillLayout); |
72 password_field_ = new UserEntryTextfield(user_controller_, | 72 password_field_ = new UserEntryTextfield(user_controller_, |
73 views::Textfield::STYLE_PASSWORD); | 73 views::Textfield::STYLE_PASSWORD); |
74 password_field_->set_background( | 74 password_field_->set_background( |
75 views::Background::CreateVerticalGradientBackground( | 75 views::Background::CreateVerticalGradientBackground( |
76 kBackgroundColorTop, kBackgroundColorBottom)); | 76 kBackgroundColorTop, kBackgroundColorBottom)); |
77 password_field_->SetFocusable(true); | 77 password_field_->SetFocusable(true); |
78 password_field_->SetController(this); | 78 password_field_->SetController(this); |
79 AddChildView(password_field_); | 79 AddChildView(password_field_); |
80 } | 80 } |
81 password_field_->set_text_to_display_when_empty( | 81 password_field_->set_text_to_display_when_empty( |
82 l10n_util::GetStringUTF16(IDS_LOGIN_POD_EMPTY_PASSWORD_TEXT)); | 82 l10n_util::GetStringUTF16(IDS_LOGIN_POD_EMPTY_PASSWORD_TEXT)); |
83 Layout(); | 83 Layout(); |
84 SchedulePaint(); | 84 SchedulePaint(); |
85 } | 85 } |
86 | 86 |
87 bool ExistingUserView::AcceleratorPressed( | 87 bool ExistingUserView::AcceleratorPressed( |
88 const views::Accelerator& accelerator) { | 88 const views::Accelerator& accelerator) { |
89 if (accelerator == accel_login_off_the_record_) { | 89 if (accelerator == accel_login_off_the_record_) { |
90 user_controller_->OnLoginOffTheRecord(); | 90 user_controller_->OnLoginOffTheRecord(); |
91 return true; | 91 return true; |
92 } else if (accelerator == accel_enable_accessibility_) { | 92 } else if (accelerator == accel_toggle_accessibility_) { |
93 WizardAccessibilityHelper::GetInstance()->EnableAccessibility(this); | 93 WizardAccessibilityHelper::GetInstance()->ToggleAccessibility(this); |
94 return true; | 94 return true; |
95 } | 95 } |
96 return false; | 96 return false; |
97 } | 97 } |
98 | 98 |
99 bool ExistingUserView::HandleKeystroke( | 99 bool ExistingUserView::HandleKeystroke( |
100 views::Textfield* sender, | 100 views::Textfield* sender, |
101 const views::Textfield::Keystroke& keystroke) { | 101 const views::Textfield::Keystroke& keystroke) { |
102 if (keystroke.GetKeyboardCode() == app::VKEY_RETURN) { | 102 if (keystroke.GetKeyboardCode() == app::VKEY_RETURN) { |
103 user_controller_->OnLogin("", UTF16ToUTF8(password_field_->text())); | 103 user_controller_->OnLogin("", UTF16ToUTF8(password_field_->text())); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 gfx::Rect ExistingUserView::GetMainInputScreenBounds() const { | 143 gfx::Rect ExistingUserView::GetMainInputScreenBounds() const { |
144 return password_field_->GetScreenBounds(); | 144 return password_field_->GetScreenBounds(); |
145 } | 145 } |
146 | 146 |
147 void ExistingUserView::OnLocaleChanged() { | 147 void ExistingUserView::OnLocaleChanged() { |
148 RecreateFields(); | 148 RecreateFields(); |
149 } | 149 } |
150 | 150 |
151 } // namespace chromeos | 151 } // namespace chromeos |
OLD | NEW |