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/password_changed_view.h" | 5 #include "chrome/browser/chromeos/login/password_changed_view.h" |
6 | 6 |
7 #include "app/keyboard_codes.h" | 7 #include "app/keyboard_codes.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 views::View* PasswordChangedView::GetInitiallyFocusedView() { | 52 views::View* PasswordChangedView::GetInitiallyFocusedView() { |
53 if (!full_sync_disabled_) { | 53 if (!full_sync_disabled_) { |
54 return views::DialogDelegate::GetInitiallyFocusedView(); | 54 return views::DialogDelegate::GetInitiallyFocusedView(); |
55 } else { | 55 } else { |
56 DCHECK(old_password_field_); | 56 DCHECK(old_password_field_); |
57 return old_password_field_; | 57 return old_password_field_; |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 std::wstring PasswordChangedView::GetWindowTitle() const { | 61 std::wstring PasswordChangedView::GetWindowTitle() const { |
62 return l10n_util::GetString(IDS_LOGIN_PASSWORD_CHANGED_DIALOG_BOX_TITLE); | 62 return UTF16ToWide( |
| 63 l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_DIALOG_BOX_TITLE)); |
63 } | 64 } |
64 | 65 |
65 gfx::Size PasswordChangedView::GetPreferredSize() { | 66 gfx::Size PasswordChangedView::GetPreferredSize() { |
66 // TODO(nkostylev): Once UI is finalized, create locale settings. | 67 // TODO(nkostylev): Once UI is finalized, create locale settings. |
67 return gfx::Size(views::Window::GetLocalizedContentsSize( | 68 return gfx::Size(views::Window::GetLocalizedContentsSize( |
68 IDS_PASSWORD_CHANGED_DIALOG_WIDTH_CHARS, | 69 IDS_PASSWORD_CHANGED_DIALOG_WIDTH_CHARS, |
69 IDS_PASSWORD_CHANGED_DIALOG_HEIGHT_LINES)); | 70 IDS_PASSWORD_CHANGED_DIALOG_HEIGHT_LINES)); |
70 } | 71 } |
71 | 72 |
72 void PasswordChangedView::ViewHierarchyChanged(bool is_add, | 73 void PasswordChangedView::ViewHierarchyChanged(bool is_add, |
73 views::View* parent, | 74 views::View* parent, |
74 views::View* child) { | 75 views::View* child) { |
75 if (is_add && child == this) { | 76 if (is_add && child == this) { |
76 Init(); | 77 Init(); |
77 WizardAccessibilityHelper::GetInstance()->MaybeEnableAccessibility(this); | 78 WizardAccessibilityHelper::GetInstance()->MaybeEnableAccessibility(this); |
78 } | 79 } |
79 } | 80 } |
80 | 81 |
81 void PasswordChangedView::Init() { | 82 void PasswordChangedView::Init() { |
82 // Set up fonts. | 83 // Set up fonts. |
83 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 84 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
84 gfx::Font title_font = rb.GetFont(ResourceBundle::MediumBoldFont); | 85 gfx::Font title_font = rb.GetFont(ResourceBundle::MediumBoldFont); |
85 | 86 |
86 // Create controls | 87 // Create controls |
87 title_label_ = new Label(); | 88 title_label_ = new Label(); |
88 title_label_->SetFont(title_font); | 89 title_label_->SetFont(title_font); |
89 title_label_->SetText(l10n_util::GetString(IDS_LOGIN_PASSWORD_CHANGED_TITLE)); | 90 title_label_->SetText( |
| 91 UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_TITLE))); |
90 title_label_->SetHorizontalAlignment(Label::ALIGN_LEFT); | 92 title_label_->SetHorizontalAlignment(Label::ALIGN_LEFT); |
91 | 93 |
92 description_label_ = new Label(); | 94 description_label_ = new Label(); |
93 description_label_->SetText( | 95 description_label_->SetText( |
94 l10n_util::GetString(IDS_LOGIN_PASSWORD_CHANGED_DESC)); | 96 UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_DESC))); |
95 description_label_->SetMultiLine(true); | 97 description_label_->SetMultiLine(true); |
96 description_label_->SetHorizontalAlignment(Label::ALIGN_LEFT); | 98 description_label_->SetHorizontalAlignment(Label::ALIGN_LEFT); |
97 | 99 |
98 full_sync_radio_ = new RadioButton( | 100 full_sync_radio_ = new RadioButton( |
99 l10n_util::GetString(IDS_LOGIN_PASSWORD_CHANGED_RESET), 0); | 101 UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_RESET)), |
| 102 0); |
100 full_sync_radio_->set_listener(this); | 103 full_sync_radio_->set_listener(this); |
101 full_sync_radio_->SetMultiLine(true); | 104 full_sync_radio_->SetMultiLine(true); |
102 | 105 |
103 delta_sync_radio_ = new RadioButton( | 106 delta_sync_radio_ = new RadioButton( |
104 l10n_util::GetString(IDS_LOGIN_PASSWORD_CHANGED_MIGRATE), 0); | 107 UTF16ToWide( |
| 108 l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_MIGRATE)), |
| 109 0); |
105 delta_sync_radio_->set_listener(this); | 110 delta_sync_radio_->set_listener(this); |
106 delta_sync_radio_->SetMultiLine(true); | 111 delta_sync_radio_->SetMultiLine(true); |
107 | 112 |
108 old_password_field_ = new Textfield(Textfield::STYLE_PASSWORD); | 113 old_password_field_ = new Textfield(Textfield::STYLE_PASSWORD); |
109 old_password_field_->set_text_to_display_when_empty( | 114 old_password_field_->set_text_to_display_when_empty( |
110 l10n_util::GetStringUTF16(IDS_LOGIN_PREVIOUS_PASSWORD)); | 115 l10n_util::GetStringUTF16(IDS_LOGIN_PREVIOUS_PASSWORD)); |
111 old_password_field_->set_default_width_in_chars(kPasswordFieldWidthChars); | 116 old_password_field_->set_default_width_in_chars(kPasswordFieldWidthChars); |
112 old_password_field_->SetController(this); | 117 old_password_field_->SetController(this); |
113 | 118 |
114 // Define controls layout. | 119 // Define controls layout. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 if (sender == full_sync_radio_) { | 182 if (sender == full_sync_radio_) { |
178 old_password_field_->SetEnabled(false); | 183 old_password_field_->SetEnabled(false); |
179 old_password_field_->SetText(string16()); | 184 old_password_field_->SetText(string16()); |
180 } else if (sender == delta_sync_radio_) { | 185 } else if (sender == delta_sync_radio_) { |
181 old_password_field_->SetEnabled(true); | 186 old_password_field_->SetEnabled(true); |
182 old_password_field_->RequestFocus(); | 187 old_password_field_->RequestFocus(); |
183 } | 188 } |
184 } | 189 } |
185 | 190 |
186 } // namespace chromeos | 191 } // namespace chromeos |
OLD | NEW |