OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/password_changed_view.h" | 5 #include "chrome/browser/chromeos/login/password_changed_view.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" | 8 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" |
9 #include "chrome/browser/chromeos/login/textfield_with_margin.h" | 9 #include "chrome/browser/chromeos/login/textfield_with_margin.h" |
10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 void PasswordChangedView::Init() { | 98 void PasswordChangedView::Init() { |
99 // Set up fonts. | 99 // Set up fonts. |
100 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 100 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
101 gfx::Font title_font = rb.GetFont(ResourceBundle::MediumBoldFont); | 101 gfx::Font title_font = rb.GetFont(ResourceBundle::MediumBoldFont); |
102 | 102 |
103 // Create controls | 103 // Create controls |
104 title_label_ = new Label(); | 104 title_label_ = new Label(); |
105 title_label_->SetFont(title_font); | 105 title_label_->SetFont(title_font); |
106 title_label_->SetText( | 106 title_label_->SetText( |
107 l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_TITLE)); | 107 l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_TITLE)); |
108 title_label_->SetHorizontalAlignment(Label::ALIGN_LEFT); | 108 title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
109 | 109 |
110 description_label_ = new Label(); | 110 description_label_ = new Label(); |
111 description_label_->SetText( | 111 description_label_->SetText( |
112 l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_DESC)); | 112 l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_DESC)); |
113 description_label_->SetMultiLine(true); | 113 description_label_->SetMultiLine(true); |
114 description_label_->SetHorizontalAlignment(Label::ALIGN_LEFT); | 114 description_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
115 | 115 |
116 full_sync_radio_ = new RadioButton( | 116 full_sync_radio_ = new RadioButton( |
117 l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_RESET), 0); | 117 l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_RESET), 0); |
118 full_sync_radio_->set_listener(this); | 118 full_sync_radio_->set_listener(this); |
119 full_sync_radio_->SetMultiLine(true); | 119 full_sync_radio_->SetMultiLine(true); |
120 | 120 |
121 delta_sync_radio_ = new RadioButton( | 121 delta_sync_radio_ = new RadioButton( |
122 l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_MIGRATE), 0); | 122 l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_MIGRATE), 0); |
123 delta_sync_radio_->set_listener(this); | 123 delta_sync_radio_->set_listener(this); |
124 delta_sync_radio_->SetMultiLine(true); | 124 delta_sync_radio_->SetMultiLine(true); |
125 | 125 |
126 old_password_field_ = new TextfieldWithMargin(Textfield::STYLE_OBSCURED); | 126 old_password_field_ = new TextfieldWithMargin(Textfield::STYLE_OBSCURED); |
127 old_password_field_->set_placeholder_text( | 127 old_password_field_->set_placeholder_text( |
128 l10n_util::GetStringUTF16(IDS_LOGIN_PREVIOUS_PASSWORD)); | 128 l10n_util::GetStringUTF16(IDS_LOGIN_PREVIOUS_PASSWORD)); |
129 old_password_field_->set_default_width_in_chars(kPasswordFieldWidthChars); | 129 old_password_field_->set_default_width_in_chars(kPasswordFieldWidthChars); |
130 old_password_field_->SetController(this); | 130 old_password_field_->SetController(this); |
131 | 131 |
132 if (show_invalid_old_password_error_) { | 132 if (show_invalid_old_password_error_) { |
133 password_error_label_ = new Label(); | 133 password_error_label_ = new Label(); |
134 // TODO(nkostylev): Add separate string on TOT. | 134 // TODO(nkostylev): Add separate string on TOT. |
135 password_error_label_->SetText( | 135 password_error_label_->SetText( |
136 l10n_util::GetStringUTF16(IDS_NETWORK_CONFIG_ERROR_INCORRECT_PASSWORD)); | 136 l10n_util::GetStringUTF16(IDS_NETWORK_CONFIG_ERROR_INCORRECT_PASSWORD)); |
137 password_error_label_->SetMultiLine(true); | 137 password_error_label_->SetMultiLine(true); |
138 password_error_label_->SetHorizontalAlignment(Label::ALIGN_LEFT); | 138 password_error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
139 password_error_label_->SetEnabledColor(SK_ColorRED); | 139 password_error_label_->SetEnabledColor(SK_ColorRED); |
140 } | 140 } |
141 | 141 |
142 // Define controls layout. | 142 // Define controls layout. |
143 GridLayout* layout = GridLayout::CreatePanel(this); | 143 GridLayout* layout = GridLayout::CreatePanel(this); |
144 SetLayoutManager(layout); | 144 SetLayoutManager(layout); |
145 | 145 |
146 views::ColumnSet* column_set = layout->AddColumnSet(0); | 146 views::ColumnSet* column_set = layout->AddColumnSet(0); |
147 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, | 147 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, |
148 GridLayout::USE_PREF, 0, 0); | 148 GridLayout::USE_PREF, 0, 0); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 const string16& new_contents) { | 215 const string16& new_contents) { |
216 GetDialogClientView()->UpdateDialogButtons(); | 216 GetDialogClientView()->UpdateDialogButtons(); |
217 } | 217 } |
218 | 218 |
219 bool PasswordChangedView::HandleKeyEvent(views::Textfield* sender, | 219 bool PasswordChangedView::HandleKeyEvent(views::Textfield* sender, |
220 const ui::KeyEvent& keystroke) { | 220 const ui::KeyEvent& keystroke) { |
221 return false; | 221 return false; |
222 } | 222 } |
223 | 223 |
224 } // namespace chromeos | 224 } // namespace chromeos |
OLD | NEW |