Chromium Code Reviews| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 main_(NULL), | 65 main_(NULL), |
| 66 username_(NULL) { | 66 username_(NULL) { |
| 67 DCHECK(screen_locker_); | 67 DCHECK(screen_locker_); |
| 68 } | 68 } |
| 69 | 69 |
| 70 gfx::Size ScreenLockView::GetPreferredSize() { | 70 gfx::Size ScreenLockView::GetPreferredSize() { |
| 71 return main_->GetPreferredSize(); | 71 return main_->GetPreferredSize(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void ScreenLockView::Layout() { | 74 void ScreenLockView::Layout() { |
| 75 int username_height = username_->GetPreferredSize().height(); | 75 int username_height = login::kSelectedLabelHeight; // see |
|
Daniel Erat
2010/11/16 21:23:41
fix comment (just says "see")
oshima
2010/11/17 17:53:28
Done.
| |
| 76 main_->SetBounds(0, 0, width(), height()); | 76 main_->SetBounds(0, 0, width(), height()); |
| 77 username_->SetBounds( | 77 username_->SetBounds( |
| 78 kBorderSize, | 78 kBorderSize, |
| 79 login::kUserImageSize - username_height + kBorderSize, | 79 login::kUserImageSize - username_height + kBorderSize, |
| 80 login::kUserImageSize, | 80 login::kUserImageSize, |
| 81 username_height); | 81 username_height); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void ScreenLockView::Init() { | 84 void ScreenLockView::Init() { |
| 85 registrar_.Add(this, | 85 registrar_.Add(this, |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 105 | 105 |
| 106 // User icon. | 106 // User icon. |
| 107 UserManager::User user = screen_locker_->user(); | 107 UserManager::User user = screen_locker_->user(); |
| 108 user_view_->SetImage(user.image()); | 108 user_view_->SetImage(user.image()); |
| 109 | 109 |
| 110 // User name. | 110 // User name. |
| 111 std::wstring text = UTF8ToWide(user.GetDisplayName()); | 111 std::wstring text = UTF8ToWide(user.GetDisplayName()); |
| 112 | 112 |
| 113 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 113 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 114 const gfx::Font& font = | 114 const gfx::Font& font = |
| 115 rb.GetFont(ResourceBundle::LargeFont).DeriveFont(0, gfx::Font::BOLD); | 115 rb.GetFont(ResourceBundle::MediumBoldFont); |
|
Daniel Erat
2010/11/16 21:23:41
nit: this line can be unwrapped now
oshima
2010/11/17 17:53:28
Done.
| |
| 116 | 116 |
| 117 // Layouts image, textfield and button components. | 117 // Layouts image, textfield and button components. |
| 118 GridLayout* layout = new GridLayout(main_); | 118 GridLayout* layout = new GridLayout(main_); |
| 119 main_->SetLayoutManager(layout); | 119 main_->SetLayoutManager(layout); |
| 120 views::ColumnSet* column_set = layout->AddColumnSet(0); | 120 views::ColumnSet* column_set = layout->AddColumnSet(0); |
| 121 column_set->AddPaddingColumn(0, kBorderSize); | 121 column_set->AddPaddingColumn(0, kBorderSize); |
| 122 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | 122 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, |
| 123 GridLayout::USE_PREF, 0, 0); | 123 GridLayout::USE_PREF, 0, 0); |
| 124 column_set->AddPaddingColumn(0, kBorderSize); | 124 column_set->AddPaddingColumn(0, kBorderSize); |
| 125 | 125 |
| 126 column_set = layout->AddColumnSet(1); | 126 column_set = layout->AddColumnSet(1); |
| 127 column_set->AddPaddingColumn(0, 5); | 127 column_set->AddPaddingColumn(0, 5); |
| 128 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | 128 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, |
| 129 GridLayout::USE_PREF, 0, 0); | 129 GridLayout::USE_PREF, 0, 0); |
| 130 column_set->AddPaddingColumn(0, 5); | 130 column_set->AddPaddingColumn(0, 5); |
| 131 | 131 |
| 132 layout->AddPaddingRow(0, kBorderSize); | 132 layout->AddPaddingRow(0, kBorderSize); |
| 133 layout->StartRow(0, 0); | 133 layout->StartRow(0, 0); |
| 134 layout->AddView(user_view_); | 134 layout->AddView(user_view_); |
| 135 layout->AddPaddingRow(0, kBorderSize); | 135 layout->AddPaddingRow(0, kBorderSize); |
| 136 layout->StartRow(0, 1); | 136 layout->StartRow(0, 1); |
| 137 layout->AddView(password_field_); | 137 layout->AddView(password_field_); |
| 138 layout->AddPaddingRow(0, kBorderSize); | 138 layout->AddPaddingRow(0, kBorderSize); |
| 139 | 139 |
| 140 AddChildView(main_); | 140 AddChildView(main_); |
| 141 | 141 |
| 142 UsernameView* username = new UsernameView(text); | 142 UsernameView* username = new UsernameView(text); |
| 143 username_ = username; | 143 username_ = username; |
| 144 username->SetColor(login::kTextColor); | |
| 144 username->SetFont(font); | 145 username->SetFont(font); |
| 145 AddChildView(username); | 146 AddChildView(username); |
| 146 } | 147 } |
| 147 | 148 |
| 148 void ScreenLockView::ClearAndSetFocusToPassword() { | 149 void ScreenLockView::ClearAndSetFocusToPassword() { |
| 149 password_field_->RequestFocus(); | 150 password_field_->RequestFocus(); |
| 150 password_field_->SetText(string16()); | 151 password_field_->SetText(string16()); |
| 151 } | 152 } |
| 152 | 153 |
| 153 void ScreenLockView::SetSignoutEnabled(bool enabled) { | 154 void ScreenLockView::SetSignoutEnabled(bool enabled) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 user_view_->SetImage(user->image()); | 208 user_view_->SetImage(user->image()); |
| 208 } | 209 } |
| 209 | 210 |
| 210 void ScreenLockView::ViewHierarchyChanged(bool is_add, | 211 void ScreenLockView::ViewHierarchyChanged(bool is_add, |
| 211 views::View* parent, | 212 views::View* parent, |
| 212 views::View* child) { | 213 views::View* child) { |
| 213 if (is_add && this == child) | 214 if (is_add && this == child) |
| 214 WizardAccessibilityHelper::GetInstance()->MaybeEnableAccessibility(this); | 215 WizardAccessibilityHelper::GetInstance()->MaybeEnableAccessibility(this); |
| 215 } | 216 } |
| 216 } // namespace chromeos | 217 } // namespace chromeos |
| OLD | NEW |