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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 Layout(); | 89 Layout(); |
90 SchedulePaint(); | 90 SchedulePaint(); |
91 } | 91 } |
92 | 92 |
93 bool ExistingUserView::AcceleratorPressed( | 93 bool ExistingUserView::AcceleratorPressed( |
94 const views::Accelerator& accelerator) { | 94 const views::Accelerator& accelerator) { |
95 if (accelerator == accel_login_off_the_record_) { | 95 if (accelerator == accel_login_off_the_record_) { |
96 user_controller_->OnLoginAsGuest(); | 96 user_controller_->OnLoginAsGuest(); |
97 return true; | 97 return true; |
98 } else if (accelerator == accel_toggle_accessibility_) { | 98 } else if (accelerator == accel_toggle_accessibility_) { |
99 WizardAccessibilityHelper::GetInstance()->ToggleAccessibility(this); | 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.GetKeyCode() == 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())); |
(...skipping 20 matching lines...) Expand all Loading... |
130 | 130 |
131 void ExistingUserView::ClearAndFocusControls() { | 131 void ExistingUserView::ClearAndFocusControls() { |
132 ClearAndFocusPassword(); | 132 ClearAndFocusPassword(); |
133 } | 133 } |
134 | 134 |
135 void ExistingUserView::ClearAndFocusPassword() { | 135 void ExistingUserView::ClearAndFocusPassword() { |
136 password_field_->SetText(string16()); | 136 password_field_->SetText(string16()); |
137 FocusPasswordField(); | 137 FocusPasswordField(); |
138 } | 138 } |
139 | 139 |
140 void ExistingUserView::ViewHierarchyChanged(bool is_add, | |
141 views::View* parent, | |
142 views::View* child) { | |
143 if (is_add && this == child) | |
144 WizardAccessibilityHelper::GetInstance()->MaybeEnableAccessibility(this); | |
145 } | |
146 | |
147 void ExistingUserView::FocusPasswordField() { | 140 void ExistingUserView::FocusPasswordField() { |
148 password_field_->RequestFocus(); | 141 password_field_->RequestFocus(); |
149 } | 142 } |
150 | 143 |
151 gfx::Rect ExistingUserView::GetMainInputScreenBounds() const { | 144 gfx::Rect ExistingUserView::GetMainInputScreenBounds() const { |
152 return password_field_->GetScreenBounds(); | 145 return password_field_->GetScreenBounds(); |
153 } | 146 } |
154 | 147 |
155 void ExistingUserView::OnLocaleChanged() { | 148 void ExistingUserView::OnLocaleChanged() { |
156 RecreateFields(); | 149 RecreateFields(); |
157 } | 150 } |
158 | 151 |
159 } // namespace chromeos | 152 } // namespace chromeos |
OLD | NEW |