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/screen_lock_view.h" | 5 #include "chrome/browser/chromeos/login/screen_lock_view.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/chromeos/login/helper.h" | 10 #include "chrome/browser/chromeos/login/helper.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 } // namespace | 56 } // namespace |
57 | 57 |
58 using views::GridLayout; | 58 using views::GridLayout; |
59 using login::kBorderSize; | 59 using login::kBorderSize; |
60 | 60 |
61 ScreenLockView::ScreenLockView(ScreenLocker* screen_locker) | 61 ScreenLockView::ScreenLockView(ScreenLocker* screen_locker) |
62 : user_view_(NULL), | 62 : user_view_(NULL), |
63 password_field_(NULL), | 63 password_field_(NULL), |
64 screen_locker_(screen_locker), | 64 screen_locker_(screen_locker), |
65 main_(NULL), | 65 main_(NULL), |
66 username_(NULL) { | 66 username_(NULL), |
67 throbber_widget_(NULL) { | |
oshima
2010/12/09 21:52:10
looks like this is not used?
altimofeev
2010/12/10 16:37:40
Exactly. Removed.
| |
67 DCHECK(screen_locker_); | 68 DCHECK(screen_locker_); |
68 } | 69 } |
69 | 70 |
70 gfx::Size ScreenLockView::GetPreferredSize() { | 71 gfx::Size ScreenLockView::GetPreferredSize() { |
71 return main_->GetPreferredSize(); | 72 return main_->GetPreferredSize(); |
72 } | 73 } |
73 | 74 |
74 void ScreenLockView::Layout() { | 75 void ScreenLockView::Layout() { |
75 int username_height = login::kSelectedLabelHeight; | 76 int username_height = login::kSelectedLabelHeight; |
76 main_->SetBounds(0, 0, width(), height()); | 77 main_->SetBounds(0, 0, width(), height()); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 void ScreenLockView::SetSignoutEnabled(bool enabled) { | 154 void ScreenLockView::SetSignoutEnabled(bool enabled) { |
154 user_view_->SetSignoutEnabled(enabled); | 155 user_view_->SetSignoutEnabled(enabled); |
155 } | 156 } |
156 | 157 |
157 gfx::Rect ScreenLockView::GetPasswordBoundsRelativeTo(const views::View* view) { | 158 gfx::Rect ScreenLockView::GetPasswordBoundsRelativeTo(const views::View* view) { |
158 gfx::Point p; | 159 gfx::Point p; |
159 views::View::ConvertPointToView(password_field_, view, &p); | 160 views::View::ConvertPointToView(password_field_, view, &p); |
160 return gfx::Rect(p, size()); | 161 return gfx::Rect(p, size()); |
161 } | 162 } |
162 | 163 |
164 views::Widget* ScreenLockView::GetWidgetForThrobber() { | |
165 if (!password_field_) | |
166 return NULL; | |
167 return password_field_->GetWidget(); | |
oshima
2010/12/09 21:52:10
or just return password_field_ ? ... : NULL;
altimofeev
2010/12/10 16:37:40
Done.
| |
168 } | |
169 | |
163 void ScreenLockView::SetEnabled(bool enabled) { | 170 void ScreenLockView::SetEnabled(bool enabled) { |
164 views::View::SetEnabled(enabled); | 171 views::View::SetEnabled(enabled); |
165 | 172 |
166 if (!enabled) { | 173 if (!enabled) { |
167 user_view_->StartThrobber(); | |
168 // TODO(oshima): Re-enabling does not move the focus to the view | 174 // TODO(oshima): Re-enabling does not move the focus to the view |
169 // that had a focus (issue http://crbug.com/43131). | 175 // that had a focus (issue http://crbug.com/43131). |
170 // Clear focus on the textfield so that re-enabling can set focus | 176 // Clear focus on the textfield so that re-enabling can set focus |
171 // back to the text field. | 177 // back to the text field. |
172 // FocusManager may be null if the view does not have | 178 // FocusManager may be null if the view does not have |
173 // associated Widget yet. | 179 // associated Widget yet. |
174 if (password_field_->GetFocusManager()) | 180 if (password_field_->GetFocusManager()) |
175 password_field_->GetFocusManager()->ClearFocus(); | 181 password_field_->GetFocusManager()->ClearFocus(); |
176 } else { | |
177 user_view_->StopThrobber(); | |
178 } | 182 } |
179 password_field_->SetEnabled(enabled); | 183 password_field_->SetEnabled(enabled); |
180 } | 184 } |
181 | 185 |
182 void ScreenLockView::OnSignout() { | 186 void ScreenLockView::OnSignout() { |
183 screen_locker_->Signout(); | 187 screen_locker_->Signout(); |
184 } | 188 } |
185 | 189 |
186 bool ScreenLockView::HandleKeystroke( | 190 bool ScreenLockView::HandleKeystroke( |
187 views::Textfield* sender, | 191 views::Textfield* sender, |
(...skipping 18 matching lines...) Expand all Loading... | |
206 return; | 210 return; |
207 user_view_->SetImage(user->image(), user->image()); | 211 user_view_->SetImage(user->image(), user->image()); |
208 } | 212 } |
209 | 213 |
210 void ScreenLockView::ViewHierarchyChanged(bool is_add, | 214 void ScreenLockView::ViewHierarchyChanged(bool is_add, |
211 views::View* parent, | 215 views::View* parent, |
212 views::View* child) { | 216 views::View* child) { |
213 if (is_add && this == child) | 217 if (is_add && this == child) |
214 WizardAccessibilityHelper::GetInstance()->MaybeEnableAccessibility(this); | 218 WizardAccessibilityHelper::GetInstance()->MaybeEnableAccessibility(this); |
215 } | 219 } |
220 | |
216 } // namespace chromeos | 221 } // namespace chromeos |
OLD | NEW |