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/views/autofill_profiles_view_win.h" | 5 #include "chrome/browser/views/autofill_profiles_view_win.h" |
6 | 6 |
7 #include <vsstyle.h> | 7 #include <vsstyle.h> |
8 #include <vssym32.h> | 8 #include <vssym32.h> |
9 | 9 |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 views::GridLayout* layout = new views::GridLayout(link_container); | 294 views::GridLayout* layout = new views::GridLayout(link_container); |
295 link_container->SetLayoutManager(layout); | 295 link_container->SetLayoutManager(layout); |
296 | 296 |
297 views::ColumnSet* column_set = layout->AddColumnSet(0); | 297 views::ColumnSet* column_set = layout->AddColumnSet(0); |
298 column_set->AddPaddingColumn(0, kDialogPadding); | 298 column_set->AddPaddingColumn(0, kDialogPadding); |
299 column_set->AddColumn(views::GridLayout::LEADING, | 299 column_set->AddColumn(views::GridLayout::LEADING, |
300 views::GridLayout::LEADING, 0, | 300 views::GridLayout::LEADING, 0, |
301 views::GridLayout::USE_PREF, 0, 0); | 301 views::GridLayout::USE_PREF, 0, 0); |
302 layout->StartRow(0, 0); | 302 layout->StartRow(0, 0); |
303 views::Link* link = new views::Link( | 303 views::Link* link = new views::Link( |
304 l10n_util::GetString(IDS_AUTOFILL_LEARN_MORE)); | 304 UTF16ToWide(l10n_util::GetStringUTF16(IDS_AUTOFILL_LEARN_MORE))); |
305 link->SetController(this); | 305 link->SetController(this); |
306 layout->AddView(link); | 306 layout->AddView(link); |
307 | 307 |
308 return link_container; | 308 return link_container; |
309 } | 309 } |
310 | 310 |
311 bool AutoFillProfilesView::IsDialogButtonEnabled( | 311 bool AutoFillProfilesView::IsDialogButtonEnabled( |
312 MessageBoxFlags::DialogButton button) const { | 312 MessageBoxFlags::DialogButton button) const { |
313 switch (button) { | 313 switch (button) { |
314 case MessageBoxFlags::DIALOGBUTTON_OK: | 314 case MessageBoxFlags::DIALOGBUTTON_OK: |
315 case MessageBoxFlags::DIALOGBUTTON_CANCEL: | 315 case MessageBoxFlags::DIALOGBUTTON_CANCEL: |
316 return true; | 316 return true; |
317 default: | 317 default: |
318 break; | 318 break; |
319 } | 319 } |
320 NOTREACHED(); | 320 NOTREACHED(); |
321 return false; | 321 return false; |
322 } | 322 } |
323 | 323 |
324 | 324 |
325 std::wstring AutoFillProfilesView::GetWindowTitle() const { | 325 std::wstring AutoFillProfilesView::GetWindowTitle() const { |
326 return l10n_util::GetString(IDS_AUTOFILL_OPTIONS_TITLE); | 326 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_AUTOFILL_OPTIONS_TITLE)); |
327 } | 327 } |
328 | 328 |
329 void AutoFillProfilesView::WindowClosing() { | 329 void AutoFillProfilesView::WindowClosing() { |
330 focus_manager_->RemoveFocusChangeListener(this); | 330 focus_manager_->RemoveFocusChangeListener(this); |
331 instance_ = NULL; | 331 instance_ = NULL; |
332 } | 332 } |
333 | 333 |
334 views::View* AutoFillProfilesView::GetContentsView() { | 334 views::View* AutoFillProfilesView::GetContentsView() { |
335 return this; | 335 return this; |
336 } | 336 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 if (!pref_name || *pref_name == prefs::kAutoFillEnabled) | 441 if (!pref_name || *pref_name == prefs::kAutoFillEnabled) |
442 UpdateWidgetState(); | 442 UpdateWidgetState(); |
443 } | 443 } |
444 | 444 |
445 ///////////////////////////////////////////////////////////////////////////// | 445 ///////////////////////////////////////////////////////////////////////////// |
446 // AutoFillProfilesView, private: | 446 // AutoFillProfilesView, private: |
447 void AutoFillProfilesView::Init() { | 447 void AutoFillProfilesView::Init() { |
448 GetData(); | 448 GetData(); |
449 | 449 |
450 enable_auto_fill_button_ = new views::Checkbox( | 450 enable_auto_fill_button_ = new views::Checkbox( |
451 l10n_util::GetString(IDS_OPTIONS_AUTOFILL_ENABLE)); | 451 UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_AUTOFILL_ENABLE))); |
452 enable_auto_fill_button_->set_listener(this); | 452 enable_auto_fill_button_->set_listener(this); |
453 | 453 |
454 table_model_.reset(new ContentListTableModel(&profiles_set_, | 454 table_model_.reset(new ContentListTableModel(&profiles_set_, |
455 &credit_card_set_)); | 455 &credit_card_set_)); |
456 std::vector<TableColumn> columns; | 456 std::vector<TableColumn> columns; |
457 columns.push_back(TableColumn()); | 457 columns.push_back(TableColumn()); |
458 scroll_view_ = new views::TableView(table_model_.get(), columns, | 458 scroll_view_ = new views::TableView(table_model_.get(), columns, |
459 views::TEXT_ONLY, false, true, true); | 459 views::TEXT_ONLY, false, true, true); |
460 scroll_view_->SetObserver(this); | 460 scroll_view_->SetObserver(this); |
461 | 461 |
462 add_address_button_ = new views::NativeButton(this, | 462 add_address_button_ = new views::NativeButton(this, |
463 l10n_util::GetString(IDS_AUTOFILL_ADD_ADDRESS_BUTTON)); | 463 UTF16ToWide(l10n_util::GetStringUTF16(IDS_AUTOFILL_ADD_ADDRESS_BUTTON))); |
464 add_credit_card_button_ = new views::NativeButton(this, | 464 add_credit_card_button_ = new views::NativeButton(this, UTF16ToWide( |
465 l10n_util::GetString(IDS_AUTOFILL_ADD_CREDITCARD_BUTTON)); | 465 l10n_util::GetStringUTF16(IDS_AUTOFILL_ADD_CREDITCARD_BUTTON))); |
466 edit_button_ = new views::NativeButton(this, | 466 edit_button_ = new views::NativeButton(this, |
467 l10n_util::GetString(IDS_AUTOFILL_EDIT_BUTTON)); | 467 UTF16ToWide(l10n_util::GetStringUTF16(IDS_AUTOFILL_EDIT_BUTTON))); |
468 remove_button_ = new views::NativeButton(this, | 468 remove_button_ = new views::NativeButton(this, |
469 l10n_util::GetString(IDS_AUTOFILL_DELETE_BUTTON)); | 469 UTF16ToWide(l10n_util::GetStringUTF16(IDS_AUTOFILL_DELETE_BUTTON))); |
470 | 470 |
471 views::GridLayout* layout = CreatePanelGridLayout(this); | 471 views::GridLayout* layout = CreatePanelGridLayout(this); |
472 SetLayoutManager(layout); | 472 SetLayoutManager(layout); |
473 | 473 |
474 const int table_with_buttons_column_view_set_id = 0; | 474 const int table_with_buttons_column_view_set_id = 0; |
475 views::ColumnSet* column_set = | 475 views::ColumnSet* column_set = |
476 layout->AddColumnSet(table_with_buttons_column_view_set_id); | 476 layout->AddColumnSet(table_with_buttons_column_view_set_id); |
477 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, | 477 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, |
478 views::GridLayout::USE_PREF, 0, 0); | 478 views::GridLayout::USE_PREF, 0, 0); |
479 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); | 479 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 int AutoFillProfilesView::EditableSetViewContents::GetDialogButtons() const { | 739 int AutoFillProfilesView::EditableSetViewContents::GetDialogButtons() const { |
740 return MessageBoxFlags::DIALOGBUTTON_CANCEL | | 740 return MessageBoxFlags::DIALOGBUTTON_CANCEL | |
741 MessageBoxFlags::DIALOGBUTTON_OK; | 741 MessageBoxFlags::DIALOGBUTTON_OK; |
742 } | 742 } |
743 | 743 |
744 std::wstring | 744 std::wstring |
745 AutoFillProfilesView::EditableSetViewContents::GetDialogButtonLabel( | 745 AutoFillProfilesView::EditableSetViewContents::GetDialogButtonLabel( |
746 MessageBoxFlags::DialogButton button) const { | 746 MessageBoxFlags::DialogButton button) const { |
747 switch (button) { | 747 switch (button) { |
748 case MessageBoxFlags::DIALOGBUTTON_OK: | 748 case MessageBoxFlags::DIALOGBUTTON_OK: |
749 return l10n_util::GetString(IDS_AUTOFILL_DIALOG_SAVE); | 749 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SAVE)); |
750 case MessageBoxFlags::DIALOGBUTTON_CANCEL: | 750 case MessageBoxFlags::DIALOGBUTTON_CANCEL: |
751 return std::wstring(); | 751 return std::wstring(); |
752 default: | 752 default: |
753 break; | 753 break; |
754 } | 754 } |
755 NOTREACHED(); | 755 NOTREACHED(); |
756 return std::wstring(); | 756 return std::wstring(); |
757 } | 757 } |
758 | 758 |
759 bool AutoFillProfilesView::EditableSetViewContents::IsDialogButtonEnabled( | 759 bool AutoFillProfilesView::EditableSetViewContents::IsDialogButtonEnabled( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 std::wstring | 805 std::wstring |
806 AutoFillProfilesView::EditableSetViewContents::GetWindowTitle() const { | 806 AutoFillProfilesView::EditableSetViewContents::GetWindowTitle() const { |
807 int string_id = 0; | 807 int string_id = 0; |
808 if (temporary_info_.is_address) { | 808 if (temporary_info_.is_address) { |
809 string_id = new_item_ ? IDS_AUTOFILL_ADD_ADDRESS_CAPTION : | 809 string_id = new_item_ ? IDS_AUTOFILL_ADD_ADDRESS_CAPTION : |
810 IDS_AUTOFILL_EDIT_ADDRESS_CAPTION; | 810 IDS_AUTOFILL_EDIT_ADDRESS_CAPTION; |
811 } else { | 811 } else { |
812 string_id = new_item_ ? IDS_AUTOFILL_ADD_CREDITCARD_CAPTION : | 812 string_id = new_item_ ? IDS_AUTOFILL_ADD_CREDITCARD_CAPTION : |
813 IDS_AUTOFILL_EDIT_CREDITCARD_CAPTION; | 813 IDS_AUTOFILL_EDIT_CREDITCARD_CAPTION; |
814 } | 814 } |
815 return l10n_util::GetString(string_id); | 815 return UTF16ToWide(l10n_util::GetStringUTF16(string_id)); |
816 } | 816 } |
817 | 817 |
818 void AutoFillProfilesView::EditableSetViewContents::WindowClosing() { | 818 void AutoFillProfilesView::EditableSetViewContents::WindowClosing() { |
819 observer_->ChildWindowClosed(); | 819 observer_->ChildWindowClosed(); |
820 } | 820 } |
821 | 821 |
822 views::View* AutoFillProfilesView::EditableSetViewContents::GetContentsView() { | 822 views::View* AutoFillProfilesView::EditableSetViewContents::GetContentsView() { |
823 return this; | 823 return this; |
824 } | 824 } |
825 | 825 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 | 935 |
936 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 936 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
937 layout->StartRow(0, double_column_fill_view_set_id_); | 937 layout->StartRow(0, double_column_fill_view_set_id_); |
938 layout->AddView(CreateLeftAlignedLabel(IDS_AUTOFILL_DIALOG_COMPANY_NAME)); | 938 layout->AddView(CreateLeftAlignedLabel(IDS_AUTOFILL_DIALOG_COMPANY_NAME)); |
939 | 939 |
940 layout->StartRow(0, double_column_fill_view_set_id_); | 940 layout->StartRow(0, double_column_fill_view_set_id_); |
941 layout->AddView(text_fields_[TEXT_COMPANY]); | 941 layout->AddView(text_fields_[TEXT_COMPANY]); |
942 | 942 |
943 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 943 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
944 layout->StartRow(0, double_column_leading_view_set_id_); | 944 layout->StartRow(0, double_column_leading_view_set_id_); |
945 layout->AddView(new views::Label(l10n_util::GetString( | 945 layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( |
946 IDS_AUTOFILL_DIALOG_ADDRESS_LINE_1))); | 946 IDS_AUTOFILL_DIALOG_ADDRESS_LINE_1)))); |
947 | 947 |
948 layout->StartRow(0, double_column_fill_view_set_id_); | 948 layout->StartRow(0, double_column_fill_view_set_id_); |
949 layout->AddView(text_fields_[TEXT_ADDRESS_LINE_1]); | 949 layout->AddView(text_fields_[TEXT_ADDRESS_LINE_1]); |
950 | 950 |
951 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 951 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
952 layout->StartRow(0, double_column_leading_view_set_id_); | 952 layout->StartRow(0, double_column_leading_view_set_id_); |
953 layout->AddView(new views::Label(l10n_util::GetString( | 953 layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( |
954 IDS_AUTOFILL_DIALOG_ADDRESS_LINE_2))); | 954 IDS_AUTOFILL_DIALOG_ADDRESS_LINE_2)))); |
955 | 955 |
956 layout->StartRow(0, double_column_fill_view_set_id_); | 956 layout->StartRow(0, double_column_fill_view_set_id_); |
957 layout->AddView(text_fields_[TEXT_ADDRESS_LINE_2]); | 957 layout->AddView(text_fields_[TEXT_ADDRESS_LINE_2]); |
958 | 958 |
959 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 959 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
960 layout->StartRow(0, triple_column_fill_view_set_id_); | 960 layout->StartRow(0, triple_column_fill_view_set_id_); |
961 layout->AddView(CreateLeftAlignedLabel(IDS_AUTOFILL_DIALOG_CITY)); | 961 layout->AddView(CreateLeftAlignedLabel(IDS_AUTOFILL_DIALOG_CITY)); |
962 layout->AddView(CreateLeftAlignedLabel(IDS_AUTOFILL_DIALOG_STATE)); | 962 layout->AddView(CreateLeftAlignedLabel(IDS_AUTOFILL_DIALOG_STATE)); |
963 layout->AddView(CreateLeftAlignedLabel(IDS_AUTOFILL_DIALOG_ZIP_CODE)); | 963 layout->AddView(CreateLeftAlignedLabel(IDS_AUTOFILL_DIALOG_ZIP_CODE)); |
964 | 964 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, | 1165 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, |
1166 1, views::GridLayout::FIXED, 0, 0); | 1166 1, views::GridLayout::FIXED, 0, 0); |
1167 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); | 1167 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); |
1168 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, | 1168 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, |
1169 1, views::GridLayout::FIXED, 0, 0); | 1169 1, views::GridLayout::FIXED, 0, 0); |
1170 } | 1170 } |
1171 | 1171 |
1172 views::Label* | 1172 views::Label* |
1173 AutoFillProfilesView::EditableSetViewContents::CreateLeftAlignedLabel( | 1173 AutoFillProfilesView::EditableSetViewContents::CreateLeftAlignedLabel( |
1174 int label_id) { | 1174 int label_id) { |
1175 views::Label* label = new views::Label(l10n_util::GetString(label_id)); | 1175 views::Label* label = |
| 1176 new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(label_id))); |
1176 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 1177 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
1177 return label; | 1178 return label; |
1178 } | 1179 } |
1179 | 1180 |
1180 void AutoFillProfilesView::EditableSetViewContents::UpdateButtons() { | 1181 void AutoFillProfilesView::EditableSetViewContents::UpdateButtons() { |
1181 GetDialogClientView()->UpdateDialogButtons(); | 1182 GetDialogClientView()->UpdateDialogButtons(); |
1182 } | 1183 } |
1183 | 1184 |
1184 bool AutoFillProfilesView::EditableSetViewContents::UpdateContentsPhoneViews( | 1185 bool AutoFillProfilesView::EditableSetViewContents::UpdateContentsPhoneViews( |
1185 TextFields field, views::Textfield* sender, const string16& new_contents) { | 1186 TextFields field, views::Textfield* sender, const string16& new_contents) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 } else { | 1275 } else { |
1275 row -= profiles_->size(); | 1276 row -= profiles_->size(); |
1276 return WideToUTF16Hack(credit_cards_->at(row).credit_card.PreviewSummary()); | 1277 return WideToUTF16Hack(credit_cards_->at(row).credit_card.PreviewSummary()); |
1277 } | 1278 } |
1278 } | 1279 } |
1279 | 1280 |
1280 TableModel::Groups AutoFillProfilesView::ContentListTableModel::GetGroups() { | 1281 TableModel::Groups AutoFillProfilesView::ContentListTableModel::GetGroups() { |
1281 TableModel::Groups groups; | 1282 TableModel::Groups groups; |
1282 | 1283 |
1283 TableModel::Group profile_group; | 1284 TableModel::Group profile_group; |
1284 profile_group.title = l10n_util::GetString(IDS_AUTOFILL_ADDRESSES_GROUP_NAME); | 1285 profile_group.title = |
| 1286 l10n_util::GetStringUTF16(IDS_AUTOFILL_ADDRESSES_GROUP_NAME); |
1285 profile_group.id = kAddressGroup; | 1287 profile_group.id = kAddressGroup; |
1286 groups.push_back(profile_group); | 1288 groups.push_back(profile_group); |
1287 | 1289 |
1288 Group cc_group; | 1290 Group cc_group; |
1289 cc_group.title = l10n_util::GetString(IDS_AUTOFILL_CREDITCARDS_GROUP_NAME); | 1291 cc_group.title = |
| 1292 l10n_util::GetStringUTF16(IDS_AUTOFILL_CREDITCARDS_GROUP_NAME); |
1290 cc_group.id = kCreditCardGroup; | 1293 cc_group.id = kCreditCardGroup; |
1291 groups.push_back(cc_group); | 1294 groups.push_back(cc_group); |
1292 | 1295 |
1293 return groups; | 1296 return groups; |
1294 } | 1297 } |
1295 | 1298 |
1296 int AutoFillProfilesView::ContentListTableModel::GetGroupID(int row) { | 1299 int AutoFillProfilesView::ContentListTableModel::GetGroupID(int row) { |
1297 DCHECK(row < static_cast<int>(profiles_->size() + credit_cards_->size())); | 1300 DCHECK(row < static_cast<int>(profiles_->size() + credit_cards_->size())); |
1298 return (row < static_cast<int>(profiles_->size())) ? kAddressGroup : | 1301 return (row < static_cast<int>(profiles_->size())) ? kAddressGroup : |
1299 kCreditCardGroup; | 1302 kCreditCardGroup; |
(...skipping 10 matching lines...) Expand all Loading... |
1310 AutoFillDialogObserver* observer, | 1313 AutoFillDialogObserver* observer, |
1311 Profile* profile) { | 1314 Profile* profile) { |
1312 DCHECK(profile); | 1315 DCHECK(profile); |
1313 | 1316 |
1314 PersonalDataManager* personal_data_manager = | 1317 PersonalDataManager* personal_data_manager = |
1315 profile->GetPersonalDataManager(); | 1318 profile->GetPersonalDataManager(); |
1316 DCHECK(personal_data_manager); | 1319 DCHECK(personal_data_manager); |
1317 AutoFillProfilesView::Show(parent, observer, personal_data_manager, profile, | 1320 AutoFillProfilesView::Show(parent, observer, personal_data_manager, profile, |
1318 profile->GetPrefs(), NULL, NULL); | 1321 profile->GetPrefs(), NULL, NULL); |
1319 } | 1322 } |
OLD | NEW |